WarpX
|
#include <LaserProfiles.H>
Public Member Functions | |
void | init (const amrex::ParmParse &ppl, CommonLaserParameters params) final |
void | update (amrex::Real t) final |
Reads new field data chunk from file if needed. More... | |
void | fill_amplitude (int np, amrex::Real const *AMREX_RESTRICT Xp, amrex::Real const *AMREX_RESTRICT Yp, amrex::Real t, amrex::Real *AMREX_RESTRICT amplitude) const final |
compute field amplitude at particles' position for a laser beam loaded from an E(x,y,t) file. More... | |
void | internal_fill_amplitude_uniform_cartesian (int idx_t_left, int np, amrex::Real const *AMREX_RESTRICT Xp, amrex::Real const *AMREX_RESTRICT Yp, amrex::Real t, amrex::Real *AMREX_RESTRICT amplitude) const |
Function to fill the amplitude in case of a uniform grid and for the lasy format in 3D Cartesian. This function cannot be private due to restrictions related to the use of extended device lambda. More... | |
void | internal_fill_amplitude_uniform_cylindrical (int idx_t_left, int np, amrex::Real const *AMREX_RESTRICT Xp, amrex::Real const *AMREX_RESTRICT Yp, amrex::Real t, amrex::Real *AMREX_RESTRICT amplitude) const |
Function to fill the amplitude in case of a uniform grid and for the lasy format in RZ geometry. This function cannot be private due to restrictions related to the use of extended device lambda. More... | |
void | internal_fill_amplitude_uniform_binary (int idx_t_left, int np, amrex::Real const *AMREX_RESTRICT Xp, amrex::Real const *AMREX_RESTRICT Yp, amrex::Real t, amrex::Real *AMREX_RESTRICT amplitude) const |
Function to fill the amplitude in case of a uniform grid and for the binary format. This function cannot be private due to restrictions related to the use of extended device lambda. More... | |
![]() | |
ILaserProfile ()=default | |
virtual | ~ILaserProfile ()=default |
ILaserProfile (ILaserProfile const &)=default | |
ILaserProfile & | operator= (ILaserProfile const &)=default |
ILaserProfile (ILaserProfile &&)=default | |
ILaserProfile & | operator= (ILaserProfile &&)=default |
Private Member Functions | |
void | parse_lasy_file (const std::string &lasy_file_name) |
parse a field file in the HDF5 'lasy' format More... | |
void | parse_binary_file (const std::string &binary_file_name) |
parse a field file in the binary 'binary' format (whose details are given below). More... | |
std::pair< int, int > | find_left_right_time_indices (amrex::Real t) const |
Finds left and right time indices corresponding to time t. More... | |
void | read_data_t_chunk (int t_begin, int t_end) |
Load field data within the temporal range [t_begin, t_end]. More... | |
void | read_binary_data_t_chunk (int t_begin, int t_end) |
Load field data within the temporal range [t_begin, t_end]. More... | |
Private Attributes | |
struct { | |
std::string binary_file_name | |
std::string lasy_file_name | |
bool file_in_lasy_format | |
int file_in_cartesian_geom | |
int nt | |
int nx | |
int ny | |
int nr | |
int n_rz_azimuthal_components | |
amrex::Real t_min | |
amrex::Real t_max | |
amrex::Real x_min | |
amrex::Real x_max | |
amrex::Real y_min | |
amrex::Real y_max | |
amrex::Real r_min | |
amrex::Real r_max | |
int time_chunk_size | |
int first_time_index | |
int last_time_index | |
amrex::Gpu::DeviceVector< Complex > E_lasy_data | |
amrex::Gpu::DeviceVector< amrex::Real > E_binary_data | |
amrex::Real t_delay = amrex::Real(0.0) | |
} | m_params |
m_params contains all the internal parameters used by this laser profile More... | |
CommonLaserParameters | m_common_params |
Laser profile read from a file (lasy or binary) The binary file must contain:
|
finalvirtual |
compute field amplitude at particles' position for a laser beam loaded from an E(x,y,t) file.
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.
np | number of laser particles |
Xp | pointer to first component of positions of laser particles |
Yp | pointer to second component of positions of laser particles |
t | Current physical time |
amplitude | pointer to array of field amplitude. |
Implements WarpXLaserProfiles::ILaserProfile.
|
private |
Finds left and right time indices corresponding to time t.
t | simulation time |
|
finalvirtual |
Initialize Laser Profile
Reads the section of the inputfile relative to the laser beam (e.g. laser_name.profile_t_peak, laser_name.profile_duration...) and the "my_constants" section. It also receives some common laser profile parameters. It uses these data to initialize the member variables of the laser profile class.
[in] | ppl | should be amrex::ParmParse(laser_name) |
[in] | params | common laser profile parameters |
Implements WarpXLaserProfiles::ILaserProfile.
void WarpXLaserProfiles::FromFileLaserProfile::internal_fill_amplitude_uniform_binary | ( | int | idx_t_left, |
int | np, | ||
amrex::Real const *AMREX_RESTRICT | Xp, | ||
amrex::Real const *AMREX_RESTRICT | Yp, | ||
amrex::Real | t, | ||
amrex::Real *AMREX_RESTRICT | amplitude | ||
) | const |
Function to fill the amplitude in case of a uniform grid and for the binary format. This function cannot be private due to restrictions related to the use of extended device lambda.
idx_t_left | index of the last time coordinate < t |
np | number of laser particles |
Xp | pointer to first component of positions of laser particles |
Yp | pointer to second component of positions of laser particles |
t | Current physical time |
amplitude | pointer to array of field amplitude. |
void WarpXLaserProfiles::FromFileLaserProfile::internal_fill_amplitude_uniform_cartesian | ( | int | idx_t_left, |
int | np, | ||
amrex::Real const *AMREX_RESTRICT | Xp, | ||
amrex::Real const *AMREX_RESTRICT | Yp, | ||
amrex::Real | t, | ||
amrex::Real *AMREX_RESTRICT | amplitude | ||
) | const |
Function to fill the amplitude in case of a uniform grid and for the lasy format in 3D Cartesian. This function cannot be private due to restrictions related to the use of extended device lambda.
idx_t_left | index of the last time coordinate < t |
np | number of laser particles |
Xp | pointer to first component of positions of laser particles |
Yp | pointer to second component of positions of laser particles |
t | Current physical time |
amplitude | pointer to array of field amplitude. |
void WarpXLaserProfiles::FromFileLaserProfile::internal_fill_amplitude_uniform_cylindrical | ( | int | idx_t_left, |
int | np, | ||
amrex::Real const *AMREX_RESTRICT | Xp, | ||
amrex::Real const *AMREX_RESTRICT | Yp, | ||
amrex::Real | t, | ||
amrex::Real *AMREX_RESTRICT | amplitude | ||
) | const |
Function to fill the amplitude in case of a uniform grid and for the lasy format in RZ geometry. This function cannot be private due to restrictions related to the use of extended device lambda.
idx_t_left | index of the last time coordinate < t |
np | number of laser particles |
Xp | pointer to first component of positions of laser particles |
Yp | pointer to second component of positions of laser particles |
t | Current physical time |
amplitude | pointer to array of field amplitude. |
|
private |
parse a field file in the binary 'binary' format (whose details are given below).
A 'binary' file should be a binary file with the following format: -np, number of timesteps (uint32_t, must be >=2) -nx, number of points along x (uint32_t, must be >=2) -ny, number of points along y (uint32_t, must be 1 for 2D simulations and >=2 for 3D simulations) -timesteps (double[2]) -x_coords (double[2]) -y_coords (double[1] if 2D, double[2] if 3D -field_data (double[nt * nx * ny], with nt being the slowest coordinate). The spatiotemporal grid must be rectangular and uniform.
binary_file_name | name of the binary file to parse |
|
private |
parse a field file in the HDF5 'lasy' format
lasy_file_name | name of the lasy file to parse |
|
private |
Load field data within the temporal range [t_begin, t_end].
Must be called after having parsed a binary data file with the 'parse_binary_file' function.
t_begin | left limit of the timestep range to read |
t_end | right limit of the timestep range to read (t_end is not read) |
Load field data within the temporal range [t_begin, t_end].
Must be called after having parsed a lasy data file with the 'parse_lasy_file' function.
t_begin | left limit of the timestep range to read |
t_end | right limit of the timestep range to read (t_end is not read) |
|
finalvirtual |
Reads new field data chunk from file if needed.
[in] | t | simulation time (seconds) |
Implements WarpXLaserProfiles::ILaserProfile.
std::string WarpXLaserProfiles::FromFileLaserProfile::binary_file_name |
Name of the binary file containing the data
amrex::Gpu::DeviceVector<amrex::Real> WarpXLaserProfiles::FromFileLaserProfile::E_binary_data |
binary field data
amrex::Gpu::DeviceVector<Complex> WarpXLaserProfiles::FromFileLaserProfile::E_lasy_data |
lasy field data
int WarpXLaserProfiles::FromFileLaserProfile::file_in_cartesian_geom |
lasy file geometry ("cartesian" for 3D cartesian or "thetaMode" for RZ)
bool WarpXLaserProfiles::FromFileLaserProfile::file_in_lasy_format |
true if the file is in the lasy format, false if it is in the binary format
int WarpXLaserProfiles::FromFileLaserProfile::first_time_index |
Index of the first timestep in memory
int WarpXLaserProfiles::FromFileLaserProfile::last_time_index |
Index of the last timestep in memory
std::string WarpXLaserProfiles::FromFileLaserProfile::lasy_file_name |
Name of the lasy file containing the data
|
private |
struct { ... } WarpXLaserProfiles::FromFileLaserProfile::m_params |
m_params contains all the internal parameters used by this laser profile
int WarpXLaserProfiles::FromFileLaserProfile::n_rz_azimuthal_components |
Number of azimuthal components (2 per mode, 1 for mode 0)
int WarpXLaserProfiles::FromFileLaserProfile::nr |
Dimensions of E_lasy_data in RZ
int WarpXLaserProfiles::FromFileLaserProfile::nt |
Dimensions of E_binary_data or E_lasy_data. nt, nx must be >=2. If DIM=3, ny must be >=2 as well. If DIM=2, ny must be 1
int WarpXLaserProfiles::FromFileLaserProfile::nx |
int WarpXLaserProfiles::FromFileLaserProfile::ny |
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::r_max |
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::r_min |
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::t_delay = amrex::Real(0.0) |
This parameter is subtracted to simulation time before interpolating field data in file (either lasy or binary). If t_delay > 0, the laser is delayed, otherwise it is anticipated.
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::t_max |
Stop time
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::t_min |
Start time
int WarpXLaserProfiles::FromFileLaserProfile::time_chunk_size |
Size of the timestep range to load
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::x_max |
max of x coordinates
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::x_min |
min of x coordinates
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::y_max |
max of y coordinates
amrex::Real WarpXLaserProfiles::FromFileLaserProfile::y_min |
min of y coordinates