11 #include "MooseVariable.h"
12 #include "AuxiliarySystem.h"
13 #include "MooseMesh.h"
23 params.addClassDescription(
"Calculates the inertial torques and inertia proportional damping "
24 "corresponding to the nodal rotational inertia.");
25 params.addCoupledVar(
"rotations",
"rotational displacement variables");
26 params.addCoupledVar(
"rotational_velocities",
"rotational velocity variables");
27 params.addCoupledVar(
"rotational_accelerations",
"rotational acceleration variables");
28 params.addRangeCheckedParam<Real>(
29 "beta",
"beta>0.0",
"beta parameter for Newmark Time integration");
30 params.addRangeCheckedParam<Real>(
31 "gamma",
"gamma>0.0",
"gamma parameter for Newmark Time integration");
32 params.addRangeCheckedParam<Real>(
"eta",
35 "Constant real number defining the eta parameter for"
37 params.addRangeCheckedParam<Real>(
"alpha",
39 "alpha >= -0.3333 & alpha <= 0.0",
40 "Alpha parameter for mass dependent numerical damping induced "
41 "by HHT time integration scheme");
42 params.addRequiredRangeCheckedParam<Real>(
43 "Ixx",
"Ixx>0.0",
"Moment of inertia in the x direction.");
44 params.addRequiredRangeCheckedParam<Real>(
45 "Iyy",
"Iyy>0.0",
"Moment of inertia in the y direction.");
46 params.addRequiredRangeCheckedParam<Real>(
47 "Izz",
"Izz>0.0",
"Moment of inertia in the z direction.");
48 params.addParam<Real>(
"Ixy", 0.0,
"Moment of inertia in the xy direction.");
49 params.addParam<Real>(
"Ixz", 0.0,
"Moment of inertia in the xz direction.");
50 params.addParam<Real>(
"Iyz", 0.0,
"Moment of inertia in the yz direction.");
52 "x_orientation",
"Unit vector along the x direction if different from global x direction.");
54 "y_orientation",
"Unit vector along the y direction if different from global y direction.");
55 params.addRequiredRangeCheckedParam<
unsigned int>(
58 "An integer corresponding to the direction "
59 "the variable this nodalkernel acts in. (0 for rot_x, "
60 "1 for rot_y, and 2 for rot_z).");
65 : TimeNodalKernel(parameters),
66 _has_beta(isParamValid(
"beta")),
67 _has_gamma(isParamValid(
"gamma")),
68 _has_rot_velocities(isParamValid(
"rotational_velocities")),
69 _has_rot_accelerations(isParamValid(
"rotational_accelerations")),
70 _has_x_orientation(isParamValid(
"x_orientation")),
71 _has_y_orientation(isParamValid(
"y_orientation")),
72 _nrot(coupledComponents(
"rotations")),
76 _rot_accel_num(_nrot),
77 _rot_variables(_nrot),
81 _beta(_has_beta ? getParam<Real>(
"beta") : 0.1),
82 _gamma(_has_gamma ? getParam<Real>(
"gamma") : 0.1),
83 _eta(getParam<Real>(
"eta")),
84 _alpha(getParam<Real>(
"alpha")),
85 _component(getParam<unsigned int>(
"component")),
86 _rot_vel_value(_nrot),
87 _rot_vel_old_value(_nrot),
88 _rot_accel_value(_nrot)
92 _aux_sys = &(_fe_problem.getAuxiliarySystem());
93 if (coupledComponents(
"rotational_velocities") !=
_nrot ||
94 coupledComponents(
"rotational_accelerations") !=
_nrot)
96 "NodalRotationalInertia: rotational_velocities and rotational_accelerations should "
100 for (
unsigned int i = 0; i <
_nrot; ++i)
102 MooseVariable * rot_var = getVar(
"rotations", i);
103 MooseVariable * rot_vel_var = getVar(
"rotational_velocities", i);
104 MooseVariable * rot_accel_var = getVar(
"rotational_accelerations", i);
106 _rot[i] = &rot_var->dofValues();
107 _rot_old[i] = &rot_var->dofValuesOld();
117 for (
unsigned int i = 0; i <
_nrot; ++i)
119 MooseVariable * rot_var = getVar(
"rotations", i);
132 mooseError(
"NodalRotationalInertia: Either all or none of `beta`, `gamma`, "
133 "`rotational_velocities` and `rotational_accelerations` should be provided as "
138 _inertia(0, 0) = getParam<Real>(
"Ixx");
139 _inertia(0, 1) = getParam<Real>(
"Ixy");
140 _inertia(0, 2) = getParam<Real>(
"Ixz");
142 _inertia(1, 1) = getParam<Real>(
"Iyy");
143 _inertia(1, 2) = getParam<Real>(
"Iyz");
146 _inertia(2, 2) = getParam<Real>(
"Izz");
153 if (det1 < 1e-6 || det2 < 1e-6 || det3 < 1e-6)
154 mooseError(
"NodalRotationalInertia: The moment of inertia tensor should be positive definite.");
157 const RealGradient x_orientation = getParam<RealGradient>(
"x_orientation");
158 const RealGradient y_orientation = getParam<RealGradient>(
"y_orientation");
160 if (std::abs(x_orientation.norm() - 1.0) > 1e-6 || std::abs(y_orientation.norm() - 1.0) > 1e-6)
161 mooseError(
"NodalRotationalInertia: x_orientation and y_orientation must be unit vectors.");
163 Real sum = x_orientation(0) * y_orientation(0) + x_orientation(1) * y_orientation(1) +
164 x_orientation(2) * y_orientation(2);
166 if (std::abs(sum) > 1e-4)
167 mooseError(
"NodalRotationalInertia: x_orientation and y_orientation should be perpendicular "
172 z_orientation(0) = (x_orientation(1) * y_orientation(2) - x_orientation(2) * y_orientation(1));
173 z_orientation(1) = (x_orientation(2) * y_orientation(0) - x_orientation(0) * y_orientation(2));
174 z_orientation(2) = (x_orientation(0) * y_orientation(1) - x_orientation(1) * y_orientation(0));
178 orientation(0, 0) = x_orientation(0);
179 orientation(0, 1) = x_orientation(1);
180 orientation(0, 2) = x_orientation(2);
181 orientation(1, 0) = y_orientation(0);
182 orientation(1, 1) = y_orientation(1);
183 orientation(1, 2) = y_orientation(2);
184 orientation(2, 0) = z_orientation(0);
185 orientation(2, 1) = z_orientation(1);
186 orientation(2, 2) = z_orientation(2);
193 mooseError(
"NodalRotationalInertia: Both x_orientation and y_orientation should be provided if "
195 "y_orientation is different from global x or y direction, respectively.");
207 mooseAssert(
_beta > 0.0,
"NodalRotationalInertia: Beta parameter should be positive.");
209 const NumericVector<Number> & aux_sol_old =
_aux_sys->solutionOld();
211 for (
unsigned int i = 0; i <
_nrot; ++i)
215 const Real rot_accel_old =
219 ((((*
_rot[i])[_qp] - (*
_rot_old[i])[_qp]) / (_dt * _dt)) -
226 for (
unsigned int i = 0; i <
_nrot; ++i)
235 for (
unsigned int i = 0; i <
_nrot; ++i)
248 mooseAssert(
_beta > 0.0,
"NodalRotationalInertia: Beta parameter should be positive.");
266 unsigned int coupled_component = 0;
267 bool rot_coupled =
false;
269 mooseAssert(
_beta > 0.0,
"NodalRotationalInertia: Beta parameter should be positive.");
271 for (
unsigned int i = 0; i <
_nrot; ++i)
275 coupled_component = i;
283 else if (rot_coupled)