Hipace
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Hipace Class Referencefinal

Singleton class, that intialize, runs and finalizes the simulation. More...

#include <Hipace.H>

Inheritance diagram for Hipace:
Hipace_early_init

Public Member Functions

 Hipace ()
 
void InitData ()
 
void Evolve ()
 
void MakeGeometry ()
 
void WriteDiagnostics (int output_step, const OpenPMDWriterCallType call_type)
 Dump simulation data to file. More...
 
PhysConst get_phys_const ()
 Return a copy of member struct for physical constants. More...
 
void SolveOneSlice (int islice, int step)
 Full evolve on 1 slice. More...
 
void InitializeSxSyWithBeam (const int lev)
 Initialize Sx and Sy with the beam contributions. More...
 
void ExplicitMGSolveBxBy (const int lev, const int which_slice)
 Knowing the sources Sx, Sy and chi, apply MG to solve for Bx, By. More...
 
void ResetAllQuantities ()
 Reset plasma and field slice quantities to initial value. More...
 
void ResetLaser ()
 reset all laser slices to 0 More...
 
void doCoulombCollision ()
 does Coulomb collisions between plasmas and beams More...
 
- Public Member Functions inherited from Hipace_early_init
 Hipace_early_init (Hipace *instance)
 

Static Public Member Functions

static HipaceGetInstance ()
 
static bool HeadRank ()
 Returns true on the head rank, otherwise false. More...
 
static std::string Version ()
 

Public Attributes

amrex::Vector< amrex::Geometrym_3D_geom
 
amrex::Vector< amrex::DistributionMappingm_3D_dm
 
amrex::Vector< amrex::BoxArraym_3D_ba
 
amrex::Vector< amrex::Geometrym_slice_geom
 
amrex::Vector< amrex::DistributionMappingm_slice_dm
 
amrex::Vector< amrex::BoxArraym_slice_ba
 
Fields m_fields
 
MultiBeam m_multi_beam
 
MultiPlasma m_multi_plasma
 
MultiBuffer m_multi_buffer
 
bool m_has_last_step = false
 
amrex::Real m_predcorr_avg_iterations = 0.
 
amrex::Real m_predcorr_avg_B_error = 0.
 
amrex::Real m_dt = 0.0
 
AdaptiveTimeStep m_adaptive_time_step
 
MultiLaser m_multi_laser
 
GridCurrent m_grid_current
 
int m_salame_n_iter = 3
 
bool m_salame_do_advance = true
 
int m_salame_last_slice = -1
 
bool m_salame_overloaded = false
 
amrex::Real m_salame_zeta_initial = 0
 
amrex::Parser m_salame_parser
 
amrex::ParserExecutor< 3 > m_salame_target_func
 
bool m_comms_buffer_on_gpu = false
 
int m_comms_buffer_max_leading_slices = std::numeric_limits<int>::max()
 
int m_comms_buffer_max_trailing_slices = std::numeric_limits<int>::max()
 
- Public Attributes inherited from Hipace_early_init
PhysConst m_phys_const
 
int m_N_level = 1
 

Static Public Attributes

static Hipacem_instance = nullptr
 
static bool m_normalized_units = false
 
static int m_numprocs = 0
 
static int m_max_step = 0
 
static amrex::Real m_max_time = std::numeric_limits<amrex::Real>::infinity()
 
static amrex::Real m_physical_time = 0.0
 
static amrex::Real m_initial_time = 0.0
 
static int m_verbose = 0
 
static amrex::Real m_predcorr_B_error_tolerance = 4e-2
 
static int m_predcorr_max_iterations = 30
 
static amrex::Real m_predcorr_B_mixing_factor = 0.05
 
static bool m_do_beam_jx_jy_deposition = true
 
static bool m_do_beam_jz_minus_rho = false
 
static bool m_deposit_rho = false
 
static bool m_deposit_rho_individual = false
 
static bool m_interpolate_neutralizing_background = false
 
static bool m_do_tiling = true
 
static bool m_explicit = true
 
static amrex::Real m_MG_tolerance_rel = 1.e-4
 
static amrex::Real m_MG_tolerance_abs = std::numeric_limits<amrex::Real>::min()
 
static int m_MG_verbose = 0
 
static bool m_use_amrex_mlmg = false
 
static bool m_use_laser = false
 
static amrex::Real m_background_density_SI = 0.
 
