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

Class for handling particle-mesh operations with AMR. More...

#include <CD_EBAMRParticleMesh.H>

Public Member Functions

 EBAMRParticleMesh ()
 Default constructor. Leaves object in undefined state and thus requires the user to call define.
 
 EBAMRParticleMesh (const Vector< RefCountedPtr< EBLevelGrid > > &a_eblgs, const Vector< int > &a_refRat, const Vector< Real > &a_dx, const RealVect &a_probLo, const int &a_ghost, const int a_finestLevel)
 Full constructor. Calls the define function.
 
virtual ~EBAMRParticleMesh ()
 Destructor (does nothing)
 
void define (const Vector< RefCountedPtr< EBLevelGrid > > &a_eblgs, const Vector< int > &a_refRat, const Vector< Real > &a_dx, const RealVect &a_probLo, const int &a_ghost, const int a_finestLevel)
 Define function.
 
template<class P , class Ret , Ret(P::*)() const MemberFunc>
void deposit (EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const CoarseFineDeposition a_coarseFineDeposition, const bool a_forceIrregNGP=false)
 Class for deposition of particles of a type P to the mesh. This is the main function that users should call.
 
template<class P , class Ret , Ret(P::*)() MemberFunc>
void interpolate (ParticleContainer< P > &a_particles, const EBAMRCellData &a_meshData, const DepositionType a_interpType, const bool a_forceIrregNGP=false) const
 Interpolate a scalar field onto the particle position.
 
Vector< RefCountedPtr< EBCoarseFineParticleMesh > > & getEBCoarseFineParticleMesh () const
 Get buffers for handling deposition over refinement boundaries.
 
const EBParticleMeshgetEBParticleMesh (const int a_lvl, const DataIndex &a_dit) const
 Get EBParticleMesh deposition/interpolation object for specified grid patch.
 

Protected Member Functions

void defineLevelMotion ()
 Define level copiers.
 
void defineCoarseFineMotion ()
 Define coarse-fine data motion operators.
 
void defineEBParticleMesh ()
 Define EBParticleMesh objects.
 
void defineOuterHaloMasks ()
 Define the outer halo masks.
 
void defineTransitionMasks ()
 Define the coarse-fine transition masks.
 
int getTransitionMaskWidth (const DepositionType a_depositionType, const int a_refRat) const
 Get transition mask width.
 
template<class P , class Ret , Ret(P::*)() const MemberFunc>
void depositInterp (EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const bool a_forceIrregNGP=false)
 Deposit particles on the mesh, interpolating the coarse-grid invalid mass to the fine grid.

 
template<class P , class Ret , Ret(P::*)() const MemberFunc>
void depositHalo (EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const bool a_forceIrregNGP=false)
 Deposit particles on the mesh, keeping the original particle width everywhere and depositing directly into every level.
 
template<class P , class Ret , Ret(P::*)() const MemberFunc>
void depositHaloNGP (EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const bool a_forceIrregNGP=false)
 Deposit particles on the mesh, using an NGP scheme for coarse-grid particles on the refinement boundary.
 
template<class P , class Ret , Ret(P::*)() const MemberFunc>
void depositTransition (EBAMRCellData &a_meshData, const ParticleContainer< P > &a_particles, const DepositionType a_depositionType, const bool a_forceIrregNGP=false)
 Deposit particles on the mesh.
 
template<class P >
void transferMaskParticlesTransition (ParticleContainer< P > &a_particles, const DepositionType a_depositionType) const
 Support function for transferring particles that lie in the transition zone around a refinement boundary.
 

Protected Attributes

bool m_isDefined
 Is defined or not.
 
bool m_verbose
 Verbose or not.
 
RealVect m_probLo
 Lower-left corner of physical domain.
 
int m_ghost
 Number of ghost cells.
 
int m_finestLevel
 Finest AMR level.
 
Vector< RefCountedPtr< EBLevelGrid > > m_eblgs
 Grids on each level.
 
Vector< intm_refRat
 Refinement ratios between levels.
 
Vector< Realm_dx
 Grid resolutions.
 
Vector< RefCountedPtr< LayoutData< EBParticleMesh > > > m_ebParticleMesh
 Regular particle-mesh object on each grid level.
 
