Reduce the number of Hankel transforms per iteration #161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the current dev branch, we perform 16 Hankel transform and 16 Fourier transform per azimuthal mode and per iteration. Within those 16 transforms, 12 transforms are done because we do a
spect2interp
andinterp2spect
of the fields E and B (2 * 2 fields * 3 components).The reason for performing these back-and-forth transformations is that we have to perform some operations on the fields in spectral space (Maxwell push) and some operations in real space (MPI exchanges and damping of the open boundaries).
However, because the MPI exchanges and damping of the open boundaries is purely along z, updating the spectral fields can be done only by a succession an inverse and forward Fourier transform (no Hankel transform involved). Then updating the fields in interpolation space requires an additional Hankel + Fourier transform.
This effectively replaces the 16 Hankel and 16 Fourier transforms by 10 Hankel and 22 Fourier transforms (per mode, per iteration). Because the Fourier transforms are almost always much faster than the Hankel transforms, this results in a speedup of the simulation.
Note: I am definitely not the first to use this trick! @Hightower has been using it for a while in his code chimera.