diff options
Diffstat (limited to 'Source/Laser/LaserProfiles.cpp')
-rw-r--r-- | Source/Laser/LaserProfiles.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/Laser/LaserProfiles.cpp b/Source/Laser/LaserProfiles.cpp index 704107c2d..69804b17c 100644 --- a/Source/Laser/LaserProfiles.cpp +++ b/Source/Laser/LaserProfiles.cpp @@ -9,14 +9,14 @@ using namespace amrex; * Both Xp and Yp are given in laser plane coordinate. * For each particle with position Xp and Yp, this routine computes the * amplitude of the laser electric field, stored in array amplitude. - * + * * \param np: number of laser particles * \param Xp: pointer to first component of positions of laser particles * \param Yp: pointer to second component of positions of laser particles * \param t: Current physical time * \param amplitude: pointer to array of field amplitude. */ -void +void LaserParticleContainer::gaussian_laser_profile ( const int np, Real const * AMREX_RESTRICT const Xp, Real const * AMREX_RESTRICT const Yp, Real t, Real * AMREX_RESTRICT const amplitude) @@ -34,9 +34,9 @@ LaserParticleContainer::gaussian_laser_profile ( // Time stretching due to STCs and phi2 complex envelope // (1 if zeta=0, beta=0, phi2=0) - const Complex stretch_factor = 1. + 4. * + const Complex stretch_factor = 1. + 4. * (zeta+beta*profile_focal_distance) * (zeta+beta*profile_focal_distance) - * (inv_tau2*inv_complex_waist_2) + + * (inv_tau2*inv_complex_waist_2) + 2.*I*(phi2 - beta*beta*k0*profile_focal_distance) * inv_tau2; // Amplitude and monochromatic oscillations @@ -59,10 +59,10 @@ LaserParticleContainer::gaussian_laser_profile ( Real tmp_profile_focal_distance = profile_focal_distance; // Loop through the macroparticle to calculate the proper amplitude amrex::ParallelFor( - np, + np, [=] AMREX_GPU_DEVICE (int i) { const Complex stc_exponent = 1./stretch_factor * inv_tau2 * - MathFunc::pow((t - tmp_profile_t_peak - + MathFunc::pow((t - tmp_profile_t_peak - tmp_beta*k0*(Xp[i]*std::cos(tmp_theta_stc) + Yp[i]*std::sin(tmp_theta_stc)) - 2.*I*(Xp[i]*std::cos(tmp_theta_stc) + Yp[i]*std::sin(tmp_theta_stc)) *( tmp_zeta - tmp_beta*tmp_profile_focal_distance ) * inv_complex_waist_2),2); @@ -81,14 +81,14 @@ LaserParticleContainer::gaussian_laser_profile ( * Both Xp and Yp are given in laser plane coordinate. * For each particle with position Xp and Yp, this routine computes the * amplitude of the laser electric field, stored in array amplitude. - * + * * \param np: number of laser particles * \param Xp: pointer to first component of positions of laser particles * \param Yp: pointer to second component of positions of laser particles * \param t: Current physical time * \param amplitude: pointer to array of field amplitude. */ -void +void LaserParticleContainer::harris_laser_profile ( const int np, Real const * AMREX_RESTRICT const Xp, Real const * AMREX_RESTRICT const Yp, Real t, Real * AMREX_RESTRICT const amplitude) @@ -96,14 +96,14 @@ LaserParticleContainer::harris_laser_profile ( // This function uses the Harris function as the temporal profile of the pulse const Real omega0 = 2.*MathConst::pi*PhysConst::c/wavelength; const Real zR = MathConst::pi * profile_waist*profile_waist / wavelength; - const Real wz = profile_waist * + const Real wz = profile_waist * std::sqrt(1. + profile_focal_distance*profile_focal_distance/zR*zR); const Real inv_wz_2 = 1./(wz*wz); Real inv_Rz; - if (profile_focal_distance == 0.){ + if (profile_focal_distance == 0.){ inv_Rz = 0.; } else { - inv_Rz = -profile_focal_distance / + inv_Rz = -profile_focal_distance / ( profile_focal_distance*profile_focal_distance + zR*zR ); } const Real arg_env = 2.*MathConst::pi*t/profile_duration; @@ -111,8 +111,8 @@ LaserParticleContainer::harris_laser_profile ( // time envelope is given by the Harris function Real time_envelope = 0.; if (t < profile_duration) - time_envelope = 1./32. * (10. - 15.*std::cos(arg_env) + - 6.*std::cos(2.*arg_env) - + time_envelope = 1./32. * (10. - 15.*std::cos(arg_env) + + 6.*std::cos(2.*arg_env) - std::cos(3.*arg_env)); // Copy member variables to tmp copies for GPU runs. @@ -121,7 +121,7 @@ LaserParticleContainer::harris_laser_profile ( amrex::ParallelFor( np, [=] AMREX_GPU_DEVICE (int i) { - const Real space_envelope = + const Real space_envelope = std::exp(- ( Xp[i]*Xp[i] + Yp[i]*Yp[i] ) * inv_wz_2); const Real arg_osc = omega0*t - omega0/PhysConst::c* (Xp[i]*Xp[i] + Yp[i]*Yp[i]) * inv_Rz / 2.; |