12 #include "libmesh/quadrature.h" 21 "Global Strain UserObject to provide Residual and diagonal Jacobian entry");
22 params.
addParam<std::vector<Real>>(
"applied_stress_tensor",
23 "Vector of values defining the constant applied stress " 24 "to add, in order 11, 22, 33, 23, 13, 12");
25 params.
addParam<std::string>(
"base_name",
"Material properties base name");
26 params.
addCoupledVar(
"displacements",
"The name of the displacement variables");
35 _base_name(isParamValid(
"base_name") ? getParam<
std::string>(
"base_name") +
"_" :
""),
36 _dstress_dstrain(getMaterialProperty<
RankFourTensor>(_base_name +
"Jacobian_mult")),
37 _stress(getMaterialProperty<
RankTwoTensor>(_base_name +
"stress")),
38 _dim(_mesh.dimension()),
39 _ndisp(coupledComponents(
"displacements")),
43 for (
unsigned int i = 0; i <
_ndisp; ++i)
46 for (
unsigned int dir = 0; dir <
_dim; ++dir)
50 for (
unsigned int i = 1; i <
_ndisp; ++i)
52 mooseError(
"All the displacement components in a particular direction should have same " 58 getParam<std::vector<Real>>(
"applied_stress_tensor"));
75 for (
unsigned int _qp = 0; _qp <
_qrule->n_points(); _qp++)
96 std::vector<Real> residual(9);
97 std::vector<Real> jacobian(81);
105 std::copy(residual.begin(), residual.end(), &
_residual(0, 0));
106 std::copy(jacobian.begin(), jacobian.end(), &
_jacobian(0, 0, 0, 0));
121 const VectorValue<bool> &
const MaterialProperty< RankTwoTensor > & _stress
The stress tensor.
virtual unsigned int coupled(const std::string &var_name, unsigned int comp=0) const
registerMooseObject("SolidMechanicsApp", GlobalStrainUserObject)
const MooseArray< Real > & _coord
static InputParameters validParams()
const unsigned int _ndisp
Number of displacement variables.
bool isTranslatedPeriodic(unsigned int nonlinear_var_num, unsigned int component) const
RankTwoTensor _applied_stress_tensor
bool isParamValid(const std::string &name) const
void initialize() override
void fillFromInputVector(const std::vector< Real > &input, FillMethod fill_method=autodetect)
const MaterialProperty< RankFourTensor > & _dstress_dstrain
static InputParameters validParams()
const T & getParam(const std::string &name) const
virtual const RankFourTensor & getJacobian() const override
VectorValue< bool > _periodic_dir
std::vector< unsigned int > _disp_var
Variable numbers of the displacement variables.
const ExecFlagType EXEC_LINEAR
GlobalStrainUserObject(const InputParameters ¶meters)
virtual void computeAdditionalStress()
Calculate additional applied stresses.
const QBase *const & _qrule
This class provides interface for extracting the periodic directions, residual, and jacobian values f...
const MooseArray< Real > & _JxW
void mooseError(Args &&... args) const
virtual const VectorValue< bool > & getPeriodicDirections() const override
virtual const RankTwoTensor & getResidual() const override
void threadJoin(const UserObject &uo) override