https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
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 : FVQpFluxBC(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
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}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("MooseApp", FVOrthogonalBoundaryDiffusion)
const FaceInfo * _face_info
Holds information for the face we are currently examining.
FaceInfo::VarFaceNeighbors _face_type
The variable face type.
Definition FVFluxBC.h:60
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 ADMaterialProperty< Real > & _coeff_elem
Diffusion coefficient on the element.
FVOrthogonalBoundaryDiffusion(const InputParameters &parameters)
const MooseArray< ADReal > & _diff_quant_neighbor
const ADMaterialProperty< Real > & _coeff_neighbor
Diffusion coefficient on the neighbor.
const MooseArray< ADReal > & _diff_quant_elem
Base class for FV flux BCs that need qp-indexed solution values on both sides of a face.
Definition FVQpFluxBC.h:18
static InputParameters validParams()
Definition FVQpFluxBC.C:15
const Point & neighborCentroid() const
Definition FaceInfo.h:247
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face.
Definition FaceInfo.h:99
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition FaceInfo.h:75
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:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
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...
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.