Vector< RefCountedPtr< LayoutData< EBParticleMesh > > > m_ebParticleMeshFiCo
 Special particle-mesh objects for depositing on the coarsened fine grid.
 
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > m_validCells
 Valid grid cells.
 
std::map< int, Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > > m_outerHaloMasks
 Outer halo masks with various widths.
 
std::map< int, Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > > m_transitionMasks
 Transition masks with various widths.
 
Vector< RefCountedPtr< EBCoarseFineParticleMesh > > m_coarseFinePM
 Buffers for handling arithmetic for mass moving from coarse to fine level and vice versa.
 
Vector< Copierm_levelCopiers
 Copier for moving data from valid+ghost to valid on each AMR level.
 

Detailed Description

Class for handling particle-mesh operations with AMR.

This class contains templated functions for depositing particles with AMR. When depositing, the user must specify the deposition type (e.g., CIC) as well as how to handle coarse-fine boundary conditions and cut-cell deposition. Because of the many degrees of freedom in depositing particles with AMR (and EB), the user must expect to preprocess his particle data before solving. There are several ways deposition works through this class:

When specifying CoarseFineDeposition::Interp, the deposition is done by first depositing the data as usual on both levels. On the fine level, there may be mass that hangs over the refinement boundaries; that mass is added to the coarse level. On the coarse level some of the particles will deposit mass into cells that are covered by a finer level; that mass is interpolated with piece-wise constant interpolation and then added to the fine level.

When specifying CoarseFineDeposition::Halo, the handling of the coarse-side deposition is different. The mass from the fine-level particles that hangs over the refinement boundaries is put on the coarse mesh. However, the coarse-level particles are deposited in two separate steps so that the coarse-level particles have the same physical widths on the coarse and fine levels. We first deposit ALL the coarse-level particles on the coarse level. Some of these particles (halo particles) will have clouds that overlap with the fine level. We take the set of these particles and deposit them directly onto the fine level (via buffers) with 2x or 4x the original particle width (depending on the refinement ratios between the levels). Essentially, this differs CoarseFineDeposition::Interp in the sense that the original particle width is maintained on the fine level.

When specifying CoarseFineDeposition::HaloNGP, the particles whose deposition clouds hang over the refinement boundary are deposited on the fine level, and the ghosted mass is then added to the coarse side. Particles that live on the coarse side of a refinement boundary are deposited using an NGP scheme.

When specifying CoarseFineDeposition::Transition, the particles immediately on the coarse-side of the refinement boundary deposit with the fine-grid particle width.

Constructor & Destructor Documentation

◆ EBAMRParticleMesh()

EBAMRParticleMesh::EBAMRParticleMesh ( const Vector< RefCountedPtr< EBLevelGrid > > &  a_eblgs,
const Vector< int > &  a_refRat,
const Vector< Real > &  a_dx,
const RealVect a_probLo,
const int a_ghost,
const int  a_finestLevel 
)

Full constructor. Calls the define function.

Parameters
[in]a_eblgsGrids
[in]a_refRatRefinement factory between levels
[in]a_dxGrid resolutions. @πaram[in] a_probLo Lower-left corner of physical domain.
[in]a_ghostGhost cells in data holders.
[in]a_finestLevelFinest grid level

Member Function Documentation

◆ define()

void EBAMRParticleMesh::define ( const Vector< RefCountedPtr< EBLevelGrid > > &  a_eblgs,
const Vector< int > &  a_refRat,
const Vector< Real > &  a_dx,
const RealVect a_probLo,
const int a_ghost,
const int  a_finestLevel 
)

Define function.

Parameters
[in]a_eblgsGrids
[in]a_refRatRefinement factory between levels
[in]a_dxGrid resolutions. @πaram[in] a_probLo Lower-left corner of physical domain.
[in]a_ghostGhost cells in data holders.
[in]a_finestLevelFinest grid level

◆ defineCoarseFineMotion()

void EBAMRParticleMesh::defineCoarseFineMotion ( )
protected

Define coarse-fine data motion operators.

This defines the necessary constructors for

◆ defineLevelMotion()

