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

Container for particles of 1 beam species. More...

#include <BeamParticleContainer.H>

Public Member Functions

 BeamParticleContainer (std::string name)
 
void ReadParameters ()
 
amrex::Real InitData (const amrex::Geometry &geom)
 Allocate beam particle data and initialize particles with requested beam profile. More...
 
void InitBeamFixedPPC3D ()
 
void InitBeamFixedPPCSlice (const int islice, const int which_beam_slice)
 
void InitBeamFixedWeight3D ()
 
void InitBeamFixedWeightSlice (const int islice, const int which_beam_slice)
 
void InitBeamFixedWeightPDF3D ()
 
void InitBeamFixedWeightPDFSlice (int slice, int which_slice)
 
void InSituComputeDiags (int islice)
 
void InSituWriteToFile (int step, amrex::Real time, const amrex::Geometry &geom)
 
void TagByLevel (const int current_N_level, amrex::Vector< amrex::Geometry > const &geom3D, const int which_slice)
 Store the finest level of every beam particle on which_slice in the cpu() attribute. More...
 
void ReorderParticles (int beam_slice, int step, amrex::Geometry &slice_geom)
 Reorder beam particles to speed-up push and current deposition. More...
 
amrex::Real GetCharge () const
 
amrex::Real GetMass () const
 
std::string get_name () const
 
void shiftBeamSlices ()
 
BeamTilegetBeamSlice (int which_slice)
 
const BeamTilegetBeamSlice (int which_slice) const
 
int getNumParticles (int which_slice) const
 
int getNumParticlesIncludingSlipped (int which_slice) const
 
void resize (int which_slice, int num_particles, int num_slipped_particles)
 
BeamTileInitgetBeamInitSlice ()
 
void intializeSlice (int slice, int which_slice)
 
uint64_t getTotalNumParticles () const
 
int numRealComponents () const
 
int numIntComponents () const
 
bool communicateIdCpuComponent () const
 
bool communicateRealComponent (int rcomp) const
 
bool communicateIntComponent (int icomp) const
 

Public Attributes

amrex::Real m_charge
 
amrex::Real m_mass
 
bool m_do_z_push {true}
 
int m_n_subcycles {10}
 
bool m_do_radiation_reaction {false}
 
bool m_do_salame = false
 
bool m_do_reset_id_init {false}
 
bool m_initialize_on_cpu {false}
 
int m_insitu_period {0}
 
bool m_use_external_fields = false
 
amrex::GpuArray< amrex::ParserExecutor< 4 >, 6 > m_external_fields
 
amrex::Array< amrex::Parser, 6 > m_external_fields_parser
 
bool m_do_spin_tracking = false
 

Private Attributes

int m_slice_permutation = 0
 
std::array< BeamTile, WhichBeamSlice::Nm_slices {}
 
std::array< int, WhichBeamSlice::Nm_num_particles_without_slipped {}
 
std::array< int, WhichBeamSlice::Nm_num_particles_with_slipped {}
 
BeamTileInit m_init_slice {}
 
BoxSorter m_init_sorter
 
uint64_t m_total_num_particles = 0
 
std::string m_name
 
std::string m_injection_type
 
uint64_t m_id64 = 1
 
amrex::Real m_zmin = -std::numeric_limits<amrex::Real>::infinity()
 
amrex::Real m_zmax = std::numeric_limits<amrex::Real>::infinity()
 
amrex::Real m_radius {std::numeric_limits<amrex::Real>::infinity()}
 
amrex::Real m_insitu_radius {std::numeric_limits<amrex::Real>::infinity()}
 
GetInitialMomentum m_get_momentum {}
 
int m_reorder_period = 0
 
amrex::IntVect m_reorder_idx_type = {0, 0, 0}
 
amrex::IntVect m_ppc {1, 1, 1}
 
amrex::RealVect m_position_mean {0., 0., 0.}
 
amrex::Real m_min_density {0.}
 
amrex::IntVect m_random_ppc {0, 0, 0}
 
GetInitialDensity m_get_density {}
 
amrex::Parser m_density_parser
 
bool m_can_profile = false
 
amrex::Parser m_pos_mean_x_parser
 
amrex::ParserExecutor< 1 > m_pos_mean_x_func
 
amrex::Parser m_pos_mean_y_parser
 
