diff options
Diffstat (limited to 'Source/Particles')
-rw-r--r-- | Source/Particles/MultiParticleContainer.cpp | 3 | ||||
-rw-r--r-- | Source/Particles/WarpXParticleContainer.cpp | 21 |
2 files changed, 16 insertions, 8 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index ea8e58ee7..6cf890821 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -10,6 +10,7 @@ * License: BSD-3-Clause-LBNL */ #include "MultiParticleContainer.H" +#include "Parallelization/WarpXCommUtil.H" #include "Particles/ElementaryProcess/Ionization.H" #ifdef WARPX_QED # include "Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H" @@ -556,7 +557,7 @@ MultiParticleContainer::GetChargeDensity (int lev, bool local) } if (!local) { const Geometry& gm = allcontainers[0]->Geom(lev); - rho->SumBoundary(gm.periodicity()); + WarpXCommUtil::SumBoundary(*rho, gm.periodicity()); } return rho; } diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 5a76a24df..8610238db 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -13,6 +13,7 @@ #include "Deposition/CurrentDeposition.H" #include "Pusher/GetAndSetPosition.H" #include "Pusher/UpdatePosition.H" +#include "Parallelization/WarpXCommUtil.H" #include "ParticleBoundaries_K.H" #include "Utils/CoarsenMR.H" #include "Utils/WarpXAlgorithmSelection.H" @@ -783,23 +784,29 @@ WarpXParticleContainer::DepositCharge (amrex::Vector<std::unique_ptr<amrex::Mult #endif // Exchange guard cells - if (local == false) rho[lev]->SumBoundary(m_gdb->Geom(lev).periodicity()); + if (local == false) { + WarpXCommUtil::SumBoundary(*rho[lev], m_gdb->Geom(lev).periodicity()); + } } // Now that the charge has been deposited at each level, // we average down from fine to crse if (interpolate_across_levels) { - for (int lev = finest_level - 1; lev >= 0; --lev) - { + for (int lev = finest_level - 1; lev >= 0; --lev) { const DistributionMapping& fine_dm = rho[lev+1]->DistributionMap(); BoxArray coarsened_fine_BA = rho[lev+1]->boxArray(); coarsened_fine_BA.coarsen(m_gdb->refRatio(lev)); MultiFab coarsened_fine_data(coarsened_fine_BA, fine_dm, rho[lev+1]->nComp(), 0); coarsened_fine_data.setVal(0.0); - const int refinement_ratio = 2; - CoarsenMR::Coarsen(coarsened_fine_data, *rho[lev+1], IntVect(refinement_ratio)); - rho[lev]->ParallelAdd(coarsened_fine_data, m_gdb->Geom(lev).periodicity()); + + int const refinement_ratio = 2; + + CoarsenMR::Coarsen( coarsened_fine_data, *rho[lev+1], IntVect(refinement_ratio) ); + WarpXCommUtil::ParallelAdd(*rho[lev], coarsened_fine_data, 0, 0, rho[lev]->nComp(), + amrex::IntVect::TheZeroVector(), + amrex::IntVect::TheZeroVector(), + m_gdb->Geom(lev).periodicity()); } } } @@ -860,7 +867,7 @@ WarpXParticleContainer::GetChargeDensity (int lev, bool local) WarpX::GetInstance().ApplyInverseVolumeScalingToChargeDensity(rho.get(), lev); #endif - if (local == false) rho->SumBoundary(gm.periodicity()); + if (local == false) { WarpXCommUtil::SumBoundary(*rho, gm.periodicity()); } return rho; } |