Skip to content

Commit

Permalink
Remove check if particles are in bounds since it is redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgrote committed Dec 27, 2023
1 parent c0d0b9e commit 4546d34
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1919,10 +1919,10 @@ PhysicalParticleContainer::AddPlasmaFlux (PlasmaInjector const& plasma_injector,

// This assumes the flux_pos is of type InjectorPositionRandomPlane
const XDim3 r = (fine_overlap_box.ok() && fine_overlap_box.contains(iv)) ?
// In the refined injection region: use refinement ratio `lrrfac`
flux_pos->getPositionUnitBox(i_part, lrrfac, engine) :
// Otherwise: use 1 as the refinement ratio
flux_pos->getPositionUnitBox(i_part, amrex::IntVect::TheUnitVector(), engine);
// In the refined injection region: use refinement ratio `lrrfac`
flux_pos->getPositionUnitBox(i_part, lrrfac, engine) :
// Otherwise: use 1 as the refinement ratio
flux_pos->getPositionUnitBox(i_part, amrex::IntVect::TheUnitVector(), engine);
auto pos = getCellCoords(emitting_cell_location, dx, r, iv);
auto ppos = PDim3(pos);

Expand Down Expand Up @@ -2037,27 +2037,6 @@ PhysicalParticleContainer::AddPlasmaFlux (PlasmaInjector const& plasma_injector,
const amrex::Real t_fract = amrex::Random(engine)*dt;
UpdatePosition(ppos.x, ppos.y, ppos.z, pu.x, pu.y, pu.z, t_fract);

// Check if the updated particle location is within the domain.
// If not, skip it.
#if defined(WARPX_DIM_3D)
if (!tile_realbox.contains(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})) {
p.id() = -1;
continue;
}
#else
amrex::ignore_unused(j, k);
if (!tile_realbox.contains(XDim3{ppos.z, 0.0_prt, 0.0_prt})) {
p.id() = -1;
continue;
}
#endif

#if defined(WARPX_DIM_3D)
p.pos(0) = ppos.x;
p.pos(1) = ppos.y;
Expand Down

0 comments on commit 4546d34

Please sign in to comment.