diff options
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]; |