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.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]));
}
}