20 const PetscReal &inValue)
22 init(inMesh, bcLoc, inField, inType, inValue);
27 PetscFunctionBeginUser;
31 ierr = PetscFinalized(&finalized); CHKERRV(ierr);
32 if (finalized)
return;
39 PetscFunctionBeginUser;
52 PetscFunctionReturn(0);
59 const PetscReal &inValue)
61 PetscFunctionBeginUser;
89 normal = ((int(
loc) % 2) == 0) ? -1.0 : 1.0;
102 ierr = MPI_Barrier(
comm); CHKERRQ(ierr);
104 PetscFunctionReturn(0);
109 PetscFunctionBeginUser;
113 PetscReal targetValue;
117 ierr = VecGetValues(vec, 1, &(it.second.targetPackedId), &targetValue);
123 PetscFunctionReturn(0);
129 PetscFunctionBeginUser;
133 PetscReal targetValue;
137 ierr = VecGetValues(vec, 1, &(it.second.targetPackedId), &targetValue);
143 PetscFunctionReturn(0);
148 PetscFunctionBeginUser;
152 PetscReal targetValue;
156 ierr = VecGetValues(vec, 1, &(it.second.targetPackedId), &targetValue);
159 it.second.value = it.second.a0 * targetValue + it.second.a1;
162 PetscFunctionReturn(0);
167 PetscFunctionBeginUser;
173 ierr = VecSetValue(lclVec, it.second.lclId, it.second.value,
174 INSERT_VALUES); CHKERRQ(ierr);
177 PetscFunctionReturn(0);
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< mesh::MeshBase > Mesh
Type definition of Mesh.
PetscErrorCode checkBoundaryProc(const DM &da, const type::IntVec1D &n, const type::BCLoc &loc, PetscBool &onThisProc)
Check if a boundary is on this process.
PetscErrorCode getGhostPointList(const type::Mesh &mesh, const type::Field &field, const type::BCLoc &loc, type::GhostPointsList &points)
Get a list of ghost points on a desired boundary.
BCType
Type of boundary conditions.
std::map< MatStencil, GhostPointInfo > GhostPointsList
A map between MatStencil and GhostPointInfo.
BCLoc
Location of a boundary.
Prototypes of some miscellaneous functions.
A toolbox for building flow solvers.
Definition of the class SingleBoundaryBase.