WarpX
Public Member Functions | Private Member Functions | Private Attributes | List of all members
WarpXLaserProfiles::FromFileLaserProfile Class Reference

#include <LaserProfiles.H>

Inheritance diagram for WarpXLaserProfiles::FromFileLaserProfile:
WarpXLaserProfiles::ILaserProfile

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...
 
- Public Member Functions inherited from WarpXLaserProfiles::ILaserProfile
 ILaserProfile ()=default
 
virtual ~ILaserProfile ()=default
 
 ILaserProfile (ILaserProfile const &)=default
 
ILaserProfileoperator= (ILaserProfile const &)=default
 
 ILaserProfile (ILaserProfile &&)=default
 
ILaserProfileoperator= (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, intfind_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
 

Detailed Description

Laser profile read from a file (lasy or binary) The binary file must contain:

Member Function Documentation

◆ fill_amplitude()

void WarpXLaserProfiles::FromFileLaserProfile::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
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.

Parameters
npnumber of laser particles
Xppointer to first component of positions of laser particles
Yppointer to second component of positions of laser particles
tCurrent physical time
amplitudepointer to array of field amplitude.

Implements WarpXLaserProfiles::ILaserProfile.

◆ find_left_right_time_indices()

std::pair< int, int > WarpXLaserProfiles::FromFileLaserProfile::find_left_right_time_indices ( amrex::Real  t) const
private

Finds left and right time indices corresponding to time t.

Parameters
tsimulation time

◆ init()

void WarpXLaserProfiles::FromFileLaserProfile::init ( const amrex::ParmParse ppl,
CommonLaserParameters  params 
)
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.

Parameters
[in]pplshould be amrex::ParmParse(laser_name)
[in]paramscommon laser profile parameters

Implements WarpXLaserProfiles::ILaserProfile.

◆ internal_fill_amplitude_uniform_binary()

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.

Parameters
idx_t_leftindex of the last time coordinate < t
npnumber of laser particles
Xppointer to first component of positions of laser particles
Yppointer to second component of positions of laser particles
tCurrent physical time
amplitudepointer to array of field amplitude.

◆ internal_fill_amplitude_uniform_cartesian()

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.

Parameters
idx_t_leftindex of the last time coordinate < t
npnumber of laser particles
Xppointer to first component of positions of laser particles
Yppointer to second component of positions of laser particles
tCurrent physical time
amplitudepointer to array of field amplitude.

◆ internal_fill_amplitude_uniform_cylindrical()

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.

Parameters
idx_t_leftindex of the last time coordinate < t
npnumber of laser particles
Xppointer to first component of positions of laser particles
Yppointer to second component of positions of laser particles
tCurrent physical time
amplitudepointer to array of field amplitude.

◆ parse_binary_file()

void WarpXLaserProfiles::FromFileLaserProfile::parse_binary_file ( const std::string &  binary_file_name)
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.

Parameters
binary_file_namename of the binary file to parse

◆ parse_lasy_file()

void WarpXLaserProfiles::FromFileLaserProfile::parse_lasy_file ( const std::string &  lasy_file_name)
private

parse a field file in the HDF5 'lasy' format

Parameters
lasy_file_namename of the lasy file to parse

◆ read_binary_data_t_chunk()

void WarpXLaserProfiles::FromFileLaserProfile::read_binary_data_t_chunk ( int  t_begin,
int  t_end 
)
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.

Parameters
t_beginleft limit of the timestep range to read
t_endright limit of the timestep range to read (t_end is not read)

◆ read_data_t_chunk()

void WarpXLaserProfiles::FromFileLaserProfile::read_data_t_chunk ( int  t_begin,
int  t_end 
)
private

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.

Parameters
t_beginleft limit of the timestep range to read
t_endright limit of the timestep range to read (t_end is not read)

◆ update()

void WarpXLaserProfiles::FromFileLaserProfile::update ( amrex::Real  t)
finalvirtual

Reads new field data chunk from file if needed.

Parameters
[in]tsimulation time (seconds)

Implements WarpXLaserProfiles::ILaserProfile.

Member Data Documentation

◆ binary_file_name

std::string WarpXLaserProfiles::FromFileLaserProfile::binary_file_name

Name of the binary file containing the data

◆ E_binary_data

amrex::Gpu::DeviceVector<amrex::Real> WarpXLaserProfiles::FromFileLaserProfile::E_binary_data

binary field data

◆ E_lasy_data

amrex::Gpu::DeviceVector<Complex> WarpXLaserProfiles::FromFileLaserProfile::E_lasy_data

lasy field data

◆ file_in_cartesian_geom

int WarpXLaserProfiles::FromFileLaserProfile::file_in_cartesian_geom

lasy file geometry ("cartesian" for 3D cartesian or "thetaMode" for RZ)

◆ file_in_lasy_format

bool WarpXLaserProfiles::FromFileLaserProfile::file_in_lasy_format

true if the file is in the lasy format, false if it is in the binary format

◆ first_time_index

int WarpXLaserProfiles::FromFileLaserProfile::first_time_index

Index of the first timestep in memory

◆ last_time_index

int WarpXLaserProfiles::FromFileLaserProfile::last_time_index

Index of the last timestep in memory

◆ lasy_file_name

std::string WarpXLaserProfiles::FromFileLaserProfile::lasy_file_name

Name of the lasy file containing the data

◆ m_common_params

CommonLaserParameters WarpXLaserProfiles::FromFileLaserProfile::m_common_params
private

◆ 

struct { ... } WarpXLaserProfiles::FromFileLaserProfile::m_params

m_params contains all the internal parameters used by this laser profile

◆ n_rz_azimuthal_components

int WarpXLaserProfiles::FromFileLaserProfile::n_rz_azimuthal_components

Number of azimuthal components (2 per mode, 1 for mode 0)

◆ nr

int WarpXLaserProfiles::FromFileLaserProfile::nr

Dimensions of E_lasy_data in RZ

◆ nt

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

◆ nx

int WarpXLaserProfiles::FromFileLaserProfile::nx

◆ ny

int WarpXLaserProfiles::FromFileLaserProfile::ny

◆ r_max

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::r_max

◆ r_min

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::r_min

◆ t_delay

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.

◆ t_max

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::t_max

Stop time

◆ t_min

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::t_min

Start time

◆ time_chunk_size

int WarpXLaserProfiles::FromFileLaserProfile::time_chunk_size

Size of the timestep range to load

◆ x_max

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::x_max

max of x coordinates

◆ x_min

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::x_min

min of x coordinates

◆ y_max

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::y_max

max of y coordinates

◆ y_min

amrex::Real WarpXLaserProfiles::FromFileLaserProfile::y_min

min of y coordinates


The documentation for this class was generated from the following files: