www.mooseframework.org
InterfaceQpValueUserObject.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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.addRequiredCoupledVar("var", "The variable name");
19  params.addCoupledVar("var_neighbor", "The neighbor variable name");
20  params.addClassDescription(
21  "Computes the variable value, rate or increment across an "
22  "interface. The value, rate or increment is computed according to the provided "
23  "interface_value_type parameter");
24  return params;
25 }
26 
28  : InterfaceQpUserObjectBase(parameters),
29  _u(_value_type > 0 ? coupledDot("var") : coupledValue("var")),
30  _u_neighbor(
31  parameters.isParamSetByUser("var_neighbor")
32  ? (_value_type > 0 ? coupledNeighborValueDot("var_neighbor")
33  : coupledNeighborValue("var_neighbor"))
34  : (_value_type > 0 ? coupledNeighborValueDot("var") : coupledNeighborValue("var")))
35 
36 {
37 }
38 
39 Real
41 {
42  /* civet complains about fall through, let's fix this using some extra code */
43  switch (_value_type)
44  {
45  case 0: /*value*/
46  return computeInterfaceValueType(_u[qp], _u_neighbor[qp]);
47  case 1: /*rate*/
48  return computeInterfaceValueType(_u[qp], _u_neighbor[qp]);
49  case 2: /*increment*/
50  return computeInterfaceValueType(_u[qp] * _dt, _u_neighbor[qp] * _dt);
51  default:
52  mooseError("InterfaceQpValueUserObject::computeRealValue the supplied "
53  "value type has not been implemented");
54  }
55  mooseError("InterfaceQpValueUserObject::computeRealValue if we are here something is wrong");
56 }
const VariableValue & _u
the variable and neighbor variable values or rate
Specialization of InterfaceQpUserObjectBase for scalar variables.
virtual Real computeInterfaceValueType(const Real, const Real)
method computing an interface value give two Real quantities
This is a base class for userobjects collecting values of variables or material properites across an ...
InterfaceQpValueUserObject(const InputParameters &parameters)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
const MooseEnum _value_type
moose enum deciding this userobject reture value type
Real & _dt
Time step size.
registerMooseObject("MooseApp", InterfaceQpValueUserObject)
virtual Real computeRealValue(const unsigned int qp) override
method to overrid in child classes returnig a real value
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
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...