https://mooseframework.inl.gov
FVOrthogonalBoundaryDiffusion.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "Function.h"
12 
14 
17 {
19  params.addClassDescription(
20  "Imposes an orthogonal diffusion boundary term with specified boundary function.");
21  params.addRequiredParam<FunctionName>("function",
22  "The value of the quantity of interest on the boundary.");
23  params.addRequiredParam<MaterialPropertyName>("coeff", "diffusion coefficient");
24  params.addParam<MaterialPropertyName>(
25  "diffusing_quantity",
26  "The quantity that is diffusing. By default, the 'variable' solution value will be used.");
27  return params;
28 }
29 
31  : FVFluxBC(parameters),
32  _function(getFunction("function")),
33  _coeff_elem(getADMaterialProperty<Real>("coeff")),
34  _coeff_neighbor(getNeighborADMaterialProperty<Real>("coeff")),
35  _diff_quant_elem(isParamValid("diffusing_quantity")
36  ? getADMaterialProperty<Real>("diffusing_quantity").get()
37  : _u),
38  _diff_quant_neighbor(isParamValid("diffusing_quantity")
39  ? getNeighborADMaterialProperty<Real>("diffusing_quantity").get()
40  : _u_neighbor)
41 {
42 }
43 
44 ADReal
46 {
47  const bool elem_is_interior = (_face_type == FaceInfo::VarFaceNeighbors::ELEM);
48 
49  const auto & diff_quant = elem_is_interior ? _diff_quant_elem[_qp] : _diff_quant_neighbor[_qp];
50  const auto & coeff = elem_is_interior ? _coeff_elem[_qp] : _coeff_neighbor[_qp];
51  const auto & interior_centroid =
52  elem_is_interior ? _face_info->elemCentroid() : _face_info->neighborCentroid();
53 
54  return -coeff * (_function.value(_t, _face_info->faceCentroid()) - diff_quant) /
55  (_face_info->faceCentroid() - interior_centroid).norm();
56 }
const FaceInfo * _face_info
Holds information for the face we are currently examining.
FaceInfo::VarFaceNeighbors _face_type
The variable face type.
Definition: FVFluxBC.h:73
static InputParameters validParams()
Definition: FVFluxBC.C:17
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition: FaceInfo.h:71
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", FVOrthogonalBoundaryDiffusion)
const Point & neighborCentroid() const
Definition: FaceInfo.h:243
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:46
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
const unsigned int _qp
Definition: FVFluxBC.h:45
This class computes a boundary diffusion flux by taking the difference between a provided boundary va...
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face...
Definition: FaceInfo.h:95
const MooseArray< ADReal > & _diff_quant_neighbor
FVOrthogonalBoundaryDiffusion(const InputParameters &parameters)
const ADMaterialProperty< Real > & _coeff_neighbor
Diffusion coefficient on the neighbor.
Provides an interface for computing residual contributions from finite volume numerical fluxes comput...
Definition: FVFluxBC.h:23
auto norm(const T &a) -> decltype(std::abs(a))
const ADMaterialProperty< Real > & _coeff_elem
Diffusion coefficient on the element.
const MooseArray< ADReal > & _diff_quant_elem
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero...
Definition: Function.C:44