amrex::ParserExecutor< 1 > m_pos_mean_y_func
 
amrex::Real m_pos_mean_z = 0
 
amrex::RealVect m_position_std {0., 0., 0.}
 
amrex::Real m_z_foc {0.}
 
amrex::Real m_duz_per_uz0_dzeta {0.}
 
amrex::Long m_num_particles
 
amrex::Real m_total_charge
 
amrex::Real m_density
 
bool m_do_symmetrize {0}
 
amrex::PODVector< amrex::Real, amrex::PolymorphicArenaAllocator< amrex::Real > > m_z_array {}
 
bool m_peak_density_is_specified = false
 
int m_pdf_ref_ratio = 4
 
amrex::Real m_total_weight = 0
 
amrex::ParserExecutor< 1 > m_pdf_func
 
amrex::Vector< unsigned intm_num_particles_slice
 
amrex::Array< amrex::ParserExecutor< 1 >, 4 > m_pdf_pos_func
 
amrex::Array< amrex::ParserExecutor< 1 >, 6 > m_pdf_u_func
 
amrex::Vector< amrex::Parserm_pdf_parsers
 
amrex::Real m_plasma_density = 0
 
std::string m_input_file
 
amrex::Array< std::string, AMREX_SPACEDIM > m_file_coordinates_xyz
 
int m_num_iteration {0}
 
std::string m_species_name
 
int m_nslices
 
amrex::Vector< amrex::Real > m_insitu_rdata
 
amrex::Vector< intm_insitu_idata
 
amrex::Vector< amrex::Real > m_insitu_sum_rdata
 
amrex::Vector< intm_insitu_sum_idata
 
std::string m_insitu_file_prefix = "diags/insitu"
 
friend AdaptiveTimeStep
 

Static Private Attributes

static constexpr int m_insitu_nrp = 22
 
static constexpr int m_insitu_nip = 1
 

Detailed Description

Container for particles of 1 beam species.

Constructor & Destructor Documentation

◆ BeamParticleContainer()

BeamParticleContainer::BeamParticleContainer ( std::string  name)
inlineexplicit

Constructor

Member Function Documentation

◆ communicateIdCpuComponent()

bool BeamParticleContainer::communicateIdCpuComponent ( ) const
inline

◆ communicateIntComponent()

bool BeamParticleContainer::communicateIntComponent ( int  icomp) const
inline

◆ communicateRealComponent()

bool BeamParticleContainer::communicateRealComponent ( int  rcomp) const
inline

◆ get_name()

std::string BeamParticleContainer::get_name ( ) const
inline

◆ getBeamInitSlice()

BeamTileInit& BeamParticleContainer::getBeamInitSlice ( )
inline

◆ getBeamSlice() [1/2]

BeamTile& BeamParticleContainer::getBeamSlice ( int  which_slice)
inline

◆ getBeamSlice() [2/2]

const BeamTile& BeamParticleContainer::getBeamSlice ( int  which_slice) const
inline

◆ GetCharge()

amrex::Real BeamParticleContainer::GetCharge ( ) const
inline

Returns elementary charge q_e (or -q_e for electrons).

◆ GetMass()

amrex::Real BeamParticleContainer::GetMass ( ) const
inline

Returns mass of physical species

◆ getNumParticles()

int BeamParticleContainer::getNumParticles ( int  which_slice) const
inline

◆ getNumParticlesIncludingSlipped()

int BeamParticleContainer::getNumParticlesIncludingSlipped ( int  which_slice) const
inline

◆ getTotalNumParticles()

uint64_t BeamParticleContainer::getTotalNumParticles ( ) const
inline

◆ InitBeamFixedPPC3D()

void BeamParticleContainer::InitBeamFixedPPC3D ( )

Initialize a beam with a fixed number of particles per cell

◆ InitBeamFixedPPCSlice()

void BeamParticleContainer::InitBeamFixedPPCSlice ( const int  islice,
const int  which_beam_slice 
)

◆ InitBeamFixedWeight3D()

void BeamParticleContainer::InitBeamFixedWeight3D ( )

Initialize a beam with a fixed number of particles, and fixed weight

◆ InitBeamFixedWeightPDF3D()

void BeamParticleContainer::InitBeamFixedWeightPDF3D ( )

