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

Class for computing "jump interface" boundary conditions for multifluid code. More...

#include <CD_MFHelmholtzJumpBC.H>

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

Public Types

using BcoefPtr = RefCountedPtr< LevelData< MFBaseIVFAB > >
 Alias to cut down on typing.
 

Public Member Functions

 MFHelmholtzJumpBC ()=delete
 Disallowed weak construction.
 
 MFHelmholtzJumpBC (const Location::Cell a_dataLocation, const MFLevelGrid &a_mflg, const BcoefPtr &a_Bcoef, const Real a_dx, const int a_order, const int a_weight, const int a_radius, const int a_ghostCF, const IntVect a_ghostPhi)
 Defining constructor. More...
 
 MFHelmholtzJumpBC (const MFHelmholtzJumpBC &a_other)=delete
 Disallowed copy constructor.
 
virtual ~MFHelmholtzJumpBC ()
 Destructor. Does nothing.
 
MFHelmholtzJumpBCoperator= (const MFHelmholtzJumpBC &a_other)=delete
 Disallowed assignment constructor.
 
void setBco (const RefCountedPtr< LevelData< MFBaseIVFAB >> &a_Bcoef)
 Set B-coefficient. This updates the stencils. More...
 
bool isMultiPhase () const noexcept
 Is multiphase or not. More...
 
int getOrder () const
 Return stencil order.
 
int getWeight () const
 Return stencil weight (for least squares)
 
int getRadius () const
 Return stencil radius (for least squares)
 
virtual void matchBC (LevelData< BaseIVFAB< Real >> &a_jump, const LevelData< MFCellFAB > &a_phi, const bool a_homogeneousPhysBC) const
 Match the BC. More...
 
virtual void matchBC (BaseIVFAB< Real > &a_jump, const MFCellFAB &a_phi, const bool a_homogeneousPhysBC, const DataIndex &a_dit) const
 Match the BC. More...
 
virtual const BaseIVFAB< Real > & getBndryPhi (const int a_phase, const DataIndex &a_dit) const
 Get phi on the boundary. More...
 
virtual VoFIterator & getSinglePhaseVofs (const int a_phase, const DataIndex &a_dit) const
 Return vof iterator which iterates over single-phase cells on a specific phase and box.
 
virtual VoFIterator & getMultiPhaseVofs (const int a_phase, const DataIndex &a_dit) const
 Return vof iterator which iterates over multi-phase cells on a specified phase and box.
 
virtual const LayoutData< MFInterfaceFAB< VoFStencil > > & getGradPhiStencils () const noexcept
 Get stencils for computing dphi/dn at the boundary.
 
virtual const LayoutData< MFInterfaceFAB< Real > > & getGradPhiWeights () const noexcept
 Get constant weights involved when computing dphi/dn at the boundary.
 
virtual void resetBC () const
 Set everything to zero. This is a debugging function.
 

Protected Member Functions

void defineStencils ()
 Define function. Builds stencils.
 
void defineIterators ()
 Define function. Builds stencils.
 
void buildAverageStencils ()
 Brief the average stencils.
 
virtual bool getLeastSquaresBoundaryGradStencil (std::pair< Real, VoFStencil > &a_stencil, const VolIndex &a_vof, const EBISBox &a_ebisbox, const VofUtils::Neighborhood a_neighborhood, const int a_order) const
 Get stencil with specified order. More...
 
bool isStencilValidCF (const VoFStencil &a_stencil, const DataIndex &a_dit) const
 Check if stencil is valid. More...
 
Real applyStencil (const VoFStencil &a_stencil, const EBCellFAB &a_phi) const
 Apply a stencil and return the result. More...
 

Protected Attributes

Location::Cell m_dataLocation
 Data centering.
 
MFLevelGrid m_mflg
 Grids.
 
RefCountedPtr< LevelData< MFBaseIVFAB > > m_Bcoef
 B-coefficient.
 
Real m_dx
 Grid resolution.
 
int m_order
 Stencil order.
 
int m_weight
 Stencil order.
 
int m_radius
 Stencil order.
 
int m_ghostCF
 Number of grid cells that were filled over the CF.
 
int m_numPhases
 Number of phases.
 
IntVect m_ghostPhi
 Number of ghost cells in phi (must be exact match in order to use AggStencil)
 
bool m_multiPhase
 Multiphase or not.
 
LayoutData< MFInterfaceFAB< Real > > m_boundaryPhi
 Value of phi on the boundary.
 
std::map< int, std::shared_ptr< LayoutData< VoFIterator > > > m_singlePhaseVofs
 Iterators for single-phase cells. The integer index is the phase.
 
std::map< int, std::shared_ptr< LayoutData< VoFIterator > > > m_multiPhaseVofs
 Iterators for multi-phase cells. The integer index is the phase.
 
LayoutData< IntVectSet > m_ivs
 IntVectSet over which we run the "averaging".
 
LayoutData< MFInterfaceFAB< VoFStencil > > m_gradPhiStencils
 Raw stencils for dphi/dn.
 
LayoutData< MFInterfaceFAB< Real > > m_gradPhiWeights
 Raw weights for dphi/dn.
 
LayoutData< MFInterfaceFAB< VoFStencil > > m_avgStencils
 Average stencil.
 
LayoutData< MFInterfaceFAB< Vector< VolIndex > > > m_avgVoFs
 Target vofs for average stencils.
 
LayoutData< MFInterfaceFAB< Real > > m_denom
 Denominator 1/(bp*wp + bq*wq) for all interface cells.
 
