www.mooseframework.org
InertialTorque.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 "InertialTorque.h"
11 
12 #include "MooseVariable.h"
13 #include "PermutationTensor.h"
14 
15 registerMooseObject("TensorMechanicsApp", InertialTorque);
16 
18 
19 InputParameters
21 {
22  InputParameters params = TimeKernel::validParams();
23  params.addClassDescription("Kernel for inertial torque: density * displacement x acceleration");
24  params.set<bool>("use_displaced_mesh") = false;
25  params.addRequiredRangeCheckedParam<unsigned int>(
26  "component",
27  "component<3",
28  "The component of the Cosserat rotation Variable prescribed to "
29  "this Kernel (0 for x, 1 for y, 2 for z)");
30  params.addRequiredCoupledVar("displacements", "The 3 displacement variables");
31  params.addRequiredCoupledVar("velocities", "The 3 velocity variables");
32  params.addRequiredCoupledVar("accelerations", "The 3 acceleration variables");
33  params.addRequiredParam<Real>("beta", "beta parameter for Newmark Time integration");
34  params.addRequiredParam<Real>("gamma", "gamma parameter for Newmark Time integration");
35  params.addParam<MaterialPropertyName>(
36  "density", "density", "Name of Material Property that provides the density");
37  params.addParam<MaterialPropertyName>("eta",
38  0.0,
39  "Name of material property or a constant real "
40  "number defining the eta parameter for the "
41  "Rayleigh damping.");
42  params.addParam<Real>("alpha",
43  0,
44  "alpha parameter for mass dependent numerical damping induced "
45  "by HHT time integration scheme");
46  return params;
47 }
48 
49 InertialTorque::InertialTorque(const InputParameters & parameters)
50  : TimeKernel(parameters),
51  _density(getMaterialProperty<Real>("density")),
52  _beta(getParam<Real>("beta")),
53  _gamma(getParam<Real>("gamma")),
54  _eta(getMaterialProperty<Real>("eta")),
55  _alpha(getParam<Real>("alpha")),
56  _component(getParam<unsigned int>("component")),
57  _ndisp(coupledComponents("displacements")),
58  _disp_num(_ndisp),
59  _disp(_ndisp),
60  _disp_old(_ndisp),
61  _vel_old(_ndisp),
62  _accel_old(_ndisp),
63  _accel(_ndisp),
64  _vel(_ndisp),
65  _daccel(_ndisp),
66  _dvel(_ndisp)
67 {
68  if (_ndisp != 3 || coupledComponents("velocities") != 3 ||
69  coupledComponents("accelerations") != 3)
70  mooseError(
71  "InertialTorque: This Kernel is only defined for 3-dimensional simulations so 3 "
72  "displacement variables, 3 velocity variables and 3 acceleration variables are needed");
73  for (unsigned i = 0; i < _ndisp; ++i)
74  {
75  _disp_num[i] = coupled("displacements", i);
76  _disp[i] = &coupledValue("displacements", i);
77  _disp_old[i] = &coupledValueOld("displacements", i);
78  _vel_old[i] = &coupledValueOld("velocities", i);
79  _accel_old[i] = &coupledValueOld("accelerations", i);
80  }
81 }
82 
83 Real
85 {
86  for (unsigned int j = 0; j < _ndisp; ++j)
87  {
88  // Newmark and damping
89  _accel[j] = 1.0 / _beta *
90  ((((*_disp[j])[_qp] - (*_disp_old[j])[_qp]) / (_dt * _dt)) -
91  (*_vel_old[j])[_qp] / _dt - (*_accel_old[j])[_qp] * (0.5 - _beta));
92  _vel[j] = (*_vel_old[j])[_qp] + (_dt * (1 - _gamma)) * (*_accel_old[j])[_qp] +
93  _gamma * _dt * _accel[j];
94  _accel[j] =
95  _accel[j] + _vel[j] * _eta[_qp] * (1 + _alpha) - _alpha * _eta[_qp] * (*_vel_old[j])[_qp];
96  }
97 
98  Real the_sum = 0.0;
99  for (unsigned int j = 0; j < _ndisp; ++j)
100  for (unsigned int k = 0; k < _ndisp; ++k)
101  the_sum += PermutationTensor::eps(_component, j, k) * (*_disp[j])[_qp] * _accel[k];
102  return _test[_i][_qp] * _density[_qp] * the_sum;
103 }
104 
105 Real
107 {
108  return InertialTorque::computeQpOffDiagJacobian(_var.number());
109 }
110 
111 Real
113 {
114  for (unsigned int j = 0; j < _ndisp; ++j)
115  {
116  _accel[j] = 1.0 / _beta *
117  ((((*_disp[j])[_qp] - (*_disp_old[j])[_qp]) / (_dt * _dt)) -
118  (*_vel_old[j])[_qp] / _dt - (*_accel_old[j])[_qp] * (0.5 - _beta));
119  _daccel[j] = 1.0 / _beta / _dt / _dt;
120  _vel[j] = (*_vel_old[j])[_qp] + (_dt * (1 - _gamma)) * (*_accel_old[j])[_qp] +
121  _gamma * _dt * _accel[j];
122  _dvel[j] = _gamma * _dt * _daccel[j];
123  _accel[j] =
124  _accel[j] + _vel[j] * _eta[_qp] * (1 + _alpha) - _alpha * _eta[_qp] * (*_vel_old[j])[_qp];
125  _daccel[j] = _daccel[j] + _dvel[j] * _eta[_qp] * (1 + _alpha);
126  }
127 
128  for (unsigned v = 0; v < _ndisp; ++v)
129  {
130  if (v == _component)
131  continue; // PermutationTensor will kill this
132  if (jvar == _disp_num[v])
133  {
134  Real the_sum = 0.0;
135  for (unsigned int k = 0; k < _ndisp; ++k)
136  the_sum += PermutationTensor::eps(_component, v, k) * _accel[k];
137  for (unsigned int j = 0; j < _ndisp; ++j)
138  the_sum += PermutationTensor::eps(_component, j, v) * (*_disp[j])[_qp] * _daccel[v];
139  return _test[_i][_qp] * _density[_qp] * the_sum * _phi[_j][_qp];
140  }
141  }
142  return 0.0;
143 }
defineLegacyParams
defineLegacyParams(InertialTorque)
InertialTorque::_eta
const MaterialProperty< Real > & _eta
Rayleigh-damping eta parameter.
Definition: InertialTorque.h:51
registerMooseObject
registerMooseObject("TensorMechanicsApp", InertialTorque)
InertialTorque::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
Definition: InertialTorque.C:112
InertialTorque::_dvel
std::vector< Real > _dvel
Derivative of velocity with respect to displacement.
Definition: InertialTorque.h:91
InertialTorque::_ndisp
const unsigned _ndisp
Number of displacement variables. This must be 3.
Definition: InertialTorque.h:64
InertialTorque::_accel
std::vector< Real > _accel
Acceleration (instantiating this vector avoids re-creating a new vector every residual calculation)
Definition: InertialTorque.h:82
InertialTorque
Computes the inertial torque, which is density * displacement x acceleration (a cross-product is used...
Definition: InertialTorque.h:28
InertialTorque::validParams
static InputParameters validParams()
Definition: InertialTorque.C:20
InertialTorque::InertialTorque
InertialTorque(const InputParameters &parameters)
Definition: InertialTorque.C:49
InertialTorque::_alpha
const Real _alpha
HHT alpha parameter.
Definition: InertialTorque.h:54
InertialTorque::_beta
const Real _beta
Newmark beta parameter.
Definition: InertialTorque.h:45
InertialTorque::computeQpResidual
virtual Real computeQpResidual() override
Definition: InertialTorque.C:84
InertialTorque::_disp_old
std::vector< const VariableValue * > _disp_old
Old value of displacements.
Definition: InertialTorque.h:73
InertialTorque::_component
const unsigned _component
Component of the cross-product desired.
Definition: InertialTorque.h:61
InertialTorque::computeQpJacobian
virtual Real computeQpJacobian() override
Definition: InertialTorque.C:106
InertialTorque::_gamma
const Real _gamma
Newmark gamma parameter.
Definition: InertialTorque.h:48
validParams
InputParameters validParams()
InertialTorque.h
InertialTorque::_accel_old
std::vector< const VariableValue * > _accel_old
Old value of accelerations.
Definition: InertialTorque.h:79
InertialTorque::_disp_num
std::vector< unsigned > _disp_num
MOOSE internal variable numbers corresponding to the displacments.
Definition: InertialTorque.h:67
InertialTorque::_daccel
std::vector< Real > _daccel
Derivative of acceleration with respect to displacement.
Definition: InertialTorque.h:88
InertialTorque::_vel
std::vector< Real > _vel
Velocity (instantiating this vector avoids re-creating a new vector every residual calculation)
Definition: InertialTorque.h:85
InertialTorque::_disp
std::vector< const VariableValue * > _disp
Displacements.
Definition: InertialTorque.h:70
InertialTorque::_density
const MaterialProperty< Real > & _density
density
Definition: InertialTorque.h:42
InertialTorque::_vel_old
std::vector< const VariableValue * > _vel_old
Old value of velocities.
Definition: InertialTorque.h:76