PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
petibm::boundary::SingleBoundaryBase Class Referenceabstract

Base (abstract) class for ghost points & BC on a single boundary. More...

#include <singleboundary.h>

Inheritance diagram for petibm::boundary::SingleBoundaryBase:
[legend]

Public Member Functions

 SingleBoundaryBase (const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const type::BCType &type, const PetscReal &value)
 Constructor. More...
 
 SingleBoundaryBase ()=default
 Default constructor. More...
 
virtual ~SingleBoundaryBase ()
 Default destructor. More...
 
virtual PetscErrorCode destroy ()
 Manually destroy data. More...
 
PetscErrorCode setGhostICs (const Vec &vec)
 Set up the initial values of the ghost points. More...
 
PetscErrorCode updateEqs (const Vec &vec, const PetscReal &dt)
 Modify the coefficients in the equation of ghost points. More...
 
PetscErrorCode updateGhostValues (const Vec &vec)
 Update the values of ghost points using the equation. More...
 
PetscErrorCode copyValues2LocalVec (Vec &lclVec)
 Copy the values of ghost points to a local Vec. More...
 

Public Attributes

PetscInt dim
 Dimension. More...
 
type::BCLoc loc
 The location of this boundary. More...
 
type::Field field
 The field of which the ghost points represent. More...
 
type::BCType type
 The type of boundary conditions. More...
 
PetscReal value
 A constant value representing BC value. More...
 
PetscReal normal
 The direction of normal vector. More...
 
type::GhostPointsList points
 The list of ghost points on this boundary and at this field. More...
 
PetscBool onThisProc
 Indicate if this process holds part of this boundary. More...
 

Protected Member Functions

PetscErrorCode init (const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const type::BCType &type, const PetscReal &bcValue)
 Underlying initialization function. More...
 
virtual PetscErrorCode setGhostICsKernel (const PetscReal &targetValue, type::GhostPointInfo &p)=0
 The underlying kernel for setting initial values and equations. More...
 
virtual PetscErrorCode updateEqsKernel (const PetscReal &targetValue, const PetscReal &dt, type::GhostPointInfo &p)=0
 Underlying kernel for updating the coefficients of the equation. More...
 

Protected Attributes

MPI_Comm comm
 MPI communicator. More...
 
PetscMPIInt mpiSize
 The size of the MPI communicator. More...
 
PetscMPIInt mpiRank
 The rank of this process. More...
 
type::Mesh mesh
 The corresponding Mesh object. More...
 

Detailed Description

Base (abstract) class for ghost points & BC on a single boundary.

See also
Boundaries and boundary conditions, petibm::type::SingleBoundary

Definition at line 30 of file singleboundary.h.

Constructor & Destructor Documentation

◆ SingleBoundaryBase() [1/2]

petibm::boundary::SingleBoundaryBase::SingleBoundaryBase ( const type::Mesh mesh,
const type::BCLoc loc,
const type::Field field,
const type::BCType type,
const PetscReal &  value 
)

Constructor.

Parameters
mesh[in] a Mesh instance.
loc[in] the location of the target boundary.
field[in] the target field.
type[in] the type of BC.
value[in] BC value.

Definition at line 16 of file singleboundarybase.cpp.

◆ SingleBoundaryBase() [2/2]

petibm::boundary::SingleBoundaryBase::SingleBoundaryBase ( )
default

Default constructor.

◆ ~SingleBoundaryBase()

petibm::boundary::SingleBoundaryBase::~SingleBoundaryBase ( )
virtual

Default destructor.

Definition at line 25 of file singleboundarybase.cpp.

Member Function Documentation

◆ copyValues2LocalVec()

PetscErrorCode petibm::boundary::SingleBoundaryBase::copyValues2LocalVec ( Vec &  lclVec)

Copy the values of ghost points to a local Vec.

Parameters
lclVec[in, out] a local Vec with memory allocations for ghost points.
Returns
PetscErrorCode.

In PetIBM, we use a global packed Vec for velocity fields. But in some occasions, we may need local Vecs that have ghost points in them. So we have to copy the ghost values from this instance to the local Vecs.

Definition at line 165 of file singleboundarybase.cpp.

◆ destroy()

PetscErrorCode petibm::boundary::SingleBoundaryBase::destroy ( )
virtual

Manually destroy data.

Returns
PetscErrorCode.

Reimplemented in petibm::boundary::SingleBoundaryConvective.

Definition at line 37 of file singleboundarybase.cpp.

◆ init()

PetscErrorCode petibm::boundary::SingleBoundaryBase::init ( const type::Mesh mesh,
const type::BCLoc loc,
const type::Field field,
const type::BCType type,
const PetscReal &  bcValue 
)
protected

Underlying initialization function.

Parameters
mesh[in] a Mesh instance.
loc[in] the location of the target boundary.
field[in] the target field.
type[in] the type of BC.
bcValue[in] BC value.
Returns
PetscErrorCode.

Definition at line 55 of file singleboundarybase.cpp.

◆ setGhostICs()

PetscErrorCode petibm::boundary::SingleBoundaryBase::setGhostICs ( const Vec &  vec)

Set up the initial values of the ghost points.

Parameters
vec[in] a packed solution Vec containing initial values.
Returns
PetscErrorCode.

Definition at line 107 of file singleboundarybase.cpp.

◆ setGhostICsKernel()

virtual PetscErrorCode petibm::boundary::SingleBoundaryBase::setGhostICsKernel ( const PetscReal &  targetValue,
type::GhostPointInfo p 
)
protectedpure virtual

The underlying kernel for setting initial values and equations.

Parameters
targetValue[in] the value of the corresponding boundary point.
p[in, out] the target ghost point.
Returns
PetscErrorCode.

Implemented in petibm::boundary::SingleBoundaryConvective, petibm::boundary::SingleBoundaryDirichlet, petibm::boundary::SingleBoundaryNeumann, and petibm::boundary::SingleBoundaryPeriodic.

◆ updateEqs()

PetscErrorCode petibm::boundary::SingleBoundaryBase::updateEqs ( const Vec &  vec,
const PetscReal &  dt 
)

Modify the coefficients in the equation of ghost points.

Parameters
vec[in] a packed solution Vec at current time step.
dt[in] a PetscReal representing time-step size.
Returns
PetscErrorCode.

The equation of ghost points means the relationship between boundary points and ghost points. The equation has a form u_ghost = a0 * u_boundary + a1. This function changes a1 and a0 according to the type of BC.

Definition at line 126 of file singleboundarybase.cpp.

◆ updateEqsKernel()

virtual PetscErrorCode petibm::boundary::SingleBoundaryBase::updateEqsKernel ( const PetscReal &  targetValue,
const PetscReal &  dt,
type::GhostPointInfo p 
)
protectedpure virtual

Underlying kernel for updating the coefficients of the equation.

Parameters
targetValue[in] the value of corresponding boundary point.
dt[in] the size of a time step.
p[in, out] the target ghost point.
Returns
PetscErrorCode.

Implemented in petibm::boundary::SingleBoundaryConvective, petibm::boundary::SingleBoundaryDirichlet, petibm::boundary::SingleBoundaryNeumann, and petibm::boundary::SingleBoundaryPeriodic.

◆ updateGhostValues()

PetscErrorCode petibm::boundary::SingleBoundaryBase::updateGhostValues ( const Vec &  vec)

Update the values of ghost points using the equation.

Parameters
vec[in] a packed solution Vec at current time step.
Returns
PetscErrorCode.

Definition at line 146 of file singleboundarybase.cpp.

Member Data Documentation

◆ comm

MPI_Comm petibm::boundary::SingleBoundaryBase::comm
protected

MPI communicator.

Definition at line 154 of file singleboundary.h.

◆ dim

PetscInt petibm::boundary::SingleBoundaryBase::dim

Dimension.

Definition at line 34 of file singleboundary.h.

◆ field

type::Field petibm::boundary::SingleBoundaryBase::field

The field of which the ghost points represent.

Definition at line 40 of file singleboundary.h.

◆ loc

type::BCLoc petibm::boundary::SingleBoundaryBase::loc

The location of this boundary.

Definition at line 37 of file singleboundary.h.

◆ mesh

type::Mesh petibm::boundary::SingleBoundaryBase::mesh
protected

The corresponding Mesh object.

Definition at line 163 of file singleboundary.h.

◆ mpiRank

PetscMPIInt petibm::boundary::SingleBoundaryBase::mpiRank
protected

The rank of this process.

Definition at line 160 of file singleboundary.h.

◆ mpiSize

PetscMPIInt petibm::boundary::SingleBoundaryBase::mpiSize
protected

The size of the MPI communicator.

Definition at line 157 of file singleboundary.h.

◆ normal

PetscReal petibm::boundary::SingleBoundaryBase::normal

The direction of normal vector.

Definition at line 49 of file singleboundary.h.

◆ onThisProc

PetscBool petibm::boundary::SingleBoundaryBase::onThisProc

Indicate if this process holds part of this boundary.

Definition at line 55 of file singleboundary.h.

◆ points

type::GhostPointsList petibm::boundary::SingleBoundaryBase::points

The list of ghost points on this boundary and at this field.

Definition at line 52 of file singleboundary.h.

◆ type

type::BCType petibm::boundary::SingleBoundaryBase::type

The type of boundary conditions.

Definition at line 43 of file singleboundary.h.

◆ value

PetscReal petibm::boundary::SingleBoundaryBase::value

A constant value representing BC value.

Definition at line 46 of file singleboundary.h.


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