LayoutData< MFInterfaceFAB< Real > > m_avgWeights
 Average weights.
 
LayoutData< RefCountedPtr< AggStencil< EBCellFAB, BaseIVFAB< Real > > > > m_aggStencils [2]
 Agg stencils for making matching go faster.
 

Static Protected Attributes

static constexpr int m_comp = 0
 Component where stencils are stored.
 
static constexpr int m_nComp = 1
 Number of components in stencil.
 

Detailed Description

Class for computing "jump interface" boundary conditions for multifluid code.

This class creates stencils for approximating the normal derivative on each side. It uses those stencil to compute a value on the boundary which fulfills the discrete version of dphi/dn1 + dphi/dn2 = sigma. This value is used by MFHelmholtzEBBC to compute the fluxes into the cut-cells on each side.

When multi-valued cells are involved we use an "average" formulation such that we obtain the surface potential which is equal on all multi-cut surfaces. For this reason we store the bare stencils AND the averaged stencils (which are used in the matching). When stencil coefficients are updated then we use the raw stencils for recomputing the average stencils. This is done by calling setBco.

Constructor & Destructor Documentation

◆ MFHelmholtzJumpBC()

MFHelmholtzJumpBC::MFHelmholtzJumpBC ( const Location::Cell  a_dataLocation,
const MFLevelGrid a_mflg,
const BcoefPtr a_Bcoef,
const Real  a_dx,
const int  a_order,
const int  a_weight,
const int  a_radius,
const int  a_ghostCF,
const IntVect  a_ghostPhi 
)

Defining constructor.

Parameters
[in]a_dataLocationData centering
[in]a_mflgGrids
[in]a_BcoefHelmholtz B-coefficient
[in]a_dxGrid resolution
[in]a_orderStencil approximation order
[in]a_weightWeighting factor for least squares
[in]a_radiusStencil radius
[in]a_ghostCFNumber of grid cells that were filled across the CF.
[in]a_ghostPhiNumber of ghost cells in phi (needed for AggStencil)

Member Function Documentation

◆ applyStencil()

Real MFHelmholtzJumpBC::applyStencil ( const VoFStencil &  a_stencil,
const EBCellFAB &  a_phi 
) const
inlineprotected

Apply a stencil and return the result.

Parameters
[in]a_stencilStencil to apply
[in]a_phiData
Returns
Returns S(phi), S being the stencil.

◆ getBndryPhi()

const BaseIVFAB< Real > & MFHelmholtzJumpBC::getBndryPhi ( const int  a_phase,
const DataIndex &  a_dit 
) const
virtual

Get phi on the boundary.

Parameters
[in]a_phasePhase
[in]a_ditGrid index
Returns
Returns phi on the boundary. On multivalued cells, phi always lies on VolIndex(iv, 0).

◆ getLeastSquaresBoundaryGradStencil()

bool MFHelmholtzJumpBC::getLeastSquaresBoundaryGradStencil ( std::pair< Real, VoFStencil > &  a_stencil,
const VolIndex &  a_vof,
const EBISBox &  a_ebisbox,
const VofUtils::Neighborhood  a_neighborhood,
const int  a_order 
) const
protectedvirtual

Get stencil with specified order.

Parameters
[out]a_stencilWeight and stencil
[out]a_vofGrid cell
[out]a_ebisboxEBISBox
[out]a_neighborhoodNeighboorhood specifier
[in]a_orderAttempted order for stencil. This is also the stencil radius.
Returns
If this returns true, a_stencil contains a valid stencil and weight.
Note
Stencils are computed using weighted least squares with squared inverse distance weighting.

◆ isMultiPhase()

bool MFHelmholtzJumpBC::isMultiPhase ( ) const
noexcept

Is multiphase or not.

Returns
m_multiPhase

◆ isStencilValidCF()

bool MFHelmholtzJumpBC::isStencilValidCF ( const VoFStencil &  a_stencil,
const DataIndex &  a_dit 
) const
inlineprotected

Check if stencil is valid.

This routine makes sure that the stencil a_stencil does not reach over the CF interface and into ghost cells that do not have valid data.

Parameters
[in]a_stencilStencil
[in]a_ditData index

◆ matchBC() [1/2]

void MFHelmholtzJumpBC::matchBC ( BaseIVFAB< Real > &  a_jump,
const MFCellFAB &  a_phi,
const bool  a_homogeneousPhysBC,
const DataIndex &  a_dit 
) const
inlinevirtual

Match the BC.

Parameters
[in,out]a_jumpJump data, i.e. right-hand side of dphi/dn + dphi/m = jump
[in]a_phiCell-centered data
[in]a_homogeneousPhysBCHomogeneous BC or not
[in]a_ditGrid index

Reimplemented in MFHelmholtzSaturationChargeJumpBC.

◆ matchBC() [2/2]

void MFHelmholtzJumpBC::matchBC ( LevelData< BaseIVFAB< Real >> &  a_jump,
const LevelData< MFCellFAB > &  a_phi,
const bool  a_homogeneousPhysBC 
) const
virtual

Match the BC.

Parameters
[in,out]a_jumpJump data, i.e. right-hand side of dphi/dn + dphi/m = jump
[in]a_phiCell-centered data
[in]a_homogeneousPhysBCHomogeneous BC or not

◆ setBco()

void MFHelmholtzJumpBC::setBco ( const RefCountedPtr< LevelData< MFBaseIVFAB >> &  a_Bcoef)

Set B-coefficient. This updates the stencils.

Parameters
[in]a_BcoefHelmholtz B-coefficient

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