WarpX
Typedefs | Functions
ParticleUtils Namespace Reference

Typedefs

using ParticleType = typename WarpXParticleContainer::ParticleType
 
using ParticleTileType = typename WarpXParticleContainer::ParticleTileType
 
using ParticleTileDataType = typename ParticleTileType::ParticleTileDataType
 
using ParticleBins = DenseBins< ParticleTileDataType >
 
using index_type = typename ParticleBins::index_type
 

Functions

ParticleBins findParticlesInEachCell (int lev, amrex::MFIter const &mfi, WarpXParticleContainer::ParticleTileType &ptile)
 Find the particles and count the particles that are in each cell. More specifically this function returns an amrex::DenseBins object containing an offset array and a permutation array which can be used to loop over all the cells in a tile and apply an algorithm to particles of a given species present in each cell. Note that this does not rearrange particle arrays. More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE void getEnergy (amrex::ParticleReal const u2, double const mass, double &energy)
 Return (relativistic) particle energy given velocity and mass. Note the use of double since this calculation is prone to error with single precision. More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE void getCollisionEnergy (amrex::ParticleReal const u2, double const m, double const M, double &gamma, double &energy)
 Return (relativistic) collision energy assuming the target (with mass M) is stationary and the projectile is approaching with the the given speed and mass m. Note the use of double since this calculation is prone to error with single precision. More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE void doLorentzTransform (amrex::ParticleReal &ux, amrex::ParticleReal &uy, amrex::ParticleReal &uz, amrex::ParticleReal const Vx, amrex::ParticleReal const Vy, amrex::ParticleReal const Vz)
 Perform a Lorentz transformation of the given velocity to a frame moving with velocity (Vx, Vy, Vz) relative to the present one. More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE void getRandomVector (amrex::ParticleReal &x, amrex::ParticleReal &y, amrex::ParticleReal &z, amrex::RandomEngine const &engine)
 Generate random unit vector in 3 dimensions https://mathworld.wolfram.com/SpherePointPicking.html. More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE void RandomizeVelocity (amrex::ParticleReal &ux, amrex::ParticleReal &uy, amrex::ParticleReal &uz, const amrex::ParticleReal vp, amrex::RandomEngine const &engine)
 Function to perform scattering of a particle that results in a random velocity vector with given magnitude. This is used in isotropic collision events. More...
 
AMREX_GPU_HOST_DEVICE AMREX_INLINE bool containsInclusive (amrex::RealBox const &tilebox, amrex::XDim3 const point)
 

Typedef Documentation

◆ index_type

◆ ParticleBins

◆ ParticleTileDataType

using ParticleUtils::ParticleTileDataType = typedef typename ParticleTileType::ParticleTileDataType

◆ ParticleTileType

◆ ParticleType

Function Documentation

◆ containsInclusive()

AMREX_GPU_HOST_DEVICE AMREX_INLINE bool ParticleUtils::containsInclusive ( amrex::RealBox const &  tilebox,
amrex::XDim3 const  point 
)

◆ doLorentzTransform()

AMREX_GPU_HOST_DEVICE AMREX_INLINE void ParticleUtils::doLorentzTransform ( amrex::ParticleReal &  ux,
amrex::ParticleReal &  uy,
amrex::ParticleReal &  uz,
amrex::ParticleReal const  Vx,
amrex::ParticleReal const  Vy,
amrex::ParticleReal const  Vz 
)

Perform a Lorentz transformation of the given velocity to a frame moving with velocity (Vx, Vy, Vz) relative to the present one.

Parameters
[in,out]ux,uy,uzcomponents of velocity vector in the current frame - importantly these quantities are gamma * velocity
[in]Vx,Vy,Vzvelocity of the new frame relative to the current one, NOT gamma*velocity!

◆ findParticlesInEachCell()

ParticleBins ParticleUtils::findParticlesInEachCell ( int  lev,
amrex::MFIter const &  mfi,
WarpXParticleContainer::ParticleTileType ptile 
)

Find the particles and count the particles that are in each cell. More specifically this function returns an amrex::DenseBins object containing an offset array and a permutation array which can be used to loop over all the cells in a tile and apply an algorithm to particles of a given species present in each cell. Note that this does not rearrange particle arrays.

Parameters
[in]levthe index of the refinement level.
[in]mfithe MultiFAB iterator.
[in]ptilethe particle tile.

◆ getCollisionEnergy()

AMREX_GPU_HOST_DEVICE AMREX_INLINE void ParticleUtils::getCollisionEnergy ( amrex::ParticleReal const  u2,
double const  m,
double const  M,
double &  gamma,
double &  energy 
)

Return (relativistic) collision energy assuming the target (with mass M) is stationary and the projectile is approaching with the the given speed and mass m. Note the use of double since this calculation is prone to error with single precision.

Parameters
[in]u2square of particle speed (i.e. u dot u where u = gamma*v)
[in]m,Mmass of projectile and target, respectively
[out]gammarelativistic factor of the particle
[out]energyparticle energy in eV

◆ getEnergy()

AMREX_GPU_HOST_DEVICE AMREX_INLINE void ParticleUtils::getEnergy ( amrex::ParticleReal const  u2,
double const  mass,
double &  energy 
)

Return (relativistic) particle energy given velocity and mass. Note the use of double since this calculation is prone to error with single precision.

Parameters
[in]u2square of particle speed (i.e. u dot u where u = gamma*v)
[in]massparticle mass
[out]energyparticle energy in eV

◆ getRandomVector()

AMREX_GPU_HOST_DEVICE AMREX_INLINE void ParticleUtils::getRandomVector ( amrex::ParticleReal &  x,
amrex::ParticleReal &  y,
amrex::ParticleReal &  z,
amrex::RandomEngine const &  engine 
)

Generate random unit vector in 3 dimensions https://mathworld.wolfram.com/SpherePointPicking.html.

Parameters
[out]xx-component of resulting random vector
[out]yy-component of resulting random vector
[out]zz-component of resulting random vector
[in]enginethe random-engine

◆ RandomizeVelocity()

AMREX_GPU_HOST_DEVICE AMREX_INLINE void ParticleUtils::RandomizeVelocity ( amrex::ParticleReal &  ux,
amrex::ParticleReal &  uy,
amrex::ParticleReal &  uz,
const amrex::ParticleReal  vp,
amrex::RandomEngine const &  engine 
)

Function to perform scattering of a particle that results in a random velocity vector with given magnitude. This is used in isotropic collision events.

Parameters
[in,out]ux,uy,uzcolliding particle's velocity
[in]vpvelocity magnitude of the colliding particle after collision.
[in]enginethe random-engine