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