https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14
17{
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
46Real
48{
49 Real vel = _function.timeDerivative(_t);
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}
registerMooseObject("SolidMechanicsApp", PresetDisplacement)
static InputParameters validParams()
virtual Real timeDerivative(Real t, const Point &p) const
void suppressParameter(const std::string &name)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
const unsigned int _qp
This class applies a displacement time history on a given boundary in a given direction.
const VariableValue & _vel_old
virtual Real computeQpValue()
const VariableValue & _accel_old
static InputParameters validParams()
PresetDisplacement(const InputParameters &parameters)
const Function & _function
const VariableValue & _u_old