chombo-discharge
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
EBFluxRedistribution Class Reference

Class for redistribution ala Chombo's flux redistribution. More...

#include <CD_EBFluxRedistribution.H>

Public Member Functions

 EBFluxRedistribution () noexcept
 Weak constructor. Need to call define afterwards.
 
 EBFluxRedistribution (const EBFluxRedistribution &a_other)=delete
 Copy constructor is not allowed.
 
 EBFluxRedistribution (const EBLevelGrid &a_eblgCoar, const EBLevelGrid &a_eblgCoarsened, const EBLevelGrid &a_eblg, const EBLevelGrid &a_eblgRefined, const EBLevelGrid &a_eblgFine, const int a_refToCoar, const int a_refToFine, const bool a_redistributeOutside) noexcept
 Full constructor. Calls the define function and puts object in usable state. More...
 
virtual ~EBFluxRedistribution () noexcept
 Destructor (does nothing)
 
virtual void define (const EBLevelGrid &a_eblgCoar, const EBLevelGrid &a_eblgCoarsened, const EBLevelGrid &a_eblg, const EBLevelGrid &a_eblgRefined, const EBLevelGrid &a_eblgFine, const int a_refToCoar, const int a_refToFine, const bool a_redistributeOutside) noexcept
 Define fucntion. Puts object in usable state. More...
 
virtual void redistributeAMR (LevelData< EBCellFAB > *a_phiCoar, LevelData< EBCellFAB > *a_phi, LevelData< EBCellFAB > *a_phiFine, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real a_scaleCoar, const Real a_scale, const Real a_scaleFine, const Interval &a_variables) const noexcept
 Redistribute the input quantity into the coarse level, this level, and the fine level. More...
 
virtual void redistributeCoar (LevelData< EBCellFAB > &a_phiCoar, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real &a_scaleCoar, const Interval &a_variables) const noexcept
 Redistribute the input quantity to the coarse level. More...
 
virtual void redistributeLevel (LevelData< EBCellFAB > &a_phi, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real &a_scale, const Interval &a_variables) const noexcept
 Redistribute the input quantity to this level. More...
 
virtual void redistributeFine (LevelData< EBCellFAB > &a_phiFine, const LevelData< BaseIVFAB< Real >> &a_deltaM, const Real &a_scaleFine, const Interval &a_variables) const noexcept
 Redistribute the input quantity to the coarse level. More...
 

Protected Member Functions

virtual void defineStencils () noexcept
 Define redistribution stencils.
 
virtual void defineBuffers () noexcept
 Define buffer storages.
 
virtual void defineValidCells (LevelData< BaseFab< bool >> &a_validCells) const noexcept
 Define the valid region of this level. More...
 
virtual void defineInterfaceCells (LevelData< BaseFab< bool >> &a_interfaceCells) const noexcept
 Define the cells on the coarse side of the CF interface that we would redistribute to. More...
 

Protected Attributes

bool m_isDefined
 Is defined or not.
 
bool m_redistributeOutside
 If true, redistribute to the outside. Otherwise, do interior redistribution.
 
bool m_hasCoar
 Has coarse level or not.
 
bool m_hasFine
 Has fine level or not.
 
int m_refToCoar
 Refinement factor between this level and the coarse level.
 
int m_refToFine
 Refinement factor between this level and the fine level.
 
int m_redistRadius
 Redistribution radius. Always one.
 
EBLevelGrid m_eblgCoar
 Grids on coarser level.
 
EBLevelGrid m_eblgCoarsened
 Grids on this level that are a refinement of the coarser level.
 
EBLevelGrid m_eblg
 Grids on this level.
 
EBLevelGrid m_eblgRefined
 Grids on this level that are a coarsening of the fine level.
 
EBLevelGrid m_eblgFine
 Fine grids.
 
Copier m_coarCopier
 Copier for copying from the coarsening of this level to the coarse level.
 
Copier m_levelCopier
 Copier for adding data from this level to this level (yes, really).
 
Copier m_fineCopier
 Copier for copying from the refinement of this level to the fine level.
 
LayoutData< BaseIVFAB< VoFStencil > > m_redistStencilsCoar
 Stencils for redistribution into valid grid cells on the coarse level. More...
 
