diff options
-rw-r--r-- | Source/LaserParticleContainer.cpp | 14 | ||||
-rw-r--r-- | Source/WarpX_laser.F90 | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/Source/LaserParticleContainer.cpp b/Source/LaserParticleContainer.cpp index a76c2a33b..589e5f5e4 100644 --- a/Source/LaserParticleContainer.cpp +++ b/Source/LaserParticleContainer.cpp @@ -344,18 +344,18 @@ LaserParticleContainer::Evolve (int lev, } // Calculate the corresponding momentum and position for the particles { - Real v_over_c, vx, vy, vz, gamma, sign_charge; pti.foreach([&](int i, ParticleType& p) { // Calculate the velocity according to the amplitude of E - sign_charge = std::copysign( 1.0, wp[i] ); - v_over_c = sign_charge * mobility * amplitude_E[i]; + Real sign_charge = std::copysign( 1.0, wp[i] ); + Real v_over_c = sign_charge * mobility * amplitude_E[i]; + BL_ASSERT( v_over_c < 1 ); giv[i] = std::sqrt( 1 - v_over_c * v_over_c ); - gamma = 1./giv[i]; + Real gamma = 1./giv[i]; // The velocity is along the laser polarization p_X - vx = PhysConst::c * v_over_c * p_X[0]; - vy = PhysConst::c * v_over_c * p_X[1]; - vz = PhysConst::c * v_over_c * p_X[2]; + Real vx = PhysConst::c * v_over_c * p_X[0]; + Real vy = PhysConst::c * v_over_c * p_X[1]; + Real vz = PhysConst::c * v_over_c * p_X[2]; // Get the corresponding momenta uxp[i] = gamma * vx; uyp[i] = gamma * vy; diff --git a/Source/WarpX_laser.F90 b/Source/WarpX_laser.F90 index 312323fc3..0d1f69c22 100644 --- a/Source/WarpX_laser.F90 +++ b/Source/WarpX_laser.F90 @@ -21,7 +21,8 @@ contains integer(c_long) :: i real(c_real) :: k0, oscillation_phase, temporal_exponent complex*16 :: diffract_factor, exp_argument, prefactor, & - inv_complex_waist_2, j=cmplx(0., 1.) + inv_complex_waist_2 + complex*16, parameter :: j=cmplx(0., 1.) ! This function uses the complex expression of a Gaussian laser ! (Including Gouy phase and laser oscillations) |