www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MooseVariableInterface Class Reference

Interface for objects that need to get values of MooseVariables. More...

#include <MooseVariableInterface.h>

Inheritance diagram for MooseVariableInterface:
[legend]

Public Member Functions

 MooseVariableInterface (const MooseObject *moose_object, bool nodal, std::string var_param_name="variable")
 Constructing the object. More...
 
MooseVariablemooseVariable ()
 Get the variable that this object is using. More...
 
virtual ~MooseVariableInterface ()
 

Protected Member Functions

virtual const VariableValuevalue ()
 The value of the variable this object is operating on. More...
 
virtual const VariableValuevalueOld ()
 The old value of the variable this object is operating on. More...
 
virtual const VariableValuevalueOlder ()
 The older value of the variable this object is operating on. More...
 
virtual const VariableValuedot ()
 The time derivative of the variable this object is operating on. More...
 
virtual const VariableValuedotDu ()
 The derivative of the time derivative of the variable this object is operating on with respect to this variable's coefficients. More...
 
virtual const VariableGradientgradient ()
 The gradient of the variable this object is operating on. More...
 
virtual const VariableGradientgradientOld ()
 The old gradient of the variable this object is operating on. More...
 
virtual const VariableGradientgradientOlder ()
 The older gradient of the variable this object is operating on. More...
 
virtual const VariableSecondsecond ()
 The second derivative of the variable this object is operating on. More...
 
virtual const VariableSecondsecondOld ()
 The old second derivative of the variable this object is operating on. More...
 
virtual const VariableSecondsecondOlder ()
 The older second derivative of the variable this object is operating on. More...
 
virtual const VariableTestSecondsecondTest ()
 The second derivative of the test function. More...
 
virtual const VariableTestSecondsecondTestFace ()
 The second derivative of the test function on the current face. More...
 
virtual const VariablePhiSecondsecondPhi ()
 The second derivative of the trial function. More...
 
virtual const VariablePhiSecondsecondPhiFace ()
 The second derivative of the trial function on the current face. More...
 

Protected Attributes

bool _nodal
 Whether or not this object is acting only at nodes. More...
 
MooseVariable_variable
 The variable this object is acting on. More...
 
Assembly_mvi_assembly
 

Detailed Description

Interface for objects that need to get values of MooseVariables.

Definition at line 28 of file MooseVariableInterface.h.

Constructor & Destructor Documentation

MooseVariableInterface::MooseVariableInterface ( const MooseObject moose_object,
bool  nodal,
std::string  var_param_name = "variable" 
)

Constructing the object.

Parameters
parametersParameters that come from constructing the object
nodaltrue if the variable is nodal
var_param_namethe parameter name where we will find the coupled variable name

Definition at line 24 of file MooseVariableInterface.C.

27  : _nodal(nodal)
28 {
29  const InputParameters & parameters = moose_object->parameters();
30 
31  SubProblem & problem = *parameters.get<SubProblem *>("_subproblem");
32 
33  THREAD_ID tid = parameters.get<THREAD_ID>("_tid");
34 
35  // Try the scalar version first
36  std::string variable_name = parameters.getMooseType(var_param_name);
37  if (variable_name == "")
38  // When using vector variables, we are only going to use the first one in the list at the
39  // interface level...
40  variable_name = parameters.getVecMooseType(var_param_name)[0];
41 
42  _variable = &problem.getVariable(tid, variable_name);
43 
44  _mvi_assembly = &problem.assembly(tid);
45 }
virtual MooseVariable & getVariable(THREAD_ID tid, const std::string &var_name)=0
Returns the variable reference for requested variable which may be in any system. ...
std::vector< std::string > getVecMooseType(const std::string &name) const
virtual Assembly & assembly(THREAD_ID tid)=0
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
bool _nodal
Whether or not this object is acting only at nodes.
std::string getMooseType(const std::string &name) const
Utility functions for retrieving one of the MooseTypes variables into the common "string" base class...
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:53
MooseVariable * _variable
The variable this object is acting on.
unsigned int THREAD_ID
Definition: MooseTypes.h:79
MooseVariableInterface::~MooseVariableInterface ( )
virtual

