diff options
author | 2022-05-16 08:16:27 -0700 | |
---|---|---|
committer | 2022-05-16 17:16:27 +0200 | |
commit | 47a0490323adde9d8475e458f886e322be040d05 (patch) | |
tree | b37b58a9c0f173dd0d3aa1bc357dd483bee08ad4 /Source/Particles/LaserParticleContainer.cpp | |
parent | 07d4004aff3322b1d4bbba0211755c335f9431de (diff) | |
download | WarpX-47a0490323adde9d8475e458f886e322be040d05.tar.gz WarpX-47a0490323adde9d8475e458f886e322be040d05.tar.zst WarpX-47a0490323adde9d8475e458f886e322be040d05.zip |
Fix Laser Injection in RZ (#3104)
Diffstat (limited to 'Source/Particles/LaserParticleContainer.cpp')
-rw-r--r-- | Source/Particles/LaserParticleContainer.cpp | 16 |
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 |