15 #include "MooseVariable.h"
16 #include "SystemBase.h"
17 #include "RankTwoTensor.h"
18 #include "NonlinearSystem.h"
19 #include "MooseMesh.h"
21 #include "libmesh/quadrature.h"
31 params.addClassDescription(
"Quasi-static and dynamic stress divergence kernel for Beam element");
32 params.addRequiredParam<
unsigned int>(
34 "An integer corresponding to the direction "
35 "the variable this kernel acts in. (0 for disp_x, "
36 "1 for disp_y, 2 for disp_z, 3 for rot_x, 4 for rot_y and 5 for rot_z)");
37 params.addRequiredCoupledVar(
39 "The displacements appropriate for the simulation geometry and coordinate system");
40 params.addRequiredCoupledVar(
41 "rotations",
"The rotations appropriate for the simulation geometry and coordinate system");
42 params.addParam<MaterialPropertyName>(
45 "Name of material property or a constant real number defining the zeta parameter for the "
47 params.addRangeCheckedParam<Real>(
48 "alpha", 0.0,
"alpha >= -0.3333 & alpha <= 0.0",
"alpha parameter for HHT time integration");
50 params.set<
bool>(
"use_displaced_mesh") =
true;
56 _component(getParam<unsigned int>(
"component")),
57 _ndisp(coupledComponents(
"displacements")),
59 _nrot(coupledComponents(
"rotations")),
61 _force(getMaterialPropertyByName<RealVectorValue>(
"forces")),
62 _moment(getMaterialPropertyByName<RealVectorValue>(
"moments")),
63 _K11(getMaterialPropertyByName<
RankTwoTensor>(
"Jacobian_11")),
64 _K22(getMaterialPropertyByName<
RankTwoTensor>(
"Jacobian_22")),
65 _K22_cross(getMaterialPropertyByName<
RankTwoTensor>(
"Jacobian_22_cross")),
66 _K21_cross(getMaterialPropertyByName<
RankTwoTensor>(
"Jacobian_12")),
67 _K21(getMaterialPropertyByName<
RankTwoTensor>(
"Jacobian_21")),
68 _original_length(getMaterialPropertyByName<Real>(
"original_length")),
69 _total_rotation(getMaterialPropertyByName<
RankTwoTensor>(
"total_rotation")),
70 _zeta(getMaterialProperty<Real>(
"zeta")),
71 _alpha(getParam<Real>(
"alpha")),
72 _isDamped(getParam<MaterialPropertyName>(
"zeta") !=
"0.0" || std::abs(_alpha) > 0.0),
73 _force_old(_isDamped ? &getMaterialPropertyOld<RealVectorValue>(
"forces") : nullptr),
74 _moment_old(_isDamped ? &getMaterialPropertyOld<RealVectorValue>(
"moments") : nullptr),
75 _total_rotation_old(_isDamped ? &getMaterialPropertyOld<
RankTwoTensor>(
"total_rotation")
77 _force_older(std::abs(_alpha) > 0.0 ? &getMaterialPropertyOlder<RealVectorValue>(
"forces")
79 _moment_older(std::abs(_alpha) > 0.0 ? &getMaterialPropertyOlder<RealVectorValue>(
"moments")
81 _total_rotation_older(std::abs(_alpha) > 0.0
85 _global_moment_res(0),
93 "StressDivergenceBeam: The number of displacement and rotation variables should be same.");
95 for (
unsigned int i = 0; i <
_ndisp; ++i)
96 _disp_var[i] = coupled(
"displacements", i);
98 for (
unsigned int i = 0; i <
_nrot; ++i)
99 _rot_var[i] = coupled(
"rotations", i);
105 prepareVectorTag(_assembly, _var.number());
107 mooseAssert(_local_re.size() == 2,
108 "StressDivergenceBeam: Beam element must have two nodes only.");
120 for (_i = 0; _i < _test.size(); ++_i)
128 accumulateTaggedLocalResidual();
132 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
133 for (_i = 0; _i < _save_in.size(); ++_i)
134 _save_in[_i]->sys().solution().add_vector(_local_re, _save_in[_i]->dofIndices());
141 prepareMatrixTag(_assembly, _var.number(), _var.number());
143 for (
unsigned int i = 0; i < _test.size(); ++i)
145 for (
unsigned int j = 0; j < _phi.size(); ++j)
163 accumulateTaggedLocalMatrix();
165 if (_has_diag_save_in)
167 unsigned int rows = _local_ke.m();
168 DenseVector<Number> diag(rows);
169 for (
unsigned int i = 0; i < rows; ++i)
170 diag(i) = _local_ke(i, i);
172 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
173 for (
unsigned int i = 0; i < _diag_save_in.size(); ++i)
174 _diag_save_in[i]->sys().solution().add_vector(diag, _diag_save_in[i]->dofIndices());
181 size_t jvar_num = jvar.number();
182 if (jvar_num == _var.number())
186 unsigned int coupled_component = 0;
187 bool disp_coupled =
false;
188 bool rot_coupled =
false;
190 for (
unsigned int i = 0; i <
_ndisp; ++i)
194 coupled_component = i;
200 for (
unsigned int i = 0; i <
_nrot; ++i)
204 coupled_component = i + 3;
210 prepareMatrixTag(_assembly, _var.number(), jvar_num);
212 if (disp_coupled || rot_coupled)
214 for (
unsigned int i = 0; i < _test.size(); ++i)
216 for (
unsigned int j = 0; j < _phi.size(); ++j)
219 _local_ke(i, j) += (i == j ? 1 : -1) *
_K11[0](
_component, coupled_component);
220 else if (_component < 3 && coupled_component > 2)
227 else if (
_component > 2 && coupled_component < 3)
237 _local_ke(i, j) +=
_K22[0](
_component - 3, coupled_component - 3);
249 accumulateTaggedLocalMatrix();
255 std::vector<RealVectorValue> & global_moment_res)
257 mooseAssert(
_zeta[0] >= 0.0,
"StressDivergenceBeam: Zeta parameter should be non-negative.");
258 std::vector<RealVectorValue> global_force_res_old(_test.size());
259 std::vector<RealVectorValue> global_moment_res_old(_test.size());
264 std::vector<RealVectorValue> global_force_res_older(_test.size());
265 std::vector<RealVectorValue> global_moment_res_older(_test.size());
267 if (std::abs(
_alpha) > 0.0)
271 global_force_res_older,
272 global_moment_res_older);
276 for (_i = 0; _i < _test.size(); ++_i)
278 global_force_res[_i] =
281 global_force_res_older[_i] * (
_alpha *
_zeta[0] / _dt);
282 global_moment_res[_i] =
285 global_moment_res_older[_i] * (
_alpha *
_zeta[0] / _dt);
291 const MaterialProperty<RealVectorValue> * moment,
292 const MaterialProperty<RankTwoTensor> * total_rotation,
293 std::vector<RealVectorValue> & global_force_res,
294 std::vector<RealVectorValue> & global_moment_res)
303 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
310 for (_i = 0; _i < _test.size(); ++_i)
315 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
322 for (_i = 0; _i < _test.size(); ++_i)
327 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
346 for (_i = 0; _i < _test.size(); ++_i)
348 global_force_res[_i] = (*total_rotation)[0].transpose() *
_local_force_res[_i];
349 global_moment_res[_i] = (*total_rotation)[0].transpose() *
_local_moment_res[_i];