static int m_ncollisions = 0
 
- Static Public Attributes inherited from Hipace_early_init
static int m_depos_order_xy = 2
 
static int m_depos_order_z = 0
 
static int m_depos_derivative_type = 2
 
static bool m_outer_depos_loop = false
 

Private Member Functions

void InitDiagnostics (const int step)
 
void FillFieldDiagnostics (const int lev, int islice)
 
void FillBeamDiagnostics (const int step)
 
void WriteDiagnostics (const int step)
 
void FlushDiagnostics ()
 
amrex::Vector< std::string > & getDiagBeamNames ()
 get diagnostics Component names of Fields to output More...
 
void PredictorCorrectorLoopToSolveBxBy (const int islice, const int current_N_level, const int step)
 Predictor-corrector loop to calculate Bx and By. More...
 

Private Attributes

amrex::Vector< std::unique_ptr< hpmg::MultiGrid > > m_hpmg
 
Diagnostic m_diags
 
std::vector< std::string > m_collision_names
 
amrex::Vector< CoulombCollisionm_all_collisions
 

Detailed Description

Singleton class, that intialize, runs and finalizes the simulation.

Constructor & Destructor Documentation

◆ Hipace()

Hipace::Hipace ( )

Ctor: read general input parameters, call constructors of main member variables and initialize longitudinal and transverse MPI communicators

Initialize the collision objects

Member Function Documentation

◆ doCoulombCollision()

void Hipace::doCoulombCollision ( )

does Coulomb collisions between plasmas and beams

◆ Evolve()

void Hipace::Evolve ( )

Run the simulation. This function contains the loop over time steps

◆ ExplicitMGSolveBxBy()

void Hipace::ExplicitMGSolveBxBy ( const int  lev,
const int  which_slice 
)

Knowing the sources Sx, Sy and chi, apply MG to solve for Bx, By.

Parameters
[lev]MR level
[in]which_slicedefines if this or the salame slice is handled

◆ FillBeamDiagnostics()

void Hipace::FillBeamDiagnostics ( const int  step)
private

◆ FillFieldDiagnostics()

void Hipace::FillFieldDiagnostics ( const int  lev,
int  islice 
)
private

◆ FlushDiagnostics()

void Hipace::FlushDiagnostics ( )
private

◆ get_phys_const()

PhysConst Hipace::get_phys_const ( )
inline

Return a copy of member struct for physical constants.

◆ getDiagBeamNames()

amrex::Vector<std::string>& Hipace::getDiagBeamNames ( )
inlineprivate

get diagnostics Component names of Fields to output

◆ GetInstance()

Hipace & Hipace::GetInstance ( )
static

Get singleton instance

◆ HeadRank()

static bool Hipace::HeadRank ( )
inlinestatic

Returns true on the head rank, otherwise false.

◆ InitData()

void Hipace::InitData ( )

Init AmrCore and allocate beam and plasma containers

◆ InitDiagnostics()

void Hipace::InitDiagnostics ( const int  step)
private

◆ InitializeSxSyWithBeam()

void Hipace::InitializeSxSyWithBeam ( const int  lev)

Initialize Sx and Sy with the beam contributions.

Parameters
[lev]MR level

◆ MakeGeometry()

void Hipace::MakeGeometry ( )

Make Geometry, DistributionMapping and BoxArray for all MR levels

◆ PredictorCorrectorLoopToSolveBxBy()

void Hipace::PredictorCorrectorLoopToSolveBxBy ( const int  islice,
const int  current_N_level,
const int  step 
)
private

Predictor-corrector loop to calculate Bx and By.

  1. an initial Bx and By value is guessed.
  2. Using this Bx and By values, the plasma particles are advanced to the next slice, and deposit their current there.
  3. With that current, Bx and By can be calculated.
  4. Mixing the calculated Bx and By with the previous guess a new Bx and By is calculated
  5. 2.-4. are repeated for a fixed number of iterations

This modifies component Bx and By, of slice 1 in m_fields.m_slices as well as the plasma particle force terms.

Parameters
[in]islicelongitudinal slice
[in]current_N_levelnumber of MR levels active on the current slice
[in]stepcurrent time step

◆ ResetAllQuantities()

void Hipace::ResetAllQuantities ( )

Reset plasma and field slice quantities to initial value.

Typically done at the beginning of each iteration.

◆ ResetLaser()

void Hipace::ResetLaser ( )

reset all laser slices to 0

◆ SolveOneSlice()

void Hipace::SolveOneSlice ( int  islice,
int  step 
)

Full evolve on 1 slice.

Parameters
[in]isliceslice number
[in]stepcurrent time step

◆ Version()

std::string Hipace::Version ( )
static

Version of the HiPACE executable

Returns
detailed version string

◆ WriteDiagnostics() [1/2]

void Hipace::WriteDiagnostics ( const int  step)
private

◆ WriteDiagnostics() [2/2]

void Hipace::WriteDiagnostics ( int  output_step,
const OpenPMDWriterCallType  call_type 
)

Dump simulation data to file.

Parameters
[in]output_stepcurrent iteration
[in]call_typewhether the beams or the fields should be written to file

Member Data Documentation

◆ m_3D_ba

amrex::Vector<amrex::BoxArray> Hipace::m_3D_ba

3D BoxArray, vector over MR levels. One box per rank

◆ m_3D_dm

3D DistributionMapping. Does not represent the parallelization pipeline correctly

◆ m_3D_geom

amrex::Vector<amrex::Geometry> Hipace::m_3D_geom

3D Geometry, vector over MR levels

◆ m_adaptive_time_step

AdaptiveTimeStep Hipace::m_adaptive_time_step

Adaptive time step instance

◆ m_all_collisions

amrex::Vector< CoulombCollision > Hipace::m_all_collisions
private

Vector of binary collisions

◆ m_background_density_SI

amrex::Real Hipace::m_background_density_SI = 0.
inlinestatic

Background plasma density in SI, used to compute collisions, ionization, or radiation reaction in normalized units

◆ m_collision_names

std::vector<std::string> Hipace::m_collision_names
private

User-input names of the binary collisions to be used

◆ m_comms_buffer_max_leading_slices

int Hipace::m_comms_buffer_max_leading_slices = std::numeric_limits<int>::max()

How many slices of beam particles can be received in advance

◆ m_comms_buffer_max_trailing_slices

int Hipace::m_comms_buffer_max_trailing_slices = std::numeric_limits<int>::max()

How many slices of beam particles can be stored before being sent

◆ m_comms_buffer_on_gpu

bool Hipace::m_comms_buffer_on_gpu = false

Whether MPI communication buffers should be allocated in device memory

◆ m_deposit_rho

bool Hipace::m_deposit_rho = false
inlinestatic

Whether to deposit rho (plasma) for diagnostics

◆ m_deposit_rho_individual

bool Hipace::m_deposit_rho_individual = false
inlinestatic

Whether to deposit rho for every individual plasma for diagnostics

◆ m_diags

Diagnostic Hipace::m_diags
private

Diagnostics

◆ m_do_beam_jx_jy_deposition

bool Hipace::m_do_beam_jx_jy_deposition = true
inlinestatic

Whether the beams deposit Jx and Jy

◆ m_do_beam_jz_minus_rho

bool Hipace::m_do_beam_jz_minus_rho = false
inlinestatic

Whether the jz-c*rho contribution of the beam is computed and used. If not, jz-c*rho=0 is assumed

◆ m_do_tiling

bool Hipace::m_do_tiling = true
inlinestatic

Whether to use tiling for particle operations

◆ m_dt

amrex::Real Hipace::m_dt = 0.0

Time step for the beam evolution

◆ m_explicit

bool Hipace::m_explicit = true
inlinestatic

Whether the explicit field solver is used

◆ m_fields

Fields Hipace::m_fields

All field data (3D array, slices) and field methods

◆ m_grid_current

GridCurrent Hipace::m_grid_current

GridCurrent instance

◆ m_has_last_step

bool Hipace::m_has_last_step = false

◆ m_hpmg

amrex::Vector<std::unique_ptr<hpmg::MultiGrid> > Hipace::m_hpmg
private

hpmg solver for the explicit Bx and by solver

◆ m_initial_time

amrex::Real Hipace::m_initial_time = 0.0
inlinestatic

Physical time at the beginning of the simulation

◆ m_instance

Hipace* Hipace::m_instance = nullptr
inlinestatic

Pointer to current (and only) instance of class Hipace

◆ m_interpolate_neutralizing_background

bool Hipace::m_interpolate_neutralizing_background = false
inlinestatic

Whether to interpolate the neutralizing background to MR levels 1 and 2 instead of depositing it

