Skip to content

Commit

Permalink
name changed
Browse files Browse the repository at this point in the history
z0 re-added
  • Loading branch information
huixingjian committed Jan 11, 2024
1 parent bf11040 commit 615061b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/laser/Laser.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public:
std::string m_name {""};
amrex::Real m_a0 {0.}; /**< Laser peak normalized amplitude */
amrex::Real m_w0 {0.}; /**< Laser waist */
amrex::Real m_init_angle_yz {0.}; /**< initial angle of laser pulse fron tilt on yoz */
amrex::Real m_propagation_angle_yz {0.};/**< Propagation angle of the pulse in the yz plane (0 is the along the z axis) */
amrex::Real m_L0 {0.}; /**< Laser length (HW 1/e in amplitude) */
amrex::Real m_tau {0.}; /**< Laser duration (HW 1/e in amplitude) */
/** Focal distance of the laser pulse */
Expand Down
2 changes: 1 addition & 1 deletion src/laser/Laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Laser::Laser (std::string name, bool laser_from_file)
amrex::ParmParse pp(m_name);
queryWithParser(pp, "a0", m_a0);
queryWithParser(pp, "w0", m_w0);
queryWithParser(pp, "init_angle_yz", m_init_angle_yz);
queryWithParser(pp, "propagation_angle_yz", m_propagation_angle_yz);
bool length_is_specified = queryWithParser(pp, "L0", m_L0);
bool duration_is_specified = queryWithParser(pp, "tau", m_tau);
AMREX_ALWAYS_ASSERT_WITH_MESSAGE( length_is_specified + duration_is_specified == 1,
Expand Down
10 changes: 5 additions & 5 deletions src/laser/MultiLaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ MultiLaser::InitLaserSlice (const amrex::Geometry& geom, const int islice, const
const auto& laser = m_all_lasers[ilaser];
const amrex::Real a0 = laser.m_a0;
const amrex::Real w0 = laser.m_w0;
const amrex::Real init_angle_yz = laser.m_init_angle_yz;
const amrex::Real propagation_angle_yz = laser.m_propagation_angle_yz;
const amrex::Real x0 = laser.m_position_mean[0];
const amrex::Real y0 = laser.m_position_mean[1];
const amrex::Real z0 = laser.m_position_mean[2];
Expand All @@ -1020,8 +1020,8 @@ MultiLaser::InitLaserSlice (const amrex::Geometry& geom, const int islice, const
amrex::Real z = plo[2] + (islice+0.5_rt)*dx_arr[2] - z0;
amrex::Real x = (i+0.5_rt)*dx_arr[0]+plo[0]-x0;
amrex::Real y = (j+0.5_rt)*dx_arr[1]+plo[1]-y0;
const amrex::Real yp=std::cos(init_angle_yz)*y+std::sin(init_angle_yz)*z;
const amrex::Real zp=-std::sin(init_angle_yz)*y+std::cos(init_angle_yz)*z;
const amrex::Real yp=std::cos(propagation_angle_yz)*y+std::sin(propagation_angle_yz)*z;
const amrex::Real zp=-std::sin(propagation_angle_yz)*y+std::cos(propagation_angle_yz)*z;
z=zp;
y=yp;
// For first laser, setval to 0.
Expand All @@ -1030,13 +1030,13 @@ MultiLaser::InitLaserSlice (const amrex::Geometry& geom, const int islice, const
arr(i, j, k, comp + 1 ) = 0._rt;
}
// Compute envelope for time step 0
Complex diffract_factor = 1._rt + I * (z-zfoc*std::cos(init_angle_yz)) * 2._rt/( k0 * w0 * w0 );
Complex diffract_factor = 1._rt + I * (z-zfoc*std::cos(propagation_angle_yz)+z0) * 2._rt/( k0 * w0 * w0 );
Complex inv_complex_waist_2 = 1._rt /( w0 * w0 * diffract_factor );
Complex prefactor = a0/diffract_factor;
Complex time_exponent = z*z/(L0*L0);
Complex stcfactor = prefactor * amrex::exp( - time_exponent );
Complex exp_argument = - ( x*x + y*y ) * inv_complex_waist_2;
Complex envelope = stcfactor * amrex::exp( exp_argument ) * amrex::exp(I * y * k0 * init_angle_yz);
Complex envelope = stcfactor * amrex::exp( exp_argument ) * amrex::exp(I * y * k0 * propagation_angle_yz);
arr(i, j, k, comp ) += envelope.real();
arr(i, j, k, comp + 1 ) += envelope.imag();
}
Expand Down

0 comments on commit 615061b

Please sign in to comment.