Hipace
Public Member Functions | Public Attributes | Private Types | Private Attributes | Static Private Attributes | List of all members
MultiLaser Class Reference

#include <MultiLaser.H>

Public Member Functions

 MultiLaser ()
 
 ~MultiLaser ()
 
void ReadParameters ()
 
amrex::MultiFabgetSlices ()
 
const amrex::MultiFabgetSlices () const
 
void InitData (const amrex::BoxArray &slice_ba, const amrex::DistributionMapping &slice_dm, const amrex::Geometry &geom_3D)
 Allocate laser multifab. More...
 
void InitSliceEnvelope (const int islice, const int comp)
 Initialize on slice of the 3D laser field. More...
 
void GetEnvelopeFromFileHelper (const amrex::Geometry &gm)
 Read in a laser from an openPMD file. More...
 
template<typename input_type >
void GetEnvelopeFromFile (const amrex::Geometry &gm)
 Read in a laser from an openPMD file. More...
 
void ShiftLaserSlices ()
 Shift 2D slices in zeta. More...
 
void AdvanceSlice (const Fields &fields, amrex::Real dt, int step)
 
void AdvanceSliceMG (const Fields &fields, amrex::Real dt, int step)
 
void AdvanceSliceFFT (const Fields &fields, amrex::Real dt, int step)
 
void InitLaserSlice (const amrex::Geometry &geom, const int islice, const int comp)
 
void InSituComputeDiags (int step, amrex::Real time, int islice, const amrex::Geometry &geom3D, int max_step, amrex::Real max_time)
 
void InSituWriteToFile (int step, amrex::Real time, const amrex::Geometry &geom3D, int max_step, amrex::Real max_time)
 
amrex::Real GetLambda0 () const
 

Public Attributes

bool m_use_laser {false}
 

Private Types

using SpectralFieldLoc = amrex::BaseFab< amrex::GpuComplex< amrex::Real > >
 

Private Attributes

amrex::Real m_lambda0 {0.}
 
amrex::Vector< std::string > m_names {"no_laser"}
 
int m_nlasers
 
amrex::Vector< Laserm_all_lasers
 
amrex::IntVect m_slices_nguards = {-1, -1, -1}
 
std::string m_solver_type = "multigrid"
 
bool m_use_phase {true}
 
amrex::Box m_slice_box
 
amrex::Geometry m_laser_geom_3D
 
bool m_laser_from_file = false
 
amrex::FArrayBox m_F_input_file
 
std::string m_input_file_path
 
std::string m_file_envelope_name = "laserEnvelope"
 
int m_file_num_iteration = 0
 
std::string m_file_geometry = ""
 
amrex::MultiFab m_slices
 
amrex::Real m_MG_tolerance_rel = 1.e-4
 
amrex::Real m_MG_tolerance_abs = 0.
 
int m_MG_verbose = 0
 
bool m_MG_average_rhs = true
 
std::unique_ptr< hpmg::MultiGridm_mg
 
LaserFFT::VendorFFT m_plan_fwd
 
LaserFFT::VendorFFT m_plan_bkw
 
SpectralFieldLoc m_sol
 
SpectralFieldLoc m_rhs
 
SpectralFieldLoc m_rhs_fourier
 
int m_insitu_period {0}
 
amrex::Vector< amrex::Real > m_insitu_rdata
 
amrex::Vector< amrex::Real > m_insitu_sum_rdata
 
amrex::Vector< amrex::GpuComplex< amrex::Real > > m_insitu_cdata
 
std::string m_insitu_file_prefix = "diags/laser_insitu"
 

Static Private Attributes

static constexpr int m_insitu_nrp = 6
 
static constexpr int m_insitu_ncp = 1
 

Member Typedef Documentation

◆ SpectralFieldLoc

Constructor & Destructor Documentation

◆ MultiLaser()

MultiLaser::MultiLaser ( )
inlineexplicit

Constructor

◆ ~MultiLaser()

MultiLaser::~MultiLaser ( )
inline

Member Function Documentation

◆ AdvanceSlice()

void MultiLaser::AdvanceSlice ( const Fields fields,
amrex::Real  dt,
int  step 
)

Wrapper function to advance a laser slice by 1 time step.

Parameters
[in]fieldsField object
[in]dttime step of the simulation
[in]stepcurrent iteration. Needed because step 0 needs a specific treatment.

