www.mooseframework.org
PresetVelocity.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "PresetVelocity.h"
8 #include "Function.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters p = validParams<NodalBC>();
15  p.addParam<Real>(
16  "velocity", 1, "Value of the velocity. Used as scale factor if function is given.");
17  p.addParam<FunctionName>("function", "1", "Function describing the velocity.");
18  return p;
19 }
20 
21 PresetVelocity::PresetVelocity(const InputParameters & parameters)
22  : PresetNodalBC(parameters),
23  _u_old(valueOld()),
24  _velocity(parameters.get<Real>("velocity")),
25  _function(getFunction("function"))
26 {
27 }
28 
29 Real
31 {
32  Real v2 = _function.value(_t, *_current_node);
33  Real v1 = _function.value(_t - _dt, *_current_node);
34  Real vel = _velocity * 0.5 * (v1 + v2);
35 
36  return _u_old[_qp] + _dt * vel;
37 }
InputParameters validParams< PresetVelocity >()
Function & _function
virtual Real computeQpValue()
const VariableValue & _u_old
PresetVelocity(const InputParameters &parameters)
const Real _velocity