aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization/GuardCellManager.cpp
diff options
context:
space:
mode:
authorGravatar Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> 2021-10-12 18:38:37 +0200
committerGravatar GitHub <noreply@github.com> 2021-10-12 09:38:37 -0700
commit2282b42ae4f79f2c6d8e2d9103c9327acd11669b (patch)
tree8e0e7d740c3f5f77599844764b96fcab11d04b68 /Source/Parallelization/GuardCellManager.cpp
parent0be2aa87fae6fa623e88e30b672ccfb54b1b6bff (diff)
downloadWarpX-2282b42ae4f79f2c6d8e2d9103c9327acd11669b.tar.gz
WarpX-2282b42ae4f79f2c6d8e2d9103c9327acd11669b.tar.zst
WarpX-2282b42ae4f79f2c6d8e2d9103c9327acd11669b.zip
Increase number of guard cells allocated with multi-J algorithm (#2377)
Diffstat (limited to 'Source/Parallelization/GuardCellManager.cpp')
-rw-r--r--Source/Parallelization/GuardCellManager.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp
index 6e3b46645..fcc3abcba 100644
--- a/Source/Parallelization/GuardCellManager.cpp
+++ b/Source/Parallelization/GuardCellManager.cpp
@@ -46,7 +46,9 @@ guardCellManager::Init (
const amrex::Vector<amrex::Real> v_galilean,
const amrex::Vector<amrex::Real> v_comoving,
const bool safe_guard_cells,
- const int do_electrostatic)
+ const int do_electrostatic,
+ const int do_multi_J,
+ const bool fft_do_time_averaging)
{
// When using subcycling, the particles on the fine level perform two pushes
// before being redistributed ; therefore, we need one extra guard cell
@@ -122,8 +124,22 @@ guardCellManager::Init (
{
for (int i = 0; i < AMREX_SPACEDIM; i++)
{
- ng_alloc_Rho[i] += static_cast<int>(std::ceil(PhysConst::c * dt / dx[i]));
- ng_alloc_J[i] += static_cast<int>(std::ceil(PhysConst::c * dt / dx[i] * 0.5_rt));
+ amrex::Real dt_Rho = dt;
+ amrex::Real dt_J = 0.5_rt*dt;
+ if (do_multi_J) {
+ // With multi_J + time averaging, particles can move during 2*dt per PIC cycle.
+ if (fft_do_time_averaging){
+ dt_Rho = 2._rt*dt;
+ dt_J = 2._rt*dt;
+ }
+ // With multi_J but without time averaging, particles can move during dt per PIC
+ // cycle for the current deposition as well.
+ else {
+ dt_J = dt;
+ }
+ }
+ ng_alloc_Rho[i] += static_cast<int>(std::ceil(PhysConst::c * dt_Rho / dx[i]));
+ ng_alloc_J[i] += static_cast<int>(std::ceil(PhysConst::c * dt_J / dx[i]));
}
}