Definition at line 47 of file MooseVariableInterface.C.

47 {}

Member Function Documentation

const VariableValue & MooseVariableInterface::dot ( )
protectedvirtual

The time derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 83 of file MooseVariableInterface.C.

84 {
85  if (_nodal)
86  return _variable->nodalSlnDot();
87  else
88  return _variable->uDot();
89 }
bool _nodal
Whether or not this object is acting only at nodes.
const VariableValue & nodalSlnDot()
const VariableValue & uDot()
MooseVariable * _variable
The variable this object is acting on.
const VariableValue & MooseVariableInterface::dotDu ( )
protectedvirtual

The derivative of the time derivative of the variable this object is operating on with respect to this variable's coefficients.

This is useful for creating Jacobian entries for residual statements that use _u_dot

Returns
The reference to be stored off and used later.

Definition at line 92 of file MooseVariableInterface.C.

93 {
94  if (_nodal)
95  return _variable->nodalSlnDuDotDu();
96  else
97  return _variable->duDotDu();
98 }
bool _nodal
Whether or not this object is acting only at nodes.
const VariableValue & duDotDu()
const VariableValue & nodalSlnDuDotDu()
MooseVariable * _variable
The variable this object is acting on.
const VariableGradient & MooseVariableInterface::gradient ( )
protectedvirtual

The gradient of the variable this object is operating on.

This is computed by default and should already be available as _grad_u

Returns
The reference to be stored off and used later.

Definition at line 101 of file MooseVariableInterface.C.

