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

Class which can interpolate ghost cells across the coarse-fine interface. To select an interpolation method, use the type argument. More...

#include <CD_EBGhostCellInterpolator.H>

Public Types

enum  Type { PWC , MinMod , MonotonizedCentral , Superbee }
 Type of interpolation slopes supported.
 

Public Member Functions

 EBGhostCellInterpolator () noexcept
 Weak constructor. Need to call define afterwards.
 
 EBGhostCellInterpolator (const EBGhostCellInterpolator &a_other)=delete
 Disallowed copy constructor.
 
 EBGhostCellInterpolator (const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoFi, const EBLevelGrid &a_eblgCoar, const IntVect &a_ghostVector, const int a_refRat, const int a_ghostCF) noexcept
 Full constructor. Calls the define function.
 
virtual ~EBGhostCellInterpolator () noexcept
 Destructor (does nothing)
 
virtual void define (const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoFi, const EBLevelGrid &a_eblgCoar, const IntVect &a_ghostVector, const int a_refRat, const int a_ghostCF) noexcept
 Define method. Puts object in usable state.
 
virtual void interpolate (LevelData< EBCellFAB > &a_phiFine, const LevelData< EBCellFAB > &a_phiCoar, const Interval a_variables, const Type a_interpType) const noexcept
 Do inhomogeneous interpolation.
 

Protected Member Functions

virtual void defineGhostRegions () noexcept
 Define ghost regions to be interpolated.
 
virtual void defineBuffers () noexcept
 Define buffers.
 
virtual void interpolateRegular (FArrayBox &a_phiFine, const FArrayBox &a_phiCoar, const DataIndex &a_dit, const int a_fineVar, const int a_coarVar, const Type a_interpType) const noexcept
 Regular interpolation, as if the EB was not there.
 
virtual void interpolateIrregular (EBCellFAB &a_phiFine, const EBCellFAB &a_phiCoar, const DataIndex &a_dit, const int a_fineVar, const int a_coarVar, const Type a_interpType) const noexcept
 Ghost cell interpolation near the EB, correcting slopes that broke in interpolateRegular.
 

Static Protected Member Functions

static Real minmod (const Real &dwl, const Real &dwr) noexcept
 minmod slope function.
 
static Real superbee (const Real &dwl, const Real &dwr) noexcept
 Superbee slope limiter.
 
static Real monotonizedCentral (const Real &dwl, const Real &dwr) noexcept
 Monotonized central difference slope limiter.
 

Protected Attributes

bool m_isDefined
 Is defined or not.
 
EBLevelGrid m_eblgFine
 Fine grids.
 
EBLevelGrid m_eblgCoar
 Coarse grids.
 
EBLevelGrid m_eblgCoFi
 Coarsened fine grids.
 
IntVect m_ghostVector
 Minimum number of ghost cells in input data.
 
int m_refRat
 Refinement factor between fine and coarse level.
 
int m_ghostCF
 Number of ghost cells to fill across coarse-fine interface.
 
LayoutData< std::map< std::pair< int, Side::LoHiSide >, Box > > m_regularGhostRegions
 Regular ghost regions to be interpolated.
 
Copier m_copier
 Copier for making copying from m_eblgCoar to m_grownCoarData go faster.
 
LevelData< EBCellFAB > m_coarsenedFineData
 Buffer holding the coarse-grid data on the coarsened fine grids.
 
LayoutData< BaseIVFAB< VolIndex > > m_coarsenedFineGhosts
 List of coarse-grid cells that appear through coarsening a fine-grid ghost cell.
 
LayoutData< VoFIterator > m_fineIrregCells
 Fine-grid ghost cells on the coarse-fine interface that overlap an irregular coarse cell.
 
LayoutData< VoFIterator > m_coarIrregCells
 Coarse-grid cells on the caorse-side of the interface that are irregular cells.
 
LayoutData< BaseIVFAB< Real > > m_coarIrregSlopes
 Buffer data defined on the coarsened fine grids (over m_coarIrregCells). Used for holding slopes in the coarse-grid cut-cells.
 

Detailed Description

Class which can interpolate ghost cells across the coarse-fine interface. To select an interpolation method, use the type argument.

This class works by computing slopes on the coarse grid. We then interpolate within the coarse-grid cell to the fine-grid ghost cell, using the computed slopes. Note that all fine-grid ghost cells are interpolated from the coarse grid. Thus, this interpolator is useless for multigrid.

Constructor & Destructor Documentation

◆ EBGhostCellInterpolator()

EBGhostCellInterpolator::EBGhostCellInterpolator ( const EBLevelGrid &  a_eblgFine,
const EBLevelGrid &  a_eblgCoFi,
const EBLevelGrid &  a_eblgCoar,
const IntVect &  a_ghostVector,
const int  a_refRat,
const int  a_ghostCF 
)
noexcept

Full constructor. Calls the define function.

Parameters
[in]a_eblgFineFine grids
[in]a_eblgCoFiCoarsened fine grids
[in]a_eblgCoarCoarse grids
[in]a_ghostVector(Minimum) number of ghost cells in input/output data.
[in]a_refRatRefinement ratio between coarse and fine grids.
[in]a_ghostCFWidth of the ghost region to be filled. Only relevant near the EBCF.

Member Function Documentation

◆ define()

