diff options
author | 2022-08-15 13:43:38 -0700 | |
---|---|---|
committer | 2022-08-15 13:43:38 -0700 | |
commit | 3bb148ebbc1c8eae47d1f00ab60e68a041289cb6 (patch) | |
tree | 34496fd90e9f9aeb443ebef89a1e15bf643decb3 /Source/FieldSolver/ElectrostaticSolver.cpp | |
parent | 960e4d717b637443c2efaa5b6a9718718cbdee06 (diff) | |
download | WarpX-3bb148ebbc1c8eae47d1f00ab60e68a041289cb6.tar.gz WarpX-3bb148ebbc1c8eae47d1f00ab60e68a041289cb6.tar.zst WarpX-3bb148ebbc1c8eae47d1f00ab60e68a041289cb6.zip |
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
Diffstat (limited to 'Source/FieldSolver/ElectrostaticSolver.cpp')
-rw-r--r-- | Source/FieldSolver/ElectrostaticSolver.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/FieldSolver/ElectrostaticSolver.cpp b/Source/FieldSolver/ElectrostaticSolver.cpp index 164b24d00..e50098e7d 100644 --- a/Source/FieldSolver/ElectrostaticSolver.cpp +++ b/Source/FieldSolver/ElectrostaticSolver.cpp @@ -165,15 +165,18 @@ WarpX::AddSpaceChargeField (WarpXParticleContainer& pc) BoxArray nba = boxArray(lev); nba.surroundingNodes(); rho[lev] = std::make_unique<MultiFab>(nba, DistributionMap(lev), 1, ng); + rho[lev]->setVal(0.); phi[lev] = std::make_unique<MultiFab>(nba, DistributionMap(lev), 1, 1); phi[lev]->setVal(0.); } // Deposit particle charge density (source of Poisson solver) bool const local = false; - bool const reset = true; + bool const reset = false; bool const do_rz_volume_scaling = true; - pc.DepositCharge(rho, local, reset, do_rz_volume_scaling); + if ( !pc.do_not_deposit) { + pc.DepositCharge(rho, local, reset, do_rz_volume_scaling); + } // Get the particle beta vector bool const local_average = false; // Average across all MPI ranks @@ -218,9 +221,11 @@ WarpX::AddSpaceChargeFieldLabFrame () bool const do_rz_volume_scaling = false; for (int ispecies=0; ispecies<mypc->nSpecies(); ispecies++){ WarpXParticleContainer& species = mypc->GetParticleContainer(ispecies); - species.DepositCharge( - rho_fp, local, reset, do_rz_volume_scaling, interpolate_across_levels - ); + if (!species.do_not_deposit) { + species.DepositCharge( rho_fp, + local, reset, do_rz_volume_scaling, interpolate_across_levels + ); + } } #ifdef WARPX_DIM_RZ for (int lev = 0; lev <= max_level; lev++) { |