PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
singleboundarydirichlet.cpp
Go to the documentation of this file.
1
9
10namespace petibm
11{
12namespace boundary
13{
15 const type::BCLoc &inLoc,
16 const type::Field &inField,
17 const PetscReal &inValue)
18 : SingleBoundaryBase(inMesh, inLoc, inField, type::DIRICHLET, inValue)
19{
20} // SingleBoundaryDirichlet
21
23 const PetscReal &targetValue, type::GhostPointInfo &p)
24{
25 PetscFunctionBeginUser;
26
27 PetscInt dir = int(loc) / 2;
28
29 // bad idea; this means every ghost point, p, passed in will need to go
30 // through this if-condition, even though they all have same dir and field
31 // Luckily, for time-independent Dirichlet BC, a0 & a1 won't change
32 // afterward
33 if (dir == int(field))
34 {
35 p.a0 = 0.0;
36 p.a1 = value;
37 }
38 else
39 {
40 p.a0 = -1.0;
41 p.a1 = 2.0 * value;
42 }
43
44 p.value = p.a0 * targetValue + p.a1;
45
46 PetscFunctionReturn(0);
47} // setGhostICsKernel
48
50 const PetscReal &targetValue, const PetscReal &dt, type::GhostPointInfo &p)
51{
52 PetscFunctionBeginUser;
53 // for time-independent Dirichlet BC, the coefficient a0 & a1 won't change
54 PetscFunctionReturn(0);
55} // updateEqsKernel
56
57} // end of namespace boundary
58} // end of namespace petibm
Base (abstract) class for ghost points & BC on a single boundary.
type::Field field
The field of which the ghost points represent.
type::BCLoc loc
The location of this boundary.
PetscReal value
A constant value representing BC value.
virtual PetscErrorCode setGhostICsKernel(const PetscReal &targetValue, type::GhostPointInfo &p)
The underlying kernel for setting initial values and equations.
SingleBoundaryDirichlet(const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const PetscReal &value)
Constructor.
virtual PetscErrorCode updateEqsKernel(const PetscReal &targetValue, const PetscReal &dt, type::GhostPointInfo &p)
Underlying kernel for updating the coefficients of the equation.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
Definition: mesh.h:348
Field
Legal fields.
Definition: type.h:80
BCLoc
Location of a boundary.
Definition: type.h:108
@ DIRICHLET
Definition: type.h:97
A toolbox for building flow solvers.
Definition: bodypack.h:52
Definition of the class SingleBoundaryDirichlet.
A data structure for a single ghost point.
Definition: type.h:161