◆ m_max_step

int Hipace::m_max_step = 0
inlinestatic

Number of time iterations

◆ m_max_time

amrex::Real Hipace::m_max_time = std::numeric_limits<amrex::Real>::infinity()
inlinestatic

Maximum simulation time

◆ m_MG_tolerance_abs

amrex::Real Hipace::m_MG_tolerance_abs = std::numeric_limits<amrex::Real>::min()
inlinestatic

Absolute tolerance for the multigrid solver, when using the explicit solver

◆ m_MG_tolerance_rel

amrex::Real Hipace::m_MG_tolerance_rel = 1.e-4
inlinestatic

Relative tolerance for the multigrid solver, when using the explicit solver

◆ m_MG_verbose

int Hipace::m_MG_verbose = 0
inlinestatic

Level of verbosity for the MG solver

◆ m_multi_beam

MultiBeam Hipace::m_multi_beam

Contains all beam species

◆ m_multi_buffer

MultiBuffer Hipace::m_multi_buffer

◆ m_multi_laser

MultiLaser Hipace::m_multi_laser

Laser instance (soon to be multi laser container)

◆ m_multi_plasma

MultiPlasma Hipace::m_multi_plasma

Contains all plasma species

◆ m_ncollisions

int Hipace::m_ncollisions = 0
inlinestatic

Number of binary collisions

◆ m_normalized_units

bool Hipace::m_normalized_units = false
inlinestatic

Whether to use normalized units

◆ m_numprocs

int Hipace::m_numprocs = 0
inlinestatic

Number of processors in the longitudinal z direction

◆ m_physical_time

amrex::Real Hipace::m_physical_time = 0.0
inlinestatic

Physical time of the simulation. At the end of the time step, it is the physical time at which the fields have been calculated. The beam is one step ahead.

◆ m_predcorr_avg_B_error

amrex::Real Hipace::m_predcorr_avg_B_error = 0.

Average transverse B field error in the predictor corrector loop

◆ m_predcorr_avg_iterations

amrex::Real Hipace::m_predcorr_avg_iterations = 0.

Average number of iterations in the predictor corrector loop

◆ m_predcorr_B_error_tolerance

amrex::Real Hipace::m_predcorr_B_error_tolerance = 4e-2
inlinestatic

Relative transverse B field error tolerance in the predictor corrector loop

◆ m_predcorr_B_mixing_factor

amrex::Real Hipace::m_predcorr_B_mixing_factor = 0.05
inlinestatic

Mixing factor between the transverse B field iterations in the predictor corrector loop

◆ m_predcorr_max_iterations

int Hipace::m_predcorr_max_iterations = 30
inlinestatic

Maximum number of iterations in the predictor corrector loop

◆ m_salame_do_advance

bool Hipace::m_salame_do_advance = true

if the SALAME-only field should be computed exactly with plasma particles

◆ m_salame_last_slice

int Hipace::m_salame_last_slice = -1

the slice index of the previous slice with SALAME

◆ m_salame_n_iter

int Hipace::m_salame_n_iter = 3

the number of SALAME iterations to be done

◆ m_salame_overloaded

bool Hipace::m_salame_overloaded = false

if the SALAME beam was overloaded in the last slice

◆ m_salame_parser

amrex::Parser Hipace::m_salame_parser

Parser for m_salame_target_func

◆ m_salame_target_func

amrex::ParserExecutor<3> Hipace::m_salame_target_func

Function to get the target Ez field for SALAME

◆ m_salame_zeta_initial

amrex::Real Hipace::m_salame_zeta_initial = 0

the slice index of the previous slice with SALAME

◆ m_slice_ba

amrex::Vector<amrex::BoxArray> Hipace::m_slice_ba

xy slice BoxArray, vector over MR levels. Contains only one box

◆ m_slice_dm

xy slice DistributionMapping, vector over MR levels

◆ m_slice_geom

amrex::Vector<amrex::Geometry> Hipace::m_slice_geom

xy slice Geometry, vector over MR levels

◆ m_use_amrex_mlmg

bool Hipace::m_use_amrex_mlmg = false
inlinestatic

Whether to use amrex MLMG solver

◆ m_use_laser

bool Hipace::m_use_laser = false
inlinestatic

Whether the simulation uses a laser pulse

◆ m_verbose

int Hipace::m_verbose = 0
inlinestatic

Level of verbosity


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