aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Examples/Tests/galilean/inputs_3d1
-rw-r--r--Regression/WarpX-tests.ini2
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp14
-rw-r--r--Source/WarpX.cpp11
4 files changed, 20 insertions, 8 deletions
diff --git a/Examples/Tests/galilean/inputs_3d b/Examples/Tests/galilean/inputs_3d
index 60cff1215..0ee9d6a6f 100644
--- a/Examples/Tests/galilean/inputs_3d
+++ b/Examples/Tests/galilean/inputs_3d
@@ -9,7 +9,6 @@ amr.blocking_factor = 32
amr.max_level = 0
psatd.v_galilean = 0. 0. 0.99498743710662
-
geometry.coord_sys = 0
geometry.is_periodic = 1 1 1
geometry.prob_lo = -9.67 -9.67 -9.67
diff --git a/Regression/WarpX-tests.ini b/Regression/WarpX-tests.ini
index 9d63a30b7..46a2501a6 100644
--- a/Regression/WarpX-tests.ini
+++ b/Regression/WarpX-tests.ini
@@ -1597,7 +1597,7 @@ tolerance = 1.e-14
[galilean_hybrid_2d]
buildDir = .
inputFile = Examples/Tests/spectral_staggered/inputs_hybrid_2d
-runtime_params = psatd.v_galilean = 0. 0. -0.9970370305242862
+runtime_params = psatd.use_default_v_galilean=1
dim = 2
addToCompileString = USE_PSATD=TRUE
restartTest = 0
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index a4e6317e1..8f9ad2e7c 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -165,10 +165,16 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
#endif
- // Parse galilean velocity
- ParmParse ppsatd("psatd");
- ppsatd.query("v_galilean", m_v_galilean);
- // Scale the velocity by the speed of light
+ // Get Galilean velocity
+ ParmParse pp_psatd("psatd");
+ bool use_default_v_galilean = false;
+ pp_psatd.query("use_default_v_galilean", use_default_v_galilean);
+ if (use_default_v_galilean) {
+ m_v_galilean[2] = -std::sqrt(1._rt - 1._rt / (WarpX::gamma_boost * WarpX::gamma_boost));
+ } else {
+ pp_psatd.query("v_galilean", m_v_galilean);
+ }
+ // Scale the Galilean velocity by the speed of light
for (int i=0; i<3; i++) m_v_galilean[i] *= PhysConst::c;
}
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;