diff options
author | 2021-10-25 14:20:15 -0700 | |
---|---|---|
committer | 2021-10-25 14:20:15 -0700 | |
commit | 3ef89c687399c2724ceba1841e35bb6acbca9b00 (patch) | |
tree | caceddf710b5435aa5164b19dce54547fa978b71 /Source/Parallelization/GuardCellManager.cpp | |
parent | a247bd0091d8f188d6ff40695688c3e2fc64ba84 (diff) | |
download | WarpX-3ef89c687399c2724ceba1841e35bb6acbca9b00.tar.gz WarpX-3ef89c687399c2724ceba1841e35bb6acbca9b00.tar.zst WarpX-3ef89c687399c2724ceba1841e35bb6acbca9b00.zip |
Bugfixes for ref_ratio = 4 in the moving window direction. (#2452)
* Bugfixes for ref_ratio = 4 in the moving window direction.
* == should be <=
* only adjust guard cells for moving window by ref_ratio if nlevs > 1
* restore logic to always have at least 2 grow cells if moving window is on
* remove comment about this not being needed on level 0 - it does.
Diffstat (limited to 'Source/Parallelization/GuardCellManager.cpp')
-rw-r--r-- | Source/Parallelization/GuardCellManager.cpp | 26 |
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) |