◆ AdvanceSliceFFT()

void MultiLaser::AdvanceSliceFFT ( const Fields fields,
amrex::Real  dt,
int  step 
)

Advance a laser slice by 1 time step using a FFT solver. The complex phase of the envelope is evaluated on-axis only.

Parameters
[in]fieldsField object
[in]dttime step of the simulation
[in]stepcurrent iteration. Needed because step 0 needs a specific treatment.

◆ AdvanceSliceMG()

void MultiLaser::AdvanceSliceMG ( const Fields fields,
amrex::Real  dt,
int  step 
)

Advance a laser slice by 1 time step using a multigrid solver. The complex phase of the envelope is evaluated on-axis only, but can be generalized to everywhere.

Parameters
[in]fieldsField object
[in]dttime step of the simulation
[in]stepcurrent iteration. Needed because step 0 needs a specific treatment.

◆ GetEnvelopeFromFile()

template<typename input_type >
void MultiLaser::GetEnvelopeFromFile ( const amrex::Geometry gm)

Read in a laser from an openPMD file.

Parameters
[in]gmGeometry for level 0

◆ GetEnvelopeFromFileHelper()

void MultiLaser::GetEnvelopeFromFileHelper ( const amrex::Geometry gm)

Read in a laser from an openPMD file.

Parameters
[in]gmGeometry for level 0

◆ GetLambda0()

amrex::Real MultiLaser::GetLambda0 ( ) const
inline

Get the central wavelength

◆ getSlices() [1/2]

amrex::MultiFab& MultiLaser::getSlices ( )
inline

get function for the 2D slices

◆ getSlices() [2/2]

const amrex::MultiFab& MultiLaser::getSlices ( ) const
inline

get function for the 2D slices (const version)

◆ InitData()

void MultiLaser::InitData ( const amrex::BoxArray slice_ba,
const amrex::DistributionMapping slice_dm,
const amrex::Geometry geom_3D 
)

Allocate laser multifab.

Parameters
[in]slice_babox array of the slice
[in]slice_dmcorresponding distribution mapping
[in]geom_3D3D Geometry for level 0

◆ InitLaserSlice()

void MultiLaser::InitLaserSlice ( const amrex::Geometry geom,
const int  islice,
const int  comp 
)

Initialize 1 longitudinal slice of the laser, and store it in n00j00 (current time step) and nm1j00 (previous time step).

Parameters
[in]geomGeometry object for the slice
[in]isliceslice index
[in]complaser component to initialize

◆ InitSliceEnvelope()

void MultiLaser::InitSliceEnvelope ( const int  islice,
const int  comp 
)

Initialize on slice of the 3D laser field.

Parameters
[in]isliceslice index, referring to the 3D slice
[in]complaser component to initialize

◆ InSituComputeDiags()

void MultiLaser::InSituComputeDiags ( int  step,
amrex::Real  time,
int  islice,
const amrex::Geometry geom3D,
int  max_step,
amrex::Real  max_time 
)

Compute in-situ laser diagnostics of current slice, store in member variable

Parameters
[in]stepcurrent time step
[in]timephysical time
[in]islicecurrent slice, on which diags are computed.
[in]geom3DGeometry of the problem
[in]max_stepmaximum time step of simulation
[in]max_timemaximum time of simulation

◆ InSituWriteToFile()

void MultiLaser::InSituWriteToFile ( int  step,
amrex::Real  time,
const amrex::Geometry geom3D,
int  max_step,
amrex::Real  max_time 
)

Dump in-situ reduced diagnostics to file.

Parameters
[in]stepcurrent time step
[in]timephysical time
[in]geom3DGeometry object for the whole domain
[in]max_stepmaximum time step of simulation
[in]max_timemaximum time of simulation

◆ ReadParameters()

void MultiLaser::ReadParameters ( )

◆ ShiftLaserSlices()

void MultiLaser::ShiftLaserSlices ( )

Shift 2D slices in zeta.

Member Data Documentation

◆ m_all_lasers

amrex::Vector<Laser> MultiLaser::m_all_lasers
private

Each is a laser pulse

◆ m_F_input_file

amrex::FArrayBox MultiLaser::m_F_input_file
private

full 3D laser data stored on the host

◆ m_file_envelope_name

std::string MultiLaser::m_file_envelope_name = "laserEnvelope"
private

