PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
singleboundary.h
Go to the documentation of this file.
1
8#pragma once
9
10// C++ STL
11#include <memory>
12
13// here goes PETSc headers
14#include <petscsys.h>
15#include <petscvec.h>
16
17// here goes headers from our PetIBM
18#include <petibm/mesh.h>
19#include <petibm/type.h>
20
21namespace petibm
22{
23namespace boundary
24{
31{
32public:
34 PetscInt dim;
35
38
41
44
46 PetscReal value;
47
49 PetscReal normal;
50
53
55 PetscBool onThisProc;
56
66 const type::Field &field, const type::BCType &type,
67 const PetscReal &value);
68
70 SingleBoundaryBase() = default;
71
73 virtual ~SingleBoundaryBase();
74
79 virtual PetscErrorCode destroy();
80
86 PetscErrorCode setGhostICs(const Vec &vec);
87
99 PetscErrorCode updateEqs(const Vec &vec, const PetscReal &dt);
100
106 PetscErrorCode updateGhostValues(const Vec &vec);
107
117 PetscErrorCode copyValues2LocalVec(Vec &lclVec);
118
119protected:
129 PetscErrorCode init(const type::Mesh &mesh, const type::BCLoc &loc,
130 const type::Field &field, const type::BCType &type,
131 const PetscReal &bcValue);
132
139 virtual PetscErrorCode setGhostICsKernel(const PetscReal &targetValue,
141
149 virtual PetscErrorCode updateEqsKernel(const PetscReal &targetValue,
150 const PetscReal &dt,
152
154 MPI_Comm comm;
155
157 PetscMPIInt mpiSize;
158
160 PetscMPIInt mpiRank;
161
164
165}; // SingleBoundaryBase
166
167} // end of namespace boundary
168
169namespace type
170{
178typedef std::shared_ptr<boundary::SingleBoundaryBase> SingleBoundary;
179} // end of namespace type
180
181namespace boundary
182{
198PetscErrorCode createSingleBoundary(const type::Mesh &mesh,
199 const type::BCLoc &loc,
200 const type::Field &field,
201 const PetscReal &value,
202 const type::BCType &bcType,
203 type::SingleBoundary &singleBd);
204} // end of namespace boundary
205
206} // end of namespace petibm
Base (abstract) class for ghost points & BC on a single boundary.
type::BCType type
The type of boundary conditions.
PetscErrorCode updateEqs(const Vec &vec, const PetscReal &dt)
Modify the coefficients in the equation of ghost points.
virtual PetscErrorCode destroy()
Manually destroy data.
type::GhostPointsList points
The list of ghost points on this boundary and at this field.
virtual PetscErrorCode updateEqsKernel(const PetscReal &targetValue, const PetscReal &dt, type::GhostPointInfo &p)=0
Underlying kernel for updating the coefficients of the equation.
PetscBool onThisProc
Indicate if this process holds part of this boundary.
type::Field field
The field of which the ghost points represent.
SingleBoundaryBase()=default
Default constructor.
PetscErrorCode init(const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const type::BCType &type, const PetscReal &bcValue)
Underlying initialization function.
PetscErrorCode setGhostICs(const Vec &vec)
Set up the initial values of the ghost points.
PetscErrorCode updateGhostValues(const Vec &vec)
Update the values of ghost points using the equation.
PetscReal normal
The direction of normal vector.
type::BCLoc loc
The location of this boundary.
type::Mesh mesh
The corresponding Mesh object.
PetscReal value
A constant value representing BC value.
PetscMPIInt mpiSize
The size of the MPI communicator.
virtual PetscErrorCode setGhostICsKernel(const PetscReal &targetValue, type::GhostPointInfo &p)=0
The underlying kernel for setting initial values and equations.
MPI_Comm comm
MPI communicator.
virtual ~SingleBoundaryBase()
Default destructor.
PetscErrorCode copyValues2LocalVec(Vec &lclVec)
Copy the values of ghost points to a local Vec.
PetscMPIInt mpiRank
The rank of this process.
std::shared_ptr< boundary::SingleBoundaryBase > SingleBoundary
Definition of type petibm::type::SingleBoundary.
PetscErrorCode createSingleBoundary(const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const PetscReal &value, const type::BCType &bcType, type::SingleBoundary &singleBd)
Factory function for creating a SingleBoundary object.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
Definition: mesh.h:348
Field
Legal fields.
Definition: type.h:80
BCType
Type of boundary conditions.
Definition: type.h:94
std::map< MatStencil, GhostPointInfo > GhostPointsList
A map between MatStencil and GhostPointInfo.
Definition: type.h:177
BCLoc
Location of a boundary.
Definition: type.h:108
Prototype of mesh::MeshBase, type::Mesh, and factory function.
A toolbox for building flow solvers.
Definition: bodypack.h:52
A data structure for a single ghost point.
Definition: type.h:161
Definition of user-defined types for convenience.