22 params.addParam<FileName>(
23 "state_variable_file_name",
25 "Name of the file containing the initial values of slip system resistances");
26 MooseEnum intvar_read_options(
"file_input inline_input user_input",
"inline_input");
27 params.addParam<MooseEnum>(
30 "Read from options for initial value of internal variables: Default from .i file");
31 params.addParam<std::vector<unsigned int>>(
"groups",
32 "To group the initial values on different "
33 "slip systems 'format: [start end)', i.e.'0 "
34 "4 8 11' groups 0-3, 4-7 and 8-11 ");
35 params.addParam<std::vector<Real>>(
"group_values",
36 "The initial values corresponding to each "
37 "group, i.e. '0.0 1.0 2.0' means 0-4 = 0.0, "
38 "4-8 = 1.0 and 8-12 = 2.0 ");
39 params.addParam<std::vector<std::string>>(
"uo_state_var_evol_rate_comp_name",
40 "Name of state variable evolution rate component "
41 "property: Same as state variable evolution rate "
42 "component user object specified in input file.");
43 params.addParam<Real>(
"zero", 0.0,
"Numerical zero for interval variable");
44 params.addParam<std::vector<Real>>(
"scale_factor",
"Scale factor of individual component.");
45 params.addClassDescription(
46 "Crystal plasticity state variable class. Override the virtual functions in your class");
52 _num_mat_state_var_evol_rate_comps(
53 parameters.get<std::vector<std::string>>(
"uo_state_var_evol_rate_comp_name").size()),
54 _mat_prop_state_var(getMaterialProperty<std::vector<Real>>(_name)),
55 _state_variable_file_name(getParam<FileName>(
"state_variable_file_name")),
56 _intvar_read_type(getParam<MooseEnum>(
"intvar_read_type")),
57 _groups(getParam<std::vector<unsigned int>>(
"groups")),
58 _group_values(getParam<std::vector<Real>>(
"group_values")),
59 _zero(getParam<Real>(
"zero")),
60 _scale_factor(getParam<std::vector<Real>>(
"scale_factor"))
63 mooseError(
"CrystalPlasticityStateVariable: Scale factor should be have the same size of "
64 "evolution rate components.");
70 parameters.get<std::vector<std::string>>(
"uo_state_var_evol_rate_comp_name")[i]);
75 const Point & q_point)
const
89 mooseError(
"CrystalPlasticityStateVariable: Read option for initial value of internal "
90 "variables is not supported.");
95 mooseError(
"CrystalPlasticityStateVariable: Value of state variables ", i,
" non positive");
107 if (!(file >> val[i]))
108 mooseError(
"Error CrystalPlasticityStateVariable: Premature end of state_variable file");
117 mooseError(
"CrystalPlasticityStateVariable: Error in reading initial state variable values: "
118 "Specify input in .i file or in state_variable file");
121 "CrystalPlasticityStateVariable: The size of the groups and group_values does not match.");
123 for (
unsigned int i = 0; i <
_groups.size() - 1; ++i)
131 mooseError(
"CrystalPlasticityStateVariable: Start index is = ",
133 " should be greater than end index ie = ",
135 " in state variable read");
137 for (
unsigned int j = is; j <= ie; ++j)
144 const Point & )
const
146 mooseError(
"Error CrystalPlasticityStateVariable: User has to overwrite "
147 "'provideInitialValueByUser' function"
148 "in order to provide specific initial values based on quadrature point location.");
154 std::vector<Real> & val,
155 std::vector<Real> & val_old)
const
166 if (val_old[i] <
_zero && val[i] < 0.0)
169 val[i] = val_old[i] + val[i];