Re: Analysis question: getting powerspectrum at particular depth

29 views
Skip to first unread message

Ben Brown

unread,
Jun 13, 2014, 6:17:32 PM6/13/14
to Keaton Burns, dedal...@googlegroups.com, Daniel Lecoanet
Keaton,
     I wanted to check back in on the current best practices for obtaining mixed coeff-grid representations of our data (e.g., horizontal power spectra at each vertical z location in the sim). 

The particular problem I'm looking at is 2-D, with fourier-cheby (x, z) and I'd like a mixed spectrum in a (kx, z) space.  It looks like there isn't a layout='cg', correct?

so if I want an entropy "s" horizontal spectrum, is the best approach to do something like:

     analysis_slice.add_task("Interpolate(s, 'z', 0.5)", name="s spectrum", layout="c")

and then repeat this at each depth desired (ugg...), or is there a way to do something like:

     analysis_slice.add_task("s", name="s spectrum", layout="cg")

and obtain the horizontal s-spectrum at each depth all at once?

--Ben



On Wed, Feb 19, 2014 at 12:20 PM, Keaton Burns <keaton...@gmail.com> wrote:
Hey guys,

So the ability to do arbitrary mixed transform spaces (i.e. ‘gcg’) has been replaced by the layout system, which in effect allows only for spaces along one “transform path” (i.e. ‘ccc’ -> ‘ccg’ -> ‘cgg’ -> ‘ggg’), since it really simplifies the memory and transform management when parallelized.  

The way to do this type of thing now is to use the functional operators I’ve started implementing (so far there is only integration, but I can add interpolation at a specific point in space):

So doing something like

u_int = Integrate(u, ‘z')
u_center = Interpolate(u, ‘z’, 0.5)

will produce new fields that Dedalus knows internally defined on the (x, y) subspace of the domain (they have internal flags specifying that there are constant along z).

What I’m currently implementing in the analysis framework is that when you save such a field, it will only be saved over the relevant subspace (i.e. as a shape (nx, ny, 1) array).  So you could save u_int / u_center in grid / coeff layout to get the vertical integral on the (x, y) grid, or the horizontal spectrum at z=0.5 on the (kx, ky) grid, respectively.
 
-Keaton


On Feb 19, 2014, at 2:45 PM, Daniel Lecoanet <dlec...@berkeley.edu> wrote:

I think you can do this by using

u['cg']

The way I understand it, u['c'] is just shorthand for u['cc'].

Daniel


On Wed, Feb 19, 2014 at 11:43 AM, Ben Brown <bpb...@gmail.com> wrote:
Keaton & Daniel,
     And analysis question for you two.  I'd like to extract a power spectrum at some particular depth in a dedalus sim, e.g, the powerspecturm of velocity fluctuations at mid-depth.

Given velocity u, computing the powerspectrum would look something like this:

      Power = u['c']*np.conj(u['c'])

This gives what I want in coeff space.  Is there a way to now extract this only at one depth? e.g., to be in a mixed-coeff/grid space configuration?

In particular, I'd be happy to do a horizontal coeff space and vertical grid space.  It would be fine to do the powerspectrum only over the horizontal coeff dimension as well, e.g.,

      Power_x = u['c_x']*np.conj(u['c_x'])

where here 'c_x' means "be in coeff space for x but not z".


Can we do this already?
--Ben



Daniel Lecoanet

unread,
Jun 13, 2014, 6:27:23 PM6/13/14
to Ben Brown, Keaton Burns, dedal...@googlegroups.com
Hey Ben,

I think our agreement was that this should be done in post-processing.  The easiest way I can think of is to do

s.require_coeff_space()
s.require_grid_space(axis='z')

This will put s into 'cg' space.  The first call puts s into 'cc', and the second call will transform/transpose until z is in grid space, but no further.  Since the layouts are arranged 'gg' <-> 'cg' <-> 'cc', this will do the trick.  If you wanted something in 'gc' space, that would be much more work.

Daniel

Keaton Burns

unread,
Jun 13, 2014, 6:27:42 PM6/13/14
to Ben Brown, dedal...@googlegroups.com, Daniel Lecoanet
Hi Ben,

As of right now, I think interpolation is the best way to go about this within Dedalus.  The issue is that the current layout system would be substantially more complicated if it were to support arbitrary mixed spaces.  I think some of the issues may be alleviated by my current work on the basis module, but to see the general problem with arbitrary transforms, consider if you have real data and >= 2 Fourier bases: the coefficient shape just isn’t well defined unless you define a specific order for the transforms.

If you really want a horizontal power spectrum at every height, then the best option might be to just save the data in grid-space and simply do a quick FFT with numpy in post-processing.

-Keaton

Keaton Burns

unread,
Jun 13, 2014, 6:46:47 PM6/13/14
to Daniel Lecoanet, Ben Brown, dedal...@googlegroups.com
Well if you’re post-processing grid data, then you can do numpy transforms along any axes of the saved data arrays.  Depending on the situation, this might be easier than putting together all the Dedalus machinery to manipulate the data as fields.

Some of the changes I’m working on in the basis module should provide a nice middle ground:  they’ll let you use Dedalus bases to do single transforms along any axis of an array, without having to set up complete domain or field objects, which restrict the allowed mixed spaces.

Ben Brown

unread,
Jun 13, 2014, 6:48:35 PM6/13/14
to Keaton Burns, Daniel Lecoanet, dedal...@googlegroups.com
Keaton & Daniel,
     Sounds great.

In the long-run it would be really nice to be able to auto-spit-out power spectra at each depth as part of a standard analysis task, rather than handing it in post-processing.  Sounds like we're on that path, and for now I'll do it via post processing.

--Ben
Reply all
Reply to author
Forward
0 new messages