aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/WarpXParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Edoardo Zoni <59625522+EZoni@users.noreply.github.com> 2023-07-27 13:18:06 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-27 13:18:06 -0700
commit1f1b15b7b018c95025ce7afebd5e0b350d60f610 (patch)
tree1540ed089d1b902b811458b85ae42da425bf9f87 /Source/Particles/WarpXParticleContainer.cpp
parent3b804c1559345be370b4a733c1eccfa41d5c7334 (diff)
downloadWarpX-1f1b15b7b018c95025ce7afebd5e0b350d60f610.tar.gz
WarpX-1f1b15b7b018c95025ce7afebd5e0b350d60f610.tar.zst
WarpX-1f1b15b7b018c95025ce7afebd5e0b350d60f610.zip
Fix bug with MLMG solver, always pass ghost cells to `SumBoundary` (#4078)
* Must pass number of ghost cells to call `SumBoundary` * Apply suggestions from #4093 * Add inline comments on possible performance optimization
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index dd7845dff..f0f745f76 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -1014,11 +1014,11 @@ WarpXParticleContainer::DepositCharge (amrex::Vector<std::unique_ptr<amrex::Mult
// Exchange guard cells
if (local == false) {
+ // Possible performance optimization:
+ // pass less than `rho[lev]->nGrowVect()` in the fifth input variable `dst_ng`
ablastr::utils::communication::SumBoundary(
- *rho[lev],
- WarpX::do_single_precision_comms,
- m_gdb->Geom(lev).periodicity()
- );
+ *rho[lev], 0, rho[lev]->nComp(), rho[lev]->nGrowVect(), rho[lev]->nGrowVect(),
+ WarpX::do_single_precision_comms, m_gdb->Geom(lev).periodicity());
}
#ifndef WARPX_DIM_RZ
@@ -1106,7 +1106,13 @@ WarpXParticleContainer::GetChargeDensity (int lev, bool local)
WarpX::GetInstance().ApplyInverseVolumeScalingToChargeDensity(rho.get(), lev);
#endif
- if (local == false) { ablastr::utils::communication::SumBoundary(*rho, WarpX::do_single_precision_comms, gm.periodicity()); }
+ if (local == false) {
+ // Possible performance optimization:
+ // pass less than `rho->nGrowVect()` in the fifth input variable `dst_ng`
+ ablastr::utils::communication::SumBoundary(
+ *rho, 0, rho->nComp(), rho->nGrowVect(), rho->nGrowVect(),
+ WarpX::do_single_precision_comms, gm.periodicity());
+ }
#ifndef WARPX_DIM_RZ
// Reflect density over PEC boundaries, if needed.