void EBAMRParticleMesh::defineLevelMotion ( )
protected

Define level copiers.

Note
This defines the Copiers we need to move data from valid+ghost to valid on each level.

◆ deposit()

template<class P , class Ret , Ret(P::*)() const MemberFunc>
void EBAMRParticleMesh::deposit ( EBAMRCellData a_meshData,
const ParticleContainer< P > &  a_particles,
const DepositionType  a_depositionType,
const CoarseFineDeposition  a_coarseFineDeposition,
const bool  a_forceIrregNGP = false 
)

Class for deposition of particles of a type P to the mesh. This is the main function that users should call.

P is the particle type, Ret is the returned value of the particle member function, and must be a Real or a RealVect. MemFunc is a pointer to a member function of P. E.g., deposit<P, const RealVect&, &P::position>.

Parameters
[out]a_meshDataMesh data. Must have exactly one compnent. @πaram[in] a_particles Particle container. Must be in "usable state" for deposition.
[in]a_depositionTypeSpecification of deposition kernel (e.g., CIC)
[in]a_coarseFineDepositionSpecification of handling of coarse-fine boundaries.
[in]a_forceIrregNGPForce NGP deposition in irregular cells or not.
Note
When using certain types of coarseFineDeposition methods – the user may need to fill the mask particles before calling this routine.

◆ depositHalo()

template<class P , class Ret , Ret(P::*)() const MemberFunc>
void EBAMRParticleMesh::depositHalo ( EBAMRCellData a_meshData,
const ParticleContainer< P > &  a_particles,
const DepositionType  a_depositionType,
const bool  a_forceIrregNGP = false 
)
protected

Deposit particles on the mesh, keeping the original particle width everywhere and depositing directly into every level.

Parameters
[out]a_meshDataMesh data.
[in]a_particlesParticle container. Must be in "usable state" for deposition.
[in]a_depositionTypeSpecification of deposition kernel (e.g., CIC)
[in]a_forceIrregNGPForce NGP deposition in irregular cells or not.

◆ depositHaloNGP()

template<class P , class Ret , Ret(P::*)() const MemberFunc>
void EBAMRParticleMesh::depositHaloNGP ( EBAMRCellData a_meshData,
const ParticleContainer< P > &  a_particles,
const DepositionType  a_depositionType,
const bool  a_forceIrregNGP = false 
)
protected

Deposit particles on the mesh, using an NGP scheme for coarse-grid particles on the refinement boundary.

Parameters
[out]a_meshDataMesh data.
[in]a_particlesParticle container. Must be in "usable state" for deposition.
[in]a_depositionTypeSpecification of deposition kernel (e.g., CIC)
[in]a_forceIrregNGPForce NGP deposition in irregular cells or not.

◆ depositInterp()

template<class P , class Ret , Ret(P::*)() const MemberFunc>
void EBAMRParticleMesh::depositInterp ( EBAMRCellData a_meshData,
const ParticleContainer< P > &  a_particles,
const DepositionType  a_depositionType,
const bool  a_forceIrregNGP = false 
)
protected

Deposit particles on the mesh, interpolating the coarse-grid invalid mass to the fine grid.

Parameters
[out]a_meshDataMesh data.
[in]a_particlesParticle container. Must be in "usable state" for deposition.
[in]a_depositionTypeSpecification of deposition kernel (e.g., CIC)
[in]a_forceIrregNGPForce NGP deposition in irregular cells or not.

◆ depositTransition()

template<class P , class Ret , Ret(P::*)() const MemberFunc>
void EBAMRParticleMesh::depositTransition ( EBAMRCellData a_meshData,
const ParticleContainer< P > &  a_particles,
const DepositionType  a_depositionType,
const bool  a_forceIrregNGP = false 
)
protected

Deposit particles on the mesh.

In this version the particles abutting the refinement boundary from the coarse side are deposited with the fine-grid resolution.

Parameters
[out]a_meshDataMesh data.
[in]a_particlesParticle container. Must be in "usable state" for deposition.
[in]a_depositionTypeSpecification of deposition kernel (e.g., CIC)
[in]a_forceIrregNGPForce NGP deposition in irregular cells or not.

◆ getEBCoarseFineParticleMesh()

