15 #include "MooseMesh.h"
16 #include "MooseVariable.h"
17 #include "SystemBase.h"
19 #include "libmesh/quadrature.h"
29 params.addClassDescription(
"Stress divergence kernel for the Cartesian coordinate system");
30 params.addRequiredParam<
unsigned int>(
"component",
31 "An integer corresponding to the direction "
32 "the variable this kernel acts in. (0 for x, "
34 params.addRequiredCoupledVar(
"displacements",
35 "The string of displacements suitable for the problem statement");
36 params.addCoupledVar(
"temperature",
37 "The name of the temperature variable used in the "
38 "ComputeThermalExpansionEigenstrain. (Not required for "
39 "simulations without temperature coupling.)");
40 params.addParam<std::string>(
41 "thermal_eigenstrain_name",
42 "thermal_eigenstrain",
43 "The eigenstrain_name used in the ComputeThermalExpansionEigenstrain.");
44 params.addCoupledVar(
"out_of_plane_strain",
45 "The name of the out_of_plane_strain variable used in the "
46 "WeakPlaneStress kernel.");
47 MooseEnum out_of_plane_direction(
"x y z",
"z");
48 params.addParam<MooseEnum>(
49 "out_of_plane_direction",
50 out_of_plane_direction,
51 "The direction of the out_of_plane_strain variable used in the WeakPlaneStress kernel.");
52 params.addParam<std::string>(
"base_name",
"Material property base name");
53 params.set<
bool>(
"use_displaced_mesh") =
false;
54 params.addParam<
bool>(
55 "use_finite_deform_jacobian",
false,
"Jacobian for corotational finite strain");
56 params.addParam<
bool>(
"volumetric_locking_correction",
58 "Set to false to turn off volumetric locking correction");
64 _base_name(isParamValid(
"base_name") ? getParam<std::string>(
"base_name") +
"_" :
""),
65 _use_finite_deform_jacobian(getParam<bool>(
"use_finite_deform_jacobian")),
66 _stress(getMaterialPropertyByName<
RankTwoTensor>(_base_name +
"stress")),
67 _Jacobian_mult(getMaterialPropertyByName<
RankFourTensor>(_base_name +
"Jacobian_mult")),
68 _component(getParam<unsigned int>(
"component")),
69 _ndisp(coupledComponents(
"displacements")),
71 _temp_coupled(isCoupled(
"temperature")),
72 _temp_var(_temp_coupled ? coupled(
"temperature") : 0),
73 _deigenstrain_dT(_temp_coupled ? &getMaterialPropertyDerivative<
RankTwoTensor>(
74 getParam<std::string>(
"thermal_eigenstrain_name"),
75 getVar(
"temperature", 0)->
name())
77 _out_of_plane_strain_coupled(isCoupled(
"out_of_plane_strain")),
78 _out_of_plane_strain(_out_of_plane_strain_coupled ? &coupledValue(
"out_of_plane_strain")
80 _out_of_plane_strain_var(_out_of_plane_strain_coupled ? coupled(
"out_of_plane_strain") : 0),
81 _out_of_plane_direction(getParam<MooseEnum>(
"out_of_plane_direction")),
82 _use_displaced_mesh(getParam<bool>(
"use_displaced_mesh")),
83 _avg_grad_test(_test.size(), std::vector<Real>(3, 0.0)),
84 _avg_grad_phi(_phi.size(), std::vector<Real>(3, 0.0)),
85 _volumetric_locking_correction(getParam<bool>(
"volumetric_locking_correction"))
87 for (
unsigned int i = 0; i <
_ndisp; ++i)
88 _disp_var[i] = coupled(
"displacements", i);
92 mooseError(
"For 2D simulations where the out-of-plane direction is x or y coordinate "
93 "directions the number of supplied displacements must be three.");
95 mooseError(
"The number of displacement variables supplied must match the mesh dimension");
100 &getMaterialProperty<RankTwoTensor>(
_base_name +
"deformation_gradient");
102 &getMaterialPropertyOld<RankTwoTensor>(
_base_name +
"deformation_gradient");
108 mooseError(
"Volumetric locking correction should be set to false for 1-D problems.");
112 mooseWarning(
"Volumteric locking correction is not required for second order elements. Using "
113 "volumetric locking with second order elements could cause zigzag patterns in "
114 "stresses and strains.");
120 if (getBlockCoordSystem() != Moose::COORD_XYZ)
122 "The coordinate system in the Problem block must be set to XYZ for cartesian geometries.");
128 prepareVectorTag(_assembly, _var.number());
133 precalculateResidual();
134 for (_i = 0; _i < _test.size(); ++_i)
135 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
138 accumulateTaggedLocalResidual();
142 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
143 for (
const auto & var : _save_in)
144 var->sys().solution().add_vector(_local_re, var->dofIndices());
155 residual +=
_stress[_qp].trace() / 3.0 *
161 residual *= out_of_plane_thickness;
180 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
186 Kernel::computeJacobian();
202 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
208 Kernel::computeOffDiagJacobian(jvar);
246 phi(0, 0) = _grad_phi[_j][_qp](0);
247 phi(0, 1) = phi(1, 0) = _grad_phi[_j][_qp](1);
248 phi(0, 2) = phi(2, 0) = _grad_phi[_j][_qp](2);
252 phi(1, 1) = _grad_phi[_j][_qp](1);
253 phi(0, 1) = phi(1, 0) = _grad_phi[_j][_qp](0);
254 phi(1, 2) = phi(2, 1) = _grad_phi[_j][_qp](2);
258 phi(2, 2) = _grad_phi[_j][_qp](2);
259 phi(0, 2) = phi(2, 0) = _grad_phi[_j][_qp](0);
260 phi(1, 2) = phi(2, 1) = _grad_phi[_j][_qp](1);
270 jacobian *= out_of_plane_thickness;
280 for (
unsigned int coupled_component = 0; coupled_component <
_ndisp; ++coupled_component)
281 if (jvar ==
_disp_var[coupled_component])
315 (
_avg_grad_phi[_j][coupled_component] - _grad_phi[_j][_qp](coupled_component)) /
320 (
_avg_grad_phi[_j][coupled_component] - _grad_phi[_j][_qp](coupled_component)) /
325 for (
unsigned int i = 0; i < 3; ++i)
326 phi(coupled_component, i) = _grad_phi[_j][_qp](i);
339 _grad_test[_i][_qp](
_component) * _phi[_j][_qp];
344 _grad_test[_i][_qp])(
_component)*_phi[_j][_qp];
357 (*_rotation_increment)[_qp].transpose() *
_stress[_qp] * (*_rotation_increment)[_qp];
361 (*_deformation_gradient)[_qp] * (*_deformation_gradient_old)[_qp].inverse();
364 const RankTwoTensor rot_times_stress = (*_rotation_increment)[_qp] * unrotated_stress;
366 I.mixedProductIkJl(rot_times_stress) + I.mixedProductJkIl(rot_times_stress);
374 const RankTwoTensor Ctilde = A * A.transpose() - A - A.transpose();
376 -I.mixedProductIkJl(A) - I.mixedProductJkIl(A) + II_ijkl + I.mixedProductJkIl(I);
382 0.5 * II_ijkl - 1.0 / 8.0 * (I.mixedProductIkJl(Ctilde) + Ctilde.mixedProductIkJl(I));
383 RankFourTensor drot_dFhatinv = drot_dUhatinv * dUhatinv_dCtilde * dCtilde_dFhatinv;
389 -0.5 * II_ijkl + 0.25 * (I.mixedProductIkJl(Ctilde) + Ctilde.mixedProductIkJl(I));
391 rot_rank_four *
_Jacobian_mult[_qp] * dstrain_increment_dCtilde * dCtilde_dFhatinv;
394 const RankFourTensor dFhat_dFhatinv = -Fhat.mixedProductIkJl(Fhat.transpose());
395 const RankTwoTensor dJ_dFhatinv = dFhat_dFhatinv.innerProductTranspose(Fhat.ddet());
401 const RankTwoTensor Finv = (*_deformation_gradient)[_qp].inverse();
402 const RankFourTensor dFhatinv_dGradu = -Fhatinv.mixedProductIkJl(Finv.transpose());
411 for (_i = 0; _i < _test.size(); ++_i)
415 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
427 for (_i = 0; _i < _phi.size(); ++_i)
433 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)