|
chombo-discharge
|
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. | |
Deposits/interpolates ParticleSoA leaves on a single patch, with embedded-boundary (cut-cell) awareness.
|
inline |
Full constructor; calls define.
| [in] | a_domain | Computational domain. |
| [in] | a_region | Cell-centered valid box. |
| [in] | a_ebisbox | EBIS box. |
| [in] | a_dx | Grid resolution. |
| [in] | a_probLo | Lower-left corner of the computational domain. |
|
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.
| [in] | a_position | Particle position. |
| [in] | a_particleWidth | Cloud width per direction (in cells). |
|
inline |
Define function.
| [in] | a_domain | Computational domain. |
| [in] | a_region | Cell-centered valid box. |
| [in] | a_ebisbox | EBIS box. |
| [in] | a_dx | Grid resolution. |
| [in] | a_probLo | Lower-left corner of the computational domain. |
|
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.
| Members | Pack of payload data-member pointers selecting the column(s) to deposit. |
| P | Payload type (deduced). |
| Traits | Column descriptor (deduced). |
| [in,out] | a_meshData | Mesh data (INCREMENTED). Needs at least a_comp+sizeof...(Members) components. |
| [in] | a_comp | First destination mesh component. |
| [in] | a_particles | Particles to deposit. |
| [in] | a_depositionType | Deposition kernel (NGP/CIC/TSC). |
| [in] | a_widthScale | Particle-width multiplier. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
inline |
Deposit payload columns onto the first mesh components (a_comp == 0).
| Members | Pack of payload data-member pointers selecting the column(s) to deposit. |
| P | Payload type (deduced). |
| Traits | Column descriptor (deduced). |
| [in,out] | a_meshData | Mesh data (INCREMENTED). |
| [in] | a_particles | Particles to deposit. |
| [in] | a_depositionType | Deposition kernel (NGP/CIC/TSC). |
| [in] | a_widthScale | Particle-width multiplier. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
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.
| P | Payload type. |
| Traits | Column descriptor. |
| StrengthFn | Callable (std::size_t i, Real* out) filling out[0..numComp). |
| [in,out] | a_meshData | Mesh data (INCREMENTED). |
| [in] | a_comp | First destination mesh component. |
| [in] | a_particles | Particles to deposit. |
| [in] | a_numComp | Number of components to deposit (1 or SpaceDim). |
| [in] | a_depositionType | Deposition kernel. |
| [in] | a_widthScale | Particle-width multiplier. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
| [in] | a_gather | Strength gatherer (promotes column values to Real). |
|
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.
| P | Payload type of the ParticleSoA. |
| Traits | Column descriptor of P. |
| GatherFunc | Callable (std::size_t a_i, Real* a_out) writing the particle's deposited value. |
| [in,out] | a_meshData | Mesh data (INCREMENTED). Must have at least a_comp+1 components. |
| [in] | a_comp | Destination mesh component. |
| [in] | a_particles | Particles to deposit. |
| [in] | a_depositionType | Deposition kernel (NGP/CIC/TSC). |
| [in] | a_widthScale | Particle-width multiplier. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
| [in] | a_gather | Per-particle value gatherer. |
|
inlineprotectednoexcept |
CIC deposition of one particle.
| [in,out] | a_rho | Mesh data. |
| [in] | a_comp | First destination mesh component. |
| [in] | a_position | Particle position. |
| [in] | a_particleWidth | Particle width (relative to grid resolution). |
| [in] | a_volumeFactor | Volume factor. |
| [in] | a_strength | Per-component strength to deposit. |
| [in] | a_numComp | Number of components. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
inlineprotectednoexcept |
NGP deposition of one particle.
| [in,out] | a_rho | Mesh data. |
| [in] | a_comp | First destination mesh component. |
| [in] | a_position | Particle position. |
| [in] | a_volumeFactor | Volume factor. |
| [in] | a_strength | Per-component strength to deposit. |
| [in] | a_numComp | Number of components. |
|
inlineprotectednoexcept |
TSC deposition of one particle.
| [in,out] | a_rho | Mesh data. |
| [in] | a_comp | First destination mesh component. |
| [in] | a_position | Particle position. |
| [in] | a_particleWidth | Particle width (relative to grid resolution). |
| [in] | a_volumeFactor | Volume factor. |
| [in] | a_strength | Per-component strength to deposit. |
| [in] | a_numComp | Number of components. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
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().
| P | Payload type of the ParticleSoA. |
| Traits | Column descriptor of P. |
| [in,out] | a_meshData | Mesh data (INCREMENTED). Must have at least a_comp+1 components. |
| [in] | a_comp | Destination mesh component. |
| [in] | a_particles | Particles to deposit. |
| [in] | a_depositionType | Deposition kernel (NGP/CIC/TSC). |
| [in] | a_widthScale | Particle-width multiplier. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
inline |
Deposit the weight column onto the first mesh component (a_comp == 0).
| P | Payload type of the ParticleSoA. |
| Traits | Column descriptor of P. |
| [in,out] | a_meshData | Mesh data (INCREMENTED). |
| [in] | a_particles | Particles to deposit. |
| [in] | a_depositionType | Deposition kernel (NGP/CIC/TSC). |
| [in] | a_widthScale | Particle-width multiplier. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
inline |
Interpolate the first mesh components (a_comp == 0) onto payload columns.
| Members | Pack of payload data-member pointers selecting the target column(s). |
| P | Payload type (deduced). |
| Traits | Column descriptor (deduced). |
| [in,out] | a_particles | Particles whose target columns are overwritten. |
| [in] | a_meshData | Mesh data. |
| [in] | a_interpType | Interpolation kernel (NGP/CIC/TSC). |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
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.
| Members | Pack of payload data-member pointers selecting the target column(s). |
| P | Payload type (deduced). |
| Traits | Column descriptor (deduced). |
| [in,out] | a_particles | Particles whose target columns are overwritten. |
| [in] | a_meshData | Mesh data. Needs at least a_comp+sizeof...(Members) components. |
| [in] | a_comp | First source mesh component. |
| [in] | a_interpType | Interpolation kernel (NGP/CIC/TSC). |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
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.
| P | Payload type. |
| Traits | Column descriptor. |
| ScatterFn | Callable (std::size_t i, const Real* in) writing in[0..numComp) to columns. |
| [in,out] | a_particles | Particles whose target columns are overwritten. |
| [in] | a_meshData | Mesh data. |
| [in] | a_comp | First source mesh component. |
| [in] | a_numComp | Number of components (1 or SpaceDim). |
| [in] | a_interpType | Interpolation kernel. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
| [in] | a_scatter | Result scatterer (demotes Real to the column type). |
|
inlineprotectednoexcept |
CIC interpolation onto one particle.
| [out] | a_particleField | Per-component field to fill. |
| [in] | a_meshData | Mesh data. |
| [in] | a_comp | First source mesh component. |
| [in] | a_validBox | Box in which CIC is valid. |
| [in] | a_gatherBox | Read stencil box. |
| [in] | a_position | Particle position. |
| [in] | a_numComp | Number of components. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
inlineprotectednoexcept |
NGP interpolation onto one particle.
| [out] | a_particleField | Per-component field to fill. |
| [in] | a_meshData | Mesh data. |
| [in] | a_comp | First source mesh component. |
| [in] | a_position | Particle position. |
| [in] | a_numComp | Number of components. |
|
inlineprotectednoexcept |
TSC interpolation onto one particle.
| [out] | a_particleField | Per-component field to fill. |
| [in] | a_meshData | Mesh data. |
| [in] | a_comp | First source mesh component. |
| [in] | a_validBox | Box in which TSC is valid. |
| [in] | a_gatherBox | Read stencil box. |
| [in] | a_position | Particle position. |
| [in] | a_numComp | Number of components. |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
inline |
Interpolate the first mesh component (a_comp == 0) onto the weight column.
| P | Payload type of the ParticleSoA. |
| Traits | Column descriptor of P. |
| [in,out] | a_particles | Particles whose weight column is overwritten. |
| [in] | a_meshData | Mesh data. |
| [in] | a_interpType | Interpolation kernel (NGP/CIC/TSC). |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
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().
| P | Payload type of the ParticleSoA. |
| Traits | Column descriptor of P. |
| [in,out] | a_particles | Particles whose weight column is overwritten. |
| [in] | a_meshData | Mesh data. Must have at least a_comp+1 components. |
| [in] | a_comp | Source mesh component. |
| [in] | a_interpType | Interpolation kernel (NGP/CIC/TSC). |
| [in] | a_forceIrregNGP | Force NGP in cut cells. |
|
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.