diff options
author | 2019-04-19 06:04:40 -0700 | |
---|---|---|
committer | 2019-04-23 12:43:53 -0700 | |
commit | 0e9c0209744cf032da4713a1041dd0ccbaa0b1c4 (patch) | |
tree | 79e6c3d0258e2cef7b2111fda689eac9fb59d1b1 /Source/FieldSolver/SpectralSolver/SpectralFieldData.H | |
parent | 438590e9a37556ec5f0a029f0f88469e7ba3565a (diff) | |
download | WarpX-0e9c0209744cf032da4713a1041dd0ccbaa0b1c4.tar.gz WarpX-0e9c0209744cf032da4713a1041dd0ccbaa0b1c4.tar.zst WarpX-0e9c0209744cf032da4713a1041dd0ccbaa0b1c4.zip |
Define SpectralSolver class
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralFieldData.H')
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralFieldData.H | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H new file mode 100644 index 000000000..2f6274e40 --- /dev/null +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H @@ -0,0 +1,46 @@ +#ifndef WARPX_SPECTRAL_FIELD_DATA_H_ +#define WARPX_SPECTRAL_FIELD_DATA_H_ + +#include <WarpX_Complex.H> +#include <SpectralKSpace.H> +#include <AMReX_MultiFab.H> + +using namespace amrex; + +// Declare type for spectral fields +using SpectralField = FabArray<BaseFab<Complex>>; + +/* Fields that will be stored in spectral space */ +struct SpectralFieldIndex{ + enum { Ex=0, Ey, Ez, Bx, By, Bz, Jx, Jy, Jz, rho_old, rho_new }; +}; + +/* \brief Class that stores the fields in spectral space + * and performs the spectral transforms to/from real space + */ +class SpectralFieldData +{ + friend class PsatdAlgorithm; + +#ifdef AMREX_USE_GPU +// Add cuFFT-specific code +#else + using FFTplans = LayoutData<fftw_plan>; +#endif + + public: + SpectralFieldData( const BoxArray& realspace_ba, + const SpectralKSpace& k_space, + const DistributionMapping& dm ); + ~SpectralFieldData(); + void ForwardTransform( const MultiFab& mf, const int field_index ); + void BackwardTransform( MultiFab& mf, const int field_index ); + + private: + SpectralField Ex, Ey, Ez, Bx, By, Bz, Jx, Jy, Jz, rho_old, rho_new; + SpectralField tmpRealField, tmpSpectralField; // Store fields before/after transform + FFTplans forward_plan, backward_plan; + SpectralField& getSpectralField( const int field_index ); +}; + +#endif // WARPX_SPECTRAL_FIELD_DATA_H_ |