102 {
103  if (_nodal)
104  mooseError("Nodal variables do not have gradients");
105 
106  return _variable->gradSln();
107 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariable * _variable
The variable this object is acting on.
const VariableGradient & gradSln()
const VariableGradient & MooseVariableInterface::gradientOld ( )
protectedvirtual

The old gradient of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 110 of file MooseVariableInterface.C.

111 {
112  if (_nodal)
113  mooseError("Nodal variables do not have gradients");
114 
115  return _variable->gradSlnOld();
116 }
const VariableGradient & gradSlnOld()
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariable * _variable
The variable this object is acting on.
const VariableGradient & MooseVariableInterface::gradientOlder ( )
protectedvirtual

The older gradient of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 119 of file MooseVariableInterface.C.

120 {
121  if (_nodal)
122  mooseError("Nodal variables do not have gradients");
123 
124  return _variable->gradSlnOlder();
125 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
const VariableGradient & gradSlnOlder()
MooseVariable * _variable
The variable this object is acting on.
MooseVariable * MooseVariableInterface::mooseVariable ( )
const VariableSecond & MooseVariableInterface::second ( )
protectedvirtual

The second derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 128 of file MooseVariableInterface.C.

Referenced by DiracKernel::addPointWithValidId().

129 {
130  if (_nodal)
131  mooseError("Nodal variables do not have second derivatives");
132 
133  return _variable->secondSln();
134 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
const VariableSecond & secondSln()
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariable * _variable
The variable this object is acting on.
const VariableSecond & MooseVariableInterface::secondOld ( )
protectedvirtual

The old second derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 137 of file MooseVariableInterface.C.

138 {
139  if (_nodal)
140  mooseError("Nodal variables do not have second derivatives");
141 
142  return _variable->secondSlnOld();
143 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
const VariableSecond & secondSlnOld()
MooseVariable * _variable
The variable this object is acting on.
const VariableSecond & MooseVariableInterface::secondOlder ( )
protectedvirtual

The older second derivative of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 146 of file MooseVariableInterface.C.

147 {
148  if (_nodal)
149  mooseError("Nodal variables do not have second derivatives");
150 
151  return _variable->secondSlnOlder();
152 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
const VariableSecond & secondSlnOlder()
MooseVariable * _variable
The variable this object is acting on.
const VariablePhiSecond & MooseVariableInterface::secondPhi ( )
protectedvirtual

The second derivative of the trial function.

Returns
The reference to be stored off and used later.

Definition at line 173 of file MooseVariableInterface.C.

174 {
175  if (_nodal)
176  mooseError("Nodal variables do not have second derivatives");
177 
178  return _mvi_assembly->secondPhi();
179 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
const VariablePhiSecond & secondPhi()
Definition: Assembly.h:536
const VariablePhiSecond & MooseVariableInterface::secondPhiFace ( )
protectedvirtual

The second derivative of the trial function on the current face.

This should be called in e.g. IntegratedBC when you need second derivatives of the trial function function on the boundary.

Returns
The reference to be stored off and used later.

Definition at line 182 of file MooseVariableInterface.C.

183 {
184  if (_nodal)
185  mooseError("Nodal variables do not have second derivatives");
186 
187  return _mvi_assembly->secondPhiFace();
188 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
const VariablePhiSecond & secondPhiFace()
Definition: Assembly.h:540
const VariableTestSecond & MooseVariableInterface::secondTest ( )
protectedvirtual

The second derivative of the test function.

Returns
The reference to be stored off and used later.

Definition at line 155 of file MooseVariableInterface.C.

156 {
157  if (_nodal)
158  mooseError("Nodal variables do not have second derivatives");
159 
160  return _variable->secondPhi();
161 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
const VariablePhiSecond & secondPhi()
MooseVariable * _variable
The variable this object is acting on.
const VariableTestSecond & MooseVariableInterface::secondTestFace ( )
protectedvirtual

The second derivative of the test function on the current face.

This should be called in e.g. IntegratedBC when you need second derivatives of the test function function on the boundary.

Returns
The reference to be stored off and used later.

Definition at line 164 of file MooseVariableInterface.C.

165 {
166  if (_nodal)
167  mooseError("Nodal variables do not have second derivatives");
168 
169  return _variable->secondPhiFace();
170 }
const VariablePhiSecond & secondPhiFace()
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
bool _nodal
Whether or not this object is acting only at nodes.
MooseVariable * _variable
The variable this object is acting on.
const VariableValue & MooseVariableInterface::value ( )
protectedvirtual

The value of the variable this object is operating on.

This is computed by default and should already be available as _u

Returns
The reference to be stored off and used later.

Definition at line 56 of file MooseVariableInterface.C.

Referenced by AuxKernel::compute(), KernelValue::computeJacobian(), KernelGrad::computeJacobian(), ConvectiveFluxBC::computeQpResidual(), SinDirichletBC::computeQpResidual(), SinNeumannBC::computeQpResidual(), KernelGrad::computeResidual(), KernelValue::computeResidual(), and InternalSideIndicator::finalize().

57 {
58  if (_nodal)
59  return _variable->nodalSln();
60  else
61  return _variable->sln();
62 }
bool _nodal
Whether or not this object is acting only at nodes.
const VariableValue & nodalSln()
const VariableValue & sln()
MooseVariable * _variable
The variable this object is acting on.
const VariableValue & MooseVariableInterface::valueOld ( )
protectedvirtual

The old value of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 65 of file MooseVariableInterface.C.

66 {
67  if (_nodal)
68  return _variable->nodalSlnOld();
69  else
70  return _variable->slnOld();
71 }
bool _nodal
Whether or not this object is acting only at nodes.
const VariableValue & slnOld()
const VariableValue & nodalSlnOld()
MooseVariable * _variable
The variable this object is acting on.
const VariableValue & MooseVariableInterface::valueOlder ( )
protectedvirtual

The older value of the variable this object is operating on.

Returns
The reference to be stored off and used later.

Definition at line 74 of file MooseVariableInterface.C.

75 {
76  if (_nodal)
77  return _variable->nodalSlnOlder();
78  else
79  return _variable->slnOlder();
80 }
const VariableValue & slnOlder()
bool _nodal
Whether or not this object is acting only at nodes.
const VariableValue & nodalSlnOlder()
MooseVariable * _variable
The variable this object is acting on.

Member Data Documentation

Assembly* MooseVariableInterface::_mvi_assembly
protected
bool MooseVariableInterface::_nodal
protected
MooseVariable* MooseVariableInterface::_variable
protected

The documentation for this class was generated from the following files: