15struct SensitivityCase {
17 std::array<double, 5> irradiationTemp;
18 std::array<double, 4> youngModulus;
19 std::array<double, 4> p1;
24const std::array<SensitivityCase, 3> cases{{
26 {20, 20, 450, 450, 450},
27 {11890, 22252.4, 21894.7, 21516.6},
28 {1, 1.5195, 1.57151, 1.57161},
31 {20, 20, 235, 450, 450},
32 {11890, 19588, 21429.4, 21475},
33 {1, 1.33448, 1.54454, 1.57156},
36 {20, 20, 20, 235, 450},
37 {11890, 17483.2, 19802.5, 21679.3},
42constexpr std::array<double, 5> dose{{0, 0.003, 7.25, 14.5, 21.75}};
43constexpr std::array<double, 5> timeAtStepEnd{
44 {0, 1e-6, 2.000001, 4.000001, 6.000001}};
47 const char *quantity,
const char *case_name,
50 if (!std::isfinite(actual) || std::abs(actual - expected) >
tolerance)
52 "%s step %d: %s = %.12g, Abaqus = %.12g (tolerance %.3g)",
53 case_name, step, quantity, actual, expected,
tolerance);
59 std::ifstream
file(
"amentum_umat_props.inc");
62 "Could not open amentum_umat_props.inc");
64 while (std::getline(file, line)) {
65 const auto equal = line.find(
'=');
66 if (equal == std::string::npos)
68 std::istringstream value(line.substr(equal + 1));
70 if (!(value >> parameter))
72 "Invalid UMAT property in %s", line.c_str());
73 properties.push_back(parameter);
75 if (properties.size() != 134)
77 "Abaqus sensitivity replay needs 134 UMAT properties");
82 const std::vector<double> &properties) {
86 umat.props = properties;
87 umat.predef.assign(5, 0);
88 umat.dpred.assign(5, 0);
93 const auto interpolate = [](
double start,
double end,
double fraction) {
94 return start + fraction * (
end - start);
97 for (
int step = 1; step != 5; ++step) {
98 const int increment_count = step == 1 ? 1 : 8;
99 for (
int increment = 1; increment <= increment_count; ++increment) {
100 const double a =
static_cast<double>(increment - 1) / increment_count;
101 const double b =
static_cast<double>(increment) / increment_count;
102 const double start_time =
103 interpolate(timeAtStepEnd[step - 1], timeAtStepEnd[step],
a);
104 const double end_time =
105 interpolate(timeAtStepEnd[step - 1], timeAtStepEnd[step], b);
106 const double start_dose =
interpolate(dose[step - 1], dose[step],
a);
107 const double end_dose =
interpolate(dose[step - 1], dose[step], b);
108 const double start_temp =
interpolate(test_case.irradiationTemp[step - 1],
109 test_case.irradiationTemp[step],
a);
110 const double end_temp =
interpolate(test_case.irradiationTemp[step - 1],
111 test_case.irradiationTemp[step], b);
113 CHKERR umat.setTimeData(end_time, end_time - start_time);
115 CHKERR checkValue(
umat.time[1], start_time, 1e-12,
"TIME(2)",
116 test_case.name, step);
117 umat.temp = start_temp;
118 umat.dtemp = end_temp - start_temp;
119 umat.predef[2] = start_dose;
120 umat.predef[3] = start_temp;
121 umat.dpred[2] = end_dose - start_dose;
122 umat.dpred[3] = end_temp - start_temp;
127 for (
int direction = 0; direction != 3; ++direction) {
128 umat.stran[direction] = -properties[10] * (
umat.temp - 20);
129 umat.dstran[direction] = -properties[10] *
umat.dtemp;
135 const double expected_dose = step == 1 ? 0 : dose[step];
136 CHKERR checkValue(
umat.statev[1], expected_dose, 1e-8,
"STATEV(2) dose",
137 test_case.name, step);
138 CHKERR checkValue(
umat.statev[2], test_case.irradiationTemp[step], 1e-8,
139 "STATEV(3) irradiation temperature", test_case.name,
141 CHKERR checkValue(
umat.statev[5], 1, 1e-8,
"STATEV(6) weight-loss factor",
142 test_case.name, step);
143 CHKERR checkValue(
umat.statev[7], test_case.youngModulus[step - 1], 0.05,
144 "STATEV(8) Young's modulus", test_case.name, step);
145 if (test_case.checkP1)
146 CHKERR checkValue(
umat.statev[79], test_case.p1[step - 1], 5e-6,
147 "STATEV(80) P1", test_case.name, step);
149 CHKERR checkValue(
umat.statev[0], step == 2 ? 3.6235 : 3.625, 1e-8,
150 "STATEV(1) dose rate", test_case.
name, step);
151 CHKERR checkValue(
umat.statev[6], 0.25, 1e-12,
"STATEV(7) increment",
152 test_case.name, step);
154 PetscPrintf(PETSC_COMM_WORLD,
155 "%s step %d: dose %.6g, irradiation T %.6g, E %.8g, P1 %.8g\n",
156 test_case.name, step, dose[step],
umat.statev[2],
165int main(
int argc,
char **argv) {
168 std::vector<double> properties;
169 CHKERR readProperties(properties);
170 for (
const auto &test_case : cases)
171 CHKERR replay(test_case, properties);
172 PetscPrintf(PETSC_COMM_WORLD,
173 "Abaqus 450T UMAT sensitivity replay passed\n");
#define CATCH_ERRORS
Catch errors.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
promote< T, double >::V interpolate(const Tensor0< T * > &a, const int &di, const int &dj, const int &dk, const int &i0, const int &j0, const int &k0, const double distance[3], const double conjugate[3])
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
subroutine umat(stress, statev, ddsdde, sse, spd, scd, rpl, ddsddt, drplde, drpldt, stran, dstran, time, dtime, temp, dtemp, predef, dpred, cmname, ndi, nshr, ntens, nstatv, props, nprops, coords, drot, pnewdt, celent, dfgrd0, dfgrd1, noel, npt, layer, kspt, kstep, kinc)