diff options
Diffstat (limited to 'Source/Laser/LaserParticleContainer.cpp')
-rw-r--r-- | Source/Laser/LaserParticleContainer.cpp | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/Source/Laser/LaserParticleContainer.cpp b/Source/Laser/LaserParticleContainer.cpp index d28bd75e5..8499455de 100644 --- a/Source/Laser/LaserParticleContainer.cpp +++ b/Source/Laser/LaserParticleContainer.cpp @@ -205,10 +205,8 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies, void LaserParticleContainer::ContinuousInjection (Real dt, const RealBox& prob_domain) { - // update position of the antenna (outside of the box) - if (WarpX::gamma_boost>1){ - z_antenna_th -= PhysConst::c * WarpX::beta_boost * dt; - } + Print()<<" --- In LaserParticleContainer::ContinuousInjection"<<std::endl; + Print()<<"z_antenna_th "<<z_antenna_th<<std::endl; // If laser antenna particles have not been injected yet, // check if they should be injected at this iteration. If // so, inject them and set done_injecting to 0 (false). @@ -222,7 +220,9 @@ LaserParticleContainer::ContinuousInjection (Real dt, const RealBox& prob_domain // Get domain boundaries in the z direction const Real prob_lo_z = prob_domain.lo()[AMREX_SPACEDIM-1]; const Real prob_hi_z = prob_domain.hi()[AMREX_SPACEDIM-1]; - if ( z_antenna_th>prob_lo_z && z_antenna_th<prob_hi_z ){ + Print()<<"prob_lo_z "<<prob_lo_z<<std::endl; + Print()<<"prob_hi_z "<<prob_hi_z<<std::endl; + if ( z_antenna_th>=prob_lo_z && z_antenna_th<prob_hi_z ){ // Update laser_prob_domain with current value laser_prob_domain = prob_domain; // Inject laser particles. LaserParticleContainer::InitData @@ -236,6 +236,48 @@ LaserParticleContainer::ContinuousInjection (Real dt, const RealBox& prob_domain } void +LaserParticleContainer::UpdateContinuousInjectionPosition(Real dt) +{ + int dir = WarpX::moving_window_dir; + // update position of the antenna (outside of the box) + // Continuously inject plasma in new cells (by default only on level 0) + if (do_continuous_injection and (WarpX::gamma_boost > 1)){ + // In boosted-frame simulations, the plasma has moved since the last + // call to this function, and injection position needs to be updated + z_antenna_th -= WarpX::beta_boost * +#if ( AMREX_SPACEDIM == 3 ) + WarpX::boost_direction[dir] * PhysConst::c * dt; +#elif ( AMREX_SPACEDIM == 2 ) + // In 2D, dir=0 corresponds to x and dir=1 corresponds to z + // This needs to be converted in order to index `boost_direction` + // which has 3 components, for both 2D and 3D simulations. + WarpX::boost_direction[2*dir] * PhysConst::c * dt; +#endif + } + + /* + if (WarpX::do_plasma_injection and (WarpX::gamma_boost > 1){ + z_antenna_th -= PhysConst::c * WarpX::beta_boost * dt; + } + */ +} + + + + + + + + + + + + + + + + +void LaserParticleContainer::InitData () { InitData(maxLevel()); |