aboutsummaryrefslogtreecommitdiff
path: root/Source/Laser/LaserParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2019-05-07 09:33:38 -0700
committerGravatar GitHub <noreply@github.com> 2019-05-07 09:33:38 -0700
commit4d14b8af45c9f3d8e4c774c7bd9e4cddfdecfe78 (patch)
treefd173453823f9267e32301bcbec5942baf8bfb0a /Source/Laser/LaserParticleContainer.cpp
parent8c6ee069762bc1e17556fa5c76172c8b418ad0c8 (diff)
parent6bdafd570c25fde71d2ce93ecea6fbd803f8cf2c (diff)
downloadWarpX-4d14b8af45c9f3d8e4c774c7bd9e4cddfdecfe78.tar.gz
WarpX-4d14b8af45c9f3d8e4c774c7bd9e4cddfdecfe78.tar.zst
WarpX-4d14b8af45c9f3d8e4c774c7bd9e4cddfdecfe78.zip
Merge pull request #125 from ECP-WarpX/inject_laser_refac
consistent continuous injection for PhysicalParticle and LaserParticle
Diffstat (limited to 'Source/Laser/LaserParticleContainer.cpp')
-rw-r--r--Source/Laser/LaserParticleContainer.cpp52
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());