diff options
author | 2023-03-07 12:12:07 -0800 | |
---|---|---|
committer | 2023-03-07 20:12:07 +0000 | |
commit | 39564df2c97a654165cb54b63b929db1e5948278 (patch) | |
tree | bd873a7ef91957f3b8f5115acb00e9fb1d1380b8 /Source/Initialization/WarpXInitData.cpp | |
parent | bc06257fb2a57ea8f5f26d8448503f8221a197da (diff) | |
download | WarpX-39564df2c97a654165cb54b63b929db1e5948278.tar.gz WarpX-39564df2c97a654165cb54b63b929db1e5948278.tar.zst WarpX-39564df2c97a654165cb54b63b929db1e5948278.zip |
Fix `max_step` from `zmax_plasma...` upon restart (#3732)
* fix zmax_plasma_... calculation upon restart
* simple fix didn't work in all cases
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix indentation
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'Source/Initialization/WarpXInitData.cpp')
-rw-r--r-- | Source/Initialization/WarpXInitData.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 4622367a2..43bd597bd 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -375,6 +375,12 @@ WarpX::InitData () Print() << utils::logo::get_logo(); + // WarpX::computeMaxStepBoostAccelerator + // needs to start from the initial zmin_domain_boost, + // even if restarting from a checkpoint file + if (do_compute_max_step_from_zmax) { + zmin_domain_boost_step_0 = geom[0].ProbLo(WARPX_ZINDEX); + } if (restart_chkfile.empty()) { ComputeDt(); @@ -549,7 +555,7 @@ void WarpX::ComputeMaxStep () { if (do_compute_max_step_from_zmax) { - computeMaxStepBoostAccelerator(geom[0]); + computeMaxStepBoostAccelerator(); } } @@ -560,7 +566,7 @@ WarpX::ComputeMaxStep () * simulation box passes input parameter zmax_plasma_to_compute_max_step. */ void -WarpX::computeMaxStepBoostAccelerator(const amrex::Geometry& a_geom){ +WarpX::computeMaxStepBoostAccelerator() { // Sanity checks: can use zmax_plasma_to_compute_max_step only if // the moving window and the boost are all in z direction. WARPX_ALWAYS_ASSERT_WITH_MESSAGE( @@ -578,7 +584,7 @@ WarpX::computeMaxStepBoostAccelerator(const amrex::Geometry& a_geom){ // Lower end of the simulation domain. All quantities are given in boosted // frame except zmax_plasma_to_compute_max_step. - const Real zmin_domain_boost = a_geom.ProbLo(WARPX_ZINDEX); + // End of the plasma: Transform input argument // zmax_plasma_to_compute_max_step to boosted frame. const Real len_plasma_boost = zmax_plasma_to_compute_max_step/gamma_boost; @@ -586,7 +592,7 @@ WarpX::computeMaxStepBoostAccelerator(const amrex::Geometry& a_geom){ const Real v_plasma_boost = -beta_boost * PhysConst::c; // Get time at which the lower end of the simulation domain passes the // upper end of the plasma (in the z direction). - const Real interaction_time_boost = (len_plasma_boost-zmin_domain_boost)/ + const Real interaction_time_boost = (len_plasma_boost-zmin_domain_boost_step_0)/ (moving_window_v-v_plasma_boost); // Divide by dt, and update value of max_step. int computed_max_step; @@ -598,7 +604,7 @@ WarpX::computeMaxStepBoostAccelerator(const amrex::Geometry& a_geom){ } max_step = computed_max_step; Print()<<"max_step computed in computeMaxStepBoostAccelerator: " - <<computed_max_step<<std::endl; + <<max_step<<std::endl; } void |