18 #include "libmesh/elem.h" 19 #include "libmesh/system.h" 27 params.
addParam<
bool>(
"force_boundary_execution",
29 "Whether to force execution of this object on all external boundaries.");
30 params.
addParam<std::vector<BoundaryName>>(
31 "boundaries_to_force",
32 std::vector<BoundaryName>(),
33 "The set of sidesets to force execution of this FVFluxKernel on. " 34 "Setting force_boundary_execution to true is equivalent to listing all external " 35 "mesh boundaries in this parameter.");
36 params.
addParam<std::vector<BoundaryName>>(
37 "boundaries_to_avoid",
38 std::vector<BoundaryName>(),
39 "The set of sidesets to not execute this FVFluxKernel on. " 40 "This takes precedence over force_boundary_execution to restrict to less external boundaries." 41 " By default flux kernels are executed on all internal boundaries and Dirichlet boundary " 45 "Boundary execution modification");
55 this,
false,
false,
true),
56 _var(*mooseVariableFV()),
57 _u_elem(_var.adSln()),
58 _u_neighbor(_var.adSlnNeighbor()),
59 _force_boundary_execution(getParam<bool>(
"force_boundary_execution"))
61 addMooseVariableDependency(&_var);
63 const auto & vec = getParam<std::vector<BoundaryName>>(
"boundaries_to_force");
64 for (
const auto & name : vec)
65 _boundaries_to_force.insert(_mesh.getBoundaryID(name));
67 const auto & avoid_vec = getParam<std::vector<BoundaryName>>(
"boundaries_to_avoid");
68 for (
const auto & name : avoid_vec)
70 const auto bid = _mesh.getBoundaryID(name);
71 _boundaries_to_avoid.insert(bid);
72 if (_boundaries_to_force.find(bid) != _boundaries_to_force.end())
74 "boundaries_to_avoid",
75 "A boundary may not be specified in both boundaries_to_avoid and boundaries_to_force");
196 mooseAssert(
_var.
dofIndices().size() == 1,
"We're currently built to use CONSTANT MONOMIALS");
207 "If the variable is only defined on the neighbor hand side of the face, then that " 208 "means it should have no dof indices on the elem element. Conversely if " 209 "the variable is defined on both sides of the face, then it should have a non-zero " 210 "number of degrees of freedom on the elem element");
216 "We're currently built to use CONSTANT MONOMIALS");
219 std::array<ADReal, 1>{{neighbor_r}},
234 mooseAssert(
_face_info,
"the face info should be non-null");
241 mooseAssert(
_face_info,
"the face info should be non-null");
248 mooseAssert(
_face_info,
"the face info should be non-null");
255 const bool correct_skewness,
261 return makeFace(*fi, limiter_type,
true, correct_skewness, state_limiter);
276 mooseError(
"FVFluxKernel residual/Jacobian evaluation requires a face information object");
282 mooseError(
"FVFluxKernel residual/Jacobian evaluation requires a face information object");
288 mooseError(
"FVFluxKernel residual/Jacobian evaluation requires a face information object");
virtual const std::vector< dof_id_type > & dofIndicesNeighbor() const final
Get neighbor DOF indices for currently selected element.
bool hasFaceSide(const FaceInfo &fi, const bool fi_elem_side) const override
virtual ADReal gradUDotNormal(const Moose::StateArg &time, const bool correct_skewness) const
Calculates and returns "grad_u dot normal" on the face to be used for diffusive terms.
void addResidualsAndJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals and derivatives for the Jacobian, corresponding to the provided d...
std::unordered_set< BoundaryID > _boundaries_to_avoid
Which boundaries/sidesets to prevent the execution of flux kernels on.
const std::set< BoundaryID > & boundaryIDs() const
Const getter for every associated boundary ID.
void accumulateTaggedLocalResidual()
Local residual blocks will be appended by adding the current local kernel residual.
std::unordered_set< BoundaryID > _boundaries_to_force
Which boundaries/sidesets to force the execution of flux kernels on.
static InputParameters validParams()
Moose::ElemArg elemArg(bool correct_skewness=false) const
unsigned int number() const
Get variable number coming from libMesh.
const Elem & elem() const
void computeResidualAndJacobian() override
Compute this object's contribution to the residual and Jacobian simultaneously.
const FaceInfo * _face_info
This is holds meta-data for geometric information relevant to the current face including elem+neighbo...
Real & faceCoord()
Sets/gets the coordinate transformation factor (for e.g.
bool avoidBoundary(const FaceInfo &fi) const
Returns whether to avoid execution on a boundary.
RealVectorValue _normal
This is the outward unit normal vector for the face the kernel is currently operating on...
const bool _force_boundary_execution
Whether to force execution of flux kernels on all external boundaries.
DualNumber< Real, DNDerivativeType, true > ADReal
Real faceArea() const
Returns the face area of face id.
std::pair< bool, std::vector< const FVFluxBC * > > getFluxBCs(const FaceInfo &fi) const
void computeJacobian() override
Compute this object's contribution to the diagonal Jacobian entries.
FVFluxKernel(const InputParameters ¶ms)
virtual bool skipForBoundary(const FaceInfo &fi) const
Kernels are called even on boundaries in case one is for a variable with a dirichlet BC - in which ca...
bool onBoundary(const FaceInfo &fi) const
Return whether the supplied face is on a boundary of this object's execution.
Enhances MooseVariableInterface interface provide values from neighbor elements.
This data structure is used to store geometric and variable related metadata about each cell face in ...
std::pair< bool, const FVDirichletBCBase * > getDirichletBC(const FaceInfo &fi) const
static InputParameters validParams()
const Elem * neighborPtr() const
A structure defining a "face" evaluation calling argument for Moose functors.
const Elem & neighbor() const
A structure that is used to evaluate Moose functors logically at an element/cell center.
const Point & normal() const
Returns the unit normal vector for the face oriented outward from the face's elem element...
unsigned int number() const
Gets the number of this system.
FaceInfo::VarFaceNeighbors _face_type
The face type.
Assembly & _assembly
Reference to this Kernel's assembly object.
const Elem * elemPtr() const
FVKernel is a base class for all finite volume method kernels.
bool onBoundary(const SubdomainRestrictable &obj, const FaceInfo &fi)
Return whether the supplied face is on a boundary of the object's execution.
virtual ADReal computeQpResidual()=0
This is the primary function that must be implemented for flux kernel terms.
void prepareVectorTagNeighbor(Assembly &assembly, unsigned int ivar)
Prepare data for computing element residual the according to active tags for DG and interface kernels...
Moose::ElemArg neighborArg(bool correct_skewness=false) const
ADReal gradUDotNormal(const FaceInfo &face_info, const MooseVariableFV< Real > &fv_var, const Moose::StateArg &time, bool correct_skewness=false)
Calculates and returns "grad_u dot normal" on the face to be used for diffusive terms.
static InputParameters validParams()
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
This interface is designed for DGKernel, InternalSideUserObject, InterfaceUserObject, where material properties on a side of both its primary side (face) and its secondary side (neighbor) all required.
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi=nullptr, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
Determine the single sided face argument when evaluating a functor on a face.
State argument for evaluating functors.
MooseVariableFV< Real > & _var
bool hasBlocks(const SubdomainName &name) const
Test if the supplied block name is valid for this object.
void prepareVectorTag(Assembly &assembly, unsigned int ivar)
Prepare data for computing element residual according to active tags.
void computeResidual() override
Compute this object's contribution to the residual.
SystemBase & sys()
Get the system this variable is part of.
Moose::FaceArg makeFace(const FaceInfo &fi, const Moose::FV::LimiterType limiter_type, const bool elem_is_upwind, const bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
Create a functor face argument from provided component arguments.
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
virtual const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const
Returns which side(s) the given variable-system number pair is defined on for this face...