https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PresetVelocity.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 "PresetVelocity.h"
11#include "Function.h"
12
13registerMooseObject("SolidMechanicsApp", PresetVelocity);
14
17{
20 "Sets the boundary displacements through time from an imposed velocity");
21
22 params.addParam<Real>(
23 "velocity", 1, "Value of the velocity. Used as scale factor if function is given.");
24 params.addParam<FunctionName>("function", "1", "Function describing the velocity.");
25
26 // Forcefully preset the BC
27 params.set<bool>("preset") = true;
28 params.suppressParameter<bool>("preset");
29
30 return params;
31}
32
34 : DirichletBCBase(parameters),
35 _u_old(valueOld()),
36 _velocity(parameters.get<Real>("velocity")),
37 _function(getFunction("function"))
38{
39}
40
41Real
43{
44 Real v2 = _function.value(_t, *_current_node);
45 Real v1 = _function.value(_t - _dt, *_current_node);
46 Real vel = _velocity * 0.5 * (v1 + v2);
47
48 return _u_old[_qp] + _dt * vel;
49}
registerMooseObject("SolidMechanicsApp", PresetVelocity)
static InputParameters validParams()
virtual Real value(Real t, const Point &p) const
void suppressParameter(const std::string &name)
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 Node *const & _current_node
const unsigned int _qp
static InputParameters validParams()
const VariableValue & _u_old
virtual Real computeQpValue()
const Real _velocity
const Function & _function
PresetVelocity(const InputParameters &parameters)