chombo-discharge
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EBParticleMesh Class Reference

Deposits/interpolates ParticleSoA leaves on a single patch, with embedded-boundary (cut-cell) awareness. More...

#include <CD_EBParticleMesh.H>

Public Member Functions

 EBParticleMesh ()
 Default constructor. Must subsequently call define.
 
 EBParticleMesh (const ProblemDomain &a_domain, const Box &a_region, const EBISBox &a_ebisbox, const RealVect &a_dx, const RealVect &a_probLo)
 Full constructor; calls define.
 
void define (const ProblemDomain &a_domain, const Box &a_region, const EBISBox &a_ebisbox, const RealVect &a_dx, const RealVect &a_probLo)
 Define function.
 
template<typename P , typename Traits >
void depositWeight (EBCellFAB &a_meshData, const int a_comp, const ParticleSoA< P, Traits > &a_particles, const DepositionType a_depositionType, const Real a_widthScale, const bool a_forceIrregNGP) const
 Deposit the container-owned weight column onto mesh component a_comp.
 
template<typename P , typename Traits >
void depositWeight (EBCellFAB &a_meshData, const ParticleSoA< P, Traits > &a_particles, const DepositionType a_depositionType, const Real a_widthScale, const bool a_forceIrregNGP) const
 Deposit the weight column onto the first mesh component (a_comp == 0).
 
template<auto... Members, typename P , typename Traits >
void deposit (EBCellFAB &a_meshData, const int a_comp, const ParticleSoA< P, Traits > &a_particles, const DepositionType a_depositionType, const Real a_widthScale, const bool a_forceIrregNGP) const
 Deposit one or more payload columns onto mesh components [a_comp, a_comp + nColumns).
 
template<auto... Members, typename P , typename Traits >
void deposit (EBCellFAB &a_meshData, const ParticleSoA< P, Traits > &a_particles, const DepositionType a_depositionType, const Real a_widthScale, const bool a_forceIrregNGP) const
 Deposit payload columns onto the first mesh components (a_comp == 0).
 
template<typename P , typename Traits , typename GatherFunc >
void depositGathered (EBCellFAB &a_meshData, const int a_comp, const ParticleSoA< P, Traits > &a_particles, const DepositionType a_depositionType, const Real a_widthScale, const bool a_forceIrregNGP, GatherFunc &&a_gather) const
 Deposit a custom per-particle scalar (computed by a_gather) onto mesh component a_comp.
 
template<auto... Members, typename P , typename Traits >
void interpolate (ParticleSoA< P, Traits > &a_particles, const EBCellFAB &a_meshData, const int a_comp, const DepositionType a_interpType, const bool a_forceIrregNGP) const
 Interpolate mesh components [a_comp, a_comp + nColumns) onto one or more payload columns.
 
template<auto... Members, typename P , typename Traits >
void interpolate (ParticleSoA< P, Traits > &a_particles, const EBCellFAB &a_meshData, const DepositionType a_interpType, const bool a_forceIrregNGP) const
 Interpolate the first mesh components (a_comp == 0) onto payload columns.
 
template<typename P , typename Traits >
void interpolateWeight (ParticleSoA< P, Traits > &a_particles, const EBCellFAB &a_meshData, const int a_comp, const DepositionType a_interpType, const bool a_forceIrregNGP) const
 Interpolate mesh component a_comp onto the container-owned weight column.
 
template<typename P , typename Traits >
void interpolateWeight (ParticleSoA< P, Traits > &a_particles, const EBCellFAB &a_meshData, const DepositionType a_interpType, const bool a_forceIrregNGP) const
 Interpolate the first mesh component (a_comp == 0) onto the weight column.
 

Protected Member Functions

template<typename P , typename Traits , typename StrengthFn >
void depositCore (EBCellFAB &a_meshData, const int a_comp, const ParticleSoA< P, Traits > &a_particles, const int a_numComp, const DepositionType a_depositionType, const Real a_widthScale, const bool a_forceIrregNGP, StrengthFn a_gather) const
 Shared deposition loop: gathers each particle's strength via a_gather, then calls the storage-agnostic per-particle kernel for the selected deposition type.
 