void EBGhostCellInterpolator::define ( const EBLevelGrid &  a_eblgFine,
const EBLevelGrid &  a_eblgCoFi,
const EBLevelGrid &  a_eblgCoar,
const IntVect &  a_ghostVector,
const int  a_refRat,
const int  a_ghostCF 
)
virtualnoexcept

Define method. Puts object in usable state.

Parameters
[in]a_eblgFineFine grids
[in]a_eblgCoFiCoarsened fine grids
[in]a_eblgCoarCoarse grids
[in]a_ghostVector(Minimum) number of ghost cells in input/output data.
[in]a_refRatRefinement ratio between coarse and fine grids.
[in]a_ghostCFWidth of the ghost region to be filled. Only relevant near the EBCF.

◆ interpolate()

void EBGhostCellInterpolator::interpolate ( LevelData< EBCellFAB > &  a_phiFine,
const LevelData< EBCellFAB > &  a_phiCoar,
const Interval  a_variables,
const Type  a_interpType 
) const
virtualnoexcept

Do inhomogeneous interpolation.

This fills the fine-grid ghost cells that lie across the coarse-fine interface, interpolating them from the coarse grid. The coarse data is fetched into an internal buffer on the coarsened fine grids, so a_phiCoar's own ghost cells are not read and need not be valid.

Note
This routine does not exchange, and on return a_phiFine's ghost cells are not consistent. Two separate things are left to the caller. First, the ghost cells that are covered by a neighbouring patch on the fine level are not part of the coarse-fine region and are never filled here. Second, some of those cells are actively overwritten with interpolated values, because the interpolated region is stored as the bounding box of the coarse-fine ghost cells rather than as the cell set itself, and that box spans neighbour-owned cells whenever the set is not rectangular. The caller must therefore exchange a_phiFine before anything reads its ghost cells.
Parameters
[in,out]a_phiFineFine phi
[in]a_phiCoarCoarse phi
[in]a_variablesVariables to interpolate
[in]a_interpTypeInterp type

◆ interpolateIrregular()

void EBGhostCellInterpolator::interpolateIrregular ( EBCellFAB &  a_phiFine,
const EBCellFAB &  a_phiCoar,
const DataIndex &  a_dit,
const int  a_fineVar,
const int  a_coarVar,
const Type  a_interpType 
) const
protectedvirtualnoexcept

Ghost cell interpolation near the EB, correcting slopes that broke in interpolateRegular.

Parameters
[in]a_phiFineFine-grid data
[in]a_phiCoarCoarse-grid data
[in]a_ditGrid index on the fine grid
[in]a_fineVarFine-grid variable
[in]a_coarVarCoarse-grid variable
[in]a_interpTypeInterp type

◆ interpolateRegular()

void EBGhostCellInterpolator::interpolateRegular ( FArrayBox &  a_phiFine,
const FArrayBox &  a_phiCoar,
const DataIndex &  a_dit,
const int  a_fineVar,
const int  a_coarVar,
const Type  a_interpType 
) const
protectedvirtualnoexcept

Regular interpolation, as if the EB was not there.

Parameters
[in]a_phiFineFine-grid data
[in]a_phiCoarCoarse-grid data
[in]a_ditGrid index on the fine grid
[in]a_fineVarFine-grid variable
[in]a_coarVarCoarse-grid variable
[in]a_interpTypeInterp type

◆ minmod()

Real EBGhostCellInterpolator::minmod ( const Real &  dwl,
const Real &  dwr 
)
inlinestaticprotectednoexcept

minmod slope function.

Parameters
[in]dwlLeft slope
[in]dwrRight slope
Returns
Return value

◆ monotonizedCentral()

Real EBGhostCellInterpolator::monotonizedCentral ( const Real &  dwl,
const Real &  dwr 
)
inlinestaticprotectednoexcept

Monotonized central difference slope limiter.

Parameters
[in]dwlLeft slope
[in]dwrRight slope
Returns
Return value

◆ superbee()

Real EBGhostCellInterpolator::superbee ( const Real &  dwl,
const Real &  dwr 
)
staticprotectednoexcept

Superbee slope limiter.

Parameters
[in]dwlLeft slope
[in]dwrRight slope
Returns
Return value

Member Data Documentation

◆ m_coarsenedFineData

LevelData<EBCellFAB> EBGhostCellInterpolator::m_coarsenedFineData
mutableprotected

Buffer holding the coarse-grid data on the coarsened fine grids.

This is filled by a single copyTo from the coarse level, for all the interpolated variables at once. Keeping it as a member avoids rebuilding an EBCellFactory and reallocating the entire coarsened-fine layout on every call. It is sized in defineBuffers, i.e. once per regrid, and holds SpaceDim components: that covers the scalar and vector fields which make up every call on the hot path. The rare wider call – physics plot variables, whose count is set by the user's model – uses a local buffer instead, so the resident footprint stays bounded regardless of how many plot variables a model declares.

◆ m_coarsenedFineGhosts

LayoutData<BaseIVFAB<VolIndex> > EBGhostCellInterpolator::m_coarsenedFineGhosts
protected

List of coarse-grid cells that appear through coarsening a fine-grid ghost cell.

This is used to accelerate interpolation fine-grid cut-cells that are also ghost cells. Doing this to avoid in-place coarsening of the fine grid ghost cell.

◆ m_ghostCF

int EBGhostCellInterpolator::m_ghostCF
protected

Number of ghost cells to fill across coarse-fine interface.

Note
Only applies the the cut-cells.

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