21 #include "libmesh/quadrature.h" 29 params.
addClassDescription(
"Generalized Plane Strain kernel to provide contribution of the " 30 "out-of-plane strain to other kernels");
32 "Variable for the displacements");
33 params.
addCoupledVar(
"temperature",
"Variable for the temperature");
36 "Scalar variable for generalized plane strain");
37 MooseEnum outOfPlaneDirection(
"x y z",
"z");
39 "out_of_plane_direction", outOfPlaneDirection,
"The direction of the out-of-plane strain.");
40 params.
addParam<UserObjectName>(
"subblock_index_provider",
41 "SubblockIndexProvider user object name");
43 "scalar_out_of_plane_strain_index",
44 "The index number of scalar_out_of_plane_strain this kernel acts on");
45 params.
addParam<std::string>(
"base_name",
"Material property base name");
46 params.
addParam<std::vector<MaterialPropertyName>>(
47 "eigenstrain_names", {},
"List of eigenstrains to be applied in this strain calculation");
54 _base_name(isParamValid(
"base_name") ? getParam<
std::string>(
"base_name") +
"_" :
""),
55 _Jacobian_mult(getMaterialProperty<
RankFourTensor>(_base_name +
"Jacobian_mult")),
56 _eigenstrain_names(getParam<
std::vector<MaterialPropertyName>>(
"eigenstrain_names")),
57 _deigenstrain_dT(_eigenstrain_names.size()),
58 _scalar_out_of_plane_strain_var(coupledScalar(
"scalar_out_of_plane_strain")),
59 _subblock_id_provider(isParamValid(
"subblock_index_provider")
62 _scalar_var_id(isParamValid(
"scalar_out_of_plane_strain_index")
63 ? getParam<unsigned
int>(
"scalar_out_of_plane_strain_index")
65 _temp_var(isCoupled(
"temperature") ? getVar(
"temperature", 0) : nullptr),
66 _num_disp_var(getParam<
std::vector<VariableName>>(
"displacements").size()),
67 _scalar_out_of_plane_strain_direction(getParam<
MooseEnum>(
"out_of_plane_direction"))
69 const std::vector<VariableName> & nl_vnames(getParam<std::vector<VariableName>>(
"displacements"));
72 mooseError(
"For 1D axisymmetric or 2D cartesian simulations where the out-of-plane direction " 73 "is z, the number of supplied displacements to GeneralizedPlaneStrainOffDiag must " 74 "be less than three.");
76 mooseError(
"For 2D cartesian simulations where the out-of-plane direction is x or y the number " 77 "of supplied displacements must be three.");
80 _disp_var.push_back(&_subproblem.getStandardVariable(_tid, nl_vnames[i]));
86 if (isParamValid(
"scalar_variable_index_provider") &&
87 !isParamValid(
"scalar_out_of_plane_strain_index"))
88 paramError(
"scalar_out_of_plane_index",
89 "scalar_out_of_plane_strain_index should be provided if more " 90 "than one is available");
91 if (coupledComponents(
"temperature") > 1)
92 paramError(
"temperature",
"Only one variable my be specified in 'temperature'");
98 const unsigned int elem_scalar_var_id =
106 if (_var.number() ==
_disp_var[0]->number())
121 prepareMatrixTag(_assembly, _var.number(), jvar);
131 for (_i = 0; _i < _test.size(); ++_i)
132 for (_j = 0; _j < jv.order(); ++_j)
133 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
134 _local_ke(_i, _j) += _JxW[_qp] * _coord[_qp] *
140 accumulateTaggedLocalMatrix();
143 prepareMatrixTag(_assembly, jvar, _var.number());
145 accumulateTaggedLocalMatrix();
154 prepareMatrixTag(_assembly, _var.number(), jvar);
158 for (_i = 0; _i < _test.size(); ++_i)
159 for (_j = 0; _j < jv.order(); ++_j)
160 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
161 for (
unsigned int ies = 0; ies < n_eigenstrains; ++ies)
163 _JxW[_qp] * _coord[_qp] *
167 accumulateTaggedLocalMatrix();
static InputParameters validParams()
const std::vector< MaterialPropertyName > _eigenstrain_names
unsigned int _scalar_out_of_plane_strain_var
Variable number of the out-of-plane strain scalar variable.
GeneralizedPlaneStrainOffDiag(const InputParameters ¶meters)
void mooseError(Args &&... args)
unsigned int number() const
static const std::string component
Abstract base class for user objects that provide an index for a given element that is independent of...
const std::string & name() const override
static InputParameters validParams()
const std::string _base_name
Base name of the material system that this kernel applies to.
void computeOffDiagJacobianScalar(unsigned int jvar) override
These methods are used to compute the off-diagonal jacobian for the coupling between scalar variable ...
const unsigned int _num_disp_var
virtual void computeDispOffDiagJacobianScalar(unsigned int component, unsigned int jvar)
std::vector< MooseVariable * > _disp_var
DenseMatrix< Number > _ke_copy
Member variable to avoid constant dense matrix heap allocations.
void get_transpose(DenseMatrix< Number > &dest) const
std::vector< const MaterialProperty< RankTwoTensor > * > _deigenstrain_dT
virtual void computeTempOffDiagJacobianScalar(unsigned int jvar)
const SubblockIndexProvider *const _subblock_id_provider
A Userobject that carries the subblock ID for all elements.
MooseVariable * _temp_var
virtual unsigned int getSubblockIndex(const Elem &) const =0
The index of subblock this element is on.
const MaterialProperty< RankFourTensor > & _Jacobian_mult
const unsigned int _scalar_var_id
registerMooseObject("SolidMechanicsApp", GeneralizedPlaneStrainOffDiag)
void ErrorVector unsigned int
unsigned int _scalar_out_of_plane_strain_direction
The direction of the out-of-plane strain.