diff options
author | 2017-12-04 12:34:38 -0800 | |
---|---|---|
committer | 2017-12-04 12:34:38 -0800 | |
commit | 3d1b776e2273bb19c633a5d0c7bf1ed02fd9f66e (patch) | |
tree | 6659cbfa6e72337e727611f19e84e2bccafc7ac7 /Source/WarpXMove.cpp | |
parent | 30c4b7ba07fe2ac1265e198bb20f2f1d7c4f8efb (diff) | |
download | WarpX-3d1b776e2273bb19c633a5d0c7bf1ed02fd9f66e.tar.gz WarpX-3d1b776e2273bb19c633a5d0c7bf1ed02fd9f66e.tar.zst WarpX-3d1b776e2273bb19c633a5d0c7bf1ed02fd9f66e.zip |
Make the injection contiguous, even for at the first timestep
Diffstat (limited to 'Source/WarpXMove.cpp')
-rw-r--r-- | Source/WarpXMove.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Source/WarpXMove.cpp b/Source/WarpXMove.cpp index 51e6554b8..0c14178a5 100644 --- a/Source/WarpXMove.cpp +++ b/Source/WarpXMove.cpp @@ -5,13 +5,8 @@ using namespace amrex; void -WarpX::MoveWindow (bool move_j) +WarpX::UpdatePlasmaInjectionPosition (Real dt) { - if (do_moving_window == 0) return; - - // Update the continuous position of the moving window, - // and of the plasma injection - moving_window_x += moving_window_v * dt[0]; int dir = moving_window_dir; // Continuously inject plasma in new cells (by default only on level 0) if (WarpX::do_plasma_injection and (WarpX::gamma_boost > 1)){ @@ -19,14 +14,26 @@ WarpX::MoveWindow (bool move_j) // call to this function, and injection position needs to be updated current_injection_position -= WarpX::beta_boost * #if ( BL_SPACEDIM == 3 ) - WarpX::boost_direction[dir] * PhysConst::c * dt[0]; + WarpX::boost_direction[dir] * PhysConst::c * dt; #elif ( BL_SPACEDIM == 2 ) // In 2D, dir=0 corresponds to x and dir=1 corresponds to z // This needs to be converted in order to index `boost_direction` // which has 3 components, for both 2D and 3D simulations. - WarpX::boost_direction[2*dir] * PhysConst::c * dt[0]; + WarpX::boost_direction[2*dir] * PhysConst::c * dt; #endif } +} + +void +WarpX::MoveWindow (bool move_j) +{ + if (do_moving_window == 0) return; + + // Update the continuous position of the moving window, + // and of the plasma injection + moving_window_x += moving_window_v * dt[0]; + int dir = moving_window_dir; + UpdatePlasmaInjectionPosition( dt[0] ); // compute the number of cells to shift on the base level Real new_lo[BL_SPACEDIM]; |