https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVAdvectionDiffusionFunctorNeumannBC.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 fixed diffusive flux BC which can be used for the assembly of linear "
20 "finite volume system and whose normal face gradient values are determined "
21 "using a functor. This kernel is only designed to work with advection-diffusion problems.");
22 params.addRequiredParam<MooseFunctorName>(
23 "functor", "The diffusive flux functor for this boundary condition.");
24 params.addParam<MooseFunctorName>("diffusion_coeff", 1.0, "The diffusion coefficient.");
25 return params;
26}
27
29 const InputParameters & parameters)
30 : LinearFVAdvectionDiffusionBC(parameters),
31 _functor(getFunctor<Real>("functor")),
32 _diffusion_coeff(getFunctor<Real>("diffusion_coeff"))
33{
35}
36
37Real
39{
40 const auto state = determineState();
41 const auto face_arg = makeCDFace(*_current_face_info);
46 const auto d_cf = computeCellToFaceVector();
47 // For non-orthogonal meshes we compute an extra correction vector to increase order accuracy
48 // correction_vector is a vector orthogonal to the boundary normal
49 const auto correction_vector =
50 (d_cf - (d_cf * _current_face_info->normal()) * _current_face_info->normal());
51 return _var.getElemValue(*elem_info, state) +
53 _diffusion_coeff(face_arg, state) * distance +
54 _var.gradSln(*elem_info, state) * correction_vector;
55}
56
57Real
59{
60 const auto state = determineState();
61 const auto face_arg = makeCDFace(*_current_face_info);
63 _diffusion_coeff(face_arg, state);
64}
65
66Real
71
72Real
74{
75 const auto state = determineState();
76 const auto face_arg = makeCDFace(*_current_face_info);
80
81 // Fetch the boundary value from the provided functor.
83 const auto d_cf = computeCellToFaceVector();
84 // For non-orthogonal meshes we compute an extra correction vector to increase order accuracy
85 // correction_vector is a vector orthogonal to the boundary normal
86 const auto correction_vector =
87 (d_cf - (d_cf * _current_face_info->normal()) * _current_face_info->normal());
89 _diffusion_coeff(face_arg, state) * distance +
90 _var.gradSln(*elem_info, state) * correction_vector;
91}
92
93Real
98
99Real
registerMooseObject("MooseApp", LinearFVAdvectionDiffusionFunctorNeumannBC)
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
Make a functor face argument with a central differencing limiter, e.g.
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 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.
Base class for boundary conditions that are valid for advection diffusion problems.
Class implementing a Neumann boundary condition for linear finite volume variables.
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 computeBoundaryValueRHSContribution() const override
Computes the boundary value's contribution to the linear system right hand side.
const Moose::Functor< Real > & _functor
The functor for this BC (can be variable, function, etc)
virtual Real computeBoundaryValue() const override
Computes the boundary value of this object.
const Moose::Functor< Real > & _diffusion_coeff
The functor for the diffusion coefficient.
virtual Real computeBoundaryGradientMatrixContribution() const override
Computes the boundary gradient's contribution to the linear system matrix.
LinearFVAdvectionDiffusionFunctorNeumannBC(const InputParameters &parameters)
Class constructor.
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.
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.
Real distance(const Point &p)