aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpX.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2021-01-22 16:49:49 -0800
committerGravatar GitHub <noreply@github.com> 2021-01-22 16:49:49 -0800
commit54c463af5dfd3db55fc69abb60e80100687a04f7 (patch)
treed53433e9aa1edb33979741bde9e1482cd81fce44 /Source/WarpX.cpp
parent24946d2c636fc265d1fc517dfc5665b0e166b64d (diff)
downloadWarpX-54c463af5dfd3db55fc69abb60e80100687a04f7.tar.gz
WarpX-54c463af5dfd3db55fc69abb60e80100687a04f7.tar.zst
WarpX-54c463af5dfd3db55fc69abb60e80100687a04f7.zip
Add parameter for default galilean velocity (#1097)
* Add parameter for default galilean velocity * Apply suggestions from code review Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * Fix bug in constructor of PhysicalParticleContainer * Use new input parameter in CI test Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
Diffstat (limited to 'Source/WarpX.cpp')
-rw-r--r--Source/WarpX.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 498e4d02d..2163a7c79 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -743,11 +743,18 @@ WarpX::ReadParameters ()
}
pp.query("current_correction", current_correction);
- pp.query("v_galilean", m_v_galilean);
pp.query("v_comoving", m_v_comoving);
pp.query("do_time_averaging", fft_do_time_averaging);
- // Scale the velocity by the speed of light
+ // Check whether the default Galilean velocity should be used
+ bool use_default_v_galilean = false;
+ pp.query("use_default_v_galilean", use_default_v_galilean);
+ if (use_default_v_galilean) {
+ m_v_galilean[2] = -std::sqrt(1._rt - 1._rt / (gamma_boost * gamma_boost));
+ } else {
+ pp.query("v_galilean", m_v_galilean);
+ }
+ // 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;