Skip to content

Conversation

@QuentinMale
Copy link
Contributor

As discussed here: #153, here is a correction for the energy spectrum calculation.

The ParallelFor now loops on 0,1,2,...,nx 0,1,2,...,ny and 0,1,2,...,nz with a change of i index if i > nx/2 to take into account the Hermitian symmetry of the R2C output array.

I verified that the output spectrum is correct by comparing with C2C which outputs the full array.

…utput array with only (nx/2+1,ny,nz) elements.
@WeiqunZhang
Copy link
Member

The changes will not work on multiple processes because the domain might be decomposed in x-direction. What we have to do it for i > 0 && i < (N+1)/2, we double the value.

@WeiqunZhang
Copy link
Member

I think we need a special treatment for N/2 too when N is even. My original suggestion i < (N+1)/2 is cryptic. A better way is 2*i != N.

@WeiqunZhang WeiqunZhang merged commit 07b9cea into AMReX-Codes:main Apr 2, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants