Hello,
I am solving equations of MHD equations using Dedalus. As part of my (post-processing) analysis, I compute nonlinear expressions obtained from my fields and analyze them in the coefficient space.
To do so, I read my coefficient space output data (in parallel) and perform operations using Dedalus expressions, evaluate them in coefficient space and later bin them in k-space to get scale-by-scale values of the quantities I am interested in. As far as I understand, when accessing coefficient space layout of a field resulting from a nonlinear expression, I think I loose information because Dedalus discards the padded modes when transforming from grid space to coefficient space. I was wondering whether I could access the full coefficient space data of a Dedalus field (including the padded modes), bypassing the discard phase of dealising.
Let me illustrate what I want to do in an example. Suppose I want to look at the correlation function
f_lorentz@f_lorentz
where
J = -d3.Laplacian(A)
B = d3.curl(A)
f_lorentz = d3.cross(J, B)
My strategy was to get
np.sum(f_lorentz['c']*f_lorentz['c'], axis= 0)
and later bin this array in k-space to obtain scale-by-scale values of the correlation function. If done properly, the sum over the binned amplitudes should match what I would get from
d3.Average(f_lorentz@f_lorentz)
Indeed I confirmed that the routines I use for binning and summing over modes work perfectly for expressions like B@B, u@B (u is my velocity field): The sum over spectra matches d3.Average() values. However, the expressions involving nonlinear terms such as f_lorentz@f_lorentz don't match d3.Average() values. It seems to me that this is due to dealising, and indeed if I set large wavenumber modes of my fields to zero, nonlinear expressions also agree with d3.Average() values within machine precision.
My questions are:
(i) Can I access the coefficient space data of, e.g., f_lorentz, including the discarded modes during Fourier transform? I tried to do this myself by digging into Dedalus routines that compute Fourier transforms but I am a little confused about permuting axes etc. (I am performing these operations in parallel)
(ii) When computing f_lorentz@f_lorentz, I should also probably set dealias= 2 in my post-processing Dedalus bases, since the nonlinearity is quartic in this example?
I would appreciate any help you could provide me.
Regards,
Semih