37 "subdomain1",
"The subdomains on the 1st side of the boundary.");
39 "subdomain2",
"The subdomains on the 2nd side of the boundary.");
41 "variable1",
"The name of the first variable that this interface kernel applies to");
42 params.
addParam<NonlinearVariableName>(
44 "The name of the second variable that this interface kernel applies to. If not supplied, "
45 "variable1 will be used.");
46 params.
addParam<
bool>(
"use_displaced_mesh",
48 "Whether or not this object should use the "
49 "displaced mesh for computation. Note that "
50 "in the case this is true but no "
51 "displacements are provided in the Mesh block "
52 "the undisplaced mesh will still be used.");
54 params.
addParam<
unsigned short>(
"ghost_layers", 1,
"The number of layers of elements to ghost.");
55 params.
addParam<
bool>(
"use_point_neighbors",
57 "Whether to use point neighbors, which introduces additional ghosting to "
58 "that used for simple face neighbors.");
65 "ElementSideNeighborLayers",
70 rm_params.
set<
unsigned short>(
"layers") = obj_params.
get<
unsigned short>(
"ghost_layers");
71 rm_params.
set<
bool>(
"use_point_neighbors") = obj_params.
get<
bool>(
"use_point_neighbors");
79 params.
set<
bool>(
"_residual_object") =
true;
97 this, false, false, true),
101 _subproblem(*getCheckedPointerParam<
SubProblem *>(
"_subproblem")),
102 _var1(_subproblem.getVariable(_tid, getParam<NonlinearVariableName>(
"variable1"))
104 .getFVVariable<Real>(_tid, getParam<NonlinearVariableName>(
"variable1"))),
107 isParamValid(
"variable2") ? getParam<NonlinearVariableName>(
"variable2")
108 : getParam<NonlinearVariableName>(
"variable1"))
110 .getFVVariable<Real>(_tid,
111 isParamValid(
"variable2")
112 ? getParam<NonlinearVariableName>(
"variable2")
113 : getParam<NonlinearVariableName>(
"variable1"))),
114 _assembly(_subproblem.assembly(_tid, _var1.sys().number())),
115 _mesh(_subproblem.
mesh())
117 if (getParam<bool>(
"use_displaced_mesh"))
118 paramError(
"use_displaced_mesh",
"FV interface kernels do not yet support displaced mesh");
124 for (
const auto & sub_name : getParam<std::vector<SubdomainName>>(
"subdomain1"))
126 for (
const auto & sub_name : getParam<std::vector<SubdomainName>>(
"subdomain2"))
131 "variable1 does not exist on all the blocks specified by the subdomain1 parameter");
135 const std::string var_name = var2_provided ?
"variable2" :
"variable1";
138 " does not exist on all the blocks specified by the subdomain2 parameter",
140 :
".\nNote that you did not provide the variable2 parameter, "
141 "so variable1 was implicitly used on subdomain2");
151 "' is being triggered on an external face with centroid ",
153 ". An interface kernel requires elements on both sides of the face.");
155 const auto elem_subdomain = fi.
elem().subdomain_id();
156 const auto neighbor_subdomain = fi.
neighbor().subdomain_id();
158 const bool elem_on_side1 =
160 const bool elem_on_side2 =
163 if (!elem_on_side1 && !elem_on_side2)
166 "' is being triggered on a face with centroid ",
168 " connecting subdomains ",
172 ", but this face does not connect the subdomains specified by 'subdomain1' and "
175 if (elem_on_side1 && elem_on_side2)
178 "' is being triggered on a face with centroid ",
180 " connecting subdomains ",
184 ", but both orientations satisfy the user-defined 'subdomain1' and 'subdomain2' "
185 "restrictions, making the interface orientation ambiguous.");
187 return elem_on_side1;
203 (ft2 == ft_neigh || ft2 == ft_both)) ||
205 (ft2 == ft_elem || ft2 == ft_both)),
206 "Face type was not recognized. Check that the specified boundaries are interfaces.");
233 const bool side_is_one)
236 const auto & dof_indices =
238 mooseAssert(dof_indices.size() == 1,
"We're currently built to use CONSTANT MONOMIALS");
265 "The interface kernel should contribute to the system which variable1 belongs to!");
287 "The interface kernel should contribute to the system which variable1 belongs to!");
298 oriented_normal *= -1;
299 return oriented_normal;
329 return {&
elem1(), correct_skewness};
335 return {&
elem2(), correct_skewness};
340 const bool correct_skewness,
353 const bool correct_skewness,
367 const ADReal & value2)
const
DualNumber< Real, DNDerivativeType, true > ADReal
An interface for accessing Moose::Functors for systems that care about automatic differentiation,...
static InputParameters validParams()
A class for requiring an object to be boundary restricted.
static InputParameters validParams()
Interface for objects that need to use distributions.
static InputParameters validParams()
Moose::FaceArg faceArg2(Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
void addResidualAndJacobianToVariable1(const ADReal &residual)
Add a residual and its Jacobian contribution to variable1 on subdomain1.
void computeResidual(const FaceInfo &fi) override
Compute the residual on the supplied face.
const Elem & elem2() const
const Elem & elem1() const
std::set< SubdomainID > _subdomain1
MooseVariableFV< Real > & _var2
bool checkFaceIntegrity(const FaceInfo &fi) const
Check that the face connects the two user-defined sides of this interface.
static InputParameters validParams()
Moose::FaceArg faceArg1(Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
void addResidualAndJacobianToVariable2(const ADReal &residual)
Add a residual and its Jacobian contribution to variable2 on subdomain2.
Moose::ElemArg elemArg2(bool correct_skewness=false) const
void addResidual(Real residual, unsigned int var_num, bool neighbor)
Process the provided residual given var_num and whether this is on the neighbor side.
Moose::ElemArg elemArg1(bool correct_skewness=false) const
void addResidualAndJacobian(const ADReal &residual, const MooseVariableFV< Real > &variable, bool side_is_one)
Process the provided residual and its derivatives for a variable on a user-defined side.
FVInterfaceKernel(const InputParameters ¶meters)
Class constructor.
const FaceInfo * _face_info
The face that this object is currently operating on.
ADReal interpolateValue(Moose::FV::InterpMethod method, const ADReal &value1, const ADReal &value2) const
Interpolate values from the two user-defined sides to the face.
MooseVariableFV< Real > & _var1
void addResidualToVariable2(Real residual)
Add a residual contribution to variable2 on subdomain2.
const Point & centroid1() const
bool hasFaceSide(const FaceInfo &fi, bool fi_elem_side) const override
void computeResidualAndJacobian(const FaceInfo &fi) override
Compute the residual and Jacobian on the supplied face.
void setupData(const FaceInfo &fi)
setup data useful for this object
bool _face_info_elem_on_side1
Whether the current FaceInfo element is on the user-defined first side.
virtual ADReal computeQpResidual()=0
Assembly & _assembly
The Assembly object.
void computeJacobian(const FaceInfo &fi) override
Compute the jacobian on the supplied face.
std::set< SubdomainID > _subdomain2
const Point & centroid2() const
SubProblem & _subproblem
The SubProblem.
void addResidualToVariable1(Real residual)
Add a residual contribution to variable1 on subdomain1.
This data structure is used to store geometric and variable related metadata about each cell face in ...
const Point & normal() const
Returns the unit normal vector for the face oriented outward from the face's elem element.
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.
const Elem & elem() const
const Elem * neighborPtr() const
Real faceArea() const
Returns the face area of face id.
Real & faceCoord()
Sets/gets the coordinate transformation factor (for e.g.
const Point & neighborCentroid() const
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face.
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
const Elem & neighbor() const
Interface for objects that need to use functions.
static InputParameters validParams()
static InputParameters validParams()
Interface for notifications that the mesh has changed.
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Every object that can be built by the factory should be derived from this class.
static InputParameters validParams()
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
SystemBase & sys()
Get the system this variable is part of.
unsigned int number() const
Get variable number coming from libMesh.
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
This class provides variable solution values for other classes/objects to bind to when looping over f...
virtual const std::vector< dof_id_type > & dofIndices() const final
Get local DoF indices.
virtual const std::vector< dof_id_type > & dofIndicesNeighbor() const final
Get neighbor DOF indices for currently selected element.
bool hasBlocks(const SubdomainID id) const override
Returns whether the functor is defined on this block.
Interface class for classes which interact with Postprocessors.
static InputParameters validParams()
static InputParameters validParams()
Generic class for solving transient nonlinear problems.
virtual unsigned int currentNlSysNum() const =0
virtual void haveADObjects(bool have_ad_objects)
Method for setting whether we have any ad objects.
unsigned int number() const
Gets the number of this system.
static InputParameters validParams()
void accumulateTaggedLocalResidual()
Local residual blocks will be appended by adding the current local kernel residual.
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...
void prepareVectorTagNeighbor(Assembly &assembly, unsigned int ivar)
Prepare data for computing element residual the according to active tags for DG and interface kernels...
void prepareVectorTag(Assembly &assembly, unsigned int ivar)
Prepare data for computing element residual according to active tags.
DenseVector< Number > _local_re
Holds local residual entries as they are accumulated by this Kernel.
Interface for objects that needs transient capabilities.
static InputParameters validParams()
This interface is designed for DGKernel, InternalSideUserObject, InterfaceUserObject,...
static InputParameters validParams()
Interface for objects that need to use UserObjects.
static InputParameters validParams()
static InputParameters validParams()
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
Provides interpolation of face values for non-advection-specific purposes (although it can/will still...
InterpMethod
This codifies a set of available ways to interpolate with elem+neighbor solution information to calcu...
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
A structure that is used to evaluate Moose functors logically at an element/cell center.
A structure defining a "face" evaluation calling argument for Moose functors.
State argument for evaluating functors.