aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization/GuardCellManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Parallelization/GuardCellManager.cpp')
-rw-r--r--Source/Parallelization/GuardCellManager.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp
index fcc3abcba..44848c915 100644
--- a/Source/Parallelization/GuardCellManager.cpp
+++ b/Source/Parallelization/GuardCellManager.cpp
@@ -48,7 +48,8 @@ guardCellManager::Init (
const bool safe_guard_cells,
const int do_electrostatic,
const int do_multi_J,
- const bool fft_do_time_averaging)
+ const bool fft_do_time_averaging,
+ const amrex::Vector<amrex::IntVect>& ref_ratios)
{
// When using subcycling, the particles on the fine level perform two pushes
// before being redistributed ; therefore, we need one extra guard cell
@@ -91,16 +92,21 @@ guardCellManager::Init (
int ngJy = ngy_tmp;
int ngJz = ngz_tmp;
- // When calling the moving window (with one level of refinement), we shift
- // the fine grid by 2 cells ; therefore, we need at least 2 guard cells
- // on level 1. This may not be necessary for level 0.
+ // When calling the moving window (with one level of refinement), we shift
+ // the fine grid by a number of cells equal to the ref_ratio in the moving
+ // window direction.
if (do_moving_window) {
- ngx = std::max(ngx,2);
- ngy = std::max(ngy,2);
- ngz = std::max(ngz,2);
- ngJx = std::max(ngJx,2);
- ngJy = std::max(ngJy,2);
- ngJz = std::max(ngJz,2);
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(ref_ratios.size() <= 1,
+ "The number of grow cells for the moving window currently assumes 2 levels max.");
+ const int nlevs = ref_ratios.size()+1;
+ int max_r = (nlevs > 1) ? ref_ratios[0][moving_window_dir] : 2;
+
+ ngx = std::max(ngx,max_r);
+ ngy = std::max(ngy,max_r);
+ ngz = std::max(ngz,max_r);
+ ngJx = std::max(ngJx,max_r);
+ ngJy = std::max(ngJy,max_r);
+ ngJz = std::max(ngJz,max_r);
}
#if (AMREX_SPACEDIM == 3)