15 #include "MooseVariable.h"
16 #include "MooseVariableScalar.h"
17 #include "RankTwoTensor.h"
18 #include "RankFourTensor.h"
20 #include "libmesh/quadrature.h"
30 params.addClassDescription(
"Generalized Plane Strain kernel to provide contribution of the "
31 "out-of-plane strain to other kernels");
32 params.addRequiredParam<std::vector<VariableName>>(
"displacements",
33 "Variable for the displacements");
34 params.addParam<VariableName>(
"temperature",
"Variable for the temperature");
36 params.addCoupledVar(
"scalar_out_of_plane_strain",
37 "Scalar variable for generalized plane strain");
38 MooseEnum outOfPlaneDirection(
"x y z",
"z");
39 params.addParam<MooseEnum>(
40 "out_of_plane_direction", outOfPlaneDirection,
"The direction of the out-of-plane strain.");
41 params.addParam<UserObjectName>(
"subblock_index_provider",
42 "SubblockIndexProvider user object name");
43 params.addParam<
unsigned int>(
44 "scalar_out_of_plane_strain_index",
45 "The index number of scalar_out_of_plane_strain this kernel acts on");
46 params.addParam<std::string>(
"base_name",
"Material property base name");
47 params.addParam<std::vector<MaterialPropertyName>>(
48 "eigenstrain_names",
"List of eigenstrains to be applied in this strain calculation");
54 : DerivativeMaterialInterface<Kernel>(parameters),
55 _base_name(isParamValid(
"base_name") ? getParam<std::string>(
"base_name") +
"_" :
""),
56 _Jacobian_mult(getMaterialProperty<
RankFourTensor>(_base_name +
"Jacobian_mult")),
57 _eigenstrain_names(getParam<std::vector<MaterialPropertyName>>(
"eigenstrain_names")),
58 _deigenstrain_dT(_eigenstrain_names.size()),
59 _scalar_out_of_plane_strain_var(coupledScalar(
"scalar_out_of_plane_strain")),
60 _subblock_id_provider(isParamValid(
"subblock_index_provider")
63 _scalar_var_id(isParamValid(
"scalar_out_of_plane_strain_index")
64 ? getParam<unsigned int>(
"scalar_out_of_plane_strain_index")
66 _temp_var(isParamValid(
"temperature")
67 ? &_subproblem.getStandardVariable(_tid, getParam<VariableName>(
"temperature"))
69 _num_disp_var(getParam<std::vector<VariableName>>(
"displacements").size()),
70 _scalar_out_of_plane_strain_direction(getParam<MooseEnum>(
"out_of_plane_direction"))
72 const std::vector<VariableName> & nl_vnames(getParam<std::vector<VariableName>>(
"displacements"));
75 mooseError(
"For 1D axisymmetric or 2D cartesian simulations where the out-of-plane direction "
76 "is z, the number of supplied displacements to GeneralizedPlaneStrainOffDiag must "
77 "be less than three.");
79 mooseError(
"For 2D cartesian simulations where the out-of-plane direction is x or y the number "
80 "of supplied displacements must be three.");
83 _disp_var.push_back(&_subproblem.getStandardVariable(_tid, nl_vnames[i]));
89 if (isParamValid(
"scalar_variable_index_provider") &&
90 !isParamValid(
"scalar_out_of_plane_strain_index"))
91 mooseError(
"scalar_out_of_plane_strain_index should be provided if more "
92 "than one is available");
98 const unsigned int elem_scalar_var_id =
103 if (_assembly.coordSystem() == Moose::COORD_RZ)
106 if (_var.number() ==
_disp_var[0]->number())
110 else if (isParamValid(
"temperature") ? _var.number() ==
_temp_var->number() : 0)
121 DenseMatrix<Number> & ken = _assembly.jacobianBlock(_var.number(), jvar);
122 DenseMatrix<Number> & kne = _assembly.jacobianBlock(jvar, _var.number());
123 MooseVariableScalar & jv = _sys.getScalarVariable(_tid, jvar);
132 for (_i = 0; _i < _test.size(); ++_i)
133 for (_j = 0; _j < jv.order(); ++_j)
134 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
136 ken(_i, _j) += _JxW[_qp] * _coord[_qp] *
142 kne(_j, _i) += _JxW[_qp] * _coord[_qp] *
157 DenseMatrix<Number> & kne = _assembly.jacobianBlock(jvar, _var.number());
158 MooseVariableScalar & jv = _sys.getScalarVariable(_tid, jvar);
161 for (_i = 0; _i < _test.size(); ++_i)
162 for (_j = 0; _j < jv.order(); ++_j)
163 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
164 for (
unsigned int ies = 0; ies < n_eigenstrains; ++ies)
166 _JxW[_qp] * _coord[_qp] *