chombo-discharge
Loading...
Searching...
No Matches
PetscHelmholtzDomainBC Class Referenceabstract

Base class for domain boundary conditions of PetscHelmholtzOp. More...

#include <CD_PetscHelmholtzDomainBC.H>

Inheritance diagram for PetscHelmholtzDomainBC:

Public Member Functions

 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.
virtual 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 =0
 Get the stencil of the face flux through a domain face, and the weight of the boundary data.
virtual 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 =0
 Get the boundary data g at a domain face.

Protected Member Functions

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_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

Base class for domain boundary conditions of PetscHelmholtzOp.

This mirrors EBHelmholtzDomainBC, but where that class computes the flux through a domain face from data, this class returns the flux as a linear form in the cell values and the boundary data g, i.e.

F = w_B * g + sum_i w_i * phi_i

g is what the user specifies on the boundary, e.g. phi for a Dirichlet BC and dphi/dn for a Neumann BC. The weights w_i and w_B depend only on the grid and the discretization, and come from getFaceFluxStencil: the w_i go into the matrix, and w_B is kept by the operator. g comes from getBoundaryData, and w_B * g goes into the right-hand side, so that g can change between solves without the matrix being reassembled. F is the derivative of phi in the +a_dir direction on the face, i.e. it does not include the b-coefficient, which PetscHelmholtzOp multiplies in on the face. The discretizations in the subclasses are the same as in the EBHelmholtz domain BCs, so that PetscHelmholtzOp and EBHelmholtzOp discretize the same problem.

Like the PETSc matrix, the BC is composite: it is defined once over the whole AMR hierarchy, and each query names the phase, level, grid index and cell it is for. Through the PetscGrid a subclass has the grids on every level, their coarsenings and refinements (which share DataIndex with the level they came from), and knows for every cell whether it is covered by a finer grid. This is what a stencil needs in order to reach into a coarser or finer level.

Constructor & Destructor Documentation

◆ PetscHelmholtzDomainBC() [1/2]

PetscHelmholtzDomainBC::PetscHelmholtzDomainBC ( const PetscHelmholtzDomainBC & a_other)
delete

Disallowed copy constructor.

Parameters
[in]a_otherOther BC

◆ PetscHelmholtzDomainBC() [2/2]

PetscHelmholtzDomainBC::PetscHelmholtzDomainBC ( const PetscHelmholtzDomainBC && a_other)
delete

Disallowed move constructor.

Parameters
[in]a_otherOther BC

Member Function Documentation

◆ define()

void PetscHelmholtzDomainBC::define ( const RefCountedPtr< PetscGrid > & a_petscGrid,
const RealVect & a_probLo,
const Vector< Real > & a_dx )
virtual

Define the BC over the AMR hierarchy.

Parameters
[in]a_petscGridPETSc grid. Holds the grids on every level, their coarsenings and refinements, and the per-cell AMR information (e.g. whether a cell is covered by a finer grid).
[in]a_probLoLower-left corner of the computational domain
[in]a_dxGrid resolution on each level

Reimplemented in PetscHelmholtzElectrostaticDomainBC.

◆ getBoundaryData()

virtual Real PetscHelmholtzDomainBC::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
pure virtual

Get the boundary data g at a domain face.

The flux depends on g through w_B * g, with w_B from getFaceFluxStencil. g is evaluated whenever the right-hand side is built.

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
The boundary data g.

Implemented in PetscHelmholtzDirichletDomainBC, PetscHelmholtzElectrostaticDomainBC, PetscHelmholtzNeumannDomainBC, and PetscHelmholtzRobinDomainBC.

◆ getBoundaryPosition()

RealVect PetscHelmholtzDomainBC::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
protectednoexcept

Get the physical position of the centroid of a domain face.

The face is the face of a_vof on the domain side, in the EB graph of the phase. On a face that is not cut by the EB, the centroid is the face center. A cell with more than one face on the domain side is not supported.

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
Position of the face centroid.

◆ getFaceFluxStencil()

virtual void PetscHelmholtzDomainBC::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
pure virtual

Get the stencil of the face flux through a domain face, and the weight of the boundary data.

The stencil gives the weights w_i of the flux, excluding the b-coefficient. It is returned in three parts, one per level, which are summed: a_stencil over cells on level a_level in the index space of grid a_din, a_stencilCoar over cells on level a_level - 1 in the index space of grid a_din coarsened (PetscGrid::getMFLevelGridsCoFi()[a_level - 1]), and a_stencilFine over cells on level a_level + 1 in the index space of grid a_din refined (PetscGrid::getMFLevelGridsFiCo()[a_level + 1]). Previous contents of the three stencils are discarded.

This function does not require the entries to be PETSc rows: they may be e.g. coarse-fine ghost cells or cells covered by a finer grid. It is up to the operator that uses the stencil to make it consistent with the PetscGrid before it goes into the matrix, by replacing the entries it knows how to replace and failing on the rest. See PetscHelmholtzOp for what that operator accepts.

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

Implemented in PetscHelmholtzDirichletDomainBC, PetscHelmholtzElectrostaticDomainBC, PetscHelmholtzNeumannDomainBC, and PetscHelmholtzRobinDomainBC.

◆ operator=() [1/2]

PetscHelmholtzDomainBC & PetscHelmholtzDomainBC::operator= ( const PetscHelmholtzDomainBC && a_other)
delete

Disallowed move assignment operator.

Parameters
[in]a_otherOther BC
Returns
This BC.

◆ operator=() [2/2]

PetscHelmholtzDomainBC & PetscHelmholtzDomainBC::operator= ( const PetscHelmholtzDomainBC & a_other)
delete

Disallowed copy assignment operator.

Parameters
[in]a_otherOther BC
Returns
This BC.

Member Data Documentation

◆ m_petscGrid

RefCountedPtr<PetscGrid> PetscHelmholtzDomainBC::m_petscGrid
protected

PETSc grid.

For grids on level lvl, m_petscGrid->getMFLevelGridsCoFi()[lvl - 1] holds them coarsened to level lvl - 1, and m_petscGrid->getMFLevelGridsFiCo()[lvl + 1] holds them refined to level lvl + 1. Both share DataIndex with level lvl. m_petscGrid->getAMRToPetsc()[lvl] has the per-cell AMR information.


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