LayoutData< BaseIVFAB< VoFStencil > > m_redistStencilsLevel
 Stencils for redistribution into valid grid cells on this level. More...
 
LayoutData< BaseIVFAB< VoFStencil > > m_redistStencilsFine
 Stencils for redistribution into valid grid cells on the fine level. More...
 
LayoutData< VoFIterator > m_vofit
 Iterator for going through all cells on this level that we redistribute from.
 

Detailed Description

Class for redistribution ala Chombo's flux redistribution.

This uses the same algorithm as the core Chombo code, but includes much faster define functions and smaller memory footprint. Because this class is used in a non-subcycling context, it has way fewer bells and whistles. Note that this class permits redistribution outside of the domain, in which case some mass will (correctly) be lost.

The underlying stencils for in this class can be understood as follows: Assume that we have some quantity deltaM_i that we want to redistribute from cell i to nearby cells. We fetch all cells that are within a radius of 1 around this cell. If one of these cells lie on other side of the refinement boundary, we coarsen it and fetch the corresponding coarse-grid cell. Likewise, if a neighborhood cell lies underneath the fine grid, we refine it and redistribute to the fine grid cells. In each cut-cell we thus compute the total volume of the surrounding neighborhood as

totalVolume = sum_(level_cells) kappa_j + 1/NrefToFine^D * sum_(fine_cells) kappa_j + Nref*ToCoar^D * sum(coar_cells) kappa_j.

Every cell in the neighborhood of cell i gets a weight 1/totalVolume. Note that proper division by the grid resolution is not made here; the user will have to ensure proper scaling of his/her variables when calling the actual redistribution functions. The scaling factors depend on what is actually being redistributed, and the user will need to work this out on paper.

Constructor & Destructor Documentation

◆ EBFluxRedistribution()

EBFluxRedistribution::EBFluxRedistribution ( const EBLevelGrid &  a_eblgCoar,
const EBLevelGrid &  a_eblgCoarsened,
const EBLevelGrid &  a_eblg,
const EBLevelGrid &  a_eblgRefined,
const EBLevelGrid &  a_eblgFine,
const int  a_refToCoar,
const int  a_refToFine,
const bool  a_redistributeOutside 
)
noexcept

Full constructor. Calls the define function and puts object in usable state.

If there is a finer level, a_eblgFine and a_eblgRefined must be defined. If there is a coarser grid level then a_eblgCoar and a_eblgCoarsened must be defined.

Parameters
[in]a_eblgCoarCoarser grid level
[in]a_eblgCoarsenedCoarsened grid
[in]a_eblgGrids on this level
[in]a_eblgRefineddRefined grid
[in]a_eblgFineFine grid
[in]a_refToCoarRefinement factor between this level and the coarse level
[in]a_refToFineRefinement factor between this level and the fine level
[in]a_redistributeOutsideTurn on/off redistribution outside domain.

Member Function Documentation

◆ define()

void EBFluxRedistribution::define ( const EBLevelGrid &  a_eblgCoar,
const EBLevelGrid &  a_eblgCoarsened,
const EBLevelGrid &  a_eblg,
const EBLevelGrid &  a_eblgRefined,
const EBLevelGrid &  a_eblgFine,
const int  a_refToCoar,
const int  a_refToFine,
const bool  a_redistributeOutside 
)
virtualnoexcept

Define fucntion. Puts object in usable state.

If there is a finer level, a_eblgFine and a_eblgRefined must be defined. If there is a coarser grid level then a_eblgCoar and a_eblgCoarsened must be defined.

Parameters
[in]a_eblgCoarCoarser grid level
[in]a_eblgCoarsenedCoarsened grids
[in]a_eblgGrids on this level
[in]a_eblgRefinedRefined grids
[in]a_eblgFineFine grid
[in]a_refToCoarRefinement factor between this level and the coarse level
[in]a_refToFineRefinement factor between this level and the fine level
[in]a_redistributeOutsideTurn on/off redistribution outside domain.

◆ defineInterfaceCells()

void EBFluxRedistribution::defineInterfaceCells ( LevelData< BaseFab< bool >> &  a_interfaceCells) const
protectedvirtualnoexcept

Define the cells on the coarse side of the CF interface that we would redistribute to.

Parameters
[in,out]a_validCellsValid grid cells on this level.

◆ defineValidCells()

void EBFluxRedistribution::defineValidCells ( LevelData< BaseFab< bool >> &  a_validCells) const
protectedvirtualnoexcept

Define the valid region of this level.

Parameters
[in,out]a_validCellsValid grid cells on this level.

◆ redistributeAMR()

void EBFluxRedistribution::redistributeAMR ( LevelData< EBCellFAB > *  a_phiCoar,
LevelData< EBCellFAB > *  a_phi,
LevelData< EBCellFAB > *  a_phiFine,
const LevelData< BaseIVFAB< Real >> &  a_deltaM,
const Real  a_scaleCoar,
const Real  a_scale,
const Real  a_scaleFine,
const Interval &  a_variables 
) const
virtualnoexcept

Redistribute the input quantity into the coarse level, this level, and the fine level.

If calling this, pass in a_phiFine/a_phiCoar = nullptr if there is no finer/coarser level. The a_scaleCoar and a_scaleFine arguments do not matter if there is no coarser/finer level.

Parameters
[in,out]a_phiCoarData on coarse level
[in,out]a_phiData on this level
[in,out]a_phiFineData on finer level
[in]a_deltaMRedistribution data on this level
[in]a_scaleCoarScaling factor for redistribution into the coarse level
[in]a_scaleScaling factor for redistribution into this level
[in]a_scaleFineScaling factor for redistribution into the fine level
[in]a_variablesVariables to redistribute

◆ redistributeCoar()

void EBFluxRedistribution::redistributeCoar ( LevelData< EBCellFAB > &  a_phiCoar,
const LevelData< BaseIVFAB< Real >> &  a_deltaM,
const Real &  a_scaleCoar,
const Interval &  a_variables 
) const
virtualnoexcept

Redistribute the input quantity to the coarse level.

Parameters
[in,out]a_phiCoarData on coarse level
[in]a_deltaMRedistribution data on this level
[in]a_scaleCoarScaling factor for redistribution into the coarse level
[in]a_variablesVariables to redistribute

◆ redistributeFine()

void EBFluxRedistribution::redistributeFine ( LevelData< EBCellFAB > &  a_phiFine,
const LevelData< BaseIVFAB< Real >> &  a_deltaM,
const Real &  a_scaleFine,
const Interval &  a_variables 
) const
virtualnoexcept

Redistribute the input quantity to the coarse level.

Parameters
[in,out]a_phiCoarData on fine level
[in]a_deltaMRedistribution data on this level
[in]a_scaleFineScaling factor for redistribution into the fine level
[in]a_variablesVariables to redistribute

◆ redistributeLevel()

void EBFluxRedistribution::redistributeLevel ( LevelData< EBCellFAB > &  a_phi,
const LevelData< BaseIVFAB< Real >> &  a_deltaM,
const Real &  a_scale,
const Interval &  a_variables 
) const
virtualnoexcept

Redistribute the input quantity to this level.

Parameters
[in,out]a_phiData on this level
[in]a_deltaMRedistribution data on this level
[in]a_scaleScaling factor for redistribution on this level
[in]a_variablesVariables to redistribute

Member Data Documentation

◆ m_redistStencilsCoar

LayoutData<BaseIVFAB<VoFStencil> > EBFluxRedistribution::m_redistStencilsCoar
protected

Stencils for redistribution into valid grid cells on the coarse level.

Note
Defined on this level (m_eblg), but the stencils contain VoFs on the coarse level

◆ m_redistStencilsFine

LayoutData<BaseIVFAB<VoFStencil> > EBFluxRedistribution::m_redistStencilsFine
protected

Stencils for redistribution into valid grid cells on the fine level.

Note
Defined on this level (m_eblg), but the stencils contain VoFs on the fine level

◆ m_redistStencilsLevel

LayoutData<BaseIVFAB<VoFStencil> > EBFluxRedistribution::m_redistStencilsLevel
protected

Stencils for redistribution into valid grid cells on this level.

Note
Defined on this level (m_eblg), and the stencils contain VoFs on this level also.

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