https://mooseframework.inl.gov
PresetDisplacement.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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("SolidMechanicsApp", PresetDisplacement);
14 
17 {
19  params.addClassDescription(
20  "Prescribe the displacement on a given boundary in a given direction.");
21 
22  params.addParam<Real>("scale_factor", 1, "Scale factor if function is given.");
23  params.addParam<FunctionName>("function", "1", "Function describing the displacement.");
24  params.addRequiredCoupledVar("velocity", "The velocity variable.");
25  params.addRequiredCoupledVar("acceleration", "The acceleration variable.");
26  params.addRequiredParam<Real>("beta", "beta parameter for Newmark time integration.");
27 
28  // Forcefully preset the BC
29  params.set<bool>("preset") = true;
30  params.suppressParameter<bool>("preset");
31 
32  return params;
33 }
34 
36  : DirichletBCBase(parameters),
37  _u_old(valueOld()),
38  _scale_factor(parameters.get<Real>("scale_factor")),
39  _function(getFunction("function")),
40  _vel_old(coupledValueOld("velocity")),
41  _accel_old(coupledValueOld("acceleration")),
42  _beta(getParam<Real>("beta"))
43 {
44 }
45 
46 Real
48 {
50  Real vel_old = _function.timeDerivative(_t - _dt);
51  Real accel = (vel - vel_old) / _dt;
52 
53  return _u_old[_qp] + _dt * _vel_old[_qp] +
54  ((0.5 - _beta) * _accel_old[_qp] + _beta * accel) * _dt * _dt;
55 }
PresetDisplacement(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual Real timeDerivative(Real t, const Point &p) const
T & set(const std::string &name, bool quiet_mode=false)
static InputParameters validParams()
const unsigned int _qp
void addRequiredParam(const std::string &name, const std::string &doc_string)
void suppressParameter(const std::string &name)
const VariableValue & _accel_old
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
const VariableValue & _u_old
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This class applies a displacement time history on a given boundary in a given direction.
registerMooseObject("SolidMechanicsApp", PresetDisplacement)
const VariableValue & _vel_old
const Function & _function
void addClassDescription(const std::string &doc_string)
virtual Real computeQpValue()
const Elem & get(const ElemType type_in)