aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpX.cpp
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers2@gmail.com> 2017-11-20 20:36:48 +0000
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2017-11-20 20:36:48 +0000
commit6375ecd972db9edf697a6cb43090849930c94199 (patch)
treecb058e10dd60b9f94a75328f16f7dd4e1db6e7d9 /Source/WarpX.cpp
parentb892a0839001dc43321529b734dd72e156f92561 (diff)
parentf94c413bbb3dc6b273a23021f606064adf45ca6b (diff)
downloadWarpX-6375ecd972db9edf697a6cb43090849930c94199.tar.gz
WarpX-6375ecd972db9edf697a6cb43090849930c94199.tar.zst
WarpX-6375ecd972db9edf697a6cb43090849930c94199.zip
Merged in boosted_frame (pull request #39)
Boosted Frame Diagnostic Approved-by: Weiqun Zhang <WeiqunZhang@lbl.gov>
Diffstat (limited to 'Source/WarpX.cpp')
-rw-r--r--Source/WarpX.cpp68
1 files changed, 47 insertions, 21 deletions
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 622b8b0e6..4ea87d6e5 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -41,6 +41,10 @@ bool WarpX::use_laser = false;
bool WarpX::use_filter = false;
bool WarpX::serialize_ics = false;
+bool WarpX::do_boosted_frame_diagnostic = false;
+int WarpX::num_snapshots_lab = std::numeric_limits<int>::lowest();
+Real WarpX::dt_snapshots_lab = std::numeric_limits<Real>::lowest();
+
#if (BL_SPACEDIM == 3)
IntVect WarpX::Bx_nodal_flag(1,0,0);
IntVect WarpX::By_nodal_flag(0,1,0);
@@ -173,21 +177,21 @@ WarpX::ReadParameters ()
pp.query("verbose", verbose);
pp.query("regrid_int", regrid_int);
- // Boosted-frame parameters
- pp.query("gamma_boost", gamma_boost);
- beta_boost = std::sqrt(1.-1./pow(gamma_boost,2));
- if( gamma_boost > 1. ){
- // Read and normalize the boost direction
- pp.queryarr("boost_direction", boost_direction);
- Real s = 1.0/std::sqrt(boost_direction[0]*boost_direction[0] +
- boost_direction[1]*boost_direction[1] +
- boost_direction[2]*boost_direction[2]);
+ // Boosted-frame parameters
+ pp.query("gamma_boost", gamma_boost);
+ beta_boost = std::sqrt(1.-1./pow(gamma_boost,2));
+ if( gamma_boost > 1. ){
+ // Read and normalize the boost direction
+ pp.queryarr("boost_direction", boost_direction);
+ Real s = 1.0/std::sqrt(boost_direction[0]*boost_direction[0] +
+ boost_direction[1]*boost_direction[1] +
+ boost_direction[2]*boost_direction[2]);
boost_direction = { boost_direction[0]*s,
- boost_direction[1]*s,
- boost_direction[2]*s };
- }
-
- pp.queryarr("B_external", B_external);
+ boost_direction[1]*s,
+ boost_direction[2]*s };
+ }
+
+ pp.queryarr("B_external", B_external);
pp.query("do_moving_window", do_moving_window);
if (do_moving_window)
@@ -224,6 +228,31 @@ WarpX::ReadParameters ()
0, num_injected_species);
}
+ pp.query("do_boosted_frame_diagnostic", do_boosted_frame_diagnostic);
+ if (do_boosted_frame_diagnostic) {
+
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(gamma_boost > 1.0,
+ "gamma_boost must be > 1 to use the boosted frame diagnostic.");
+
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( (std::abs(boost_direction[0] - 0.0) < 1.0e-12) and
+ (std::abs(boost_direction[1] - 0.0) < 1.0e-12) and
+ (std::abs(boost_direction[2] - 1.0) < 1.0e012) ,
+ "The boosted frame diagnostic currently only works if the boost is in the z direction.");
+
+ pp.get("num_snapshots_lab", num_snapshots_lab);
+ pp.get("dt_snapshots_lab", dt_snapshots_lab);
+ pp.get("gamma_boost", gamma_boost);
+
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(do_moving_window,
+ "The moving window should be on if using the boosted frame diagnostic.");
+
+ std::string s;
+ pp.get("moving_window_dir", s);
+
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( (s == "z" || s == "Z"),
+ "The boosted frame diagnostic currently only works if the boost is in the z direction.");
+ }
+
pp.query("do_electrostatic", do_electrostatic);
pp.query("n_buffer", n_buffer);
pp.query("const_dt", const_dt);
@@ -271,14 +300,11 @@ WarpX::ReadParameters ()
pp.query("nox", nox);
pp.query("noy", noy);
pp.query("noz", noz);
- if (nox != noy || nox != noz) {
- amrex::Abort("warpx.nox, noy and noz must be equal");
- }
- if (nox < 1) {
- amrex::Abort("warpx.nox must >= 1");
- }
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( nox == noy and nox == noz ,
+ "warpx.nox, noy and noz must be equal");
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( nox >= 1, "warpx.nox must >= 1");
}
-
+
{
ParmParse pp("algo");
pp.query("current_deposition", current_deposition_algo);