aboutsummaryrefslogtreecommitdiff
path: root/Source/Utils/WarpXMovingWindow.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2020-02-21 14:27:52 -0800
committerGravatar GitHub <noreply@github.com> 2020-02-21 14:27:52 -0800
commit29e99787fc8b6548f20c352ffe24fe7a94ed3edb (patch)
tree80276e0d911bef5b455b4eabf4ece8e4b15bfba5 /Source/Utils/WarpXMovingWindow.cpp
parent5ae9c7e3edcc18272e32f5871329c024fddc4df9 (diff)
downloadWarpX-29e99787fc8b6548f20c352ffe24fe7a94ed3edb.tar.gz
WarpX-29e99787fc8b6548f20c352ffe24fe7a94ed3edb.tar.zst
WarpX-29e99787fc8b6548f20c352ffe24fe7a94ed3edb.zip
Make the option to exchange all guard cells safer (#709)
* make the option to exchange all guard cells safer * EOL **** * more consistent naming in guard cells test script
Diffstat (limited to 'Source/Utils/WarpXMovingWindow.cpp')
-rw-r--r--Source/Utils/WarpXMovingWindow.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp
index 6c2a249e0..8f1666b2f 100644
--- a/Source/Utils/WarpXMovingWindow.cpp
+++ b/Source/Utils/WarpXMovingWindow.cpp
@@ -246,15 +246,20 @@ WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir,
MultiFab tmpmf(ba, dm, nc, ng);
MultiFab::Copy(tmpmf, mf, 0, 0, nc, ng);
- IntVect ng_mw = IntVect::TheUnitVector();
- // Enough guard cells in the MW direction
- ng_mw[dir] = num_shift;
- // Add the extra cell (if momentum-conserving gather with staggered field solve)
- ng_mw += ng_extra;
- // Make sure we don't exceed number of guard cells allocated
- ng_mw = ng_mw.min(ng);
- // Fill guard cells.
- tmpmf.FillBoundary(ng_mw, geom.periodicity());
+ if ( WarpX::safe_guard_cells ) {
+ // Fill guard cells.
+ tmpmf.FillBoundary(geom.periodicity());
+ } else {
+ IntVect ng_mw = IntVect::TheUnitVector();
+ // Enough guard cells in the MW direction
+ ng_mw[dir] = num_shift;
+ // Add the extra cell (if momentum-conserving gather with staggered field solve)
+ ng_mw += ng_extra;
+ // Make sure we don't exceed number of guard cells allocated
+ ng_mw = ng_mw.min(ng);
+ // Fill guard cells.
+ tmpmf.FillBoundary(ng_mw, geom.periodicity());
+ }
// Make a box that covers the region that the window moved into
const IndexType& typ = ba.ixType();