Vector< RefCountedPtr< EBCoarseFineParticleMesh > > & EBAMRParticleMesh::getEBCoarseFineParticleMesh ( ) const

Get buffers for handling deposition over refinement boundaries.

Returns
The buffer for handling mass transfer between level lvl and level lvl+1 lives on lvl+1.

◆ getEBParticleMesh()

const EBParticleMesh & EBAMRParticleMesh::getEBParticleMesh ( const int  a_lvl,
const DataIndex a_dit 
) const

Get EBParticleMesh deposition/interpolation object for specified grid patch.

This routine is used for when users want to interpolate on a per-patch basis. This is useful when the user has written his interpolation functions on a per-patch basis. I fail to see any other reason where this routine is useful.

Parameters
[in]a_lvlGrid level
[in]a_ditGrid index

◆ getTransitionMaskWidth()

int EBAMRParticleMesh::getTransitionMaskWidth ( const DepositionType  a_depositionType,
const int  a_refRat 
) const
protected

Get transition mask width.

Used when depositing with a transition zone.

Parameters
[in]a_depositionTypeDeposition type
[in]a_refRatRefinement ratio between levels

◆ interpolate()

template<class P , class Ret , Ret(P::*)() MemberFunc>
void EBAMRParticleMesh::interpolate ( ParticleContainer< P > &  a_particles,
const EBAMRCellData a_meshData,
const DepositionType  a_interpType,
const bool  a_forceIrregNGP = false 
) const

Interpolate a scalar field onto the particle position.

P is the particle type, Ret is the returned value of the particle member function, and must be a Real or a RealVect. MemFunc is a pointer to a member function of P. E.g., interpolate<P, RealVect&, &P::position>.

Parameters
[in,out]a_particlesParticles to be interpolated.
[in]a_meshDataMesh data
[in]a_interpTypeInterpolation type.
[in]a_forceIrregNGPForce NGP interpolation in cut-cells.

◆ transferMaskParticlesTransition()

template<class P >
void EBAMRParticleMesh::transferMaskParticlesTransition ( ParticleContainer< P > &  a_particles,
const DepositionType  a_depositionType 
) const
protected

Support function for transferring particles that lie in the transition zone around a refinement boundary.

Parameters
[in,out]a_particlesInput particles
[in]a_depositionTypeDeposition type.

Member Data Documentation

◆ m_coarseFinePM

Vector<RefCountedPtr<EBCoarseFineParticleMesh> > EBAMRParticleMesh::m_coarseFinePM
mutableprotected

Buffers for handling arithmetic for mass moving from coarse to fine level and vice versa.

Note
The buffer for handling mass transfer between level lvl and level lvl+1 lives on lvl+1.

◆ m_ebParticleMeshFiCo

Vector<RefCountedPtr<LayoutData<EBParticleMesh> > > EBAMRParticleMesh::m_ebParticleMeshFiCo
protected

Special particle-mesh objects for depositing on the coarsened fine grid.

These are deposition/interpolation objects defined on the refined coarse grid. They are used when we need to deposit coarse-grid particles on the fine grid.

◆ m_levelCopiers

Vector<Copier> EBAMRParticleMesh::m_levelCopiers
mutableprotected

Copier for moving data from valid+ghost to valid on each AMR level.

Note
After depositing on a level, this is used in order to add data from the ghost cells to the valid region.

◆ m_outerHaloMasks

std::map<int, Vector<RefCountedPtr<LevelData<BaseFab<bool> > > > > EBAMRParticleMesh::m_outerHaloMasks
protected

Outer halo masks with various widths.

These masks are true on the coarse side on the refinement boundary.

Note
We have purposefully undefined the mask in patches where the mask is always false. This means that one should never call the copy function with this mask.

◆ m_transitionMasks

std::map<int, Vector<RefCountedPtr<LevelData<BaseFab<bool> > > > > EBAMRParticleMesh::m_transitionMasks
protected

Transition masks with various widths.

These masks are true in the fine-grid ghost cells on the coarse-side of the refinement boundary.

Note
We have purposefully undefined the mask in patches where the mask is always false. This means that one should never call the copy function with this mask.

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