chombo-discharge
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
EBLeastSquaresMultigridInterpolator Class Reference

Multigrid interpolator class. More...

#include <CD_EBLeastSquaresMultigridInterpolator.H>

Inheritance diagram for EBLeastSquaresMultigridInterpolator:
Inheritance graph
[legend]
Collaboration diagram for EBLeastSquaresMultigridInterpolator:
Collaboration graph
[legend]

Public Types

using CellLocation = Location::Cell
 Specification of cell-center or cell-centroid type of interpolation.
 
- Public Types inherited from EBMultigridInterpolator
using CellLocation = Location::Cell
 Specification of cell-center or cell-centroid type of interpolation.
 

Public Member Functions

 EBLeastSquaresMultigridInterpolator ()=delete
 Disallowed constructor.
 
 EBLeastSquaresMultigridInterpolator (const EBLeastSquaresMultigridInterpolator &a_other)=delete
 Disallowed copy constructor.
 
 EBLeastSquaresMultigridInterpolator (const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoFi, const EBLevelGrid &a_eblgCoar, const CellLocation a_dataLocation, const IntVect &a_ghostVector, const int a_refRat, const int a_ghostCF, const int a_order, const int a_weighting=0) noexcept
 Full constructor. More...
 
virtual ~EBLeastSquaresMultigridInterpolator () noexcept
 Destructor (does nothing)
 
virtual int getGhostCF () const noexcept override
 Return number of ghost cells across CF interface.
 
virtual void coarseFineInterp (LevelData< EBCellFAB > &a_phiFine, const LevelData< EBCellFAB > &a_phiCoar, const Interval a_variables) const noexcept override
 Do inhomogeneous interpolation. More...
 
virtual void coarseFineInterpH (LevelData< EBCellFAB > &a_phiFine, const Interval a_variables) const noexcept override
 Do homogeneous interpolation. More...
 
virtual void coarseFineInterpH (EBCellFAB &a_phiFine, const Interval a_variables, const DataIndex &a_dit) const noexcept override
 Do homogeneous coarse-fine interpolation on a grid patch. More...
 
- Public Member Functions inherited from EBMultigridInterpolator
 EBMultigridInterpolator ()=delete
 Disallowed constructor.
 
 EBMultigridInterpolator (const EBMultigridInterpolator &a_other)=delete
 Disallowed copy constructor.
 
 EBMultigridInterpolator (const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoar, const CellLocation a_dataLocation, const IntVect &a_ghostVector, const int a_refRat, const int a_ghostCF, const int a_order, const int a_weighting=0)
 Full constructor. More...
 
 ~EBMultigridInterpolator ()
 Destructor (does nothing)
 
int getGhostCF () const
 Return number of ghost cells across CF interface.
 
void coarseFineInterp (LevelData< EBCellFAB > &a_phiFine, const LevelData< EBCellFAB > &a_phiCoar, const Interval a_variables)
 Do inhomogeneous interpolation. More...
 
void slowCoarseFineInterp (LevelData< EBCellFAB > &a_phiFine, const LevelData< EBCellFAB > &a_phiCoar, const Interval a_variables)
 Do inhomogeneous interpolation. More...
 
void coarseFineInterpH (LevelData< EBCellFAB > &a_phiFine, const Interval a_variables) const
 Do homogeneous interpolation. More...
 
void slowCoarseFineInterpH (LevelData< EBCellFAB > &a_phiFine, const Interval a_variables) const
 Do homogeneous interpolation. More...
 
void coarseFineInterpH (EBCellFAB &a_phiFine, const Interval a_variables, const DataIndex &a_dit) const
 Do homogeneous coarse-fine interpolation on a grid patch. More...
 
