diff options
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolver.H')
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralSolver.H | 86 |
1 files changed, 77 insertions, 9 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H index 996053a88..e5d84a2af 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H @@ -32,12 +32,40 @@ class SpectralSolver { public: - // Inline definition of the member functions of `SpectralSolver`, - // except the constructor (see `SpectralSolver.cpp`) - // The body of these functions is short, since the work is done in the - // underlying classes `SpectralFieldData` and `PsatdAlgorithm` - // Constructor + /** + * \brief Constructor of the class SpectralSolver + * + * Select the spectral algorithm to be used, allocate the corresponding coefficients + * for the discrete field update equations, and prepare the structures that store + * the fields in spectral space. + * + * \param[in] lev mesh refinement level + * \param[in] realspace_ba BoxArray in real space + * \param[in] dm DistributionMapping for the given BoxArray + * \param[in] norder_x spectral order along x + * \param[in] norder_y spectral order along y + * \param[in] norder_z spectral order along z + * \param[in] nodal whether the spectral solver is applied to a nodal or staggered grid + * \param[in] v_galilean three-dimensional vector containing the components of the Galilean + * velocity for the standard or averaged Galilean PSATD solvers + * \param[in] v_comoving three-dimensional vector containing the components of the comoving + * velocity for the comoving PSATD solver + * \param[in] dx AMREX_SPACEDIM-dimensional vector containing the cell sizes along each direction + * \param[in] dt time step for the analytical integration of Maxwell's equations + * \param[in] pml whether the boxes in the given BoxArray are PML boxes + * \param[in] periodic_single_box whether there is only one periodic single box + * (no domain decomposition) + * \param[in] update_with_rho whether rho is used in the field update equations + * \param[in] fft_do_time_averaging whether the time averaging algorithm is used + * \param[in] J_linear_in_time whether to use two currents computed at the beginning and + * the end of the time interval (instead of using one current + * compute at half time) + * \param[in] dive_cleaning whether to use div(E) cleaning to account for errors in Gauss law + * (new field F in the field update equations) + * \param[in] divb_cleaning whether to use div(B) cleaning to account for errors in magnetic Gauss law + * (new field G in the field update equations) + */ SpectralSolver (const int lev, const amrex::BoxArray& realspace_ba, const amrex::DistributionMapping& dm, @@ -47,10 +75,11 @@ class SpectralSolver const amrex::Array<amrex::Real,3>& v_comoving, const amrex::RealVect dx, const amrex::Real dt, - const bool pml=false, - const bool periodic_single_box=false, - const bool update_with_rho=false, - const bool fft_do_time_averaging=false, + const bool pml = false, + const bool periodic_single_box = false, + const bool update_with_rho = false, + const bool fft_do_time_averaging = false, + const bool J_linear_in_time = false, const bool dive_cleaning = false, const bool divb_cleaning = false); @@ -117,7 +146,46 @@ class SpectralSolver algorithm->VayDeposition(lev, field_data, current); } + /** + * \brief Copy spectral data from component \c src_comp to component \c dest_comp + * of \c field_data.fields. + * + * \param[in] src_comp component of the source FabArray from which the data are copied + * \param[in] dest_comp component of the destination FabArray where the data are copied + */ + void CopySpectralDataComp (const int src_comp, const int dest_comp) + { + // The last two arguments represent the number of components and + // the number of ghost cells to perform this operation + Copy(field_data.fields, field_data.fields, src_comp, dest_comp, 1, 0); + } + + /** + * \brief Set to zero the data on component \c icomp of \c field_data.fields + * + * \param[in] icomp component of the FabArray where the data are set to zero + */ + void ZeroOutDataComp (const int icomp) + { + // The last argument represents the number of components to perform this operation + field_data.fields.setVal(0., icomp, 1); + } + + /** + * \brief Scale the data on component \c icomp of \c field_data.fields + * by a given scale factor + * + * \param[in] icomp component of the FabArray where the data are scaled + * \param[in] scale_factor scale factor to use for scaling + */ + void ScaleDataComp (const int icomp, const amrex::Real scale_factor) + { + // The last argument represents the number of components to perform this operation + field_data.fields.mult(scale_factor, icomp, 1); + } + private: + void ReadParameters (); // Store field in spectral space and perform the Fourier transforms |