aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.H3
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.cpp20
2 files changed, 18 insertions, 5 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
index d4019a9a3..c570b017b 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
@@ -23,7 +23,8 @@ class SpectralSolver
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 amrex::RealVect dx, const amrex::Real dt,
+ const bool pml=false );
/* \brief Transform the component `i_comp` of MultiFab `mf`
* to spectral space, and store the corresponding result internally
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
index a91fcbc47..80555a7b3 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
@@ -7,13 +7,22 @@
* This function selects the spectral algorithm to be used, allocates the
* corresponding coefficients for the discretized field update equation,
* and prepares the structures that store the fields in spectral space.
+ *
+ * \param norder_x Order of accuracy of the spatial derivatives along x
+ * \param norder_y Order of accuracy of the spatial derivatives along y
+ * \param norder_z Order of accuracy of the spatial derivatives along z
+ * \param nodal Whether the solver is applied to a nodal or staggered grid
+ * \param dx Cell size along each dimension
+ * \param dt Time step
+ * \param pml Whether the boxes in which the solver is applied are PML boxes
*/
SpectralSolver::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 amrex::RealVect dx, const amrex::Real dt,
+ const bool pml ) {
// Initialize all structures using the same distribution mapping dm
@@ -24,10 +33,13 @@ SpectralSolver::SpectralSolver(
// - Select the algorithm depending on the input parameters
// Initialize the corresponding coefficients over k space
- // TODO: Add more algorithms + selection depending on input parameters
- // For the moment, this only uses the standard PsatdAlgorithm
- algorithm = std::unique_ptr<PsatdAlgorithm>( new PsatdAlgorithm(
+ if (pml) {
+ algorithm = std::unique_ptr<PMLPsatdAlgorithm>( new PMLPsatdAlgorithm(
+ k_space, dm, norder_x, norder_y, norder_z, nodal, dt ) );
+ } else {
+ algorithm = std::unique_ptr<PsatdAlgorithm>( new PsatdAlgorithm(
k_space, dm, norder_x, norder_y, norder_z, nodal, dt ) );
+ }
// - Initialize arrays for fields in spectral space + FFT plans
field_data = SpectralFieldData( realspace_ba, k_space, dm,