Initialize a beam with a fixed number of particles, and fixed weight using a probability density function (PDF)

◆ InitBeamFixedWeightPDFSlice()

void BeamParticleContainer::InitBeamFixedWeightPDFSlice ( int  slice,
int  which_slice 
)

◆ InitBeamFixedWeightSlice()

void BeamParticleContainer::InitBeamFixedWeightSlice ( const int  islice,
const int  which_beam_slice 
)

◆ InitData()

amrex::Real BeamParticleContainer::InitData ( const amrex::Geometry geom)

Allocate beam particle data and initialize particles with requested beam profile.

Parameters
[in]geomGeometry object for the whole domain
Returns
physical time at which the simulation will start

◆ InSituComputeDiags()

void BeamParticleContainer::InSituComputeDiags ( int  islice)

Compute reduced beam diagnostics of current slice, store in member variable

Parameters
[in]islicecurrent slice, on which diags are computed.

◆ InSituWriteToFile()

void BeamParticleContainer::InSituWriteToFile ( int  step,
amrex::Real  time,
const amrex::Geometry geom 
)

Dump in-situ reduced diagnostics to file.

Parameters
[in]stepcurrent time step
[in]timephysical time
[in]geomGeometry object for the whole domain

◆ intializeSlice()

void BeamParticleContainer::intializeSlice ( int  slice,
int  which_slice 
)

◆ numIntComponents()

int BeamParticleContainer::numIntComponents ( ) const
inline

◆ numRealComponents()

int BeamParticleContainer::numRealComponents ( ) const
inline

◆ ReadParameters()

void BeamParticleContainer::ReadParameters ( )

Read parameters in the input file

◆ ReorderParticles()

void BeamParticleContainer::ReorderParticles ( int  beam_slice,
int  step,
amrex::Geometry slice_geom 
)

Reorder beam particles to speed-up push and current deposition.

Parameters
[in]beam_slicebeam slice to reorder, WhichBeamSlice::This WhichBeamSlice::Next
[in]stepcurrent time step
[in]slice_geomGeometry object for one xy slice

◆ resize()

void BeamParticleContainer::resize ( int  which_slice,
int  num_particles,
int  num_slipped_particles 
)

◆ shiftBeamSlices()

void BeamParticleContainer::shiftBeamSlices ( )
inline

◆ TagByLevel()

void BeamParticleContainer::TagByLevel ( const int  current_N_level,
amrex::Vector< amrex::Geometry > const &  geom3D,
const int  which_slice 
)

Store the finest level of every beam particle on which_slice in the cpu() attribute.

Parameters
[in]current_N_levelnumber of MR levels active on the current slice
[in]geom3DGeometry object for the whole domain
[in]which_sliceslice to mark

Member Data Documentation

◆ AdaptiveTimeStep

friend BeamParticleContainer::AdaptiveTimeStep
private

◆ m_can_profile

bool BeamParticleContainer::m_can_profile = false
private

◆ m_charge

amrex::Real BeamParticleContainer::m_charge

charge of each particle of this species

◆ m_density

amrex::Real BeamParticleContainer::m_density
private

Peak density for fixed-weight Gaussian beam

◆ m_density_parser

amrex::Parser BeamParticleContainer::m_density_parser
private

Density parser for fixed-ppc beam. Owns data for m_density_func

◆ m_do_radiation_reaction

bool BeamParticleContainer::m_do_radiation_reaction {false}

whether to calculate radiation losses

◆ m_do_reset_id_init

bool BeamParticleContainer::m_do_reset_id_init {false}

Whether to reset the global ID incrementor to 1 before initializing this beam

◆ m_do_salame

bool BeamParticleContainer::m_do_salame = false

Number of particles on upstream rank (required for IO) Whether this beam uses salame

◆ m_do_spin_tracking

bool BeamParticleContainer::m_do_spin_tracking = false

If spin tracking is enabled for this beam

◆ m_do_symmetrize

bool BeamParticleContainer::m_do_symmetrize {0}
private

Option to symmetrize the beam

◆ m_do_z_push

bool BeamParticleContainer::m_do_z_push {true}

Pushing beam particles in z direction

◆ m_duz_per_uz0_dzeta

amrex::Real BeamParticleContainer::m_duz_per_uz0_dzeta {0.}
private

relative energy spread per dzeta

◆ m_external_fields

amrex::GpuArray<amrex::ParserExecutor<4>, 6> BeamParticleContainer::m_external_fields

External field functions for Ex Ey Ez Bx By Bz

◆ m_external_fields_parser

amrex::Array<amrex::Parser, 6> BeamParticleContainer::m_external_fields_parser

Owns data for m_external_fields

◆ m_file_coordinates_xyz

amrex::Array<std::string, AMREX_SPACEDIM> BeamParticleContainer::m_file_coordinates_xyz
private

Coordinates used in input file, are converted to Hipace Coordinates x y z respectively

◆ m_get_density

GetInitialDensity BeamParticleContainer::m_get_density {}
private

density profile of the beam

◆ m_get_momentum

GetInitialMomentum BeamParticleContainer::m_get_momentum {}
private

momentum profile of the beam

◆ m_id64

uint64_t BeamParticleContainer::m_id64 = 1
private

64 bit ID to initialize many particles without overflowing

◆ m_init_slice

BeamTileInit BeamParticleContainer::m_init_slice {}
private

◆ m_init_sorter

BoxSorter BeamParticleContainer::m_init_sorter
private

◆ m_initialize_on_cpu

bool BeamParticleContainer::m_initialize_on_cpu {false}

◆ m_injection_type

std::string BeamParticleContainer::m_injection_type
private

injection type, fixed_width or fixed_ppc

◆ m_input_file

std::string BeamParticleContainer::m_input_file
private

Path to bean input file

◆ m_insitu_file_prefix

std::string BeamParticleContainer::m_insitu_file_prefix = "diags/insitu"
private

Prefix/path for the output files

◆ m_insitu_idata

amrex::Vector<int> BeamParticleContainer::m_insitu_idata
private

Per-slice int beam properties

◆ m_insitu_nip

constexpr int BeamParticleContainer::m_insitu_nip = 1
staticconstexprprivate

Number of int beam properties for in-situ per-slice reduced diagnostics.

◆ m_insitu_nrp

constexpr int BeamParticleContainer::m_insitu_nrp = 22
staticconstexprprivate

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

◆ m_insitu_period

int BeamParticleContainer::m_insitu_period {0}

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

◆ m_insitu_radius

amrex::Real BeamParticleContainer::m_insitu_radius {std::numeric_limits<amrex::Real>::infinity()}
private

radius of the beam insitu diagnostics

◆ m_insitu_rdata

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

Per-slice real beam properties

◆ m_insitu_sum_idata

amrex::Vector<int> BeamParticleContainer::m_insitu_sum_idata
private

Sum of all per-slice int beam properties

◆ m_insitu_sum_rdata

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

Sum of all per-slice real beam properties

◆ m_mass

amrex::Real BeamParticleContainer::m_mass

mass of each particle of this species

◆ m_min_density

amrex::Real BeamParticleContainer::m_min_density {0.}
private

minimum density at which beam particles are generated

◆ m_n_subcycles

int BeamParticleContainer::m_n_subcycles {10}

Number of sub-cycles in the beam pusher

◆ m_name

std::string BeamParticleContainer::m_name
private

name of the species

◆ m_nslices

int BeamParticleContainer::m_nslices
private

number of z slices of the domain

◆ m_num_iteration

int BeamParticleContainer::m_num_iteration {0}
private

the iteration of the openPMD beam

◆ m_num_particles

amrex::Long BeamParticleContainer::m_num_particles
private

Number of particles for fixed-weight Gaussian beam

◆ m_num_particles_slice

amrex::Vector<unsigned int> BeamParticleContainer::m_num_particles_slice
private

number of particles that need to be initialized per slice

◆ m_num_particles_with_slipped

std::array<int, WhichBeamSlice::N> BeamParticleContainer::m_num_particles_with_slipped {}
private

◆ m_num_particles_without_slipped

std::array<int, WhichBeamSlice::N> BeamParticleContainer::m_num_particles_without_slipped {}
private

◆ m_pdf_func

amrex::ParserExecutor<1> BeamParticleContainer::m_pdf_func
private

probability density function

◆ m_pdf_parsers

amrex::Vector<amrex::Parser> BeamParticleContainer::m_pdf_parsers
private

Owns data for all 11 Parser functions of fixed_weight_pdf