void slowCoarseFineInterpH (EBCellFAB &a_phiFine, const Interval a_variables, const DataIndex &a_dit) const
 Do homogeneous coarse-fine interpolation on a grid patch. More...
 
 EBMultigridInterpolator ()
 Disallowed constructor.
 
 EBMultigridInterpolator (const EBMultigridInterpolator &a_other)=delete
 Disallowed copy constructor.
 
virtual ~EBMultigridInterpolator ()
 Destructor (does nothing)
 

Protected Member Functions

virtual void defineGhostRegions () noexcept
 Define ghost cells to be filled in range m_ghostCF from each cut-cell.
 
virtual void defineBuffers () noexcept
 Define buffer data holder.
 
virtual void defineCoarseInterp () noexcept
 Define the coarse-sided interpolation stencils for doing the orthogonal derivatives.
 
virtual void defineStencilsEBCF () noexcept
 Define stencils for interpolation across the EBCF refinement boundary.
 
virtual void makeAggStencils () noexcept
 Build the AggStencil objects for faster stencil aggregation.
 
virtual bool getStencil (VoFStencil &a_stencilFine, VoFStencil &a_stencilCoar, const CellLocation &a_dataLocation, const VolIndex &a_ghostVofFine, const VolIndex &a_ghostVofCoar, const EBISBox &a_ebisboxFine, const EBISBox &a_ebisboxCoar, const DenseIntVectSet &a_validFineCells, const DenseIntVectSet &a_validCoarCells, const Real &a_dxFine, const Real &a_dxCoar, const int &a_order, const int &a_weight) const noexcept
 Build an interpolation stencil. More...
 
virtual void regularCoarseFineInterp (LevelData< EBCellFAB > &a_finePhi, const LevelData< EBCellFAB > &a_coarPhi, const int a_fineVar, const int a_coarVar) const noexcept
 Do regular coarse-fine interpolation as if the EB is not there. More...
 
- Protected Member Functions inherited from EBMultigridInterpolator
void defineGhostRegions ()
 Define ghost cells to be filled in range m_ghostCF from each cut-cell.
 
void defineGrids (const EBLevelGrid &a_eblgFine, const EBLevelGrid &a_eblgCoar)
 Define grids. More...
 
void defineBuffers ()
 Define data holders.
 
void defineStencilsEBCF ()
 Define stencils for interpolation across the EBCF refinement boundary.
 
void makeAggStencils ()
 Build the AggStencil objects for faster stencil aggregation.
 
bool getStencil (VoFStencil &a_stencilFine, VoFStencil &a_stencilCoar, const CellLocation &a_dataLocation, const VolIndex &a_ghostVofFine, const VolIndex &a_ghostVofCoar, const EBISBox &a_ebisboxFine, const EBISBox &a_ebisboxCoar, const DenseIntVectSet &a_validFineCells, const DenseIntVectSet &a_validCoarCells, const Real &a_dxFine, const Real &a_dxCoar, const int &a_order, const int &a_weight)
 Build an interpolation stencil. More...
 

Protected Attributes

CellLocation m_dataLocation
 How to interpret data locations.
 
EBLevelGrid m_eblgFine
 Fine grids.
 
EBLevelGrid m_eblgCoar
 Coarse grids.
 
EBLevelGrid m_eblgCoFi
 Coarsened fine grids.
 
Copier m_copier
 Copier for making copying into m_grownCoarData go faster.
 
LayoutData< VoFIterator > m_ghostIterFine
 Iterator over ghost cells.
 
bool m_isDefined
 Is defined or not.
 
IntVect m_ghostVectorFine
 Minimum number of ghost cells in input data.
 
IntVect m_ghostVectorCoFi
 Number of ghost cells on the coarsened-fine grids. Needed because the fine grids need some of the coarse grid cells.
 
int m_refRat
 Refinement factor between fine and coarse level.
 
int m_ghostCF
 Number of ghost cells to fill across coarse-fine interface. More...
 
int m_order
 Interpolation order.
 
int m_weight
 Least squares weighting factor.
 
