www.mooseframework.org
PresetDisplacement.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 "PresetDisplacement.h"
11 #include "Function.h"
12 
13 registerMooseObject("TensorMechanicsApp", PresetDisplacement);
14 
16 
17 InputParameters
19 {
20  InputParameters params = DirichletBCBase::validParams();
21  params.addClassDescription(
22  "Prescribe the displacement on a given boundary in a given direction.");
23 
24  params.addParam<Real>("scale_factor", 1, "Scale factor if function is given.");
25  params.addParam<FunctionName>("function", "1", "Function describing the displacement.");
26  params.addRequiredCoupledVar("velocity", "The velocity variable.");
27  params.addRequiredCoupledVar("acceleration", "The acceleration variable.");
28  params.addRequiredParam<Real>("beta", "beta parameter for Newmark time integration.");
29 
30  // Forcefully preset the BC
31  params.set<bool>("preset") = true;
32  params.suppressParameter<bool>("preset");
33 
34  return params;
35 }
36 
37 PresetDisplacement::PresetDisplacement(const InputParameters & parameters)
38  : DirichletBCBase(parameters),
39  _u_old(valueOld()),
40  _scale_factor(parameters.get<Real>("scale_factor")),
41  _function(getFunction("function")),
42  _vel_old(coupledValueOld("velocity")),
43  _accel_old(coupledValueOld("acceleration")),
44  _beta(getParam<Real>("beta"))
45 {
46 }
47 
48 Real
50 {
51  Point p;
52  Real vel = _function.timeDerivative(_t, p);
53  Real vel_old = _function.timeDerivative(_t - _dt, p);
54  Real accel = (vel - vel_old) / _dt;
55 
56  return _u_old[_qp] + _dt * _vel_old[_qp] +
57  ((0.5 - _beta) * _accel_old[_qp] + _beta * accel) * _dt * _dt;
58 }
PresetDisplacement::PresetDisplacement
PresetDisplacement(const InputParameters &parameters)
Definition: PresetDisplacement.C:37
PresetDisplacement::validParams
static InputParameters validParams()
Definition: PresetDisplacement.C:18
registerMooseObject
registerMooseObject("TensorMechanicsApp", PresetDisplacement)
PresetDisplacement.h
defineLegacyParams
defineLegacyParams(PresetDisplacement)
PresetDisplacement::_beta
const Real _beta
Definition: PresetDisplacement.h:37
validParams
InputParameters validParams()
PresetDisplacement::computeQpValue
virtual Real computeQpValue()
Definition: PresetDisplacement.C:49
PresetDisplacement::_function
const Function & _function
Definition: PresetDisplacement.h:34
PresetDisplacement::_u_old
const VariableValue & _u_old
Definition: PresetDisplacement.h:32
PresetDisplacement
This class applies a displacement time history on a given boundary in a given direction.
Definition: PresetDisplacement.h:22
PresetDisplacement::_accel_old
const VariableValue & _accel_old
Definition: PresetDisplacement.h:36
PresetDisplacement::_vel_old
const VariableValue & _vel_old
Definition: PresetDisplacement.h:35