aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WarpX.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index ecd6e2ddf..304e8fe01 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -1008,7 +1008,6 @@ WarpX::ReadParameters ()
}
pp_psatd.query("current_correction", current_correction);
- pp_psatd.query("v_comoving", m_v_comoving);
pp_psatd.query("do_time_averaging", fft_do_time_averaging);
pp_psatd.query("J_linear_in_time", J_linear_in_time);
@@ -1029,6 +1028,28 @@ WarpX::ReadParameters ()
} else {
pp_psatd.query("v_galilean", m_v_galilean);
}
+
+ // Check whether the default comoving velocity should be used
+ bool use_default_v_comoving = false;
+ pp_psatd.query("use_default_v_comoving", use_default_v_comoving);
+ if (use_default_v_comoving)
+ {
+ m_v_comoving[2] = -std::sqrt(1._rt - 1._rt / (gamma_boost * gamma_boost));
+ }
+ else
+ {
+ pp_psatd.query("v_comoving", m_v_comoving);
+ }
+
+ // Galilean and comoving algorithms should not be used together
+ if (m_v_galilean[0] != 0. || m_v_galilean[1] != 0. || m_v_galilean[2] != 0.)
+ {
+ if (m_v_comoving[0] != 0. || m_v_comoving[1] != 0. || m_v_comoving[2] != 0.)
+ {
+ amrex::Abort("Galilean and comoving algorithms should not be used together");
+ }
+ }
+
// Scale the Galilean/comoving velocity by the speed of light
for (int i=0; i<3; i++) m_v_galilean[i] *= PhysConst::c;
for (int i=0; i<3; i++) m_v_comoving[i] *= PhysConst::c;