◆ m_pdf_pos_func

amrex::Array<amrex::ParserExecutor<1>, 4> BeamParticleContainer::m_pdf_pos_func
private

functions for x_mean, y_mean, x_std, y_std

◆ m_pdf_ref_ratio

int BeamParticleContainer::m_pdf_ref_ratio = 4
private

number of subcycles per slice for the pdf evaluation

◆ m_pdf_u_func

amrex::Array<amrex::ParserExecutor<1>, 6> BeamParticleContainer::m_pdf_u_func
private

functions for ux_mean, uy_mean, uz_mean, ux_std, uy_std, uz_std

◆ m_peak_density_is_specified

bool BeamParticleContainer::m_peak_density_is_specified = false
private

if the peak density is specified

◆ m_plasma_density

amrex::Real BeamParticleContainer::m_plasma_density = 0
private

Density of plasma to convert from_file beam to normalized units

◆ m_pos_mean_x_func

amrex::ParserExecutor<1> BeamParticleContainer::m_pos_mean_x_func
private

Average x position of the fixed-weight beam depending on z

◆ m_pos_mean_x_parser

amrex::Parser BeamParticleContainer::m_pos_mean_x_parser
private

Average x position of the fixed-weight beam depending on z

◆ m_pos_mean_y_func

amrex::ParserExecutor<1> BeamParticleContainer::m_pos_mean_y_func
private

◆ m_pos_mean_y_parser

amrex::Parser BeamParticleContainer::m_pos_mean_y_parser
private

Average y position of the fixed-weight beam depending on z

◆ m_pos_mean_z

amrex::Real BeamParticleContainer::m_pos_mean_z = 0
private

◆ m_position_mean

amrex::RealVect BeamParticleContainer::m_position_mean {0., 0., 0.}
private

mean position of the beam

◆ m_position_std

amrex::RealVect BeamParticleContainer::m_position_std {0., 0., 0.}
private

Width of the Gaussian beam. Only used for a fixed-weight beam

◆ m_ppc

amrex::IntVect BeamParticleContainer::m_ppc {1, 1, 1}
private

Number of particles per cell in each direction

◆ m_radius

amrex::Real BeamParticleContainer::m_radius {std::numeric_limits<amrex::Real>::infinity()}
private

Radius of the beam

◆ m_random_ppc

amrex::IntVect BeamParticleContainer::m_random_ppc {0, 0, 0}
private

if the cell position is random in each direction

◆ m_reorder_idx_type

amrex::IntVect BeamParticleContainer::m_reorder_idx_type = {0, 0, 0}
private

2D reordering index type. 0: cell, 1: node, 2: both

◆ m_reorder_period

int BeamParticleContainer::m_reorder_period = 0
private

After how many slices the particles are reordered. 0: off

◆ m_slice_permutation

int BeamParticleContainer::m_slice_permutation = 0
private

◆ m_slices

std::array<BeamTile, WhichBeamSlice::N> BeamParticleContainer::m_slices {}
private

◆ m_species_name

std::string BeamParticleContainer::m_species_name
private

the name of the particle species in the beam file

◆ m_total_charge

amrex::Real BeamParticleContainer::m_total_charge
private

Total beam charge for fixed-weight Gaussian beam

◆ m_total_num_particles

uint64_t BeamParticleContainer::m_total_num_particles = 0
private

◆ m_total_weight

amrex::Real BeamParticleContainer::m_total_weight = 0
private

sum of the weights of all particles

◆ m_use_external_fields

bool BeamParticleContainer::m_use_external_fields = false

Whether external fields should be used for this beam

◆ m_z_array

amrex::PODVector<amrex::Real, amrex::PolymorphicArenaAllocator<amrex::Real> > BeamParticleContainer::m_z_array {}
private

Array for the z position of all beam particles

◆ m_z_foc

amrex::Real BeamParticleContainer::m_z_foc {0.}
private

Distance at which the beam is focused, starting from its initial position

◆ m_zmax

amrex::Real BeamParticleContainer::m_zmax = std::numeric_limits<amrex::Real>::infinity()
private

Max longitudinal particle position of the beam

◆ m_zmin

amrex::Real BeamParticleContainer::m_zmin = -std::numeric_limits<amrex::Real>::infinity()
private

Min longitudinal particle position of the beam


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