https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVAdvectionDiffusionFunctorRobinBCBase.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
18
25
26Real
28{
29 const auto face = singleSidedFaceArg(_current_face_info);
31 "This should not be assigned on an internal face!");
35 const auto state = determineState();
36
37 const auto alpha = getAlpha(face, state);
38 const auto beta = getBeta(face, state);
39 const auto gamma = getGamma(face, state);
40
41 const auto phi = _var.getElemValue(*elem_info, state);
42 const auto grad_phi = _var.gradSln(*elem_info, state);
43
44 const auto & nhat = _current_face_info->normal();
45
46 const auto d_cf = computeCellToFaceVector(); // vector from boundary cell centre to boundary face
47 const auto projection = d_cf * nhat;
48 const auto vc = d_cf - (projection * nhat);
49 return ((alpha * phi) + (alpha * grad_phi * vc) + (gamma * projection)) /
50 (alpha + (beta * projection));
51}
52
53Real
55{
56 const auto face = singleSidedFaceArg(_current_face_info);
57 const auto state = determineState();
58
59 const auto alpha = getAlpha(face, state);
60 mooseAssert(!MooseUtils::isZero(alpha), "Alpha should not be 0!");
61 const auto beta = getBeta(face, state);
62 const auto gamma = getGamma(face, state);
63 return (gamma - beta * computeBoundaryValue()) / alpha;
64}
65
66// implicit terms for advection kernel
67Real
69{
70 const auto face = singleSidedFaceArg(_current_face_info);
71 const auto state = determineState();
72 const auto alpha = getAlpha(face, state);
73 const auto beta = getBeta(face, state);
74 const auto & nhat = _current_face_info->normal();
75
76 return alpha / (alpha + (beta * computeCellToFaceVector() * nhat));
77}
78
79// explicit terms for advection kernel
80Real
82{
83 const auto face = singleSidedFaceArg(_current_face_info);
84 const auto state = determineState();
86 "This should not be assigned on an internal face!");
90
91 const auto alpha = getAlpha(face, state);
92 const auto beta = getBeta(face, state);
93 const auto gamma = getGamma(face, state);
94
95 const auto & grad_phi = _var.gradSln(*elem_info, state);
96
97 const auto & nhat = _current_face_info->normal();
98
99 const auto d_cf = computeCellToFaceVector(); // vector from boundary cell centre to boundary face
100 const auto projection = d_cf * nhat;
101 const auto vc = d_cf - (projection * nhat); // correction vector for non-orthogonal cells
102
103 return (gamma * projection / (alpha + (beta * projection))) +
104 (alpha * grad_phi * vc / (alpha + (beta * projection)));
105}
106
107// implicit terms for diffusion kernel
108Real
110{
111 const auto face = singleSidedFaceArg(_current_face_info);
112 const auto state = determineState();
113 const auto alpha = getAlpha(face, state);
114 const auto beta = getBeta(face, state);
115
116 const auto & nhat = _current_face_info->normal();
117
118 return beta / (alpha + (beta * computeCellToFaceVector() * nhat));
119}
120
121// explicit terms for diffusion kernel
122Real
124{
126 "This should not be assigned on an internal face!");
127 const auto & elem_info = _current_face_type == FaceInfo::VarFaceNeighbors::ELEM
130 const auto face = singleSidedFaceArg(_current_face_info);
131 const auto state = determineState();
132 const auto & grad_phi = _var.gradSln(*elem_info, state);
133
134 const auto alpha = getAlpha(face, state);
135 const auto beta = getBeta(face, state);
136 const auto gamma = getGamma(face, state);
137
138 const auto & nhat = _current_face_info->normal();
139
140 const auto d_cf = computeCellToFaceVector(); // vector from boundary cell centre to boundary face
141 const auto projection = d_cf * nhat;
142 const auto vc = d_cf - (projection * nhat); // correction vector for non-orthogonal cells
143
144 return (gamma / alpha) + (-beta * gamma * projection / alpha / (alpha + (beta * projection))) +
145 (-beta * grad_phi * vc / (alpha + (beta * projection)));
146}
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.
Base class for boundary conditions that are valid for advection diffusion problems.
virtual Real getGamma(Moose::FaceArg face, Moose::StateArg state) const =0
virtual Real computeBoundaryGradientRHSContribution() const override
Computes the boundary gradient's contribution to the linear system right hand side.
virtual Real computeBoundaryNormalGradient() const override
Computes the normal gradient (often used in diffusion terms) on the boundary.
virtual Real getAlpha(Moose::FaceArg face, Moose::StateArg state) const =0
Getter functions (consistent entry point for all derived classes)
LinearFVAdvectionDiffusionFunctorRobinBCBase(const InputParameters &parameters)
Class constructor.
virtual Real getBeta(Moose::FaceArg face, Moose::StateArg state) const =0
virtual Real computeBoundaryValueRHSContribution() const override
Computes the boundary value's contribution to the linear system right hand side.
virtual Real computeBoundaryValue() const override
Computes the boundary value of this object.
virtual Real computeBoundaryGradientMatrixContribution() const override
Computes the boundary gradient's contribution to the linear system matrix.
virtual Real computeBoundaryValueMatrixContribution() const override
Computes the boundary value's contribution to the linear system matrix.
const FaceInfo * _current_face_info
Pointer to the face info we are operating on right now.
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false) const
Determine the single sided face argument when evaluating a functor on a 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.
const LinearFVGradientReader & requestCellGradients(unsigned int oldest_state=0)
Register the configured default gradient method with time-state storage.
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.