www.mooseframework.org
InertialForce.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 "InertialForce.h"
11 #include "SubProblem.h"
12 
13 registerMooseObject("TensorMechanicsApp", InertialForce);
14 
16 
17 InputParameters
19 {
20  InputParameters params = TimeKernel::validParams();
21  params.addClassDescription("Calculates the residual for the inertial force "
22  "($M \\cdot acceleration$) and the contribution of mass"
23  " dependent Rayleigh damping and HHT time "
24  " integration scheme ($\\eta \\cdot M \\cdot"
25  " ((1+\\alpha)velq2-\\alpha \\cdot vel-old) $)");
26  params.set<bool>("use_displaced_mesh") = true;
27  params.addCoupledVar("velocity", "velocity variable");
28  params.addCoupledVar("acceleration", "acceleration variable");
29  params.addParam<Real>("beta", "beta parameter for Newmark Time integration");
30  params.addParam<Real>("gamma", "gamma parameter for Newmark Time integration");
31  params.addParam<MaterialPropertyName>("eta",
32  0.0,
33  "Name of material property or a constant real "
34  "number defining the eta parameter for the "
35  "Rayleigh damping.");
36  params.addParam<Real>("alpha",
37  0,
38  "alpha parameter for mass dependent numerical damping induced "
39  "by HHT time integration scheme");
40  params.addParam<MaterialPropertyName>(
41  "density", "density", "Name of Material Property that provides the density");
42  return params;
43 }
44 
45 InertialForce::InertialForce(const InputParameters & parameters)
46  : TimeKernel(parameters),
47  _density(getMaterialProperty<Real>("density")),
48  _has_beta(isParamValid("beta")),
49  _has_gamma(isParamValid("gamma")),
50  _beta(_has_beta ? getParam<Real>("beta") : 0.1),
51  _gamma(_has_gamma ? getParam<Real>("gamma") : 0.1),
52  _has_velocity(isParamValid("velocity")),
53  _has_acceleration(isParamValid("acceleration")),
54  _eta(getMaterialProperty<Real>("eta")),
55  _alpha(getParam<Real>("alpha"))
56 {
58  {
59  _vel_old = &coupledValueOld("velocity");
60  _accel_old = &coupledValueOld("acceleration");
61  _u_old = &valueOld();
62  }
64  {
65  _u_dot = &(_var.uDot());
66  _u_dotdot = &(_var.uDotDot());
67  _u_dot_old = &(_var.uDotOld());
68  _du_dot_du = &(_var.duDotDu());
69  _du_dotdot_du = &(_var.duDotDotDu());
70  }
71  else
72  mooseError(
73  "InertialForce: Either all or none of `beta`, `gamma`, `velocity`, and `acceleration` "
74  "should be provided as input.");
75 }
76 
77 Real
79 {
80  if (_dt == 0)
81  return 0;
82  else if (_has_beta)
83  {
84  Real accel = 1. / _beta *
85  (((_u[_qp] - (*_u_old)[_qp]) / (_dt * _dt)) - (*_vel_old)[_qp] / _dt -
86  (*_accel_old)[_qp] * (0.5 - _beta));
87  Real vel = (*_vel_old)[_qp] + (_dt * (1 - _gamma)) * (*_accel_old)[_qp] + _gamma * _dt * accel;
88  return _test[_i][_qp] * _density[_qp] *
89  (accel + vel * _eta[_qp] * (1 + _alpha) - _alpha * _eta[_qp] * (*_vel_old)[_qp]);
90  }
91  else
92  return _test[_i][_qp] * _density[_qp] *
93  ((*_u_dotdot)[_qp] + (*_u_dot)[_qp] * _eta[_qp] * (1.0 + _alpha) -
94  _alpha * _eta[_qp] * (*_u_dot_old)[_qp]);
95 }
96 
97 Real
99 {
100  if (_dt == 0)
101  return 0;
102  else if (_has_beta)
103  return _test[_i][_qp] * _density[_qp] / (_beta * _dt * _dt) * _phi[_j][_qp] +
104  _eta[_qp] * (1 + _alpha) * _test[_i][_qp] * _density[_qp] * _gamma / _beta / _dt *
105  _phi[_j][_qp];
106  else
107  return _test[_i][_qp] * _density[_qp] * (*_du_dotdot_du)[_qp] * _phi[_j][_qp] +
108  _eta[_qp] * (1 + _alpha) * _test[_i][_qp] * _density[_qp] * (*_du_dot_du)[_qp] *
109  _phi[_j][_qp];
110 }
InertialForce::_beta
const Real _beta
Definition: InertialForce.h:40
InertialForce::InertialForce
InertialForce(const InputParameters &parameters)
Definition: InertialForce.C:45
registerMooseObject
registerMooseObject("TensorMechanicsApp", InertialForce)
InertialForce::_has_gamma
const bool _has_gamma
Definition: InertialForce.h:39
InertialForce::_u_dot_old
const VariableValue * _u_dot_old
Definition: InertialForce.h:50
InertialForce::_du_dotdot_du
const VariableValue * _du_dotdot_du
Definition: InertialForce.h:52
InertialForce::_has_velocity
const bool _has_velocity
Definition: InertialForce.h:42
InertialForce::_vel_old
const VariableValue * _vel_old
Definition: InertialForce.h:36
InertialForce::_du_dot_du
const VariableValue * _du_dot_du
Definition: InertialForce.h:51
InertialForce::_accel_old
const VariableValue * _accel_old
Definition: InertialForce.h:37
InertialForce::_has_beta
const bool _has_beta
Definition: InertialForce.h:38
InertialForce.h
InertialForce::_u_old
const VariableValue * _u_old
Definition: InertialForce.h:35
validParams
InputParameters validParams()
InertialForce::_gamma
const Real _gamma
Definition: InertialForce.h:41
InertialForce::_alpha
const Real _alpha
Definition: InertialForce.h:45
InertialForce::_u_dot
const VariableValue * _u_dot
Definition: InertialForce.h:48
InertialForce::_eta
const MaterialProperty< Real > & _eta
Definition: InertialForce.h:44
InertialForce::_u_dotdot
const VariableValue * _u_dotdot
Definition: InertialForce.h:49
InertialForce::validParams
static InputParameters validParams()
Definition: InertialForce.C:18
InertialForce::computeQpJacobian
virtual Real computeQpJacobian()
Definition: InertialForce.C:98
InertialForce::computeQpResidual
virtual Real computeQpResidual()
Definition: InertialForce.C:78
InertialForce::_has_acceleration
const bool _has_acceleration
Definition: InertialForce.h:43
InertialForce
Definition: InertialForce.h:21
defineLegacyParams
defineLegacyParams(InertialForce)
InertialForce::_density
const MaterialProperty< Real > & _density
Definition: InertialForce.h:34