12 #include "MooseMesh.h"
15 #define QUOTE(macro) stringifyName(macro)
24 params.addRequiredParam<FileName>(
25 "plugin",
"The path to the compiled dynamic library for the plugin you want to use");
26 params.addRequiredParam<std::vector<Real>>(
"mechanical_constants",
27 "Mechanical Material Properties");
28 params.addParam<std::vector<Real>>(
"thermal_constants",
"Thermal Material Properties");
29 params.addRequiredParam<
unsigned int>(
"num_state_vars",
30 "The number of state variables this UMAT is going to use");
36 _plugin(getParam<FileName>(
"plugin")),
37 _mechanical_constants(getParam<std::vector<Real>>(
"mechanical_constants")),
38 _thermal_constants(getParam<std::vector<Real>>(
"thermal_constants")),
39 _num_state_vars(getParam<unsigned int>(
"num_state_vars")),
40 _grad_disp_x(coupledGradient(
"disp_x")),
41 _grad_disp_y(coupledGradient(
"disp_y")),
42 _grad_disp_z(coupledGradient(
"disp_z")),
43 _grad_disp_x_old(coupledGradientOld(
"disp_x")),
44 _grad_disp_y_old(coupledGradientOld(
"disp_y")),
45 _grad_disp_z_old(coupledGradientOld(
"disp_z")),
46 _state_var(declareProperty<std::vector<Real>>(
"state_var")),
47 _state_var_old(getMaterialPropertyOld<std::vector<Real>>(
"state_var")),
48 _Fbar(declareProperty<ColumnMajorMatrix>(
"Fbar")),
49 _Fbar_old(getMaterialPropertyOld<ColumnMajorMatrix>(
"Fbar")),
50 _elastic_strain_energy(declareProperty<Real>(
"elastic_strain_energy")),
51 _plastic_dissipation(declareProperty<Real>(
"plastic_dissipation")),
52 _creep_dissipation(declareProperty<Real>(
"creep_dissipation"))
55 _plugin += std::string(
"-") + QUOTE(METHOD) +
".plugin";
67 if (_mesh.dimension() == 3)
73 else if (_mesh.dimension() == 2)
96 for (
int i = 0; i <
_NTENS; ++i)
105 for (
unsigned int i = 0; i < 9; ++i)
119 _PROPS[i] = props_array[i];
131 std::ostringstream error;
132 error <<
"Cannot open library: " << dlerror() <<
'\n';
133 mooseError(error.str());
141 void * pointer = dlsym(
_handle,
"umat_");
142 _umat = *reinterpret_cast<umat_t *>(&pointer);
146 const char * dlsym_error = dlerror();
150 std::ostringstream error;
151 error <<
"Cannot load symbol 'umat_': " << dlsym_error <<
'\n';
152 mooseError(error.str());
186 ColumnMajorMatrix Fbar;
201 Real myDFGRD0[9] = {
_Fbar_old[_qp](0, 0),
210 Real myDFGRD1[9] = {
_Fbar[_qp](0, 0),
220 for (
unsigned int i = 0; i < 9; ++i)
231 for (
int i = 0; i <
_NTENS; ++i)
243 for (
unsigned int i = 0; i < 3; ++i)