name of the openPMD species in the file

◆ m_file_geometry

std::string MultiLaser::m_file_geometry = ""
private

Geometry of the laser file, 'rt' or 'xyt'

◆ m_file_num_iteration

int MultiLaser::m_file_num_iteration = 0
private

index of the iteration in the openPMD file

◆ m_input_file_path

std::string MultiLaser::m_input_file_path
private

path to input openPMD file

◆ m_insitu_cdata

amrex::Vector<amrex::GpuComplex<amrex::Real> > MultiLaser::m_insitu_cdata
private

All per-slice complex laser properties

◆ m_insitu_file_prefix

std::string MultiLaser::m_insitu_file_prefix = "diags/laser_insitu"
private

Prefix/path for the output files

◆ m_insitu_ncp

constexpr int MultiLaser::m_insitu_ncp = 1
staticconstexprprivate

Number of real complex properties for in-situ per-slice reduced diagnostics.

◆ m_insitu_nrp

constexpr int MultiLaser::m_insitu_nrp = 6
staticconstexprprivate

Number of real laser properties for in-situ per-slice reduced diagnostics.

◆ m_insitu_period

int MultiLaser::m_insitu_period {0}
private

How often the insitu laser diagnostics should be computed and written Default is 0, meaning no output

◆ m_insitu_rdata

amrex::Vector<amrex::Real> MultiLaser::m_insitu_rdata
private

All per-slice real laser properties

◆ m_insitu_sum_rdata

amrex::Vector<amrex::Real> MultiLaser::m_insitu_sum_rdata
private

Sum of all per-slice real laser properties

◆ m_lambda0

amrex::Real MultiLaser::m_lambda0 {0.}
private

Laser central wavelength. he central wavelength influences the solver. As long as all the lasers are on the same grid (part of MultiLaser), this must be a property of MultiLaser.

◆ m_laser_from_file

bool MultiLaser::m_laser_from_file = false
private

if the lasers are initialized from openPMD file

◆ m_laser_geom_3D

amrex::Geometry MultiLaser::m_laser_geom_3D
private

◆ m_mg

std::unique_ptr<hpmg::MultiGrid> MultiLaser::m_mg
private

hpmg solver for the envelope solver

◆ m_MG_average_rhs

bool MultiLaser::m_MG_average_rhs = true
private

Whether to use time-averaged RHS in envelope solver.

◆ m_MG_tolerance_abs

amrex::Real MultiLaser::m_MG_tolerance_abs = 0.
private

◆ m_MG_tolerance_rel

amrex::Real MultiLaser::m_MG_tolerance_rel = 1.e-4
private

◆ m_MG_verbose

int MultiLaser::m_MG_verbose = 0
private

◆ m_names

amrex::Vector<std::string> MultiLaser::m_names {"no_laser"}
private

name of the laser

◆ m_nlasers

int MultiLaser::m_nlasers
private

Number of laser pulses

◆ m_plan_bkw

LaserFFT::VendorFFT MultiLaser::m_plan_bkw
private

FFTW plan for backward C2C transform to solve Complex Poisson equation

◆ m_plan_fwd

LaserFFT::VendorFFT MultiLaser::m_plan_fwd
private

FFTW plan for forward C2C transform to solve Complex Poisson equation

◆ m_rhs

SpectralFieldLoc MultiLaser::m_rhs
private

Complex FAB to store the RHS in position space

◆ m_rhs_fourier

SpectralFieldLoc MultiLaser::m_rhs_fourier
private

Complex FAB to store the RHS in Fourier space

◆ m_slice_box

amrex::Box MultiLaser::m_slice_box
private

◆ m_slices

amrex::MultiFab MultiLaser::m_slices
private

Array of N slices required to compute current slice

◆ m_slices_nguards

amrex::IntVect MultiLaser::m_slices_nguards = {-1, -1, -1}
private

Number of guard cells for slices MultiFab

◆ m_sol

SpectralFieldLoc MultiLaser::m_sol
private

Complex FAB to store the solution (e.g. laser envelope on current slice)

◆ m_solver_type

std::string MultiLaser::m_solver_type = "multigrid"
private

◆ m_use_laser

bool MultiLaser::m_use_laser {false}

whether a laser is used or not

◆ m_use_phase

bool MultiLaser::m_use_phase {true}
private

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