aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/LaserParticleContainer.H3
-rw-r--r--Source/LaserParticleContainer.cpp20
-rw-r--r--Source/WarpX_f.H2
-rw-r--r--Source/WarpX_laser.F907
4 files changed, 27 insertions, 5 deletions
diff --git a/Source/LaserParticleContainer.H b/Source/LaserParticleContainer.H
index 8fe012fc0..77a52dc26 100644
--- a/Source/LaserParticleContainer.H
+++ b/Source/LaserParticleContainer.H
@@ -52,6 +52,8 @@ private:
amrex::Vector<amrex::Real> position;
amrex::Vector<amrex::Real> nvec;
amrex::Vector<amrex::Real> p_X;
+ amrex::Vector<amrex::Real> stc_direction;
+
long pusher_algo = -1;
amrex::Real e_max = std::numeric_limits<amrex::Real>::quiet_NaN();
amrex::Real wavelength = std::numeric_limits<amrex::Real>::quiet_NaN();
@@ -72,6 +74,7 @@ private:
amrex::Real zeta = 0.;
amrex::Real beta = 0.;
amrex::Real phi2 = 0.;
+ amrex::Real theta_stc = 0.;
// parse_field_function profile
int parser_instance_number = 0;
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) {
diff --git a/Source/WarpX_f.H b/Source/WarpX_f.H
index a580c663b..e709c1332 100644
--- a/Source/WarpX_f.H
+++ b/Source/WarpX_f.H
@@ -172,7 +172,7 @@ extern "C"
void warpx_gaussian_laser( const long* np,
amrex::Real* Xp, amrex::Real* Yp, amrex::Real* t, amrex::Real* wavelength, amrex::Real* e_max, amrex::Real* waist,
amrex::Real* duration, amrex::Real* t_peak, amrex::Real* f, amrex::Real* amplitude,
- amrex::Real* zeta, amrex::Real* beta, amrex::Real* phi2 );
+ amrex::Real* zeta, amrex::Real* beta, amrex::Real* phi2, amrex::Real* theta_stc );
void warpx_harris_laser( const long* np,
amrex::Real* Xp, amrex::Real* Yp, amrex::Real* t, amrex::Real* wavelength,
diff --git a/Source/WarpX_laser.F90 b/Source/WarpX_laser.F90
index 76ff0caa6..a99cec8c7 100644
--- a/Source/WarpX_laser.F90
+++ b/Source/WarpX_laser.F90
@@ -12,12 +12,12 @@ contains
subroutine warpx_gaussian_laser( np, Xp, Yp, t, &
wavelength, e_max, waist, duration, t_peak, f, amplitude, &
- zeta, beta, phi2 ) bind(C, name="warpx_gaussian_laser")
+ zeta, beta, phi2, theta_stc ) bind(C, name="warpx_gaussian_laser")
integer(c_long), intent(in) :: np
real(amrex_real), intent(in) :: Xp(np),Yp(np)
real(amrex_real), intent(in) :: e_max, t, t_peak, wavelength, duration, f, waist
- real(amrex_real), intent(in) :: zeta, beta, phi2
+ real(amrex_real), intent(in) :: zeta, beta, phi2, theta_stc
real(amrex_real), intent(inout) :: amplitude(np)
integer(c_long) :: i
@@ -61,7 +61,8 @@ contains
do i = 1, np
! Exp argument for the temporal gaussian envelope + STCs
stc_exponent = 1./stretch_factor * inv_tau2 * \
- (t - t_peak - beta*k0*Xp(i) - 2*j*Xp(i)*( zeta - beta*f ) * \
+ (t - t_peak - beta*k0*(Xp(i)*cos(theta_stc) + Yp(i)*sin(theta_stc)) -\
+ 2*j*(Xp(i)*cos(theta_stc) + Yp(i)*sin(theta_stc))*( zeta - beta*f ) *\
inv_complex_waist_2)**2
! stcfactor = everything but complex transverse envelope
stcfactor = prefactor * exp( - stc_exponent )