aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WarpX.cpp')
-rw-r--r--Source/WarpX.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 1cdd2e3e0..aa6301a6e 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -121,6 +121,8 @@ short WarpX::charge_deposition_algo;
short WarpX::field_gathering_algo;
short WarpX::particle_pusher_algo;
short WarpX::maxwell_solver_id;
+short WarpX::J_in_time;
+short WarpX::rho_in_time;
short WarpX::load_balance_costs_update_algo;
bool WarpX::do_dive_cleaning = false;
bool WarpX::do_divb_cleaning = false;
@@ -1154,6 +1156,11 @@ WarpX::ReadParameters ()
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(noz_fft > 0, "PSATD order must be finite unless psatd.periodic_single_box_fft is used");
}
+ // Integers that correspond to the time dependency of J (constant, linear)
+ // and rho (linear, quadratic) for the PSATD algorithm
+ J_in_time = GetAlgorithmInteger(pp_psatd, "J_in_time");
+ rho_in_time = GetAlgorithmInteger(pp_psatd, "rho_in_time");
+
// Current correction activated by default, unless a charge-conserving
// current deposition (Esirkepov, Vay) or the div(E) cleaning scheme
// are used
@@ -1308,10 +1315,28 @@ WarpX::ReadParameters ()
v_galilean_is_zero,
"Multi-J algorithm not implemented with Galilean PSATD"
);
+ }
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE(update_with_rho,
- "psatd.update_with_rho must be set to 1 when warpx.do_multi_J = 1"
- );
+ if (J_in_time == JInTime::Constant)
+ {
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
+ rho_in_time == RhoInTime::Linear,
+ "psatd.J_in_time=constant supports only psatd.rho_in_time=linear");
+ }
+
+ if (J_in_time == JInTime::Linear)
+ {
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
+ update_with_rho,
+ "psatd.update_with_rho must be set to 1 when psatd.J_in_time=linear");
+
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
+ v_galilean_is_zero,
+ "psatd.J_in_time=linear not implemented with Galilean PSATD");
+
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
+ v_comoving_is_zero,
+ "psatd.J_in_time=linear not implemented with comoving PSATD");
}
for (int dir = 0; dir < AMREX_SPACEDIM; dir++)
@@ -2216,7 +2241,8 @@ void WarpX::AllocLevelSpectralSolverRZ (amrex::Vector<std::unique_ptr<SpectralSo
isAnyBoundaryPML(),
update_with_rho,
fft_do_time_averaging,
- do_multi_J,
+ J_in_time,
+ rho_in_time,
do_dive_cleaning,
do_divb_cleaning);
spectral_solver[lev] = std::move(pss);
@@ -2271,7 +2297,8 @@ void WarpX::AllocLevelSpectralSolver (amrex::Vector<std::unique_ptr<SpectralSolv
fft_periodic_single_box,
update_with_rho,
fft_do_time_averaging,
- do_multi_J,
+ J_in_time,
+ rho_in_time,
do_dive_cleaning,
do_divb_cleaning);
spectral_solver[lev] = std::move(pss);