aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/LaserParticleContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/LaserParticleContainer.cpp')
-rw-r--r--Source/Particles/LaserParticleContainer.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/Source/Particles/LaserParticleContainer.cpp b/Source/Particles/LaserParticleContainer.cpp
index 22ffb2a5f..12d7e78cd 100644
--- a/Source/Particles/LaserParticleContainer.cpp
+++ b/Source/Particles/LaserParticleContainer.cpp
@@ -261,7 +261,21 @@ LaserParticleContainer::ContinuousInjection (const RealBox& injection_box)
#else
const Real p_pos[1] = {m_updated_position[2]};
#endif
- if ( injection_box.contains(p_pos) ){
+#if defined(WARPX_DIM_RZ)
+ // In RZ, check if laser enters the box only along Z. This is needed
+ // because the Cartesian check below (injection_box.contains(p_pos))
+ // would fail in RZ, due to the fact that such a check verifies that
+ // p_pos is strictly contained within injection_box and this is not
+ // the case for the R coordinate of the laser antenna in RZ (since
+ // that equals 0 and thus coincides with the low end of the injection
+ // box along R, which also equals 0).
+ const bool is_contained = (injection_box.lo(1) < p_pos[1] &&
+ p_pos[1] < injection_box.hi(1));
+#else
+ const bool is_contained = injection_box.contains(p_pos);
+#endif
+ if (is_contained)
+ {
// Update laser_injection_box with current value
m_laser_injection_box = injection_box;
// Inject laser particles. LaserParticleContainer::InitData