chombo-discharge
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
ParticleOps Class Reference

A shallow static class for doing various kinds of particle-related operations. More...

#include <CD_ParticleOps.H>

Static Public Member Functions

static IntVect getParticleCellIndex (const RealVect &a_particlePosition, const RealVect &a_probLo, const Real &a_dx) noexcept
 Get the cell index corresponding to the particle position.
 
static IntVect getParticleCellIndex (const RealVect &a_particlePosition, const RealVect &a_probLo, const RealVect &a_dx) noexcept
 Get the cell index corresponding to the particle position.
 
template<typename P , typename Traits >
static void getPhysicalParticlesPerCell (EBAMRCellData &a_ppc, const ParticleContainer< P, Traits > &a_src) noexcept
 Get the number of physical particles per cell (SoA overload).
 
template<typename P , typename Traits >
static void getComputationalParticlesPerCell (EBAMRCellData &a_ppc, const ParticleContainer< P, Traits > &a_src) noexcept
 Get the number of computational particles per cell (SoA overload).
 
static IntVect getParticleGridCell (const RealVect &a_particlePosition, const RealVect &a_probLo, const RealVect &a_dx) noexcept
 Get the grid cell where the particle lives.
 
static bool domainIntersection (const RealVect &a_oldPos, const RealVect &a_newPos, const RealVect &a_probLo, const RealVect &a_probHi, Real &a_s)
 Compute the intersection point between a particle path and a domain side.
 
static bool ebIntersectionBisect (const RefCountedPtr< BaseIF > &a_impFunc, const RealVect &a_oldPos, const RealVect &a_newPos, const Real &a_bisectStep, Real &a_s)
 Compute the intersection point between a particle path and an implicit function using a bisection algorithm.
 
static bool ebIntersectionRaycast (const RefCountedPtr< BaseIF > &a_impFunc, const RealVect &a_oldPos, const RealVect &a_newPos, const Real &a_tolerance, Real &a_s)
 Compute the intersection point between a particle path and an implicit function using a ray-casting algorithm.
 
template<typename P , typename Traits >
static void copyDestructive (ParticleContainer< P, Traits > &a_dst, ParticleContainer< P, Traits > &a_src) noexcept
 Move all particles from a_src into a_dst (per leaf), emptying a_src. SoA overload.
 
template<typename P , typename Traits >
static Real sum (const ParticleContainer< P, Traits > &a_particles) noexcept
 Global sum of the container-owned weight column (SoA overload).
 
template<typename P , typename Traits >
static void setData (ParticleContainer< P, Traits > &a_particles, const std::function< void(ParticleSoA< P, Traits > &, std::size_t)> &a_functor) noexcept
 Set value function for SoA containers. Lets the user set particle parameters via a (leaf, index) callback.
 

Detailed Description

A shallow static class for doing various kinds of particle-related operations.

Member Function Documentation

◆ copyDestructive()

template<typename P , typename Traits >
void ParticleOps::copyDestructive ( ParticleContainer< P, Traits > &  a_dst,
ParticleContainer< P, Traits > &  a_src 
)
inlinestaticnoexcept

Move all particles from a_src into a_dst (per leaf), emptying a_src. SoA overload.

