aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/Laser/LaserParticleContainer.H4
-rw-r--r--Source/Laser/LaserParticleContainer.cpp37
2 files changed, 16 insertions, 25 deletions
diff --git a/Source/Laser/LaserParticleContainer.H b/Source/Laser/LaserParticleContainer.H
index ccd48f3b5..516e368ab 100644
--- a/Source/Laser/LaserParticleContainer.H
+++ b/Source/Laser/LaserParticleContainer.H
@@ -88,9 +88,7 @@ private:
// Theoretical position of the antenna. Used if do_continuous_injection=1.
// Track the position of the antenna until it enters the simulation domain.
amrex::Vector<amrex::Real> updated_position;
- // Avoid injecting the antenna several times.
- int done_injecting=1;
-
+
void ComputeSpacing (int lev, amrex::Real& Sx, amrex::Real& Sy) const;
void ComputeWeightMobility (amrex::Real Sx, amrex::Real Sy);
void InitData (int lev);
diff --git a/Source/Laser/LaserParticleContainer.cpp b/Source/Laser/LaserParticleContainer.cpp
index 3bbd7a039..a45da540d 100644
--- a/Source/Laser/LaserParticleContainer.cpp
+++ b/Source/Laser/LaserParticleContainer.cpp
@@ -162,7 +162,7 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies,
if (do_continuous_injection){
// If laser antenna initially outside of the box, store its theoretical
- // position in z_antenna_th, and set done_injecting to 0.
+ // position in z_antenna_th
updated_position = position;
// Convert updated position to Real* to use RealBox.contains()
#if (AMREX_SPACEDIM == 3)
@@ -170,9 +170,6 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies,
#else
const Real p_pos[2] = {updated_position[0], updated_position[2]};
#endif
- if ( not laser_injection_box.contains(p_pos) ){
- done_injecting = 0;
- }
// Sanity checks
int dir = WarpX::moving_window_dir;
@@ -203,28 +200,24 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies,
void
LaserParticleContainer::ContinuousInjection (const RealBox& injection_box)
{
- if (done_injecting==0)
- {
- // Input parameter injection_box contains small box where injection
- // should occur.
- // So far, LaserParticleContainer::laser_injection_box contains the
- // outdated full problem domain at t=0.
+ // Input parameter injection_box contains small box where injection
+ // should occur.
+ // So far, LaserParticleContainer::laser_injection_box contains the
+ // outdated full problem domain at t=0.
- // Convert updated_position to Real* to use RealBox::contains().
+ // Convert updated_position to Real* to use RealBox::contains().
#if (AMREX_SPACEDIM == 3)
- const Real* p_pos = updated_position.dataPtr();
+ const Real* p_pos = updated_position.dataPtr();
#else
- const Real p_pos[2] = {updated_position[0], updated_position[2]};
+ const Real p_pos[2] = {updated_position[0], updated_position[2]};
#endif
- if ( injection_box.contains(p_pos) ){
- // Update laser_injection_box with current value
- laser_injection_box = injection_box;
- // Inject laser particles. LaserParticleContainer::InitData
- // is called only once, when the antenna enters the simulation
- // domain.
- InitData();
- done_injecting = 1;
- }
+ if ( injection_box.contains(p_pos) ){
+ // Update laser_injection_box with current value
+ laser_injection_box = injection_box;
+ // Inject laser particles. LaserParticleContainer::InitData
+ // is called only once, when the antenna enters the simulation
+ // domain.
+ InitData();
}
}