LayoutData< IntVectSet > m_ghostCells
 Ghost cells that will be interpolated near the cut-cells. More...
 
LayoutData< BaseIVFAB< VoFStencil > > m_fineStencils
 Fine-grid interpolation stencils.
 
LayoutData< BaseIVFAB< VoFStencil > > m_coarStencils
 Coarse-grid interpolation stencils.
 
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, EBCellFAB > > > m_aggFineStencils
 Fine grid interpolation stencils. More...
 
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, EBCellFAB > > > m_aggCoarStencils
 Coarse-grid interpolation stencils. More...
 
LayoutData< std::map< std::pair< int, Side::LoHiSide >, Box > > m_cfivs
 Regular coarse-fine interface boxes. More...
 
LayoutData< CoarseInterpQuadCFm_loCoarseInterpCF [SpaceDim]
 For doing the coarse-side interpolation near the AMR interface.
 
LayoutData< CoarseInterpQuadCFm_hiCoarseInterpCF [SpaceDim]
 For doing the coarse-side interpolation near the AMR interface.
 
- Protected Attributes inherited from EBMultigridInterpolator
RefCountedPtr< QuadCFInterp > m_scalarInterpolator
 For regular interpolation of scalar quantities.
 
RefCountedPtr< QuadCFInterp > m_vectorInterpolator
 For regular interpolation of vector quantities.
 
CellLocation m_dataLocation
 How to interpret data locations.
 
EBLevelGrid m_eblgFine
 Fine grids.
 
EBLevelGrid m_eblgCoar
 Coarse grids.
 
EBLevelGrid m_eblgCoFi
 Refined coarse grids.
 
BoxLayout m_grownCoarBoxesLayout
 Grown box layout on the coarse level.
 
BoxLayoutData< EBCellFAB > m_grownCoarData
 Coarsened data.
 
LayoutData< VoFIterator > m_vofIterFine
 Iterator over ghost cells.
 
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. More...
 
int m_order
 Interpolation order.
 
int m_weight
 Least squares weighting factor.
 
LayoutData< IntVectSet > m_ghostCells
 Ghost cells that will be interpolated near the cut-cells. More...
 
LayoutData< BaseIVFAB< VoFStencil > > m_fineStencils
 Fine-grid interpolation stencils.
 
LayoutData< BaseIVFAB< VoFStencil > > m_coarStencils
 Coarse-grid interpolation stencils.
 
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, EBCellFAB > > > m_aggFineStencils
 Fine grid interpolation stencils. More...
 
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, EBCellFAB > > > m_aggCoarStencils
 Coarse-grid interpolation stencils. More...
 
LayoutData< std::map< std::pair< int, Side::LoHiSide >, Box > > m_cfivs
 Regular coarse-fine interface boxes. More...
 

Static Protected Attributes

static constexpr int m_stenComp = 0
 Component that interpolation stencil is stored at.
 
static constexpr int m_numStenComp = 1
 Number of variables in stencil data layouts.
 
static constexpr int m_comp = 0
 Component number. Used for setting interval when data is copied into EBLeastSquaresMultigridInterpolator's buffers.
 
- Static Protected Attributes inherited from EBMultigridInterpolator
static constexpr int m_stenComp = 0
 Component that interpolation stencil is stored at.
 
static constexpr int m_numStenComp = 1
 Number of variables in stencil data layouts.
 
static constexpr int m_comp = 0
 Component number. Used for setting interval when data is copied into EBMultigridInterpolator's buffers.
 

Detailed Description

Multigrid interpolator class.

