|
WarpX
|
#include <WarpXParticleContainer.H>
Public Types | |
| using | DiagnosticParticleData = amrex::StructOfArrays< DiagIdx::nattribs, 0 > |
| using | DiagnosticParticles = amrex::Vector< std::map< std::pair< int, int >, DiagnosticParticleData > > |
| using | PairIndex = std::pair< int, int > |
| using | TmpParticleTile = std::array< amrex::Gpu::DeviceVector< amrex::ParticleReal >, TmpIdx::nattribs > |
| using | TmpParticles = amrex::Vector< std::map< PairIndex, TmpParticleTile > > |
Public Member Functions | |
| WarpXParticleContainer (amrex::AmrCore *amr_core, int ispecies) | |
| virtual | ~WarpXParticleContainer () |
| virtual void | InitData ()=0 |
| virtual 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)=0 |
| virtual void | PostRestart ()=0 |
| virtual void | GetParticleSlice (const int, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, const amrex::Real, DiagnosticParticles &) |
| void | AllocData () |
| void | PushX (amrex::Real dt) |
| void | PushX (int lev, amrex::Real dt) |
| virtual 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)=0 |
| void | DepositCurrent (amrex::Vector< std::array< std::unique_ptr< amrex::MultiFab >, 3 > > &J, const amrex::Real dt, const amrex::Real relative_t) |
| Deposit current density. More... | |
| void | DepositCharge (amrex::Vector< std::unique_ptr< amrex::MultiFab > > &rho, const bool local=false, const bool reset=false, const bool do_rz_volume_scaling=false, const bool interpolate_across_levels=true, const int icomp=0) |
| Deposit charge density. More... | |
| std::unique_ptr< amrex::MultiFab > | GetChargeDensity (int lev, bool local=false) |
| virtual void | DepositCharge (WarpXParIter &pti, RealVector &wp, const int *const ion_lev, amrex::MultiFab *rho, int icomp, const long offset, const long np_to_depose, int thread_num, int lev, int depos_lev) |
| virtual void | DepositCurrent (WarpXParIter &pti, RealVector const &wp, RealVector const &uxp, RealVector const &uyp, RealVector const &uzp, int const *const ion_lev, amrex::MultiFab *const jx, amrex::MultiFab *const jy, amrex::MultiFab *const jz, long const offset, long const np_to_depose, int const thread_num, int const lev, int const depos_lev, amrex::Real const dt, amrex::Real const relative_time) |
| virtual void | ContinuousInjection (const amrex::RealBox &) |
| virtual void | UpdateContinuousInjectionPosition (amrex::Real) |
| virtual void | ContinuousFluxInjection (amrex::Real) |
| amrex::Real | sumParticleCharge (bool local=false) |
| std::array< amrex::Real, 3 > | meanParticleVelocity (bool local=false) |
| amrex::Real | maxParticleVelocity (bool local=false) |
| void | AddNParticles (int lev, int n, const amrex::ParticleReal *x, const amrex::ParticleReal *y, const amrex::ParticleReal *z, const amrex::ParticleReal *vx, const amrex::ParticleReal *vy, const amrex::ParticleReal *vz, int nattr, const amrex::ParticleReal *attr, int uniqueparticles, amrex::Long id=-1) |
| virtual void | ReadHeader (std::istream &is)=0 |
| virtual void | WriteHeader (std::ostream &os) const =0 |
| virtual void | ConvertUnits (ConvertDirection) |
| void | ApplyBoundaryConditions () |
| Apply particle BC. More... | |
| void | AddRealComp (const std::string &name, bool comm=true) |
| void | AddIntComp (const std::string &name, bool comm=true) |
| int | doBackTransformedDiagnostics () const |
| std::map< std::string, int > | getParticleComps () const noexcept |
| std::map< std::string, int > | getParticleiComps () const noexcept |
| std::map< std::string, int > | getParticleRuntimeComps () const noexcept |
| std::map< std::string, int > | getParticleRuntimeiComps () const noexcept |
| amrex::ParticleReal | getCharge () const |
| amrex::ParticleReal | getMass () const |
| int | DoFieldIonization () const |
| virtual bool | has_quantum_sync () const |
| virtual bool | has_breit_wheeler () const |
| int | DoQED () const |
| template<PhysicalSpecies PhysSpec> | |
| bool | AmIA () const noexcept |
| amrex::Array< amrex::Real, 3 > | get_v_galilean () |
| virtual void | resample (const int) |
| Virtual method to resample the species. Overriden by PhysicalParticleContainer only. Empty body is here because making the method purely virtual would mean that we need to override the method for every derived class. Note that in practice this function is never called because resample() is only called for PhysicalParticleContainers. More... | |
| void | defineAllParticleTiles () noexcept |
Static Public Member Functions | |
| static void | ReadParameters () |
| static void | BackwardCompatibility () |
Public Attributes | |
| friend | MultiParticleContainer |
| bool | do_splitting = false |
| bool | initialize_self_fields = false |
| amrex::Real | self_fields_required_precision |
| int | self_fields_max_iters = 200 |
| int | self_fields_verbosity = 2 |
| int | split_type = 0 |
Protected Member Functions | |
| virtual void | set_breit_wheeler_engine_ptr (std::shared_ptr< BreitWheelerEngine >) |
| virtual void | set_quantum_sync_engine_ptr (std::shared_ptr< QuantumSynchrotronEngine >) |
Protected Attributes | |
| amrex::Array< amrex::Real, 3 > | m_v_galilean = {{0}} |
| std::map< std::string, int > | particle_comps |
| std::map< std::string, int > | particle_icomps |
| std::map< std::string, int > | particle_runtime_comps |
| std::map< std::string, int > | particle_runtime_icomps |
| int | species_id |
| amrex::Real | charge |
| amrex::Real | mass |
| PhysicalSpecies | physical_species |
| ParticleBoundaries | m_boundary_conditions |
| bool | m_deposit_on_main_grid = false |
| instead of depositing (current, charge) on the finest patch level, deposit to the coarsest grid More... | |
| bool | m_gather_from_main_grid = false |
| instead of gathering fields from the finest patch level, gather from the coarsest More... | |
| int | do_not_push = 0 |
| int | do_not_deposit = 0 |
| int | do_not_gather = 0 |
| int | do_continuous_injection = 0 |
| int | do_field_ionization = 0 |
| int | ionization_product |
| std::string | ionization_product_name |
| int | ion_atomic_number |
| int | ionization_initial_level = 0 |
| amrex::Gpu::DeviceVector< amrex::Real > | ionization_energies |
| amrex::Gpu::DeviceVector< amrex::Real > | adk_power |
| amrex::Gpu::DeviceVector< amrex::Real > | adk_prefactor |
| amrex::Gpu::DeviceVector< amrex::Real > | adk_exp_prefactor |
| std::string | physical_element |
| int | do_resampling = 0 |
| int | do_back_transformed_diagnostics = 1 |
| int | m_qed_breit_wheeler_ele_product |
| std::string | m_qed_breit_wheeler_ele_product_name |
| int | m_qed_breit_wheeler_pos_product |
| std::string | m_qed_breit_wheeler_pos_product_name |
| int | m_qed_quantum_sync_phot_product |
| std::string | m_qed_quantum_sync_phot_product_name |
| amrex::Vector< amrex::FArrayBox > | local_rho |
| amrex::Vector< amrex::FArrayBox > | local_jx |
| amrex::Vector< amrex::FArrayBox > | local_jy |
| amrex::Vector< amrex::FArrayBox > | local_jz |
| TmpParticles | tmp_particle_data |
Private Member Functions | |
| virtual void | particlePostLocate (ParticleType &p, const amrex::ParticleLocData &pld, const int lev) override |
WarpXParticleContainer is the base polymorphic class from which all concrete particle container classes (that store a collection of particles) derive. Derived classes can be used for plasma particles, photon particles, or non-physical particles (e.g., for the laser antenna). It derives from amrex::ParticleContainer<0,0,PIdx::nattribs>, where the template arguments stand for the number of int and amrex::Real SoA and AoS data in amrex::Particle.
WarpXParticleContainer contains the main functions for initialization, interaction with the grid (field gather and current deposition) and particle push.
Note: many functions are pure virtual (meaning they MUST be defined in derived classes, e.g., Evolve) or actual functions (e.g. CurrentDeposition).
| using WarpXParticleContainer::DiagnosticParticleData = amrex::StructOfArrays<DiagIdx::nattribs, 0> |
| using WarpXParticleContainer::DiagnosticParticles = amrex::Vector<std::map<std::pair<int, int>, DiagnosticParticleData> > |
| using WarpXParticleContainer::PairIndex = std::pair<int, int> |
| using WarpXParticleContainer::TmpParticles = amrex::Vector<std::map<PairIndex, TmpParticleTile> > |
| using WarpXParticleContainer::TmpParticleTile = std::array<amrex::Gpu::DeviceVector<amrex::ParticleReal>, TmpIdx::nattribs> |
| WarpXParticleContainer::WarpXParticleContainer | ( | amrex::AmrCore * | amr_core, |
| int | ispecies | ||
| ) |
|
inlinevirtual |
|
inline |
| void WarpXParticleContainer::AddNParticles | ( | int | lev, |
| int | n, | ||
| const amrex::ParticleReal * | x, | ||
| const amrex::ParticleReal * | y, | ||
| const amrex::ParticleReal * | z, | ||
| const amrex::ParticleReal * | vx, | ||
| const amrex::ParticleReal * | vy, | ||
| const amrex::ParticleReal * | vz, | ||
| int | nattr, | ||
| const amrex::ParticleReal * | attr, | ||
| int | uniqueparticles, | ||
| amrex::Long | id = -1 |
||
| ) |
|
inline |
| void WarpXParticleContainer::AllocData | ( | ) |
|
inlinenoexcept |
| void WarpXParticleContainer::ApplyBoundaryConditions | ( | ) |
Apply particle BC.
| [in] | boundary_conditions | Type of boundary conditions. For now, only absorbing or none are supported |
|
static |
|
inlinevirtual |
Reimplemented in PhysicalParticleContainer.
|
inlinevirtual |
Reimplemented in PhysicalParticleContainer, and LaserParticleContainer.
|
inlinevirtual |
Reimplemented in PhysicalParticleContainer.
|
noexcept |
When using runtime components, AMReX requires to touch all tiles in serial and create particles tiles with runtime components if they do not exist (or if they were defined by default, i.e., without runtime component).
| void WarpXParticleContainer::DepositCharge | ( | amrex::Vector< std::unique_ptr< amrex::MultiFab > > & | rho, |
| const bool | local = false, |
||
| const bool | reset = false, |
||
| const bool | do_rz_volume_scaling = false, |
||
| const bool | interpolate_across_levels = true, |
||
| const int | icomp = 0 |
||
| ) |
Deposit charge density.
| [in,out] | rho | vector of charge densities (one pointer to MultiFab per mesh refinement level) |
| [in] | local | if false, exchange the data in the guard cells after the deposition |
| [in] | reset | if true, reset all values of rho to zero |
| [in] | do_rz_volume_scaling | whether to scale the final density by some volume norm in RZ geometry |
| [in] | interpolate_across_levels | whether to average down from the fine patch to the coarse patch |
| [in] | icomp | component of the MultiFab where rho is deposited (old, new) |
|
virtual |
Reimplemented in PhotonParticleContainer.
| void WarpXParticleContainer::DepositCurrent | ( | amrex::Vector< std::array< std::unique_ptr< amrex::MultiFab >, 3 > > & | J, |
| const amrex::Real | dt, | ||
| const amrex::Real | relative_t | ||
| ) |
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 (is used when temporarily modifying the particle positions, either within the Esirkepov or when relative_t is different than 0 |
| [in] | relative_t | Time at which to deposit J, relative to the time of the current positions of the particles (expressed as a fraction of dt). When different than 0, the particle position will be temporarily modified to match the time of the deposition. |
|
virtual |
Reimplemented in PhotonParticleContainer.
|
inline |
|
inline |
|
inline |
|
pure virtual |
Evolve is the central WarpXParticleContainer function that advances particles for a time dt (typically one timestep). It is a pure virtual function for flexibility.
Implemented in PhysicalParticleContainer, RigidInjectedParticleContainer, LaserParticleContainer, and PhotonParticleContainer.
|
inline |
|
inline |
| std::unique_ptr< MultiFab > WarpXParticleContainer::GetChargeDensity | ( | int | lev, |
| bool | local = false |
||
| ) |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinevirtual |
Reimplemented in PhysicalParticleContainer.
|
inlinevirtual |
Reimplemented in PhysicalParticleContainer.
|
inlinevirtual |
Reimplemented in PhysicalParticleContainer.
|
pure virtual |
Implemented in PhysicalParticleContainer, RigidInjectedParticleContainer, LaserParticleContainer, and PhotonParticleContainer.
| Real WarpXParticleContainer::maxParticleVelocity | ( | bool | local = false | ) |
| std::array< Real, 3 > WarpXParticleContainer::meanParticleVelocity | ( | bool | local = false | ) |
|
overrideprivatevirtual |
|
pure virtual |
Implemented in PhysicalParticleContainer, and LaserParticleContainer.
|
pure virtual |
This pushes the particle momenta by dt.
Implemented in PhysicalParticleContainer, RigidInjectedParticleContainer, PhotonParticleContainer, and LaserParticleContainer.
| void WarpXParticleContainer::PushX | ( | amrex::Real | dt | ) |
This pushes the particle positions by one half time step. It is used to desynchronize the particles after initializaton or when restarting from a checkpoint.
| void WarpXParticleContainer::PushX | ( | int | lev, |
| amrex::Real | dt | ||
| ) |
|
pure virtual |
Implemented in RigidInjectedParticleContainer, PhysicalParticleContainer, and LaserParticleContainer.
|
static |
|
inlinevirtual |
Virtual method to resample the species. Overriden by PhysicalParticleContainer only. Empty body is here because making the method purely virtual would mean that we need to override the method for every derived class. Note that in practice this function is never called because resample() is only called for PhysicalParticleContainers.
Reimplemented in PhysicalParticleContainer.
|
inlineprotectedvirtual |
Reimplemented in PhysicalParticleContainer.
|
inlineprotectedvirtual |
Reimplemented in PhysicalParticleContainer.
| Real WarpXParticleContainer::sumParticleCharge | ( | bool | local = false | ) |
This returns the total charge for all the particles in this ParticleContainer. This is needed when solving Poisson's equation with periodic boundary conditions.
|
inlinevirtual |
Reimplemented in LaserParticleContainer.
|
pure virtual |
Implemented in RigidInjectedParticleContainer, PhysicalParticleContainer, and LaserParticleContainer.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| bool WarpXParticleContainer::do_splitting = false |
| bool WarpXParticleContainer::initialize_self_fields = false |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
instead of depositing (current, charge) on the finest patch level, deposit to the coarsest grid
|
protected |
instead of gathering fields from the finest patch level, gather from the coarsest
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| friend WarpXParticleContainer::MultiParticleContainer |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| int WarpXParticleContainer::self_fields_max_iters = 200 |
| amrex::Real WarpXParticleContainer::self_fields_required_precision |
| int WarpXParticleContainer::self_fields_verbosity = 2 |
|
protected |
| int WarpXParticleContainer::split_type = 0 |
|
protected |
1.8.13