www.mooseframework.org
PresetDisplacement.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 "PresetDisplacement.h"
8 #include "Function.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<NodalBC>();
15  params.addClassDescription(
16  "Prescribe the displacement on a given boundary in a given direction.");
17  params.addParam<Real>("scale_factor", 1, "Scale factor if function is given.");
18  params.addParam<FunctionName>("function", "1", "Function describing the displacement.");
19  params.addRequiredCoupledVar("velocity", "The velocity variable.");
20  params.addRequiredCoupledVar("acceleration", "The acceleration variable.");
21  params.addRequiredParam<Real>("beta", "beta parameter for Newmark time integration.");
22  return params;
23 }
24 
25 PresetDisplacement::PresetDisplacement(const InputParameters & parameters)
26  : PresetNodalBC(parameters),
27  _u_old(valueOld()),
28  _scale_factor(parameters.get<Real>("scale_factor")),
29  _function(getFunction("function")),
30  _vel_old(coupledValueOld("velocity")),
31  _accel_old(coupledValueOld("acceleration")),
32  _beta(getParam<Real>("beta"))
33 {
34 }
35 
36 Real
38 {
39  Point p;
40  Real vel = _function.timeDerivative(_t, p);
41  Real vel_old = _function.timeDerivative(_t - _dt, p);
42  Real accel = (vel - vel_old) / _dt;
43 
44  return _u_old[_qp] + _dt * _vel_old[_qp] +
45  ((0.5 - _beta) * _accel_old[_qp] + _beta * accel) * _dt * _dt;
46 }
PresetDisplacement(const InputParameters &parameters)
InputParameters validParams< PresetDisplacement >()
const VariableValue & _accel_old
const VariableValue & _u_old
const VariableValue & _vel_old
virtual Real computeQpValue()