aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2020-07-29 06:23:57 +0200
committerGravatar GitHub <noreply@github.com> 2020-07-28 21:23:57 -0700
commitbe7ccae324cb3c6dbfa266fad975b4077f563c3e (patch)
treea22414384ddfb085fa1d24a354070c2e1d1498f5 /Source/Particles/PhysicalParticleContainer.cpp
parent8dcb939c78a7a1aaadaca4f948c16ee83d3040eb (diff)
downloadWarpX-be7ccae324cb3c6dbfa266fad975b4077f563c3e.tar.gz
WarpX-be7ccae324cb3c6dbfa266fad975b4077f563c3e.tar.zst
WarpX-be7ccae324cb3c6dbfa266fad975b4077f563c3e.zip
[tiny] Avoid particles with do_not_gather=1 be pushed in the last half step (#1210)
* species with do_not_gather=1 are not anymore pushed in the last halft step * now do_not_gather is used just to avoid doing doGatherShapeN * Minor fix * fix involuntary capture of *this in lambda
Diffstat (limited to '')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 9511ab8f8..8c6959060 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -1474,6 +1474,8 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
const auto pusher_algo = WarpX::particle_pusher_algo;
const auto do_crr = do_classical_radiation_reaction;
+ const auto t_do_not_gather = do_not_gather;
+
amrex::ParallelFor( np, [=] AMREX_GPU_DEVICE (long ip)
{
amrex::ParticleReal xp, yp, zp;
@@ -1485,12 +1487,14 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
amrex::ParticleReal Bxp = 0._rt, Byp = 0._rt, Bzp = 0._rt;
getExternalB(ip, Bxp, Byp, Bzp);
- // first gather E and B to the particle positions
- doGatherShapeN(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
- ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
- ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
- dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes,
- nox, l_lower_order_in_v);
+ if (!t_do_not_gather){
+ // first gather E and B to the particle positions
+ doGatherShapeN(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
+ ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
+ ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
+ dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes,
+ nox, l_lower_order_in_v);
+ }
if (do_crr) {
amrex::Real qp = q;
@@ -1760,8 +1764,7 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
(gather_lev==(lev )),
"Gather buffers only work for lev-1");
// If no particles, do not do anything
- // If do_not_gather = 1 by user, do not do anything
- if (np_to_push == 0 || do_not_gather) return;
+ if (np_to_push == 0) return;
// Get cell size on gather_lev
const std::array<Real,3>& dx = WarpX::CellSize(std::max(gather_lev,0));
@@ -1850,6 +1853,8 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
}
#endif
+ const auto t_do_not_gather = do_not_gather;
+
amrex::ParallelFor( np_to_push, [=] AMREX_GPU_DEVICE (long ip)
{
amrex::ParticleReal xp, yp, zp;
@@ -1861,12 +1866,14 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
amrex::ParticleReal Bxp = 0._rt, Byp = 0._rt, Bzp = 0._rt;
getExternalB(ip, Bxp, Byp, Bzp);
- // first gather E and B to the particle positions
- doGatherShapeN(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
- ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
- ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
- dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes,
- nox, l_lower_order_in_v);
+ if(!t_do_not_gather){
+ // first gather E and B to the particle positions
+ doGatherShapeN(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
+ ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
+ ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
+ dx_arr, xyzmin_arr, lo, n_rz_azimuthal_modes,
+ nox, l_lower_order_in_v);
+ }
scaleFields(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp);