https://mooseframework.inl.gov
LinearFVAdvectionDiffusionFunctorRobinBC.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 {
18  params.addClassDescription(
19  "Adds a Robin BC of the form \\alpha * \\nabla \\phi*n + \\beta * \\phi = \\gamma, "
20  "which can be used for the assembly of linear "
21  "finite volume system and whose face values are determined using "
22  "three functors. This kernel is "
23  "only designed to work with advection-diffusion problems.");
24  params.addParam<MooseFunctorName>(
25  "alpha", 1.0, "Functor for the coefficient of the normal gradient term.");
26  params.addParam<MooseFunctorName>("beta", 1.0, "Functor for the coefficient of the scalar term.");
27  params.addParam<MooseFunctorName>(
28  "gamma", 1.0, "Functor for the constant term on the RHS of the Robin BC.");
29  return params;
30 }
31 
33  const InputParameters & parameters)
35  _alpha(getFunctor<Real>("alpha")),
36  _beta(getFunctor<Real>("beta")),
37  _gamma(getFunctor<Real>("gamma"))
38 {
40 
41  if (_alpha.isConstant())
42  {
43  // We check if we can parse the value to a number and if yes, we throw an error if it is 0
44  std::istringstream ss(getParam<MooseFunctorName>("alpha"));
45  Real real_value;
46  if (ss >> real_value && ss.eof())
47  if (MooseUtils::isZero(real_value))
48  paramError("alpha",
49  "This value shall not be 0. Use a Dirichlet boundary condition instead!");
50  }
51 }
52 
53 Real
55 {
56  return _alpha(face, state);
57 }
58 
59 Real
61 {
62  return _beta(face, state);
63 }
64 
65 Real
67 {
68  return _gamma(face, state);
69 }
const Moose::Functor< Real > & _gamma
Functor giving the gamma coefficient (on right hand side, treated explicitly)
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition: MooseBase.h:439
const Moose::Functor< Real > & _beta
Functor giving the beta coefficient (multiplying value)
virtual Real getAlpha(Moose::FaceArg face, Moose::StateArg state) const override
Getter functions (consistent entry point for all derived classes)
Class implementing a Robin boundary condition for linear finite volume variables. ...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
LinearFVAdvectionDiffusionFunctorRobinBC(const InputParameters &parameters)
Class constructor.
virtual Real getGamma(Moose::FaceArg face, Moose::StateArg state) const override
A structure defining a "face" evaluation calling argument for Moose functors.
const Moose::Functor< Real > & _alpha
Functor giving the alpha coefficient (multiplying normal gradient)
MooseLinearVariableFV< Real > & _var
Reference to the linear finite volume variable object.
virtual Real getBeta(Moose::FaceArg face, Moose::StateArg state) const override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Class implementing the base for the Robin boundary condition for linear finite volume variables...
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...
State argument for evaluating functors.
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 computeCellGradients()
Switch to request cell gradient computations.
registerMooseObject("MooseApp", LinearFVAdvectionDiffusionFunctorRobinBC)