11 #include "RankTwoTensor.h"
13 #include "Conversion.h"
23 params.addClassDescription(
"Computes an eigenstrain from an initial stress");
24 params.addRequiredParam<std::vector<FunctionName>>(
26 "A list of functions describing the initial stress. There must be 9 of these, corresponding "
27 "to the xx, yx, zx, xy, yy, zy, xz, yz, zz components respectively. To compute the "
28 "eigenstrain correctly, your elasticity tensor should not be time-varying in the first "
30 params.addCoupledVar(
"initial_stress_aux",
31 "A list of 9 AuxVariables describing the initial stress. If provided, each "
32 "of these is multiplied by its corresponding initial_stress function to "
33 "obtain the relevant component of initial stress.");
34 params.addParam<std::string>(
"base_name",
35 "The base_name for the elasticity tensor that will be "
36 "used to compute strain from stress. Do not provide "
37 "any base_name if your elasticity tensor does not use "
43 const InputParameters & parameters)
45 _base_name(isParamValid(
"base_name") ? getParam<std::string>(
"base_name") +
"_" :
""),
46 _elasticity_tensor(getMaterialPropertyByName<
RankFourTensor>(_base_name +
"elasticity_tensor")),
47 _eigenstrain_old(getMaterialPropertyOld<
RankTwoTensor>(_eigenstrain_name)),
48 _ini_aux_provided(isParamValid(
"initial_stress_aux"))
50 const std::vector<FunctionName> & fcn_names(
51 getParam<std::vector<FunctionName>>(
"initial_stress"));
52 const std::size_t num = fcn_names.size();
54 if (num != LIBMESH_DIM * LIBMESH_DIM)
57 "ComputeEigenstrainFromInitialStress: " + Moose::stringify(LIBMESH_DIM * LIBMESH_DIM) +
58 " initial stress functions must be provided. You supplied " + Moose::stringify(num) +
62 for (
unsigned i = 0; i < num; ++i)
67 const std::size_t aux_size = coupledComponents(
"initial_stress_aux");
68 if (aux_size != LIBMESH_DIM * LIBMESH_DIM)
69 paramError(
"initial_stress_aux",
70 "ComputeEigenstrainFromInitialStress: If you supply initial_stress_aux, " +
71 Moose::stringify(LIBMESH_DIM * LIBMESH_DIM) +
72 " values must be given. You supplied " + Moose::stringify(aux_size) +
"\n");
74 for (
unsigned i = 0; i < aux_size; ++i)
75 _ini_aux.push_back(&coupledValue(
"initial_stress_aux", i));
85 for (
unsigned i = 0; i < LIBMESH_DIM; ++i)
86 for (
unsigned j = 0; j < LIBMESH_DIM; ++j)
90 initial_stress(i, j) *= (*
_ini_aux[i * LIBMESH_DIM + j])[_qp];