aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.H46
-rw-r--r--Source/FieldSolver/SpectralSolver/WarpX_Complex.H3
2 files changed, 36 insertions, 13 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
index 363ac7bd8..9870cbfb5 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
@@ -5,8 +5,11 @@
#include <PsatdAlgorithm.H>
#include <SpectralFieldData.H>
-/* \brief
- * TODO
+/* \brief Top-level class for the electromagnetic spectral solver
+ *
+ * Stores the field in spectral space, and has member functions
+ * to Fourier-transform the fields between real space and spectral space
+ * and to update fields in spectral space over one time step.
*/
class SpectralSolver
{
@@ -16,28 +19,47 @@ class SpectralSolver
PsatdAlgorithm algorithm; // Contains Psatd coefficients
// and field update equation
public:
+ // Inline definition of the member functions of `SpectralSolver`
+ // The body of these functions is short, since the work is done in the
+ // underlying classes `SpectralFieldData` and `PsatdAlgorithm`
+
+ /* \brief Initialize the spectral solver */
SpectralSolver( const amrex::BoxArray& realspace_ba,
const amrex::DistributionMapping& dm,
- const int norder_x, const int norder_y, const int norder_z,
- const bool nodal, const amrex::RealVect dx, const amrex::Real dt )
- {
+ const int norder_x, const int norder_y,
+ const int norder_z, const bool nodal,
+ const amrex::RealVect dx, const amrex::Real dt ) {
// Initialize all structures using the same distribution mapping dm
- // - Initialize k space (Contains size of each box in spectral space,
- // and corresponding values of the k vectors)
- const SpectralKSpace k_space = SpectralKSpace( realspace_ba, dm, dx );
- // - Initialize algorithm (coefficients) over this space
- algorithm = PsatdAlgorithm( k_space, dm, norder_x, norder_y, norder_z, nodal, dt );
+
+ // - Initialize k space object (Contains info about the size of
+ // the spectral space corresponding to each box in `realspace_ba`,
+ // as well as the value of the corresponding k coordinates)
+ const SpectralKSpace k_space= SpectralKSpace(realspace_ba, dm, dx);
+ // - Initialize the algorithm (coefficients) over this space
+ algorithm = PsatdAlgorithm( k_space, dm, norder_x, norder_y,
+ norder_z, nodal, dt );
// - Initialize arrays for fields in Fourier space + FFT plans
field_data = SpectralFieldData( realspace_ba, k_space, dm );
};
+
+ /* \brief Transform the component `i_comp` of MultiFab `mf`
+ * to spectral space, and store the corresponding result internally
+ * (in the spectral field specified by `field_index`) */
void ForwardTransform( const amrex::MultiFab& mf,
- const int field_index, const int i_comp=0 ){
+ const int field_index,
+ const int i_comp=0 ){
field_data.ForwardTransform( mf, field_index, i_comp );
};
+
+ /* \brief Transform spectral field specified by `field_index` back to
+ * real space, and store it in the component `i_comp` of `mf` */
void BackwardTransform( amrex::MultiFab& mf,
- const int field_index, const int i_comp=0 ){
+ const int field_index,
+ const int i_comp=0 ){
field_data.BackwardTransform( mf, field_index, i_comp );
};
+
+ /* \brief Update the fields in spectral space, over one timestep */
void pushSpectralFields(){
algorithm.pushSpectralFields( field_data );
};
diff --git a/Source/FieldSolver/SpectralSolver/WarpX_Complex.H b/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
index 8e2b3977f..c898c5baa 100644
--- a/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
+++ b/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
@@ -21,6 +21,7 @@ static_assert( sizeof(Complex) == sizeof(fftw_complex),
"The complex types in WarpX and FFTW do not match.");
#endif
-static_assert(sizeof(Complex) == sizeof(amrex::Real[2]), "Unexpected complex type.");
+static_assert(sizeof(Complex) == sizeof(amrex::Real[2]),
+ "Unexpected complex type.");
#endif //WARPX_COMPLEX_H_