19 #include "libmesh/quadrature.h" 30 "An integer corresponding to the direction " 31 "the variable this kernel acts in. (0 for x, " 34 "The string of displacements suitable for the problem statement");
38 "The name of the temperature variable used in the " 39 "ComputeThermalExpansionEigenstrain. (Not required for " 40 "simulations without temperature coupling.)");
42 params.
addParam<std::vector<MaterialPropertyName>>(
45 "List of eigenstrains used in the strain calculation. Used for computing their derivatives " 46 "for off-diagonal Jacobian terms.");
48 "The name of the out_of_plane_strain variable used in the " 49 "WeakPlaneStress kernel.");
50 MooseEnum out_of_plane_direction(
"x y z",
"z");
52 "out_of_plane_direction",
53 out_of_plane_direction,
54 "The direction of the out_of_plane_strain variable used in the WeakPlaneStress kernel.");
55 params.
addParam<std::string>(
"base_name",
"Material property base name");
56 params.
set<
bool>(
"use_displaced_mesh") =
false;
58 "use_finite_deform_jacobian",
false,
"Jacobian for corotational finite strain");
59 params.
addParam<
bool>(
"volumetric_locking_correction",
61 "Set to false to turn off volumetric locking correction");
67 _base_name(isParamValid(
"base_name") ? getParam<
std::string>(
"base_name") +
"_" :
""),
68 _use_finite_deform_jacobian(getParam<bool>(
"use_finite_deform_jacobian")),
69 _stress(getMaterialPropertyByName<
RankTwoTensor>(_base_name +
"stress")),
70 _Jacobian_mult(getMaterialPropertyByName<
RankFourTensor>(_base_name +
"Jacobian_mult")),
71 _component(getParam<unsigned
int>(
"component")),
72 _ndisp(coupledComponents(
"displacements")),
74 _out_of_plane_strain_coupled(isCoupled(
"out_of_plane_strain")),
75 _out_of_plane_strain(_out_of_plane_strain_coupled ? &coupledValue(
"out_of_plane_strain")
77 _out_of_plane_strain_var(_out_of_plane_strain_coupled ? coupled(
"out_of_plane_strain") : 0),
78 _out_of_plane_direction(getParam<
MooseEnum>(
"out_of_plane_direction")),
79 _use_displaced_mesh(getParam<bool>(
"use_displaced_mesh")),
80 _avg_grad_test(_test.size(),
std::vector<
Real>(3, 0.0)),
81 _avg_grad_phi(_phi.size(),
std::vector<
Real>(3, 0.0)),
82 _volumetric_locking_correction(getParam<bool>(
"volumetric_locking_correction"))
85 for (
unsigned int i = 0; i <
_ndisp; ++i)
86 _disp_var[i] = coupled(
"displacements", i);
89 const auto nvar = _coupled_moose_vars.size();
91 for (std::size_t i = 0; i < nvar; ++i)
92 for (
auto eigenstrain_name : getParam<std::vector<MaterialPropertyName>>(
"eigenstrain_names"))
94 eigenstrain_name, _coupled_moose_vars[i]->
name()));
98 mooseError(
"For 2D simulations where the out-of-plane direction is x or y coordinate " 99 "directions the number of supplied displacements must be three.");
101 mooseError(
"The number of displacement variables supplied must match the mesh dimension");
106 &getMaterialProperty<RankTwoTensor>(
_base_name +
"deformation_gradient");
108 &getMaterialPropertyOld<RankTwoTensor>(
_base_name +
"deformation_gradient");
114 mooseError(
"Volumetric locking correction should be set to false for 1-D problems.");
118 mooseWarning(
"Volumteric locking correction is not required for second order elements. Using " 119 "volumetric locking with second order elements could cause zigzag patterns in " 120 "stresses and strains.");
127 for (
auto eigenstrain_name : getParam<std::vector<MaterialPropertyName>>(
"eigenstrain_names"))
128 validateNonlinearCoupling<RankTwoTensor>(eigenstrain_name);
132 mooseError(
"The coordinate system in the Problem block must be set to XYZ for cartesian " 139 prepareVectorTag(_assembly, _var.number());
144 precalculateResidual();
145 for (_i = 0; _i < _test.size(); ++_i)
146 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
149 accumulateTaggedLocalResidual();
153 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
154 for (
const auto & var : _save_in)
155 var->sys().solution().add_vector(_local_re, var->dofIndices());
165 residual +=
_stress[_qp].trace() / 3.0 *
171 residual *= out_of_plane_thickness;
190 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
212 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
229 _grad_phi_undisplaced[_j][_qp]);
258 phi(0, 0) = _grad_phi[_j][_qp](0);
259 phi(0, 1) = phi(1, 0) = _grad_phi[_j][_qp](1);
260 phi(0, 2) = phi(2, 0) = _grad_phi[_j][_qp](2);
264 phi(1, 1) = _grad_phi[_j][_qp](1);
265 phi(0, 1) = phi(1, 0) = _grad_phi[_j][_qp](0);
266 phi(1, 2) = phi(2, 1) = _grad_phi[_j][_qp](2);
270 phi(2, 2) = _grad_phi[_j][_qp](2);
271 phi(0, 2) = phi(2, 0) = _grad_phi[_j][_qp](0);
272 phi(1, 2) = phi(2, 1) = _grad_phi[_j][_qp](1);
283 jacobian *= out_of_plane_thickness;
293 for (
unsigned int coupled_component = 0; coupled_component <
_ndisp; ++coupled_component)
294 if (jvar ==
_disp_var[coupled_component])
307 _grad_phi_undisplaced[_j][_qp]);
328 (
_avg_grad_phi[_j][coupled_component] - _grad_phi[_j][_qp](coupled_component)) /
333 (
_avg_grad_phi[_j][coupled_component] - _grad_phi[_j][_qp](coupled_component)) /
338 for (
unsigned int i = 0; i < 3; ++i)
339 phi(coupled_component, i) = _grad_phi[_j][_qp](i);
352 _grad_test[_i][_qp](
_component) * _phi[_j][_qp];
362 total_deigenstrain += (*deigenstrain_darg)[_qp];
365 _grad_test[_i][_qp])(
_component)*_phi[_j][_qp];
371 usingTensorIndices(i_, j_, k_, l_);
377 (*_rotation_increment)[_qp].
transpose() *
_stress[_qp] * (*_rotation_increment)[_qp];
381 (*_deformation_gradient)[_qp] * (*_deformation_gradient_old)[_qp].
inverse();
384 const RankTwoTensor rot_times_stress = (*_rotation_increment)[_qp] * unrotated_stress;
386 I.times<i_, k_, j_, l_>(rot_times_stress) + I.times<j_, k_, i_, l_>(rot_times_stress);
388 (*_rotation_increment)[_qp].times<i_, k_, j_, l_>((*_rotation_increment)[_qp]);
396 -I.times<i_, k_, j_, l_>(
A) - I.times<j_, k_, i_, l_>(
A) + I2 + I.times<j_, k_, i_, l_>(I);
402 0.5 * I2 - 1.0 / 8.0 * (I.times<i_, k_, j_, l_>(Ctilde) + Ctilde.
times<i_, k_, j_, l_>(I));
403 RankFourTensor drot_dFhatinv = drot_dUhatinv * dUhatinv_dCtilde * dCtilde_dFhatinv;
405 drot_dFhatinv -= Fhat.
times<i_, k_, j_, l_>((*_rotation_increment)[_qp].transpose());
409 -0.5 * I2 + 0.25 * (I.times<i_, k_, j_, l_>(Ctilde) + Ctilde.
times<i_, k_, j_, l_>(I));
411 rot_rank_four *
_Jacobian_mult[_qp] * dstrain_increment_dCtilde * dCtilde_dFhatinv;
415 const RankTwoTensor dJ_dFhatinv = dFhat_dFhatinv.innerProductTranspose(Fhat.
ddet());
422 const RankFourTensor dFhatinv_dGradu = -Fhatinv.times<i_, k_, j_, l_>(Finv.transpose());
431 for (_i = 0; _i < _test.size(); ++_i)
435 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
447 for (_i = 0; _i < _phi.size(); ++_i)
453 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
const std::string _base_name
Base name of the material system that this kernel applies to.
std::vector< std::vector< Real > > _avg_grad_phi
Gradient of phi function averaged over the element. Used in volumetric locking correction calculation...
RankTwoTensorTempl< Real > inverse() const
const VariableValue *const _out_of_plane_strain
bool _volumetric_locking_correction
Flag for volumetric locking correction.
void mooseError(Args &&... args)
unsigned int _ndisp
Coupled displacement variables.
std::vector< std::vector< Real > > _avg_grad_test
Gradient of test function averaged over the element. Used in volumetric locking correction calculatio...
static const std::string component
const unsigned int _out_of_plane_strain_var
void mooseWarning(Args &&... args)
virtual void computeOffDiagJacobian(unsigned int jvar) override
const unsigned int _component
An integer corresponding to the direction this kernel acts in.
const MaterialProperty< RankTwoTensor > * _deformation_gradient_old
virtual void computeJacobian() override
const unsigned int _out_of_plane_direction
static RankTwoTensorTempl Identity()
virtual Real computeQpJacobian() override
const bool _out_of_plane_strain_coupled
virtual void computeAverageGradientTest()
const MaterialProperty< RankTwoTensor > * _rotation_increment
std::vector< unsigned int > _disp_var
Displacement variables IDs.
std::vector< RankFourTensor > _finite_deform_Jacobian_mult
StressDivergenceTensors(const InputParameters ¶meters)
static InputParameters validParams()
const JvarMap & getJvarMap()
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
std::vector< std::vector< const MaterialProperty< RankTwoTensor > * > > _deigenstrain_dargs
eigen strain derivatives wrt coupled variables
registerMooseObject("SolidMechanicsApp", StressDivergenceTensors)
virtual void initialSetup() override
const bool _use_displaced_mesh
Whether this object is acting on the displaced mesh.
unsigned int mapJvarToCvar(unsigned int jvar)
const MaterialProperty< RankTwoTensor > * _deformation_gradient
const MaterialProperty< RankFourTensor > & _Jacobian_mult
virtual void computeOffDiagJacobian(unsigned int jvar) override
virtual void computeJacobian() override
RankTwoTensorTempl< Real > transpose() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computeFiniteDeformJacobian()
RankFourTensorTempl< Real > times(const RankTwoTensorTempl< Real > &b) const
virtual void computeResidual() override
static InputParameters validParams()
virtual Real computeQpResidual() override
RankTwoTensorTempl< Real > ddet() const
virtual void computeOffDiagJacobian(unsigned int jvar) override
bool _use_finite_deform_jacobian
void ErrorVector unsigned int
virtual void computeAverageGradientPhi()
const MaterialProperty< RankTwoTensor > & _stress
The stress tensor that the divergence operator operates on.
virtual void computeJacobian() override
StressDivergenceTensors mostly copies from StressDivergence.