aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
diff options
context:
space:
mode:
authorGravatar Edoardo Zoni <59625522+EZoni@users.noreply.github.com> 2021-03-04 13:00:13 -0800
committerGravatar GitHub <noreply@github.com> 2021-03-04 13:00:13 -0800
commita0870a3063e9e655e281cc31e2d1b6580294696e (patch)
tree2f52fa0d2efa77d77f92c558c92b534bf2c021bd /Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
parentbca858c89e9012f15c94ce896dbe7ea4fedbc322 (diff)
downloadWarpX-a0870a3063e9e655e281cc31e2d1b6580294696e.tar.gz
WarpX-a0870a3063e9e655e281cc31e2d1b6580294696e.tar.zst
WarpX-a0870a3063e9e655e281cc31e2d1b6580294696e.zip
Implement averaged algo on staggered grids & merge spectral classes (#1544)
* Refactor and clean up some spectral classes * Abort when current correction or Vay deposition are not implemented * Implement general equations for averaged Galilean * Allocate averaged MultiFabs also when aux_is_nodal=1 and do_nodal=0 * Allocate +ngextra guard cells also for averaged MultiFabs * Make alias MultiFabs for averaged aux data * With averaging, interpolate from avg_fp (not fp) to aux * Fix some limits of the coefficients * Fix bug causing NaNs in spectral coefficients * Add 2D CI test with same analysis as nodal test * Add 3D CI test with same analysis as nodal test * Add limit that was not covered (knorm=0 && knorm_c!=0 && nu=0) * Allocate T2_coef only if Galilean algorithm is used * Allocate X4_coef only if Galilean algorithm is used * Remove extra ghost cell from 'avg_fp' MultiFabs
Diffstat (limited to '')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
index 4c9cb6967..725cfcf92 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
@@ -7,8 +7,6 @@
#include "SpectralKSpace.H"
#include "SpectralSolver.H"
#include "SpectralAlgorithms/PsatdAlgorithm.H"
-#include "SpectralAlgorithms/GalileanAlgorithm.H"
-#include "SpectralAlgorithms/AvgGalileanAlgorithm.H"
#include "SpectralAlgorithms/PMLPsatdAlgorithm.H"
#include "SpectralAlgorithms/ComovingPsatdAlgorithm.H"
#include "WarpX.H"
@@ -61,26 +59,15 @@ SpectralSolver::SpectralSolver(
k_space, dm, norder_x, norder_y, norder_z, nodal, dt);
}
else {
- if (fft_do_time_averaging){
- algorithm = std::make_unique<AvgGalileanAlgorithm>(
- k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt);
+ // Comoving PSATD algorithm
+ 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);
}
+ // PSATD algorithms: standard, Galilean, or averaged Galilean
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);
- }
+ algorithm = std::make_unique<PsatdAlgorithm>(
+ k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt, update_with_rho, fft_do_time_averaging);
}
}