www.mooseframework.org
PresetVelocity.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 
10 #include "PresetVelocity.h"
11 #include "Function.h"
12 
13 registerMooseObject("TensorMechanicsApp", PresetVelocity);
14 
16 
17 InputParameters
19 {
20  InputParameters params = DirichletBCBase::validParams();
21 
22  params.addParam<Real>(
23  "velocity", 1, "Value of the velocity. Used as scale factor if function is given.");
24  params.addParam<FunctionName>("function", "1", "Function describing the velocity.");
25 
26  // Forcefully preset the BC
27  params.set<bool>("preset") = true;
28  params.suppressParameter<bool>("preset");
29 
30  return params;
31 }
32 
33 PresetVelocity::PresetVelocity(const InputParameters & parameters)
34  : DirichletBCBase(parameters),
35  _u_old(valueOld()),
36  _velocity(parameters.get<Real>("velocity")),
37  _function(getFunction("function"))
38 {
39 }
40 
41 Real
43 {
44  Real v2 = _function.value(_t, *_current_node);
45  Real v1 = _function.value(_t - _dt, *_current_node);
46  Real vel = _velocity * 0.5 * (v1 + v2);
47 
48  return _u_old[_qp] + _dt * vel;
49 }
PresetVelocity::PresetVelocity
PresetVelocity(const InputParameters &parameters)
Definition: PresetVelocity.C:33
PresetVelocity::validParams
static InputParameters validParams()
Definition: PresetVelocity.C:18
PresetVelocity
Definition: PresetVelocity.h:14
validParams
InputParameters validParams()
PresetVelocity::_u_old
const VariableValue & _u_old
Definition: PresetVelocity.h:24
PresetVelocity::_velocity
const Real _velocity
Definition: PresetVelocity.h:25
PresetVelocity.h
PresetVelocity::_function
const Function & _function
Definition: PresetVelocity.h:26
registerMooseObject
registerMooseObject("TensorMechanicsApp", PresetVelocity)
defineLegacyParams
defineLegacyParams(PresetVelocity)
PresetVelocity::computeQpValue
virtual Real computeQpValue()
Definition: PresetVelocity.C:42