diff options
author | 2019-06-05 19:01:26 -0400 | |
---|---|---|
committer | 2019-06-05 19:01:26 -0400 | |
commit | f0f8a8da1c7d57f5feff454f4e22099ca6dc09d2 (patch) | |
tree | 1b0b3408d70d5c312954fb3c4ff0284d5e2c99f0 /Source/Utils/WarpXMovingWindow.cpp | |
parent | c3a5d1fa06f1c2670d7df1cc9d4acc6852b82d1b (diff) | |
parent | 6faec7af00055eb58000967f2aa6415516533a34 (diff) | |
download | WarpX-f0f8a8da1c7d57f5feff454f4e22099ca6dc09d2.tar.gz WarpX-f0f8a8da1c7d57f5feff454f4e22099ca6dc09d2.tar.zst WarpX-f0f8a8da1c7d57f5feff454f4e22099ca6dc09d2.zip |
Merge branch 'dev' of https://github.com/ECP-WarpX/WarpX into spectral_cufftOnGPU
Diffstat (limited to 'Source/Utils/WarpXMovingWindow.cpp')
-rw-r--r-- | Source/Utils/WarpXMovingWindow.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp index 18d89951d..ae781f9aa 100644 --- a/Source/Utils/WarpXMovingWindow.cpp +++ b/Source/Utils/WarpXMovingWindow.cpp @@ -5,7 +5,7 @@ using namespace amrex; void -WarpX::UpdatePlasmaInjectionPosition (Real dt) +WarpX::UpdatePlasmaInjectionPosition (Real a_dt) { int dir = moving_window_dir; // Continuously inject plasma in new cells (by default only on level 0) @@ -14,12 +14,12 @@ WarpX::UpdatePlasmaInjectionPosition (Real dt) // call to this function, and injection position needs to be updated current_injection_position -= WarpX::beta_boost * #if ( AMREX_SPACEDIM == 3 ) - WarpX::boost_direction[dir] * PhysConst::c * dt; + WarpX::boost_direction[dir] * PhysConst::c * a_dt; #elif ( AMREX_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; + WarpX::boost_direction[2*dir] * PhysConst::c * a_dt; #endif } } @@ -62,8 +62,28 @@ WarpX::MoveWindow (bool move_j) } new_lo[dir] = current_lo[dir] + num_shift_base * cdx[dir]; new_hi[dir] = current_hi[dir] + num_shift_base * cdx[dir]; - RealBox new_box(new_lo, new_hi); - Geometry::ProbDomain(new_box); + + ResetProbDomain(RealBox(new_lo, new_hi)); + + // Moving slice coordinates - lo and hi - with moving window // + // slice box is modified only if slice diagnostics is initialized in input // + if ( slice_plot_int > 0 ) + { + Real new_slice_lo[AMREX_SPACEDIM]; + Real new_slice_hi[AMREX_SPACEDIM]; + const Real* current_slice_lo = slice_realbox.lo(); + const Real* current_slice_hi = slice_realbox.hi(); + for ( int i = 0; i < AMREX_SPACEDIM; i++) { + new_slice_lo[i] = current_slice_lo[i]; + new_slice_hi[i] = current_slice_hi[i]; + } + int num_shift_base_slice = static_cast<int> ((moving_window_x - + current_slice_lo[dir]) / cdx[dir]); + new_slice_lo[dir] = current_slice_lo[dir] + num_shift_base_slice*cdx[dir]; + new_slice_hi[dir] = current_slice_hi[dir] + num_shift_base_slice*cdx[dir]; + slice_realbox.setLo(new_slice_lo); + slice_realbox.setHi(new_slice_hi); + } int num_shift = num_shift_base; int num_shift_crse = num_shift; @@ -254,3 +274,14 @@ WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir) }); } } + +void +WarpX::ResetProbDomain (const RealBox& rb) +{ + Geometry::ResetDefaultProbDomain(rb); + for (int lev = 0; lev <= max_level; ++lev) { + Geometry g = Geom(lev); + g.ProbDomain(rb); + SetGeometry(lev, g); + } +} |