diff options
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolver.cpp')
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralSolver.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp index 0cfd899df..4c9cb6967 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp @@ -10,6 +10,7 @@ #include "SpectralAlgorithms/GalileanAlgorithm.H" #include "SpectralAlgorithms/AvgGalileanAlgorithm.H" #include "SpectralAlgorithms/PMLPsatdAlgorithm.H" +#include "SpectralAlgorithms/ComovingPsatdAlgorithm.H" #include "WarpX.H" #include "Utils/WarpXProfilerWrapper.H" #include "Utils/WarpXUtil.H" @@ -39,6 +40,7 @@ SpectralSolver::SpectralSolver( const int norder_x, const int norder_y, const int norder_z, const bool nodal, const amrex::Array<amrex::Real,3>& v_galilean, + const amrex::Array<amrex::Real,3>& v_comoving, const amrex::RealVect dx, const amrex::Real dt, const bool pml, const bool periodic_single_box, const bool update_with_rho, @@ -64,15 +66,21 @@ SpectralSolver::SpectralSolver( k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt); } else { - if ((v_galilean[0]==0) && (v_galilean[1]==0) && (v_galilean[2]==0)){ - // v_galilean is 0: use standard PSATD algorithm - algorithm = std::make_unique<PsatdAlgorithm>( - k_space, dm, norder_x, norder_y, norder_z, nodal, dt, update_with_rho); - } - else { + // Galilean PSATD algorithm + if (v_galilean[0] != 0. || v_galilean[1] != 0. || v_galilean[2] != 0.) { algorithm = std::make_unique<GalileanAlgorithm>( k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt, update_with_rho); } + // Comoving PSATD algorithm + else if (v_comoving[0] != 0. || v_comoving[1] != 0. || v_comoving[2] != 0.) { + algorithm = std::make_unique<ComovingPsatdAlgorithm>( + k_space, dm, norder_x, norder_y, norder_z, nodal, v_comoving, dt, update_with_rho); + } + // Standard PSATD algorithm + else { + algorithm = std::make_unique<PsatdAlgorithm>( + k_space, dm, norder_x, norder_y, norder_z, nodal, dt, update_with_rho); + } } } |