diff options
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp')
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp index e187b9d27..558d4a78a 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp @@ -6,6 +6,7 @@ */ #include "SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H" #include "SpectralAlgorithms/PsatdAlgorithmRZ.H" +#include "SpectralAlgorithms/PMLPsatdAlgorithmRZ.H" #include "SpectralKSpaceRZ.H" #include "SpectralSolverRZ.H" #include "Utils/WarpXProfilerWrapper.H" @@ -22,8 +23,7 @@ * \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 - * PML is not supported. + * \param with_pml Whether PML boundary will be used */ SpectralSolverRZ::SpectralSolverRZ (const int lev, amrex::BoxArray const & realspace_ba, @@ -32,6 +32,7 @@ SpectralSolverRZ::SpectralSolverRZ (const int lev, int const norder_z, bool const nodal, const amrex::Vector<amrex::Real>& v_galilean, amrex::RealVect const dx, amrex::Real const dt, + bool const with_pml, bool const update_with_rho, const bool fft_do_time_averaging, const bool do_multi_J, @@ -45,13 +46,16 @@ SpectralSolverRZ::SpectralSolverRZ (const int lev, // the spectral space corresponding to each box in `realspace_ba`, // as well as the value of the corresponding k coordinates. - const bool pml = false; + const bool is_pml = false; m_spectral_index = SpectralFieldIndex(update_with_rho, fft_do_time_averaging, - do_multi_J, dive_cleaning, divb_cleaning, pml); + do_multi_J, dive_cleaning, divb_cleaning, is_pml, with_pml); // - Select the algorithm depending on the input parameters // Initialize the corresponding coefficients over k space - // PML is not supported. + if (with_pml) { + PML_algorithm = std::make_unique<PMLPsatdAlgorithmRZ>( + k_space, dm, m_spectral_index, n_rz_azimuthal_modes, norder_z, nodal, dt); + } if (v_galilean[2] == 0) { // v_galilean is 0: use standard PSATD algorithm algorithm = std::make_unique<PsatdAlgorithmRZ>( @@ -117,12 +121,16 @@ SpectralSolverRZ::BackwardTransform (const int lev, /* \brief Update the fields in spectral space, over one timestep */ void -SpectralSolverRZ::pushSpectralFields () { +SpectralSolverRZ::pushSpectralFields (const bool doing_pml) { WARPX_PROFILE("SpectralSolverRZ::pushSpectralFields"); // Virtual function: the actual function used here depends // on the sub-class of `SpectralBaseAlgorithm` that was // initialized in the constructor of `SpectralSolverRZ` - algorithm->pushSpectralFields(field_data); + if (doing_pml) { + PML_algorithm->pushSpectralFields(field_data); + } else { + algorithm->pushSpectralFields(field_data); + } } /** |