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