WarpX
|
#include <MultiParticleContainer.H>
Public Member Functions | |
MultiParticleContainer (amrex::AmrCore *amr_core) | |
~MultiParticleContainer ()=default | |
MultiParticleContainer (MultiParticleContainer const &)=delete | |
MultiParticleContainer & | operator= (MultiParticleContainer const &)=delete |
MultiParticleContainer (MultiParticleContainer &&)=default | |
MultiParticleContainer & | operator= (MultiParticleContainer &&)=default |
WarpXParticleContainer & | GetParticleContainer (int index) const |
WarpXParticleContainer * | GetParticleContainerPtr (int index) const |
WarpXParticleContainer & | GetParticleContainerFromName (const std::string &name) const |
std::array< amrex::ParticleReal, 3 > | meanParticleVelocity (int index) |
void | AllocData () |
void | InitData () |
void | InitMultiPhysicsModules () |
void | Evolve (int lev, const amrex::MultiFab &Ex, const amrex::MultiFab &Ey, const amrex::MultiFab &Ez, const amrex::MultiFab &Bx, const amrex::MultiFab &By, const amrex::MultiFab &Bz, amrex::MultiFab &jx, amrex::MultiFab &jy, amrex::MultiFab &jz, amrex::MultiFab *cjx, amrex::MultiFab *cjy, amrex::MultiFab *cjz, amrex::MultiFab *rho, amrex::MultiFab *crho, const amrex::MultiFab *cEx, const amrex::MultiFab *cEy, const amrex::MultiFab *cEz, const amrex::MultiFab *cBx, const amrex::MultiFab *cBy, const amrex::MultiFab *cBz, amrex::Real t, amrex::Real dt, DtType a_dt_type=DtType::Full, bool skip_deposition=false, PushType push_type=PushType::Explicit) |
This evolves all the particles by one PIC time step, including current deposition, the field solve, and pushing the particles, for all the species in the MultiParticleContainer. This is the electromagnetic version. More... | |
void | PushX (amrex::Real dt) |
This pushes the particle positions by one time step for all the species in the MultiParticleContainer. More... | |
void | PushP (int lev, amrex::Real dt, const amrex::MultiFab &Ex, const amrex::MultiFab &Ey, const amrex::MultiFab &Ez, const amrex::MultiFab &Bx, const amrex::MultiFab &By, const amrex::MultiFab &Bz) |
std::unique_ptr< amrex::MultiFab > | GetZeroChargeDensity (int lev) |
This returns a MultiFAB filled with zeros. It is used to return the charge density when there is no particle species. More... | |
void | DepositCharge (amrex::Vector< std::unique_ptr< amrex::MultiFab > > &rho, amrex::Real relative_time) |
Deposit charge density. More... | |
void | DepositCurrent (amrex::Vector< std::array< std::unique_ptr< amrex::MultiFab >, 3 > > &J, amrex::Real dt, amrex::Real relative_time) |
Deposit current density. More... | |
std::unique_ptr< amrex::MultiFab > | GetChargeDensity (int lev, bool local=false) |
void | doFieldIonization (int lev, const amrex::MultiFab &Ex, const amrex::MultiFab &Ey, const amrex::MultiFab &Ez, const amrex::MultiFab &Bx, const amrex::MultiFab &By, const amrex::MultiFab &Bz) |
void | doCollisions (amrex::Real cur_time, amrex::Real dt) |
void | doResampling (int timestep, bool verbose) |
This function loops over all species and performs resampling if appropriate. More... | |
void | doQEDSchwinger () |
amrex::Box | ComputeSchwingerGlobalBox () const |
void | Restart (const std::string &dir) |
void | PostRestart () |
void | ReadHeader (std::istream &is) |
void | WriteHeader (std::ostream &os) const |
void | SortParticlesByBin (amrex::IntVect bin_size) |
void | Redistribute () |
void | defineAllParticleTiles () |
void | deleteInvalidParticles () |
void | RedistributeLocal (int num_ghost) |
void | ApplyBoundaryConditions () |
amrex::Vector< amrex::Long > | GetZeroParticlesInGrid (int lev) const |
This returns a vector filled with zeros whose size is the number of boxes in the simulation boxarray. It is used to return the number of particles in each grid when there is no particle species. More... | |
amrex::Vector< amrex::Long > | NumberOfParticlesInGrid (int lev) const |
void | Increment (amrex::MultiFab &mf, int lev) |
void | SetParticleBoxArray (int lev, amrex::BoxArray &new_ba) |
void | SetParticleDistributionMap (int lev, amrex::DistributionMapping &new_dm) |
int | nSpecies () const |
int | nLasers () const |
int | nContainers () const |
void | SetDoBackTransformedParticles (bool do_back_transformed_particles) |
void | SetDoBackTransformedParticles (const std::string &species_name, bool do_back_transformed_particles) |
int | nSpeciesDepositOnMainGrid () const |
int | nSpeciesGatherFromMainGrid () const |
void | ContinuousInjection (const amrex::RealBox &injection_box) const |
void | UpdateAntennaPosition (amrex::Real dt) const |
Update antenna position for continuous injection of lasers in a boosted frame. Empty function for containers other than lasers. More... | |
int | doContinuousInjection () const |
void | ContinuousFluxInjection (amrex::Real t, amrex::Real dt) const |
std::vector< std::string > | GetSpeciesNames () const |
std::vector< std::string > | GetLasersNames () const |
std::vector< std::string > | GetSpeciesAndLasersNames () const |
PhysicalParticleContainer & | GetPCtmp () |
void | ScrapeParticlesAtEB (const amrex::Vector< const amrex::MultiFab * > &distance_to_eb) |
void | doQedEvents (int lev, const amrex::MultiFab &Ex, const amrex::MultiFab &Ey, const amrex::MultiFab &Ez, const amrex::MultiFab &Bx, const amrex::MultiFab &By, const amrex::MultiFab &Bz) |
Performs QED events (Breit-Wheeler process and photon emission) More... | |
int | getSpeciesID (const std::string &product_str) const |
amrex::Vector< std::unique_ptr< WarpXParticleContainer > >::iterator | begin () |
amrex::Vector< std::unique_ptr< WarpXParticleContainer > >::iterator | end () |
Protected Types | |
enum class | PCTypes { Physical , RigidInjected , Photon } |
Protected Member Functions | |
void | doQedBreitWheeler (int lev, const amrex::MultiFab &Ex, const amrex::MultiFab &Ey, const amrex::MultiFab &Ez, const amrex::MultiFab &Bx, const amrex::MultiFab &By, const amrex::MultiFab &Bz) |
Performs Breit-Wheeler process for the species for which it is enabled. More... | |
void | doQedQuantumSync (int lev, const amrex::MultiFab &Ex, const amrex::MultiFab &Ey, const amrex::MultiFab &Ez, const amrex::MultiFab &Bx, const amrex::MultiFab &By, const amrex::MultiFab &Bz) |
Performs QED photon emission for the species for which it is enabled. More... | |
template<typename ... Args> | |
amrex::MFItInfo | getMFItInfo (const WarpXParticleContainer &pc_src, Args const &... pc_dsts) const noexcept |
void | InitQED () |
int | NSpeciesQuantumSync () const |
int | NSpeciesBreitWheeler () const |
void | InitQuantumSync () |
void | InitBreitWheeler () |
void | QuantumSyncGenerateTable () |
void | BreitWheelerGenerateTable () |
Protected Attributes | |
std::vector< std::string > | species_names |
std::vector< std::string > | lasers_names |
std::unique_ptr< CollisionHandler > | collisionhandler |
std::vector< bool > | m_deposit_on_main_grid |
instead of depositing (current, charge) on the finest patch level, deposit to the coarsest grid More... | |
std::vector< bool > | m_laser_deposit_on_main_grid |
std::vector< bool > | m_gather_from_main_grid |
instead of gathering fields from the finest patch level, gather from the coarsest More... | |
std::vector< PCTypes > | species_types |
std::shared_ptr< BreitWheelerEngine > | m_shr_p_bw_engine |
std::shared_ptr< QuantumSynchrotronEngine > | m_shr_p_qs_engine |
int | m_nspecies_quantum_sync = 0 |
int | m_nspecies_breit_wheeler = 0 |
amrex::ParticleReal | m_quantum_sync_photon_creation_energy_threshold |
bool | m_do_qed_schwinger = false |
std::string | m_qed_schwinger_ele_product_name |
std::string | m_qed_schwinger_pos_product_name |
int | m_qed_schwinger_ele_product |
int | m_qed_schwinger_pos_product |
amrex::Real | m_qed_schwinger_y_size |
int | m_qed_schwinger_threshold_poisson_gaussian = 25 |
amrex::Real | m_qed_schwinger_xmin = std::numeric_limits<amrex::Real>::lowest() |
amrex::Real | m_qed_schwinger_xmax = std::numeric_limits<amrex::Real>::max() |
amrex::Real | m_qed_schwinger_ymin = std::numeric_limits<amrex::Real>::lowest() |
amrex::Real | m_qed_schwinger_ymax = std::numeric_limits<amrex::Real>::max() |
amrex::Real | m_qed_schwinger_zmin = std::numeric_limits<amrex::Real>::lowest() |
amrex::Real | m_qed_schwinger_zmax = std::numeric_limits<amrex::Real>::max() |
Static Protected Attributes | |
static constexpr auto | m_default_quantum_sync_photon_creation_energy_threshold |
Private Member Functions | |
void | ReadParameters () |
void | mapSpeciesProduct () |
void | MFItInfoCheckTiling (const WarpXParticleContainer &) const noexcept |
template<typename First , typename ... Args> | |
void | MFItInfoCheckTiling (const WarpXParticleContainer &pc_src, First const &pc_dst, Args const &... others) const noexcept |
void | CheckIonizationProductSpecies () |
void | CheckQEDProductSpecies () |
Private Attributes | |
amrex::Vector< std::unique_ptr< WarpXParticleContainer > > | allcontainers |
std::unique_ptr< PhysicalParticleContainer > | pc_tmp |
bool | m_do_back_transformed_particles = false |
The class MultiParticleContainer holds multiple instances of the polymorphic class WarpXParticleContainer, stored in its member variable "allcontainers". The class WarpX typically has a single (pointer to an) instance of MultiParticleContainer.
MultiParticleContainer typically has two types of functions:
|
strongprotected |
MultiParticleContainer::MultiParticleContainer | ( | amrex::AmrCore * | amr_core | ) |
|
default |
|
delete |
|
default |
void MultiParticleContainer::AllocData | ( | ) |
void MultiParticleContainer::ApplyBoundaryConditions | ( | ) |
Apply BC. For now, just discard particles outside the domain, regardless of the whole simulation BC.
|
inline |
|
protected |
Called by InitBreitWheeler if a new table has to be generated.
|
private |
Should be called right after mapSpeciesProduct in InitData. It checks the physical correctness of product particle species selected by the user for ionization process.
|
private |
Should be called right after mapSpeciesProduct in InitData. It checks the physical correctness of product particle species selected by the user for QED processes.
amrex::Box MultiParticleContainer::ComputeSchwingerGlobalBox | ( | ) | const |
This function computes the box outside which Schwinger process is disabled. The box is defined by m_qed_schwinger_xmin/xmax/ymin/ymax/zmin/zmax and the warpx level 0 geometry object (to make the link between Real and int quantities).
void MultiParticleContainer::ContinuousFluxInjection | ( | amrex::Real | t, |
amrex::Real | dt | ||
) | const |
void MultiParticleContainer::ContinuousInjection | ( | const amrex::RealBox & | injection_box | ) | const |
void MultiParticleContainer::defineAllParticleTiles | ( | ) |
void MultiParticleContainer::deleteInvalidParticles | ( | ) |
void MultiParticleContainer::DepositCharge | ( | amrex::Vector< std::unique_ptr< amrex::MultiFab > > & | rho, |
amrex::Real | relative_time | ||
) |
Deposit charge density.
[in,out] | rho | vector of charge densities (one pointer to MultiFab per mesh refinement level) |
[in] | relative_time | Time at which to deposit rho, relative to the time of the current positions of the particles. When different than 0, the particle position will be temporarily modified to match the time of the deposition. |
void MultiParticleContainer::DepositCurrent | ( | amrex::Vector< std::array< std::unique_ptr< amrex::MultiFab >, 3 > > & | J, |
amrex::Real | dt, | ||
amrex::Real | relative_time | ||
) |
Deposit current density.
[in,out] | J | vector of current densities (one three-dimensional array of pointers to MultiFabs per mesh refinement level) |
[in] | dt | Time step for particle level |
[in] | relative_time | Time at which to deposit J, relative to the time of the current positions of the particles. When different than 0, the particle position will be temporarily modified to match the time of the deposition. |
void MultiParticleContainer::doCollisions | ( | amrex::Real | cur_time, |
amrex::Real | dt | ||
) |
int MultiParticleContainer::doContinuousInjection | ( | ) | const |
void MultiParticleContainer::doFieldIonization | ( | int | lev, |
const amrex::MultiFab & | Ex, | ||
const amrex::MultiFab & | Ey, | ||
const amrex::MultiFab & | Ez, | ||
const amrex::MultiFab & | Bx, | ||
const amrex::MultiFab & | By, | ||
const amrex::MultiFab & | Bz | ||
) |
|
protected |
Performs Breit-Wheeler process for the species for which it is enabled.
void MultiParticleContainer::doQedEvents | ( | int | lev, |
const amrex::MultiFab & | Ex, | ||
const amrex::MultiFab & | Ey, | ||
const amrex::MultiFab & | Ez, | ||
const amrex::MultiFab & | Bx, | ||
const amrex::MultiFab & | By, | ||
const amrex::MultiFab & | Bz | ||
) |
Performs QED events (Breit-Wheeler process and photon emission)
|
protected |
Performs QED photon emission for the species for which it is enabled.
void MultiParticleContainer::doQEDSchwinger | ( | ) |
If Schwinger process is activated, this function is called at every timestep in Evolve and is used to create Schwinger electron-positron pairs. Within this function we loop over all cells to calculate the number of created physical pairs. If this number is higher than 0, we create a single particle per species in this cell, with a weight corresponding to the number of physical particles.
void MultiParticleContainer::doResampling | ( | int | timestep, |
bool | verbose | ||
) |
This function loops over all species and performs resampling if appropriate.
[in] | timestep | the current timestep. |
|
inline |
void MultiParticleContainer::Evolve | ( | int | lev, |
const amrex::MultiFab & | Ex, | ||
const amrex::MultiFab & | Ey, | ||
const amrex::MultiFab & | Ez, | ||
const amrex::MultiFab & | Bx, | ||
const amrex::MultiFab & | By, | ||
const amrex::MultiFab & | Bz, | ||
amrex::MultiFab & | jx, | ||
amrex::MultiFab & | jy, | ||
amrex::MultiFab & | jz, | ||
amrex::MultiFab * | cjx, | ||
amrex::MultiFab * | cjy, | ||
amrex::MultiFab * | cjz, | ||
amrex::MultiFab * | rho, | ||
amrex::MultiFab * | crho, | ||
const amrex::MultiFab * | cEx, | ||
const amrex::MultiFab * | cEy, | ||
const amrex::MultiFab * | cEz, | ||
const amrex::MultiFab * | cBx, | ||
const amrex::MultiFab * | cBy, | ||
const amrex::MultiFab * | cBz, | ||
amrex::Real | t, | ||
amrex::Real | dt, | ||
DtType | a_dt_type = DtType::Full , |
||
bool | skip_deposition = false , |
||
PushType | push_type = PushType::Explicit |
||
) |
This evolves all the particles by one PIC time step, including current deposition, the field solve, and pushing the particles, for all the species in the MultiParticleContainer. This is the electromagnetic version.
std::unique_ptr< MultiFab > MultiParticleContainer::GetChargeDensity | ( | int | lev, |
bool | local = false |
||
) |
This deposits the particle charge onto a node-centered MultiFab and returns a unique ptr to it. The charge density is accumulated over all the particles in the MultiParticleContainer
|
inline |
|
inlineprotectednoexcept |
|
inline |
WarpXParticleContainer & MultiParticleContainer::GetParticleContainerFromName | ( | const std::string & | name | ) | const |
|
inline |
|
inline |
|
inline |
int MultiParticleContainer::getSpeciesID | ( | const std::string & | product_str | ) | const |
|
inline |
This returns a MultiFAB filled with zeros. It is used to return the charge density when there is no particle species.
[in] | lev | the index of the refinement level. |
This returns a vector filled with zeros whose size is the number of boxes in the simulation boxarray. It is used to return the number of particles in each grid when there is no particle species.
[in] | lev | the index of the refinement level. |
void MultiParticleContainer::Increment | ( | amrex::MultiFab & | mf, |
int | lev | ||
) |
|
protected |
Initializes the Quantum Synchrotron engine
void MultiParticleContainer::InitData | ( | ) |
void MultiParticleContainer::InitMultiPhysicsModules | ( | ) |
|
protected |
Initialize QED engines and provides smart pointers to species who need QED processes
|
protected |
Initializes the Quantum Synchrotron engine
|
private |
|
inline |
|
inlineprivatenoexcept |
|
inlineprivatenoexcept |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
Returns the number of species having Breit Wheeler process enabled
|
inline |
|
inline |
|
inlineprotected |
Returns the number of species having Quantum Synchrotron process enabled
|
default |
|
delete |
void MultiParticleContainer::PostRestart | ( | ) |
void MultiParticleContainer::PushP | ( | int | lev, |
amrex::Real | dt, | ||
const amrex::MultiFab & | Ex, | ||
const amrex::MultiFab & | Ey, | ||
const amrex::MultiFab & | Ez, | ||
const amrex::MultiFab & | Bx, | ||
const amrex::MultiFab & | By, | ||
const amrex::MultiFab & | Bz | ||
) |
This pushes the particle momenta by dt for all the species in the MultiParticleContainer. It is used to desynchronize the particles after initialization or when restarting from a checkpoint. It is also used to synchronize particles at the the end of the run. This is the electromagnetic version.
void MultiParticleContainer::PushX | ( | amrex::Real | dt | ) |
This pushes the particle positions by one time step for all the species in the MultiParticleContainer.
|
protected |
Called by InitQuantumSync if a new table has to be generated.
void MultiParticleContainer::ReadHeader | ( | std::istream & | is | ) |
|
private |
void MultiParticleContainer::Redistribute | ( | ) |
void MultiParticleContainer::RedistributeLocal | ( | int | num_ghost | ) |
void MultiParticleContainer::Restart | ( | const std::string & | dir | ) |
void MultiParticleContainer::ScrapeParticlesAtEB | ( | const amrex::Vector< const amrex::MultiFab * > & | distance_to_eb | ) |
void MultiParticleContainer::SetDoBackTransformedParticles | ( | bool | do_back_transformed_particles | ) |
Whether back-transformed diagnostics need to be performed for any plasma species.
[in] | do_back_transformed_particles | The parameter to set if back-transformed particles are set to true/false |
void MultiParticleContainer::SetDoBackTransformedParticles | ( | const std::string & | species_name, |
bool | do_back_transformed_particles | ||
) |
Whether back-transformed diagnostics is set for species with species_name.
[in] | species_name | The species for which back-transformed particles is set. |
[in] | do_back_transformed_particles | The parameter to set if back-transformed particles are set to true/false |
void MultiParticleContainer::SetParticleBoxArray | ( | int | lev, |
amrex::BoxArray & | new_ba | ||
) |
void MultiParticleContainer::SetParticleDistributionMap | ( | int | lev, |
amrex::DistributionMapping & | new_dm | ||
) |
void MultiParticleContainer::SortParticlesByBin | ( | amrex::IntVect | bin_size | ) |
void MultiParticleContainer::UpdateAntennaPosition | ( | amrex::Real | dt | ) | const |
Update antenna position for continuous injection of lasers in a boosted frame. Empty function for containers other than lasers.
void MultiParticleContainer::WriteHeader | ( | std::ostream & | os | ) | const |
|
private |
|
protected |
amrex::Gpu::DeviceVector<amrex::ParticleReal> MultiParticleContainer::d_repeated_plasma_lens_lengths |
amrex::Gpu::DeviceVector<amrex::ParticleReal> MultiParticleContainer::d_repeated_plasma_lens_starts |
amrex::Gpu::DeviceVector<amrex::ParticleReal> MultiParticleContainer::d_repeated_plasma_lens_strengths_B |
amrex::Gpu::DeviceVector<amrex::ParticleReal> MultiParticleContainer::d_repeated_plasma_lens_strengths_E |
amrex::Vector<amrex::ParticleReal> MultiParticleContainer::h_repeated_plasma_lens_lengths |
amrex::Vector<amrex::ParticleReal> MultiParticleContainer::h_repeated_plasma_lens_starts |
amrex::Vector<amrex::ParticleReal> MultiParticleContainer::h_repeated_plasma_lens_strengths_B |
amrex::Vector<amrex::ParticleReal> MultiParticleContainer::h_repeated_plasma_lens_strengths_E |
|
protected |
std::string MultiParticleContainer::m_B_ext_particle_s = "none" |
std::unique_ptr<amrex::Parser> MultiParticleContainer::m_Bx_particle_parser |
std::unique_ptr<amrex::Parser> MultiParticleContainer::m_By_particle_parser |
std::unique_ptr<amrex::Parser> MultiParticleContainer::m_Bz_particle_parser |
|
staticconstexprprotected |
Default value of the energy threshold for photon creation in Quantum Synchrotron process.
|
protected |
instead of depositing (current, charge) on the finest patch level, deposit to the coarsest grid
|
private |
|
protected |
Whether or not to activate Schwinger process
std::string MultiParticleContainer::m_E_ext_particle_s = "none" |
std::unique_ptr<amrex::Parser> MultiParticleContainer::m_Ex_particle_parser |
std::unique_ptr<amrex::Parser> MultiParticleContainer::m_Ey_particle_parser |
std::unique_ptr<amrex::Parser> MultiParticleContainer::m_Ez_particle_parser |
|
protected |
instead of gathering fields from the finest patch level, gather from the coarsest
|
protected |
|
protected |
|
protected |
|
protected |
Index for Schwinger electron product species in allcontainers
|
protected |
Name of Schwinger electron product species
|
protected |
Index for Schwinger positron product species in allcontainers
|
protected |
Name of Schwinger positron product species
|
protected |
If the number of physical Schwinger pairs created within a cell is higher than this threshold we use a Gaussian distribution rather than a Poisson distribution for the pair production rate calculations
|
protected |
|
protected |
The 6 following variables are spatial boundaries beyond which Schwinger process is deactivated
|
protected |
Transverse size used in 2D Schwinger pair production rate calculations
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Energy threshold for photon creation in Quantum Synchrotron process.
amrex::ParticleReal MultiParticleContainer::m_repeated_plasma_lens_period |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |