12PetscErrorCode kernelConvectiveDiffDir(
const PetscReal &targetValue,
14 const PetscReal &normal,
15 const PetscReal &value,
18 PetscFunctionBeginUser;
21 p.a1 =
p.value + targetValue -
22 2.0 * normal * dt * value * (
p.value - targetValue) /
p.dL;
24 PetscFunctionReturn(0);
27PetscErrorCode kernelConvectiveSameDir(
const PetscReal &targetValue,
29 const PetscReal &normal,
30 const PetscReal &value,
33 PetscFunctionBeginUser;
36 p.a1 =
p.value - normal * dt * value * (
p.value - targetValue) /
p.dL;
38 PetscFunctionReturn(0);
49 const PetscReal &inValue)
52 PetscInt dir = int(
loc) / 2;
54 if (dir ==
int(
field))
55 kernel = &kernelConvectiveSameDir;
57 kernel = &kernelConvectiveDiffDir;
62 PetscFunctionBeginUser;
66 PetscFunctionReturn(0);
72 PetscFunctionBeginUser;
79 p.value = targetValue;
84 PetscFunctionReturn(0);
90 PetscFunctionBeginUser;
96 PetscFunctionReturn(0);
Base (abstract) class for ghost points & BC on a single boundary.
virtual PetscErrorCode destroy()
Manually destroy data.
type::Field field
The field of which the ghost points represent.
PetscReal normal
The direction of normal vector.
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.
PetscErrorCode(* kernel)(const PetscReal &targetValue, const PetscReal &dt, const PetscReal &normal, const PetscReal &value, type::GhostPointInfo &p)
Underlying kernel that will determined during runtime according to the location of the boundary and t...
virtual PetscErrorCode updateEqsKernel(const PetscReal &targetValue, const PetscReal &dt, type::GhostPointInfo &p)
Underlying kernel for updating the coefficients of the equation.
SingleBoundaryConvective(const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const PetscReal &value)
Constructor.
virtual PetscErrorCode destroy()
Manually destroy data.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
BCLoc
Location of a boundary.
A toolbox for building flow solvers.
Definition of the class SingleBoundaryConvective.
A data structure for a single ghost point.