This interpolator class interpolates with classical multigrid-type interpolation where the interpolation stencils only reach into valid cells, ignoring the region underneath the fine level. Near regular refinement boundaries we use the conventional approach where we interpolate coarse data onto the line of cells that runs between the fine-grid cells and the ghost cell. This value is used together with the valid data on the fine-grid cells to interpolate the ghost cell to O(h^2). Near EBs this is much more complex since both the fine and coarse regions may be missing cells that make that interpolation possible. Worse, EB stencils may be much bigger than the 5/7-point Laplacian, requiring us to fill more ghost cells across the coarse-fine interface near the EB. We achieve this by switching to least-squares based interpolation here, again using only the valid fine and coarse-level cells. The way of achieving this consists of building dual-level stencils for each ghost cell; these stencils represent the part of the interpolation stencil that reach into the fine and coarse grids. For efficiency reasons, we copy the coarse grid data onto data layouts that may have more ghost cells than your regular data. Since the least squares stencils require a specified number of cells to reach specified order, this permits us to use fine-grid stencils that only reach into valid data without dropping order. This optimization is useful for pruning extra communications due homogeneous multigrid interpolation. This means that our interpolation, which is in the form

phiGhost = sum(vofCoar) w(vofCoar)*phi(vofCoar) + sum(vofFine)[w(vofFine)*phi(vofFine)]

will have a coarse and and a fine grid stencil, but the fine stencil does not reach out of the ghosted fine-grid patch. The fine-grid part of the stencil is thus allowed to use the ghost cells in the patch that are filled from neighboring patches.

Constructor & Destructor Documentation

◆ EBLeastSquaresMultigridInterpolator()

EBLeastSquaresMultigridInterpolator::EBLeastSquaresMultigridInterpolator ( const EBLevelGrid &  a_eblgFine,
const EBLevelGrid &  a_eblgCoFi,
const EBLevelGrid &  a_eblgCoar,
const CellLocation  a_dataLocation,
const IntVect &  a_ghostVector,
const int  a_refRat,
const int  a_ghostCF,
const int  a_order,
const int  a_weighting = 0 
)
noexcept

Full constructor.

Parameters
[in]a_eblgFineFine grids
[in]a_eblgCoFiCoarsened fine grids
[in]a_eblgCoarCoarse grids
[in]a_dataLocationInterpration of data centering. Either on the cell center or the cell centroid.
[in]a_ghostVector(Minimum) number of ghost cells in input/output data.
[in]a_refRatRefinement ratio
[in]a_ghostCFWidth of the ghost region to be filled. Only relevant near the EBCF.
[in]a_orderInterpolation order
[in]a_weightingWeighting factor least squares.

Member Function Documentation

◆ coarseFineInterp()

void EBLeastSquaresMultigridInterpolator::coarseFineInterp ( LevelData< EBCellFAB > &  a_phiFine,
const LevelData< EBCellFAB > &  a_phiCoar,
const Interval  a_variables 
) const
overridevirtualnoexcept

Do inhomogeneous interpolation.

Parameters
[in,out]a_phiFineFine phi
[in]a_phiCoarCoarse phi
[in]a_variablesVariables to interpolate

Implements EBMultigridInterpolator.

◆ coarseFineInterpH() [1/2]

void EBLeastSquaresMultigridInterpolator::coarseFineInterpH ( EBCellFAB &  a_phiFine,
const Interval  a_variables,
const DataIndex &  a_dit 
) const
overridevirtualnoexcept

Do homogeneous coarse-fine interpolation on a grid patch.

Parameters
[in]a_phiFineFine-level data
[in]a_variablesVariables to be interpolated
[in]a_ditData index
Note
This is the kernel version. The constructor guarantees that the fine-grid stencil will not out of the ghost region defined by a_ghostVector. However, this is the direct kernel version which is public because multigrid operators might need it for performance reasons. This routine does NOT warn against input data that do not contain enough ghost cells.

Implements EBMultigridInterpolator.

◆ coarseFineInterpH() [2/2]

void EBLeastSquaresMultigridInterpolator::coarseFineInterpH ( LevelData< EBCellFAB > &  a_phiFine,
const Interval  a_variables 
) const
overridevirtualnoexcept

Do homogeneous interpolation.

