aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2023-04-06 13:25:16 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-06 13:25:16 -0700
commit1f859437c45cc7ff5ff3485f595b61bc510642d6 (patch)
treedd541871fea2c91b57828a66981ee73bd8d57d61 /Source/FieldSolver
parentf8e8198365a6a72521f323d62f3031e77765eb5f (diff)
downloadWarpX-1f859437c45cc7ff5ff3485f595b61bc510642d6.tar.gz
WarpX-1f859437c45cc7ff5ff3485f595b61bc510642d6.tar.zst
WarpX-1f859437c45cc7ff5ff3485f595b61bc510642d6.zip
code cleanup: make use of `MultiParticleContainer::DepositCurrent` in `AddSpaceChargeFieldLabFrame` (#3807)
Diffstat (limited to 'Source/FieldSolver')
-rw-r--r--Source/FieldSolver/ElectrostaticSolver.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/Source/FieldSolver/ElectrostaticSolver.cpp b/Source/FieldSolver/ElectrostaticSolver.cpp
index 65f11310e..42a98dab1 100644
--- a/Source/FieldSolver/ElectrostaticSolver.cpp
+++ b/Source/FieldSolver/ElectrostaticSolver.cpp
@@ -204,29 +204,9 @@ WarpX::AddSpaceChargeFieldLabFrame ()
"Error: RZ electrostatic only implemented for a single mode");
#endif
- // reset rho_fp before depositing charge density for this step
- for (int lev = 0; lev <= max_level; lev++) {
- rho_fp[lev]->setVal(0.);
- }
-
// Deposit particle charge density (source of Poisson solver)
- bool const local = true;
- bool const interpolate_across_levels = false;
- bool const reset = false;
- bool const do_rz_volume_scaling = false;
- for (int ispecies=0; ispecies<mypc->nSpecies(); ispecies++){
- WarpXParticleContainer& species = mypc->GetParticleContainer(ispecies);
- 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++) {
- ApplyInverseVolumeScalingToChargeDensity(rho_fp[lev].get(), lev);
- }
-#endif
+ mypc->DepositCharge(rho_fp, 0.0_rt);
+
SyncRho(); // Apply filter, perform MPI exchange, interpolate across levels
// beta is zero in lab frame