https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVAdvectionDiffusionExtrapolatedBC.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
13
16{
19 "Adds a boundary condition which calculates the face values and face gradients assuming one "
20 "or two term expansions from the cell centroid. This kernel is only compatible "
21 "with advection-diffusion problems.");
22 params.addParam<bool>(
23 "use_two_term_expansion",
24 false,
25 "If an approximate linear expansion should be used to compute the face value.");
26 return params;
27}
28
30 const InputParameters & parameters)
31 : LinearFVAdvectionDiffusionBC(parameters),
32 _two_term_expansion(getParam<bool>("use_two_term_expansion"))
33{
36}
37
38Real
40{
41 // We allow internal boundaries too so we need to check which side we are on
45 const auto state = determineState();
46
47 // By default we approximate the boundary value with the neighboring cell value
48 auto boundary_value = _var.getElemValue(*elem_info, state);
49
50 // If we request linear extrapolation, we add the gradient term as well
52 boundary_value += _var.gradSln(*elem_info, state) * computeCellToFaceVector();
53
54 return boundary_value;
55}
56
57Real
59{
60 // By default we assume that the face value is the same as the cell center value so we
61 // have a zero gradient.
62 Real normal_gradient = 0.0;
63
64 // If we request linear extrapolation, we will have a gradient. We use
66 {
70 normal_gradient = _var.gradSln(*elem_info, determineState()) * _current_face_info->normal();
71 }
72 return normal_gradient;
73}
74
75Real
80
81Real
83{
84 // If we approximate the face value with the cell value, we
85 // don't need to add anything to the right hand side
86 Real contribution = 0.0;
87
88 // If we have linear extrapolation, we chose to add the linear term to
89 // the right hand side instead of the system matrix.
91 {
95 contribution = _var.gradSln(*elem_info, determineState()) * computeCellToFaceVector();
96 }
97
98 return contribution;
99}
100
101Real
106
107Real
registerMooseObject("MooseApp", LinearFVAdvectionDiffusionExtrapolatedBC)
const Point & normal() const
Returns the unit normal vector for the face oriented outward from the face's elem element.
Definition FaceInfo.h:72
const ElemInfo * elemInfo() const
Definition FaceInfo.h:89
const ElemInfo * neighborInfo() const
Definition FaceInfo.h:90
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 addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Base class for boundary conditions that are valid for advection diffusion problems.
Class implementing an extrapolated boundary condition for linear finite volume variables.
virtual Real computeBoundaryValueMatrixContribution() const override
Computes the boundary value's contribution to the linear system matrix.
LinearFVAdvectionDiffusionExtrapolatedBC(const InputParameters &parameters)
Class constructor.
virtual Real computeBoundaryNormalGradient() const override
Computes the normal gradient (often used in diffusion terms) on the boundary.
virtual Real computeBoundaryGradientRHSContribution() const override
Computes the boundary gradient's contribution to the linear system right hand side.
virtual Real computeBoundaryValueRHSContribution() const override
Computes the boundary value's contribution to the linear system right hand side.
const bool _two_term_expansion
Switch for enabling linear extrapolation for the boundary face value.
virtual Real computeBoundaryGradientMatrixContribution() const override
Computes the boundary gradient's contribution to the linear system matrix.
virtual Real computeBoundaryValue() const override
Computes the boundary value of this object.
const FaceInfo * _current_face_info
Pointer to the face info we are operating on right now.
Real computeCellToFaceDistance() const
Compute the distance between the cell center and the face.
FaceInfo::VarFaceNeighbors _current_face_type
Face ownership information for the current face.
RealVectorValue computeCellToFaceVector() const
Computes the vector connecting the cell and boundary face centers.
MooseLinearVariableFV< Real > & _var
Reference to the linear finite volume variable object.
void computeCellGradients()
Switch to request cell gradient computations.
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
Get the solution value for the provided element and seed the derivative for the corresponding dof ind...
VectorValue< Real > gradSln(const ElemInfo &elem_info, const StateArg &state) const
Get the variable gradient at a cell center.
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.