Parameters
[in]a_phiFineFine phi
[in]a_variablesVariables to interpolate

Implements EBMultigridInterpolator.

◆ getStencil()

bool EBLeastSquaresMultigridInterpolator::getStencil ( VoFStencil &  a_stencilFine,
VoFStencil &  a_stencilCoar,
const CellLocation a_dataLocation,
const VolIndex &  a_ghostVofFine,
const VolIndex &  a_ghostVofCoar,
const EBISBox &  a_ebisboxFine,
const EBISBox &  a_ebisboxCoar,
const DenseIntVectSet &  a_validFineCells,
const DenseIntVectSet &  a_validCoarCells,
const Real &  a_dxFine,
const Real &  a_dxCoar,
const int &  a_order,
const int &  a_weight 
) const
protectedvirtualnoexcept

Build an interpolation stencil.

Parameters
[out]a_stencilFineFine-grid stencil
[out]a_stencilCoarCoarse-grid stencil
[in]a_dataLocationData location
[in]a_ghostVofFineGhost cell which is to be filled on the coarse grid.
[in]a_ghostVofCoarVof corresponding to a_ghostVofFine on the coarse grid
[in]a_ebisBoxFineFine grid EBISBox
[in]a_ebisBxoCoarCoarse grid EBISBox
[in]a_validFineCellsFine-grid region which we are allowed to use in the interpolation.
[in]a_validCoarCellsCoarse-grid region which we are allowed to use in the interpolation.
[in]a_dxFineGrid resolution on the fine level
[in]a_dxCoarGrid resolution on the coarse level
[in]a_orderInterpolation order
[in]a_weightEquation weighting for least squares reconstruction.
Returns
Returns true if a stencil was found, in which case it is defined in a_stencilFine and a_stencilCoar.

◆ regularCoarseFineInterp()

void EBLeastSquaresMultigridInterpolator::regularCoarseFineInterp ( LevelData< EBCellFAB > &  a_finePhi,
const LevelData< EBCellFAB > &  a_coarPhi,
const int  a_fineVar,
const int  a_coarVar 
) const
protectedvirtualnoexcept

Do regular coarse-fine interpolation as if the EB is not there.

Parameters
[in,out]a_finePhiFine-level data.
[in]a_coarPhiCoarse-grid data.
[in]a_fineVarFine variable
[in]a_coarVarCoarse variable

Member Data Documentation

◆ m_aggCoarStencils

LayoutData<RefCountedPtr<AggStencil<EBCellFAB, EBCellFAB> > > EBLeastSquaresMultigridInterpolator::m_aggCoarStencils
protected

Coarse-grid interpolation stencils.

This is used for performance optimization. Note that m_aggCoarStencils will only reach into m_grownCoarData, which gives well-defined cache offsets.

◆ m_aggFineStencils

LayoutData<RefCountedPtr<AggStencil<EBCellFAB, EBCellFAB> > > EBLeastSquaresMultigridInterpolator::m_aggFineStencils
protected

Fine grid interpolation stencils.

This is used for performance optimization. Note that m_aggFineStencils will reach into whatever data is being interpolated, so the input data must have the same number of ghost cells as specified in the constructor.

◆ m_cfivs

LayoutData<std::map<std::pair<int, Side::LoHiSide>, Box> > EBLeastSquaresMultigridInterpolator::m_cfivs
protected

Regular coarse-fine interface boxes.

Note
This is a map to the "regular" ghost cells that will be interpolated using a standard multigrid interpolation stencil (away from the EB).

◆ m_ghostCells

LayoutData<IntVectSet> EBLeastSquaresMultigridInterpolator::m_ghostCells
protected

Ghost cells that will be interpolated near the cut-cells.

Note
This does not include the ghost cells on the refinement boundary away from the cut-cells.

◆ m_ghostCF

int EBLeastSquaresMultigridInterpolator::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: