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

An implementation of SingleBoundaryBase for periodic BC. More...

#include <singleboundaryperiodic.h>

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

Public Member Functions

 SingleBoundaryPeriodic (const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const PetscReal &value)
 Constructor. More...
 
virtual ~SingleBoundaryPeriodic ()=default
 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

virtual PetscErrorCode setGhostICsKernel (const PetscReal &targetValue, type::GhostPointInfo &p)
 The underlying kernel for setting initial values and equations. More...
 
virtual PetscErrorCode updateEqsKernel (const PetscReal &targetValue, const PetscReal &dt, type::GhostPointInfo &p)
 Underlying kernel for updating the coefficients of the equation. More...
 
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...
 

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

An implementation of SingleBoundaryBase for periodic BC.

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

PETSc will handle periodic BCs for us, so this is just a trivial implementation to keep consistency.

Definition at line 25 of file singleboundaryperiodic.h.

Constructor & Destructor Documentation

◆ SingleBoundaryPeriodic()

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

Constructor.

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

Definition at line 14 of file singleboundaryperiodic.cpp.

◆ ~SingleBoundaryPeriodic()

virtual petibm::boundary::SingleBoundaryPeriodic::~SingleBoundaryPeriodic ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ copyValues2LocalVec()

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

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 ( )
virtualinherited

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 
)
protectedinherited

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)
inherited

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()

PetscErrorCode petibm::boundary::SingleBoundaryPeriodic::setGhostICsKernel ( const PetscReal &  targetValue,
type::GhostPointInfo p 
)
protectedvirtual

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.

Implements petibm::boundary::SingleBoundaryBase.

Definition at line 49 of file singleboundaryperiodic.cpp.

◆ updateEqs()

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

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()

PetscErrorCode petibm::boundary::SingleBoundaryPeriodic::updateEqsKernel ( const PetscReal &  targetValue,
const PetscReal &  dt,
type::GhostPointInfo p 
)
protectedvirtual

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.

Implements petibm::boundary::SingleBoundaryBase.

Definition at line 57 of file singleboundaryperiodic.cpp.

◆ updateGhostValues()

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

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
protectedinherited

MPI communicator.

Definition at line 154 of file singleboundary.h.

◆ dim

PetscInt petibm::boundary::SingleBoundaryBase::dim
inherited

Dimension.

Definition at line 34 of file singleboundary.h.

◆ field

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

The field of which the ghost points represent.

Definition at line 40 of file singleboundary.h.

◆ loc

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

The location of this boundary.

Definition at line 37 of file singleboundary.h.

◆ mesh

type::Mesh petibm::boundary::SingleBoundaryBase::mesh
protectedinherited

The corresponding Mesh object.

Definition at line 163 of file singleboundary.h.

◆ mpiRank

PetscMPIInt petibm::boundary::SingleBoundaryBase::mpiRank
protectedinherited

The rank of this process.

Definition at line 160 of file singleboundary.h.

◆ mpiSize

PetscMPIInt petibm::boundary::SingleBoundaryBase::mpiSize
protectedinherited

The size of the MPI communicator.

Definition at line 157 of file singleboundary.h.

◆ normal

PetscReal petibm::boundary::SingleBoundaryBase::normal
inherited

The direction of normal vector.

Definition at line 49 of file singleboundary.h.

◆ onThisProc

PetscBool petibm::boundary::SingleBoundaryBase::onThisProc
inherited

Indicate if this process holds part of this boundary.

Definition at line 55 of file singleboundary.h.

◆ points

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

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
inherited

The type of boundary conditions.

Definition at line 43 of file singleboundary.h.

◆ value

PetscReal petibm::boundary::SingleBoundaryBase::value
inherited

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: