diff options
author | 2022-12-15 15:42:00 -0800 | |
---|---|---|
committer | 2022-12-15 15:42:00 -0800 | |
commit | 9782feb22784b6f79a773c66e20c890aacf7ac1d (patch) | |
tree | 7cf610b4a84c061dacb27577a7ac46471ac1ed53 /Source/Particles/PhysicalParticleContainer.cpp | |
parent | b1fef21cfee3a8a8f9fd668f477af7dfacb6c14c (diff) | |
download | WarpX-9782feb22784b6f79a773c66e20c890aacf7ac1d.tar.gz WarpX-9782feb22784b6f79a773c66e20c890aacf7ac1d.tar.zst WarpX-9782feb22784b6f79a773c66e20c890aacf7ac1d.zip |
Allow surface flux injection from the domain boundary (#3554)
* Fix to AddPlasmaFlux to allow flux surface to be on the domain boundary
* Update FluxInjection3D.json since the particle positions changed
* Update comments in AddPlasmaFlux
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 17 |
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; } |