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