chombo-discharge
Loading...
Searching...
No Matches
PetscHelmholtzRobinDomainBC Class Reference

Robin domain boundary condition A*phi + B*dphi/dn = C for PetscHelmholtzOp. More...

#include <CD_PetscHelmholtzRobinDomainBC.H>

Inheritance diagram for PetscHelmholtzRobinDomainBC:
Collaboration diagram for PetscHelmholtzRobinDomainBC:

Public Member Functions

 PetscHelmholtzRobinDomainBC ()
 Default constructor. Must subsequently call setCoefficients.
virtual ~PetscHelmholtzRobinDomainBC ()
 Destructor.
void setCoefficients (const Real a_A, const Real a_B, const Real a_C)
 Set constant coefficients.
void setCoefficients (const std::function< Real(const RealVect &a_pos)> &a_A, const std::function< Real(const RealVect &a_pos)> &a_B, const std::function< Real(const RealVect &a_pos)> &a_C)
 Set spatially varying coefficients.
void getFaceFluxStencil (Real &a_boundaryWeight, VoFStencil &a_stencilCoar, VoFStencil &a_stencil, VoFStencil &a_stencilFine, const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof, const int a_dir, const Side::LoHiSide a_side) const override
 Get the stencil of the face flux through a domain face.
Real getBoundaryData (const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof, const int a_dir, const Side::LoHiSide a_side) const override
 Get the boundary data, i.e. the coefficient C.
Public Member Functions inherited from PetscHelmholtzDomainBC
 PetscHelmholtzDomainBC ()
 Default constructor. Must subsequently call define.
virtual ~PetscHelmholtzDomainBC ()
 Destructor.
 PetscHelmholtzDomainBC (const PetscHelmholtzDomainBC &a_other)=delete
 Disallowed copy constructor.
 PetscHelmholtzDomainBC (const PetscHelmholtzDomainBC &&a_other)=delete
 Disallowed move constructor.
PetscHelmholtzDomainBC & operator= (const PetscHelmholtzDomainBC &a_other)=delete
 Disallowed copy assignment operator.
PetscHelmholtzDomainBC & operator= (const PetscHelmholtzDomainBC &&a_other)=delete
 Disallowed move assignment operator.
virtual void define (const RefCountedPtr< PetscGrid > &a_petscGrid, const RealVect &a_probLo, const Vector< Real > &a_dx)
 Define the BC over the AMR hierarchy.

Protected Member Functions

void getCoefficients (Real &a_A, Real &a_B, Real &a_C, const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof, const int a_dir, const Side::LoHiSide a_side) const
 Get the coefficients at a domain face.
Protected Member Functions inherited from PetscHelmholtzDomainBC
RealVect getBoundaryPosition (const int a_phase, const int a_level, const DataIndex &a_din, const VolIndex &a_vof, const int a_dir, const Side::LoHiSide a_side) const noexcept
 Get the physical position of the centroid of a domain face.

Protected Attributes

bool m_useConstant
 Use constant coefficients or not.
bool m_useFunction
 Use spatially varying coefficients or not.
Real m_constantA
 Constant coefficient on phi.
Real m_constantB
 Constant coefficient on dphi/dn.
Real m_constantC
 Constant right-hand side.
std::function< Real(const RealVect &a_pos)> m_functionA
 Spatially varying coefficient on phi.
std::function< Real(const RealVect &a_pos)> m_functionB
 Spatially varying coefficient on dphi/dn.
std::function< Real(const RealVect &a_pos)> m_functionC
 Spatially varying right-hand side.
Protected Attributes inherited from PetscHelmholtzDomainBC
bool m_isDefined
 Is defined or not.
RefCountedPtr< PetscGrid > m_petscGrid
 PETSc grid.
RealVect m_probLo
 Lower-left corner of the computational domain.
Vector< Real > m_dx
 Grid resolution on each level.

Detailed Description

Robin domain boundary condition A*phi + B*dphi/dn = C for PetscHelmholtzOp.

As in EBHelmholtzRobinDomainBC, phi is extrapolated linearly to the face from the cell and its interior neighbor, and the flux is s*(A*phi_face - C)/B with s = -1 on the low side and +1 on the high side, since n points into the domain. The interior neighbor must be a cell on the same level, i.e. not covered by the EB or by a finer grid. Where it is not, the extrapolation needs a least-squares reconstruction over the valid cells on this level and the next finer level, which is not implemented yet and aborts.

Member Function Documentation

◆ getBoundaryData()

Real PetscHelmholtzRobinDomainBC::getBoundaryData ( const int a_phase,
const int a_level,
const DataIndex & a_din,
const VolIndex & a_vof,
const int a_dir,
const Side::LoHiSide a_side ) const
overridevirtual

Get the boundary data, i.e. the coefficient C.

Parameters
[in]a_phasePhase
[in]a_levelGrid level
[in]a_dinGrid index on the level
[in]a_vofCell adjacent to the domain face
[in]a_dirCoordinate direction of the face
[in]a_sideDomain side of the face
Returns
C at the face.

Implements PetscHelmholtzDomainBC.

◆ getCoefficients()

void PetscHelmholtzRobinDomainBC::getCoefficients ( Real & a_A,
Real & a_B,
Real & a_C,
const int a_phase,
const int a_level,
const DataIndex & a_din,
const VolIndex & a_vof,
const int a_dir,
const Side::LoHiSide a_side ) const
protected

Get the coefficients at a domain face.

Parameters
[out]a_ACoefficient on phi
[out]a_BCoefficient on dphi/dn
[out]a_CRight-hand side
[in]a_phasePhase
[in]a_levelGrid level
[in]a_dinGrid index on the level
[in]a_vofCell adjacent to the domain face
[in]a_dirCoordinate direction of the face
[in]a_sideDomain side of the face

◆ getFaceFluxStencil()

void PetscHelmholtzRobinDomainBC::getFaceFluxStencil ( Real & a_boundaryWeight,
VoFStencil & a_stencilCoar,
VoFStencil & a_stencil,
VoFStencil & a_stencilFine,
const int a_phase,
const int a_level,
const DataIndex & a_din,
const VolIndex & a_vof,
const int a_dir,
const Side::LoHiSide a_side ) const
overridevirtual

Get the stencil of the face flux through a domain face.

Parameters
[out]a_boundaryWeightWeight w_B of the boundary data in the flux, see getBoundaryData
[out]a_stencilCoarStencil over cells on level a_level - 1
[out]a_stencilStencil over cells on level a_level
[out]a_stencilFineStencil over cells on level a_level + 1
[in]a_phasePhase
[in]a_levelGrid level
[in]a_dinGrid index on the level
[in]a_vofCell adjacent to the domain face
[in]a_dirCoordinate direction of the face
[in]a_sideDomain side of the face

Implements PetscHelmholtzDomainBC.

◆ setCoefficients() [1/2]

void PetscHelmholtzRobinDomainBC::setCoefficients ( const Real a_A,
const Real a_B,
const Real a_C )

Set constant coefficients.

Parameters
[in]a_ACoefficient on phi
[in]a_BCoefficient on dphi/dn
[in]a_CRight-hand side

◆ setCoefficients() [2/2]

void PetscHelmholtzRobinDomainBC::setCoefficients ( const std::function< Real(const RealVect &a_pos)> & a_A,
const std::function< Real(const RealVect &a_pos)> & a_B,
const std::function< Real(const RealVect &a_pos)> & a_C )

Set spatially varying coefficients.

Parameters
[in]a_ACoefficient on phi
[in]a_BCoefficient on dphi/dn
[in]a_CRight-hand side

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