Both containers must be defined over the same grids. Per patch, a_dst's leaf is replaced by a_src's (via clear + catenate – an O(1) arena swap when a_dst's leaf is empty), and a_src is emptied.

Parameters
[in,out]a_dstDestination container (its leaves are overwritten).
[in,out]a_srcSource container (emptied).
Template Parameters
PPayload type.
TraitsColumn descriptor for the payload.

◆ domainIntersection()

bool ParticleOps::domainIntersection ( const RealVect &  a_oldPos,
const RealVect &  a_newPos,
const RealVect &  a_probLo,
const RealVect &  a_probHi,
Real &  a_s 
)
inlinestatic

Compute the intersection point between a particle path and a domain side.

If the particle crossed the domain side, the output argument a_s determines the intersection point by x(s) = x0 + s*(x1-x0) where x0 is the starting position (a_oldPos), x1 is the end position (a_newPos), and x(s) is the intersection point with the boundary.

Parameters
[in]a_oldPosParticle starting position
[in]a_newPosParticle end position
[in]a_probLoLower-left corner in physical coordinates
[in]a_probHiUpper-right corner in physical coordinates
[out]a_sRelative length along the path
Returns
Returns true if the particle crossed the domain boundary.

◆ ebIntersectionBisect()

bool ParticleOps::ebIntersectionBisect ( const RefCountedPtr< BaseIF > &  a_impFunc,
const RealVect &  a_oldPos,
const RealVect &  a_newPos,
const Real &  a_bisectStep,
Real &  a_s 
)
inlinestatic

Compute the intersection point between a particle path and an implicit function using a bisection algorithm.

This routine will bisect the particle path into intervals of length a_bisectStep. Each interval is examined for a crossing with the implicit function and if the particle crossed the into the EB, the output argument a_s determines the intersection point by x(s) = x0 + s*(x1-x0) where x0 is the starting position (a_oldPos), x1 is the end position (a_newPos), and x(s) is the intersection point with the geometry.

Parameters
[in]a_impFuncImplicit function.
[in]a_oldPosParticle starting position
[in]a_newPosParticle end position
[in]a_bisectStepBisection step length
[out]a_sRelative length along the path
Returns
Returns true if the particle crossed into the EB.

◆ ebIntersectionRaycast()

bool ParticleOps::ebIntersectionRaycast ( const RefCountedPtr< BaseIF > &  a_impFunc,
const RealVect &  a_oldPos,
const RealVect &  a_newPos,
const Real &  a_tolerance,
Real &  a_s 
)
inlinestatic

Compute the intersection point between a particle path and an implicit function using a ray-casting algorithm.

This routine will assume that a_impcFunc is an approximation to the signed distance function and compute the intersection point using ray-marching. Starting on the starting position we compute the distance to the EB and move the particle the compute distance along the particle trajectory. If the particle comes too close to the EB (within a_tolerance) we consider it to be absorbed. In that case the output argument a_s determines the intersection point by x(s) = x0 + s*(x1-x0) where x0 is the starting position (a_oldPos), x1 is the end position (a_newPos), and x(s) is the intersection point with the geometry.

Parameters
[in]a_impFuncImplicit function.
[in]a_oldPosParticle starting position
[in]a_newPosParticle end position
[out]a_sRelative length along the path
Returns
Returns true if the particle crossed into the EB.
Parameters
[in]a_toleranceTolerance

◆ getComputationalParticlesPerCell()

template<typename P , typename Traits >
void ParticleOps::getComputationalParticlesPerCell ( EBAMRCellData &  a_ppc,
const ParticleContainer< P, Traits > &  a_src 
)
inlinestaticnoexcept

Get the number of computational particles per cell (SoA overload).

Parameters
[out]a_ppcComputational particles per cell.
[in]a_srcSoA particle source container.
Template Parameters
PPayload type.
TraitsColumn descriptor for the payload.

◆ getParticleCellIndex() [1/2]

IntVect ParticleOps::getParticleCellIndex ( const RealVect &  a_particlePosition,
const RealVect &  a_probLo,
const Real &  a_dx 
)
inlinestaticnoexcept

Get the cell index corresponding to the particle position.

Parameters
[in]a_particlePositionParticle position
[in]a_probLoLower-left corner of computational domain
[in]a_dxGrid resolution
Returns
Particle cell index

◆ getParticleCellIndex() [2/2]

IntVect ParticleOps::getParticleCellIndex ( const RealVect &  a_particlePosition,
const RealVect &  a_probLo,
const RealVect &  a_dx 
)
inlinestaticnoexcept

Get the cell index corresponding to the particle position.

Parameters
[in]a_particlePositionParticle position
[in]a_probLoLower-left corner of computational domain
[in]a_dxGrid resolution
Returns
Particle cell index

◆ getParticleGridCell()

IntVect ParticleOps::getParticleGridCell ( const RealVect &  a_particlePosition,
const RealVect &  a_probLo,
const RealVect &  a_dx 
)
inlinestaticnoexcept

Get the grid cell where the particle lives.

Parameters
[in]a_particlePositionPhysical particle position
[in]a_probLoLower-left physical corner of simulation domain
[in]a_dxGrid resolution.
Returns
Particle grid cell

◆ getPhysicalParticlesPerCell()

template<typename P , typename Traits >
void ParticleOps::getPhysicalParticlesPerCell ( EBAMRCellData &  a_ppc,
const ParticleContainer< P, Traits > &  a_src 
)
inlinestaticnoexcept

Get the number of physical particles per cell (SoA overload).

Sums the container-owned weight column into a_ppc, deposited NGP by grid cell.

Parameters
[out]a_ppcPhysical particles per cell.
[in]a_srcSoA particle source container.
Template Parameters
PPayload type.
TraitsColumn descriptor for the payload.

◆ setData()

template<typename P , typename Traits >
void ParticleOps::setData ( ParticleContainer< P, Traits > &  a_particles,
const std::function< void(ParticleSoA< P, Traits > &, std::size_t)> &  a_functor 
)
inlinestaticnoexcept

Set value function for SoA containers. Lets the user set particle parameters via a (leaf, index) callback.

Parameters
[in,out]a_particlesParticles
[in]a_functorCallback (leaf, index) for setting particle values via payload columns
Template Parameters
PPayload type of the container.
TraitsColumn descriptor for the payload.

◆ sum()

template<typename P , typename Traits >
Real ParticleOps::sum ( const ParticleContainer< P, Traits > &  a_particles)
inlinestaticnoexcept

Global sum of the container-owned weight column (SoA overload).

Parameters
[in]a_particlesSoA particles.
Returns
Global (MPI-reduced) sum of all valid particle weights.
Template Parameters
PPayload type.
TraitsColumn descriptor for the payload.

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