diff options
Diffstat (limited to 'Source/LaserParticleContainer.cpp')
-rw-r--r-- | Source/LaserParticleContainer.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Source/LaserParticleContainer.cpp b/Source/LaserParticleContainer.cpp index 92b64b28c..8c5d799e3 100644 --- a/Source/LaserParticleContainer.cpp +++ b/Source/LaserParticleContainer.cpp @@ -57,6 +57,8 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies) pp.get("profile_duration", profile_duration); pp.get("profile_t_peak", profile_t_peak); pp.get("profile_focal_distance", profile_focal_distance); + stc_direction = p_X; + pp.queryarr("stc_direction", stc_direction); pp.query("zeta", zeta); pp.query("beta", beta); pp.query("phi2", phi2); @@ -113,6 +115,22 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies) p_Y = CrossProduct(nvec, p_X); // The second polarization vector + s = 1.0/std::sqrt(stc_direction[0]*stc_direction[0] + stc_direction[1]*stc_direction[1] + stc_direction[2]*stc_direction[2]); + stc_direction = { stc_direction[0]*s, stc_direction[1]*s, stc_direction[2]*s }; + dp = std::inner_product(nvec.begin(), nvec.end(), stc_direction.begin(), 0.0); + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(std::abs(dp) < 1.0e-14, + "stc_direction is not perpendicular to the laser plane vector"); + + // Get angle between p_X and stc_direction + // in 2d, stcs are in the simulation plane +#if AMREX_SPACEDIM == 3 + theta_stc = acos(stc_direction[0]*p_X[0] + + stc_direction[1]*p_X[1] + + stc_direction[2]*p_X[2]); +#else + theta_stc = 0.; +#endif + #if AMREX_SPACEDIM == 3 u_X = p_X; u_Y = p_Y; @@ -419,7 +437,7 @@ LaserParticleContainer::Evolve (int lev, warpx_gaussian_laser( &np, plane_Xp.data(), plane_Yp.data(), &t_lab, &wavelength, &e_max, &profile_waist, &profile_duration, &profile_t_peak, &profile_focal_distance, amplitude_E.data(), - &zeta, &beta, &phi2 ); + &zeta, &beta, &phi2, &theta_stc ); } if (profile == laser_t::Harris) { |