11 #include "libmesh/utility.h"
21 params.addParam<
unsigned int>(
"num_slip_sys_props",
23 "Number of slip system specific properties provided in the file "
24 "containing slip system normals and directions");
25 params.addParam<std::vector<Real>>(
"flowprops",
"Parameters used in slip rate equations");
26 params.addRequiredParam<FileName>(
"slip_sys_file_name",
27 "Name of the file containing the slip system");
28 params.addParam<FileName>(
29 "slip_sys_flow_prop_file_name",
31 "Name of the file containing the values of slip rate equation parameters");
32 params.addParam<
unsigned int>(
33 "num_slip_sys_flowrate_props",
35 "Number of flow rate properties for a slip system");
36 params.addParam<Real>(
"slip_incr_tol", 2e-2,
"Maximum allowable slip in an increment");
37 params.addClassDescription(
38 "Crystal plasticity slip rate class. Override the virtual functions in your class");
44 _num_slip_sys_props(getParam<unsigned int>(
"num_slip_sys_props")),
45 _flowprops(getParam<std::vector<Real>>(
"flowprops")),
46 _slip_sys_file_name(getParam<FileName>(
"slip_sys_file_name")),
47 _slip_sys_flow_prop_file_name(getParam<FileName>(
"slip_sys_flow_prop_file_name")),
48 _num_slip_sys_flowrate_props(getParam<unsigned int>(
"num_slip_sys_flowrate_props")),
49 _slip_incr_tol(getParam<Real>(
"slip_incr_tol")),
50 _mo(_variable_size * LIBMESH_DIM),
51 _no(_variable_size * LIBMESH_DIM),
70 Real vec[LIBMESH_DIM];
71 std::ifstream fileslipsys;
80 for (
unsigned int j = 0; j < LIBMESH_DIM; ++j)
81 if (!(fileslipsys >> vec[j]))
83 "CrystalPlasticitySlipRate Error: Premature end of file reading slip system file \n");
87 mag = Utility::pow<2>(vec[0]) + Utility::pow<2>(vec[1]) + Utility::pow<2>(vec[2]);
90 for (
unsigned j = 0; j < LIBMESH_DIM; ++j)
91 _no(i * LIBMESH_DIM + j) = vec[j] / mag;
94 for (
unsigned int j = 0; j < LIBMESH_DIM; ++j)
95 if (!(fileslipsys >> vec[j]))
97 "CrystalPlasticitySlipRate Error: Premature end of file reading slip system file \n");
100 mag = Utility::pow<2>(vec[0]) + Utility::pow<2>(vec[1]) + Utility::pow<2>(vec[2]);
101 mag = std::sqrt(mag);
103 for (
unsigned int j = 0; j < LIBMESH_DIM; ++j)
104 _mo(i * LIBMESH_DIM + j) = vec[j] / mag;
107 for (
unsigned int j = 0; j < LIBMESH_DIM; ++j)
108 mag +=
_mo(i * LIBMESH_DIM + j) *
_no(i * LIBMESH_DIM + j);
110 if (std::abs(mag) > 1e-8)
111 mooseError(
"CrystalPlasticitySlipRate Error: Slip direction and normal not orthonormal, "