template<typename P , typename Traits , typename ScatterFn >
void interpolateCore (ParticleSoA< P, Traits > &a_particles, const EBCellFAB &a_meshData, const int a_comp, const int a_numComp, const DepositionType a_interpType, const bool a_forceIrregNGP, ScatterFn a_scatter) const
 Shared interpolation loop: calls the storage-agnostic per-particle kernel into a stack scratch, then scatters the result into the selected column(s) via a_scatter.
 
void depositParticleNGP (EBCellFAB &a_rho, const int a_comp, const RealVect &a_position, const Real &a_volumeFactor, const Real *a_strength, const int &a_numComp) const noexcept
 NGP deposition of one particle.
 
Box cloudBox (const RealVect &a_position, const RealVect &a_particleWidth) const noexcept
 Cell box that exactly covers the support of a cloud of the given per-direction width.
 
void depositParticleCIC (EBCellFAB &a_rho, const int a_comp, const RealVect &a_position, const RealVect &a_particleWidth, const Real &a_volumeFactor, const Real *a_strength, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
 CIC deposition of one particle.
 
void depositParticleTSC (EBCellFAB &a_rho, const int a_comp, const RealVect &a_position, const RealVect &a_particleWidth, const Real &a_volumeFactor, const Real *a_strength, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
 TSC deposition of one particle.
 
void interpolateParticleNGP (Real *a_particleField, const EBCellFAB &a_meshData, const int a_comp, const RealVect &a_position, const int &a_numComp) const noexcept
 NGP interpolation onto one particle.
 
void interpolateParticleCIC (Real *a_particleField, const EBCellFAB &a_meshData, const int a_comp, const Box &a_validBox, const Box &a_gatherBox, const RealVect &a_position, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
 CIC interpolation onto one particle.
 
void interpolateParticleTSC (Real *a_particleField, const EBCellFAB &a_meshData, const int a_comp, const Box &a_validBox, const Box &a_gatherBox, const RealVect &a_position, const int &a_numComp, const bool a_forceIrregNGP) const noexcept
 TSC interpolation onto one particle.
 

Protected Attributes

ProblemDomain m_domain
 Computational domain.
 
bool m_verbose
 Verbose flag.
 
Box m_region
 Cell-centered valid box.
 
const EBISBox * m_ebisbox = nullptr
 Non-owning alias to the caller's EBIS box.
 
RealVect m_dx
 Grid resolution.
 
RealVect m_probLo
 Lower-left corner of the computational domain.
 

Detailed Description

Deposits/interpolates ParticleSoA leaves on a single patch, with embedded-boundary (cut-cell) awareness.

Constructor & Destructor Documentation

◆ EBParticleMesh()

EBParticleMesh::EBParticleMesh ( const ProblemDomain &  a_domain,
const Box &  a_region,
const EBISBox &  a_ebisbox,
const RealVect &  a_dx,
const RealVect &  a_probLo 
)
inline

Full constructor; calls define.

Parameters
[in]a_domainComputational domain.
[in]a_regionCell-centered valid box.
[in]a_ebisboxEBIS box.
[in]a_dxGrid resolution.
[in]a_probLoLower-left corner of the computational domain.

Member Function Documentation

◆ cloudBox()

Box EBParticleMesh::cloudBox ( const RealVect &  a_position,
const RealVect &  a_particleWidth 
) const
inlineprotectednoexcept

Cell box that exactly covers the support of a cloud of the given per-direction width.

Anchored at the cloud's lower/upper edge cells, so the iterated box contains ONLY the cells the cloud can overlap (cells outside it have zero weight and would be wasted scatter updates). For the standard widths this is 2 cells/dir (CIC) or 3 (TSC), versus the over-provisioned centered 3^D/5^D box; the weight clamp still zeroes any boundary cell, so the deposited field is bit-identical.

Parameters
[in]a_positionParticle position.
[in]a_particleWidthCloud width per direction (in cells).
Returns
Cell box covering the cloud support.

◆ define()

void EBParticleMesh::define ( const ProblemDomain &  a_domain,
const Box &  a_region,
const EBISBox &  a_ebisbox,
const RealVect &  a_dx,
const RealVect &  a_probLo 
)
inline

Define function.

Parameters
[in]a_domainComputational domain.
[in]a_regionCell-centered valid box.
[in]a_ebisboxEBIS box.
[in]a_dxGrid resolution.
[in]a_probLoLower-left corner of the computational domain.

◆ deposit() [1/2]

template<auto... Members, typename P , typename Traits >
void EBParticleMesh::deposit ( EBCellFAB &  a_meshData,
const int  a_comp,
const ParticleSoA< P, Traits > &  a_particles,
const DepositionType  a_depositionType,
const Real  a_widthScale,
const bool  a_forceIrregNGP 
) const
inline

Deposit one or more payload columns onto mesh components [a_comp, a_comp + nColumns).

nColumns = sizeof...(Members) (1 = scalar, SpaceDim = vector). The selected columns map to consecutive mesh components starting at a_comp.

Template Parameters
MembersPack of payload data-member pointers selecting the column(s) to deposit.
PPayload type (deduced).
TraitsColumn descriptor (deduced).
Parameters
[in,out]a_meshDataMesh data (INCREMENTED). Needs at least a_comp+sizeof...(Members) components.
[in]a_compFirst destination mesh component.
[in]a_particlesParticles to deposit.
[in]a_depositionTypeDeposition kernel (NGP/CIC/TSC).
[in]a_widthScaleParticle-width multiplier.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ deposit() [2/2]

template<auto... Members, typename P , typename Traits >
void EBParticleMesh::deposit ( EBCellFAB &  a_meshData,
const ParticleSoA< P, Traits > &  a_particles,
const DepositionType  a_depositionType,
const Real  a_widthScale,
const bool  a_forceIrregNGP 
) const
inline

Deposit payload columns onto the first mesh components (a_comp == 0).

Template Parameters
MembersPack of payload data-member pointers selecting the column(s) to deposit.
PPayload type (deduced).
TraitsColumn descriptor (deduced).
Parameters
[in,out]a_meshDataMesh data (INCREMENTED).
[in]a_particlesParticles to deposit.
[in]a_depositionTypeDeposition kernel (NGP/CIC/TSC).
[in]a_widthScaleParticle-width multiplier.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ depositCore()

template<typename P , typename Traits , typename StrengthFn >
void EBParticleMesh::depositCore ( EBCellFAB &  a_meshData,
const int  a_comp,
const ParticleSoA< P, Traits > &  a_particles,
const int  a_numComp,
const DepositionType  a_depositionType,
const Real  a_widthScale,
const bool  a_forceIrregNGP,
StrengthFn  a_gather 
) const
inlineprotected

Shared deposition loop: gathers each particle's strength via a_gather, then calls the storage-agnostic per-particle kernel for the selected deposition type.

Template Parameters
PPayload type.
TraitsColumn descriptor.
StrengthFnCallable (std::size_t i, Real* out) filling out[0..numComp).
Parameters
[in,out]a_meshDataMesh data (INCREMENTED).
[in]a_compFirst destination mesh component.
[in]a_particlesParticles to deposit.
[in]a_numCompNumber of components to deposit (1 or SpaceDim).
[in]a_depositionTypeDeposition kernel.
[in]a_widthScaleParticle-width multiplier.
[in]a_forceIrregNGPForce NGP in cut cells.
[in]a_gatherStrength gatherer (promotes column values to Real).

◆ depositGathered()

template<typename P , typename Traits , typename GatherFunc >
void EBParticleMesh::depositGathered ( EBCellFAB &  a_meshData,
const int  a_comp,
const ParticleSoA< P, Traits > &  a_particles,
const DepositionType  a_depositionType,
const Real  a_widthScale,
const bool  a_forceIrregNGP,
GatherFunc &&  a_gather 
) const
inline

Deposit a custom per-particle scalar (computed by a_gather) onto mesh component a_comp.

Generalizes depositWeight() to an arbitrary per-particle value – e.g. a product of columns such as weight*mobility (conductivity), which is not a single payload column. a_gather is the same (index, out) functor depositCore() uses internally; exactly one component is deposited.

Template Parameters
PPayload type of the ParticleSoA.
TraitsColumn descriptor of P.
GatherFuncCallable (std::size_t a_i, Real* a_out) writing the particle's deposited value.
Parameters
[in,out]a_meshDataMesh data (INCREMENTED). Must have at least a_comp+1 components.
[in]a_compDestination mesh component.
[in]a_particlesParticles to deposit.
[in]a_depositionTypeDeposition kernel (NGP/CIC/TSC).
[in]a_widthScaleParticle-width multiplier.
[in]a_forceIrregNGPForce NGP in cut cells.
[in]a_gatherPer-particle value gatherer.

◆ depositParticleCIC()

void EBParticleMesh::depositParticleCIC ( EBCellFAB &  a_rho,
const int  a_comp,
const RealVect &  a_position,
const RealVect &  a_particleWidth,
const Real &  a_volumeFactor,
const Real *  a_strength,
const int &  a_numComp,
const bool  a_forceIrregNGP 
) const
inlineprotectednoexcept

CIC deposition of one particle.

Parameters
[in,out]a_rhoMesh data.
[in]a_compFirst destination mesh component.
[in]a_positionParticle position.
[in]a_particleWidthParticle width (relative to grid resolution).
[in]a_volumeFactorVolume factor.
[in]a_strengthPer-component strength to deposit.
[in]a_numCompNumber of components.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ depositParticleNGP()

void EBParticleMesh::depositParticleNGP ( EBCellFAB &  a_rho,
const int  a_comp,
const RealVect &  a_position,
const Real &  a_volumeFactor,
const Real *  a_strength,
const int &  a_numComp 
) const
inlineprotectednoexcept

NGP deposition of one particle.

Parameters
[in,out]a_rhoMesh data.
[in]a_compFirst destination mesh component.
[in]a_positionParticle position.
[in]a_volumeFactorVolume factor.
[in]a_strengthPer-component strength to deposit.
[in]a_numCompNumber of components.

◆ depositParticleTSC()

void EBParticleMesh::depositParticleTSC ( EBCellFAB &  a_rho,
const int  a_comp,
const RealVect &  a_position,
const RealVect &  a_particleWidth,
const Real &  a_volumeFactor,
const Real *  a_strength,
const int &  a_numComp,
const bool  a_forceIrregNGP 
) const
inlineprotectednoexcept

TSC deposition of one particle.

Parameters
[in,out]a_rhoMesh data.
[in]a_compFirst destination mesh component.
[in]a_positionParticle position.
[in]a_particleWidthParticle width (relative to grid resolution).
[in]a_volumeFactorVolume factor.
[in]a_strengthPer-component strength to deposit.
[in]a_numCompNumber of components.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ depositWeight() [1/2]

template<typename P , typename Traits >
void EBParticleMesh::depositWeight ( EBCellFAB &  a_meshData,
const int  a_comp,
const ParticleSoA< P, Traits > &  a_particles,
const DepositionType  a_depositionType,
const Real  a_widthScale,
const bool  a_forceIrregNGP 
) const
inline

Deposit the container-owned weight column onto mesh component a_comp.

weight is a mandatory column, not a payload member, so it has its own entry point (see the class documentation). Equivalent to deposit() but gathers from weightColumn().

Template Parameters
PPayload type of the ParticleSoA.
TraitsColumn descriptor of P.
Parameters
[in,out]a_meshDataMesh data (INCREMENTED). Must have at least a_comp+1 components.
[in]a_compDestination mesh component.
[in]a_particlesParticles to deposit.
[in]a_depositionTypeDeposition kernel (NGP/CIC/TSC).
[in]a_widthScaleParticle-width multiplier.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ depositWeight() [2/2]

template<typename P , typename Traits >
void EBParticleMesh::depositWeight ( EBCellFAB &  a_meshData,
const ParticleSoA< P, Traits > &  a_particles,
const DepositionType  a_depositionType,
const Real  a_widthScale,
const bool  a_forceIrregNGP 
) const
inline

Deposit the weight column onto the first mesh component (a_comp == 0).

Template Parameters
PPayload type of the ParticleSoA.
TraitsColumn descriptor of P.
Parameters
[in,out]a_meshDataMesh data (INCREMENTED).
[in]a_particlesParticles to deposit.
[in]a_depositionTypeDeposition kernel (NGP/CIC/TSC).
[in]a_widthScaleParticle-width multiplier.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ interpolate() [1/2]

template<auto... Members, typename P , typename Traits >
void EBParticleMesh::interpolate ( ParticleSoA< P, Traits > &  a_particles,
const EBCellFAB &  a_meshData,
const DepositionType  a_interpType,
const bool  a_forceIrregNGP 
) const
inline

Interpolate the first mesh components (a_comp == 0) onto payload columns.

Template Parameters
MembersPack of payload data-member pointers selecting the target column(s).
PPayload type (deduced).
TraitsColumn descriptor (deduced).
Parameters
[in,out]a_particlesParticles whose target columns are overwritten.
[in]a_meshDataMesh data.
[in]a_interpTypeInterpolation kernel (NGP/CIC/TSC).
[in]a_forceIrregNGPForce NGP in cut cells.

◆ interpolate() [2/2]

template<auto... Members, typename P , typename Traits >
void EBParticleMesh::interpolate ( ParticleSoA< P, Traits > &  a_particles,
const EBCellFAB &  a_meshData,
const int  a_comp,
const DepositionType  a_interpType,
const bool  a_forceIrregNGP 
) const
inline

Interpolate mesh components [a_comp, a_comp + nColumns) onto one or more payload columns.

nColumns = sizeof...(Members) (1 = scalar, SpaceDim = vector). Consecutive mesh components starting at a_comp are read into the selected columns.

Template Parameters
MembersPack of payload data-member pointers selecting the target column(s).
PPayload type (deduced).
TraitsColumn descriptor (deduced).
Parameters
[in,out]a_particlesParticles whose target columns are overwritten.
[in]a_meshDataMesh data. Needs at least a_comp+sizeof...(Members) components.
[in]a_compFirst source mesh component.
[in]a_interpTypeInterpolation kernel (NGP/CIC/TSC).
[in]a_forceIrregNGPForce NGP in cut cells.

◆ interpolateCore()

template<typename P , typename Traits , typename ScatterFn >
void EBParticleMesh::interpolateCore ( ParticleSoA< P, Traits > &  a_particles,
const EBCellFAB &  a_meshData,
const int  a_comp,
const int  a_numComp,
const DepositionType  a_interpType,
const bool  a_forceIrregNGP,
ScatterFn  a_scatter 
) const
inlineprotected

Shared interpolation loop: calls the storage-agnostic per-particle kernel into a stack scratch, then scatters the result into the selected column(s) via a_scatter.

Template Parameters
PPayload type.
TraitsColumn descriptor.
ScatterFnCallable (std::size_t i, const Real* in) writing in[0..numComp) to columns.
Parameters
[in,out]a_particlesParticles whose target columns are overwritten.
[in]a_meshDataMesh data.
[in]a_compFirst source mesh component.
[in]a_numCompNumber of components (1 or SpaceDim).
[in]a_interpTypeInterpolation kernel.
[in]a_forceIrregNGPForce NGP in cut cells.
[in]a_scatterResult scatterer (demotes Real to the column type).

◆ interpolateParticleCIC()

void EBParticleMesh::interpolateParticleCIC ( Real *  a_particleField,
const EBCellFAB &  a_meshData,
const int  a_comp,
const Box &  a_validBox,
const Box &  a_gatherBox,
const RealVect &  a_position,
const int &  a_numComp,
const bool  a_forceIrregNGP 
) const
inlineprotectednoexcept

CIC interpolation onto one particle.

Parameters
[out]a_particleFieldPer-component field to fill.
[in]a_meshDataMesh data.
[in]a_compFirst source mesh component.
[in]a_validBoxBox in which CIC is valid.
[in]a_gatherBoxRead stencil box.
[in]a_positionParticle position.
[in]a_numCompNumber of components.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ interpolateParticleNGP()

void EBParticleMesh::interpolateParticleNGP ( Real *  a_particleField,
const EBCellFAB &  a_meshData,
const int  a_comp,
const RealVect &  a_position,
const int &  a_numComp 
) const
inlineprotectednoexcept

NGP interpolation onto one particle.

Parameters
[out]a_particleFieldPer-component field to fill.
[in]a_meshDataMesh data.
[in]a_compFirst source mesh component.
[in]a_positionParticle position.
[in]a_numCompNumber of components.

◆ interpolateParticleTSC()

void EBParticleMesh::interpolateParticleTSC ( Real *  a_particleField,
const EBCellFAB &  a_meshData,
const int  a_comp,
const Box &  a_validBox,
const Box &  a_gatherBox,
const RealVect &  a_position,
const int &  a_numComp,
const bool  a_forceIrregNGP 
) const
inlineprotectednoexcept

TSC interpolation onto one particle.

Parameters
[out]a_particleFieldPer-component field to fill.
[in]a_meshDataMesh data.
[in]a_compFirst source mesh component.
[in]a_validBoxBox in which TSC is valid.
[in]a_gatherBoxRead stencil box.
[in]a_positionParticle position.
[in]a_numCompNumber of components.
[in]a_forceIrregNGPForce NGP in cut cells.

◆ interpolateWeight() [1/2]

template<typename P , typename Traits >
void EBParticleMesh::interpolateWeight ( ParticleSoA< P, Traits > &  a_particles,
const EBCellFAB &  a_meshData,
const DepositionType  a_interpType,
const bool  a_forceIrregNGP 
) const
inline

Interpolate the first mesh component (a_comp == 0) onto the weight column.

Template Parameters
PPayload type of the ParticleSoA.
TraitsColumn descriptor of P.
Parameters
[in,out]a_particlesParticles whose weight column is overwritten.
[in]a_meshDataMesh data.
[in]a_interpTypeInterpolation kernel (NGP/CIC/TSC).
[in]a_forceIrregNGPForce NGP in cut cells.

◆ interpolateWeight() [2/2]

template<typename P , typename Traits >
void EBParticleMesh::interpolateWeight ( ParticleSoA< P, Traits > &  a_particles,
const EBCellFAB &  a_meshData,
const int  a_comp,
const DepositionType  a_interpType,
const bool  a_forceIrregNGP 
) const
inline

Interpolate mesh component a_comp onto the container-owned weight column.

weight is a mandatory column, not a payload member, so it has its own entry point (the interpolation mirror of depositWeight). Equivalent to interpolate() but scatters into weight().

Template Parameters
PPayload type of the ParticleSoA.
TraitsColumn descriptor of P.
Parameters
[in,out]a_particlesParticles whose weight column is overwritten.
[in]a_meshDataMesh data. Must have at least a_comp+1 components.
[in]a_compSource mesh component.
[in]a_interpTypeInterpolation kernel (NGP/CIC/TSC).
[in]a_forceIrregNGPForce NGP in cut cells.

Member Data Documentation

◆ m_ebisbox

const EBISBox* EBParticleMesh::m_ebisbox = nullptr
protected

Non-owning alias to the caller's EBIS box.

Deliberately a pointer, not a value. EBParticleMesh is constructed per grid patch in the deposition/interpolation hot loops, so storing the EBISBox by value would copy-assign its EBGraph/EBData PIMPL handles on every construction. EBISBox is PIMPL (EBGraph/EBData each hold a RefCountedPtr to their *Implem), so that copy is shallow – but RefCountedPtr::operator= is guarded by a single global OpenMP critical section (RCPAssign) (plus atomic refcount traffic on the shared, e.g. all-regular, *Implem). In OpenMP builds that serialises the per-patch loop on that global lock; aliasing the EBISBox (which is owned by the EBISLayout and outlives this transient helper) avoids the copy entirely. In pure-MPI builds the difference is negligible, but the alias is strictly cheaper.


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