From 3bb148ebbc1c8eae47d1f00ab60e68a041289cb6 Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Mon, 15 Aug 2022 13:43:38 -0700 Subject: Move handling of do_not_deposit to physics callers (#3225) * Rearrange in preparation for lifting do_not_deposit higher in the call stack * Make do_not_deposit public, so callers can test on it * Make all DepositCharge call sites respect WarpXParticleContainer::do_not_deposit * Drop check for do_not_deposit in DepositCharge * Fix comment to accurately describe np_to_depose * Fix logic to account for other logic in AddSpaceChargeField * Match zero charge density array to filled array in RZ PSATD case * Structure control flow per @dpgrote's preference * Reword comment for clarity --- Source/Particles/PhysicalParticleContainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Particles/PhysicalParticleContainer.cpp') diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 72543982b..5b0ea8ae5 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1910,7 +1910,7 @@ PhysicalParticleContainer::Evolve (int lev, const long np_current = (cjx) ? nfine_current : np; - if (rho && ! skip_deposition) { + if (rho && ! skip_deposition && ! do_not_deposit) { // Deposit charge before particle push, in component 0 of MultiFab rho. int* AMREX_RESTRICT ion_lev; if (do_field_ionization){ @@ -2006,7 +2006,7 @@ PhysicalParticleContainer::Evolve (int lev, } // end of "if do_electrostatic == ElectrostaticSolverAlgo::None" } // end of "if do_not_push" - if (rho && ! skip_deposition) { + if (rho && ! skip_deposition && ! do_not_deposit) { // Deposit charge after particle push, in component 1 of MultiFab rho. // (Skipped for electrostatic solver, as this may lead to out-of-bounds) if (WarpX::do_electrostatic == ElectrostaticSolverAlgo::None) { -- cgit v1.2.3