AMReX-Astro / AmrDeriveSpectrum

The AmrDeriveSpectrum postprocessing code computes the spatial Fourier transform of variables in AMReX plotfiles.
3 stars 2 forks source link

switch the spectrum code over to using AMReX's FFT #4

Open zingale opened 3 weeks ago

zingale commented 3 weeks ago

see https://github.com/AMReX-Codes/amrex/pull/3713

we can do:

int level = 0;
MultiFab mf = plotfile.get(level);
FFT::R2C<Real,FFT::Direction::forward> r2c(plotfile.probDomain(level));
auto const& [cba, cdm] = r2c.getSpectralDataLayout();
cMultiFab spectral_data(cba, cdm, 1, 0);
int icomp = 3; // component 3
MultiFab real_data(mf, amrex::make_alias, icomp, 1);
r2c.forward(read_data, spectral_data);
// spectral_data is now the result of real-to-complex forward FFT of the level 0 component 3 data.
zingale commented 1 day ago

see this tutorial: https://github.com/AMReX-Codes/amrex-tutorials/pull/144