aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index cbb0a6932..18cf17162 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -32,6 +32,7 @@
#include "Particles/SpeciesPhysicalProperties.H"
#include "Particles/WarpXParticleContainer.H"
#include "Utils/Parser/ParserUtils.H"
+#include "Utils/ParticleUtils.H"
#include "Utils/Physics/IonizationEnergiesTable.H"
#include "Utils/TextMsg.H"
#include "Utils/WarpXAlgorithmSelection.H"
@@ -1682,29 +1683,31 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt)
pu.y *= PhysConst::c;
pu.z *= PhysConst::c;
+ // The containsInclusive is used to allow the case of the flux surface
+ // being on the boundary of the domain. After the UpdatePosition below,
+ // the particles will be within the domain.
#if defined(WARPX_DIM_3D)
- if (!tile_realbox.contains(XDim3{ppos.x,ppos.y,ppos.z})) {
+ if (!ParticleUtils::containsInclusive(tile_realbox, XDim3{ppos.x,ppos.y,ppos.z})) {
p.id() = -1;
continue;
}
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
amrex::ignore_unused(k);
- if (!tile_realbox.contains(XDim3{ppos.x,ppos.z,0.0_prt})) {
+ if (!ParticleUtils::containsInclusive(tile_realbox, XDim3{ppos.x,ppos.z,0.0_prt})) {
p.id() = -1;
continue;
}
#else
amrex::ignore_unused(j,k);
- if (!tile_realbox.contains(XDim3{ppos.z,0.0_prt,0.0_prt})) {
+ if (!ParticleUtils::containsInclusive(tile_realbox, XDim3{ppos.z,0.0_prt,0.0_prt})) {
p.id() = -1;
continue;
}
#endif
// Lab-frame simulation
- // If the particle is not within the species's
- // xmin, xmax, ymin, ymax, zmin, zmax, go to
- // the next generated particle.
- if (!inj_pos->insideBounds(ppos.x, ppos.y, ppos.z)) {
+ // If the particle's initial position is not within or on the species's
+ // xmin, xmax, ymin, ymax, zmin, zmax, go to the next generated particle.
+ if (!inj_pos->insideBoundsInclusive(ppos.x, ppos.y, ppos.z)) {
p.id() = -1;
continue;
}