www.mooseframework.org
AbaqusCreepMaterial.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "AbaqusCreepMaterial.h"
11 
12 #include "SymmTensor.h"
13 #include "Factory.h"
14 
15 #include <dlfcn.h>
16 #define QUOTE(macro) stringifyName(macro)
17 
18 registerMooseObject("SolidMechanicsApp", AbaqusCreepMaterial);
19 
20 template <>
21 InputParameters
23 {
24  InputParameters params = validParams<SolidModel>();
25  params.addRequiredParam<FileName>("plugin",
26  "The path to the compiled dynamic library for the "
27  "plugin you want to use (without -opt.plugin or "
28  "-dbg.plugin)");
29  params.addRequiredParam<Real>("youngs_modulus", "Young's Modulus");
30  params.addRequiredParam<Real>("poissons_ratio", "Poissons Ratio");
31  params.addRequiredParam<Real>("num_state_vars",
32  "The number of state variables this CREEP routine will use");
33  params.addRequiredParam<unsigned int>(
34  "integration_flag", "The creep integration method: Explicit = 0 and Implicit = 1");
35  params.addRequiredParam<unsigned int>(
36  "solve_definition", "Creep/Swell Explicit/Implicit Integration Definition to use: 1 - 5");
37  params.addParam<unsigned int>("routine_flag",
38  0,
39  "The flag determining when the routine is "
40  "called: Start of increment = 0 and End of "
41  "Increment = 1");
42  return params;
43 }
44 
45 AbaqusCreepMaterial::AbaqusCreepMaterial(const InputParameters & parameters)
46  : SolidModel(parameters),
47  _plugin(getParam<FileName>("plugin")),
48  _youngs_modulus(getParam<Real>("youngs_modulus")),
49  _poissons_ratio(getParam<Real>("poissons_ratio")),
50  _num_state_vars(getParam<Real>("num_state_vars")),
51  _integration_flag(getParam<unsigned int>("integration_flag")),
52  _solve_definition(getParam<unsigned int>("solve_definition")),
53  _routine_flag(getParam<unsigned int>("routine_flag")),
54  _state_var(declareProperty<std::vector<Real>>("state_var")),
55  _state_var_old(getMaterialPropertyOld<std::vector<Real>>("state_var")),
56  _trial_stress(declareProperty<SymmTensor>("trial_stress")),
57  _trial_stress_old(getMaterialPropertyOld<SymmTensor>("trial_stress")),
58  _dev_trial_stress(declareProperty<SymmTensor>("dev_trial_stress")),
59  _dev_trial_stress_old(getMaterialPropertyOld<SymmTensor>("dev_trial_stress")),
60  _ets(declareProperty<Real>("effective_trial_stress")),
61  _ets_old(getMaterialPropertyOld<Real>("effective_trial_stress")),
62  _stress(declareProperty<SymmTensor>("stress")),
63  _stress_old(getMaterialPropertyOld<SymmTensor>("stress")),
64  _creep_inc(declareProperty<Real>("creep_inc")),
65  _creep_inc_old(getMaterialPropertyOld<Real>("creep_inc")),
66  _total_creep(declareProperty<Real>("total_creep")),
67  _total_creep_old(getMaterialPropertyOld<Real>("total_creep")),
68  _swell_inc(declareProperty<Real>("swell_inc")),
69  _swell_inc_old(getMaterialPropertyOld<Real>("swell_inc")),
70  _total_swell(declareProperty<Real>("total_swell")),
71  _total_swell_old(getMaterialPropertyOld<Real>("total_swell"))
72 {
73 #if defined(METHOD)
74  _plugin += std::string("-") + QUOTE(METHOD) + ".plugin";
75 #endif
76 
77  _STATEV = new Real[_num_state_vars];
78 
79  // Set subroutine values
83 
84  // Calculate constants needed for elasticity tensor
85  _ebulk3 = _youngs_modulus / (1. - 2. * _poissons_ratio);
87  _eg = _eg2 / 2.;
88  _eg3 = 3. * _eg;
89  _elam = (_ebulk3 - _eg2) / 3.;
90 
94 
95  // Open the library
96  _handle = dlopen(_plugin.c_str(), RTLD_LAZY);
97 
98  if (!_handle)
99  {
100  std::ostringstream error;
101  error << "Cannot open library: " << dlerror() << '\n';
102  mooseError(error.str());
103  }
104 
105  // Reset errors
106  dlerror();
107 
108  // Snag the function pointer from the library
109  {
110  void * pointer = dlsym(_handle, "creep_");
111  _creep = *reinterpret_cast<creep_t *>(&pointer);
112  }
113 
114  // Catch errors
115  const char * dlsym_error = dlerror();
116  if (dlsym_error)
117  {
118  dlclose(_handle);
119  std::ostringstream error;
120  error << "Cannot load symbol 'creep_': " << dlsym_error << '\n';
121  mooseError(error.str());
122  }
123 }
124 
126 {
127  delete _STATEV;
128 
129  dlclose(_handle);
130 }
131 
132 void
134 {
135  for (unsigned qp(0); qp < n_points; ++qp)
136  {
137  // Initialize state variable vector
138  _state_var[qp].resize(_num_state_vars);
139  for (unsigned int i = 0; i < _num_state_vars; i++)
140  {
141  _state_var[qp][i] = 0.0;
142  }
143  }
144 }
145 
146 // void AbaqusCreepMaterial::modifyStrain(const unsigned int qp,
147 // const Real /*scale_factor*/,
148 // SymmTensor & strain_increment,
149 // SymmTensor & /*dstrain_increment_dT*/)
150 void
152 {
153  // Recover "old" state variables
154  for (unsigned int i = 0; i < _num_state_vars; i++)
155  _STATEV[i] = _state_var_old[_qp][i];
156 
157  // Initialize DECRA and DESWA arrays
158  for (unsigned int i = 0; i < 5; i++)
159  {
160  _DECRA[i] = 0.0;
161  _DESWA[i] = 0.0;
162  }
163 
164  // Calculate stress array components
168 
172 
176 
180 
181  // Calculate trial stress and deviatoric trial stress
182  SymmTensor trial_stress(_stress_component[0],
187  _stress_component[5]);
188  _trial_stress[_qp] = trial_stress;
189  _trial_stress[_qp] += _stress_old[_qp];
190  _dev_trial_stress[_qp] = _trial_stress[_qp];
191  _dev_trial_stress[_qp].addDiag(-_trial_stress[_qp].trace() / 3.0);
192 
193  // Calculate effective trial stress (_ets)
194  Real dts_squared = _dev_trial_stress[_qp].doubleContraction(_dev_trial_stress[_qp]);
195 
196  if (dts_squared >= 0.)
197  _ets[_qp] = std::sqrt(1.5 * dts_squared);
198  else
199  mooseError("Attempted to take square root of a negative number!\n");
200 
201  // Calculate gradient of dev stress potential (grad_dts)
202  // grad_dts = d(qtild)/d(dev_trial_stress)
203  SymmTensor delta_dts = _dev_trial_stress[_qp] - _dev_trial_stress_old[_qp];
204 
205  Real delta_ets = _ets[_qp] - _ets_old[_qp];
206 
207  Real grad_dts_potential[6];
208  for (unsigned int i = 0; i < 6; i++)
209  {
210  if (delta_dts.component(i) == 0.0)
211  grad_dts_potential[i] = 0.0;
212  else
213  grad_dts_potential[i] = delta_ets / delta_dts.component(i);
214  }
215 
216  SymmTensor grad_dts(grad_dts_potential[0],
217  grad_dts_potential[1],
218  grad_dts_potential[2],
219  grad_dts_potential[3],
220  grad_dts_potential[4],
221  grad_dts_potential[5]);
222 
223  // Pass variables in for information
224  _KSTEP = _t_step; // Step number
225  _TIME[0] = _dt; // Value of step time at the end of the increment - Check
226  _TIME[1] = _t; // Value of total time at the end of the increment - Check
227  _DTIME = _dt; // Time increment
228  _EC[0] = _total_creep_old[_qp]; // Metal and Drucker-Prager creep at the start of the increment
229  _EC[1] = _total_creep[_qp]; // Metal and Drucker-Prager creep at the end of the increment
230  _ESW[0] = _total_swell_old[_qp]; // Metal swell at the start of the increment
231  _ESW[1] = _total_swell[_qp]; // Metal swell at the end of the increment
232  _QTILD = _ets[_qp]; // Von mises equivalent stress
233  _P = -_trial_stress[_qp].trace(); // Equivalent pressure stress
234 
235  // Connection to extern statement
236  _creep(_DECRA,
237  _DESWA,
238  _STATEV,
239  &_SERD,
240  _EC,
241  _ESW,
242  &_P,
243  &_QTILD,
244  &_TEMP,
245  &_DTEMP,
246  _PREDEF,
247  _DPRED,
248  _TIME,
249  &_DTIME,
250  &_CMNAME,
251  &_LEXIMP,
252  &_LEND,
253  _COORDS,
254  &_NSTATV,
255  &_NOEL,
256  &_NPT,
257  &_LAYER,
258  &_KSPT,
259  &_KSTEP,
260  &_KINC);
261 
262  // Update state variables
263  for (unsigned int i = 0; i < _num_state_vars; i++)
264  _state_var[_qp][i] = _STATEV[i];
265 
266  // Solve for Incremental creep (creep_inc_used) and/or Incremental Swell (swell_inc_used) based on
267  // definition
268  // NOTE: Below are equations for metal creep and/or time-dependent volumetric swelling materials
269  // only
270  // Drucker-Prager, Capped Drucker-Prager, and Gasket materials have not been included
271  _creep_inc[_qp] = _DECRA[0];
272  _total_creep[_qp] = _creep_inc[_qp];
273  _total_creep[_qp] += _total_creep_old[_qp];
274 
275  _swell_inc[_qp] = _DESWA[0];
276  _total_swell[_qp] = _swell_inc[_qp];
277  _total_swell[_qp] += _total_swell_old[_qp];
278 
279  Real p = -_trial_stress[_qp].trace();
280  Real pold = -_trial_stress_old[_qp].trace();
281 
282  Real creep_inc_used = 0.0;
283  Real swell_inc_used = 0.0;
284 
285  if (_integration_flag == 0 && _solve_definition == 1)
286  {
287  creep_inc_used = _DECRA[0];
288  swell_inc_used = _DESWA[0];
289  }
290  else if (_integration_flag == 1 && _solve_definition == 2)
291  {
292  creep_inc_used =
293  (_DECRA[1] * (_total_creep[_qp] - _total_creep_old[_qp])) + _creep_inc_old[_qp];
294  swell_inc_used =
295  (_DESWA[1] * (_total_creep[_qp] - _total_creep_old[_qp])) + _swell_inc_old[_qp];
296  }
297  else if (_integration_flag == 1 && _solve_definition == 3)
298  {
299  creep_inc_used =
300  (_DECRA[2] * (_total_swell[_qp] - _total_swell_old[_qp])) + _creep_inc_old[_qp];
301  swell_inc_used =
302  (_DESWA[2] * (_total_swell[_qp] - _total_swell_old[_qp])) + _swell_inc_old[_qp];
303  }
304  else if (_integration_flag == 1 && _solve_definition == 4)
305  {
306  creep_inc_used = (_DECRA[3] * (p - pold)) + _creep_inc_old[_qp];
307  swell_inc_used = (_DESWA[3] * (p - pold)) + _swell_inc_old[_qp];
308  }
309  else if (_integration_flag == 1 && _solve_definition == 5)
310  {
311  creep_inc_used = (_DECRA[4] * (_ets[_qp] - _ets_old[_qp])) + _creep_inc_old[_qp];
312  swell_inc_used = (_DESWA[4] * (_ets[_qp] - _ets_old[_qp])) + _swell_inc_old[_qp];
313  }
314 
315  // Calculate Incremental Creep Strain (total_effects)
316  // Incremental creep strain = ((1/3)*(swell_inc_used)*R) + (creep_inc_used*grad_dts)
317  // R = The matrix with the anisotropic swelling ratios in the diagonal if anisotropic swelling is
318  // defined; Otherwise R = Identity
319  SymmTensor R(1., 1., 1., 0., 0., 0.);
320  SymmTensor total_effects = (R * (swell_inc_used / 3.)) + (grad_dts * (creep_inc_used));
321 
322  // Modify strain increment
323  _strain_increment += total_effects;
324 
328 
332 
336 
340 
341  // Update Stress
342  SymmTensor stressnew(_stress_component[0],
347  _stress_component[5]);
348  _stress[_qp] = stressnew;
349  _stress[_qp] += _stress_old[_qp];
350 }
AbaqusCreepMaterial::_youngs_modulus
Real _youngs_modulus
Definition: AbaqusCreepMaterial.h:57
AbaqusCreepMaterial::_swell_inc_old
const MaterialProperty< Real > & _swell_inc_old
Definition: AbaqusCreepMaterial.h:100
SymmTensor.h
AbaqusCreepMaterial::_stress_component
Real _stress_component[6]
Definition: AbaqusCreepMaterial.h:76
AbaqusCreepMaterial::_num_state_vars
unsigned int _num_state_vars
Definition: AbaqusCreepMaterial.h:58
AbaqusCreepMaterial::_ESW
Real _ESW[2]
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_ets
MaterialProperty< Real > & _ets
Definition: AbaqusCreepMaterial.h:91
AbaqusCreepMaterial::_NSTATV
Real _NSTATV
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_total_creep
MaterialProperty< Real > & _total_creep
Definition: AbaqusCreepMaterial.h:97
AbaqusCreepMaterial::_stress_old
const MaterialProperty< SymmTensor > & _stress_old
Definition: AbaqusCreepMaterial.h:94
AbaqusCreepMaterial::_swell_inc
MaterialProperty< Real > & _swell_inc
Definition: AbaqusCreepMaterial.h:99
AbaqusCreepMaterial::_ets_old
const MaterialProperty< Real > & _ets_old
Definition: AbaqusCreepMaterial.h:92
AbaqusCreepMaterial::_COORDS
Real _COORDS[3]
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_LEXIMP
Real _LEXIMP
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_NOEL
int _NOEL
Definition: AbaqusCreepMaterial.h:73
AbaqusCreepMaterial::_LAYER
int _LAYER
Definition: AbaqusCreepMaterial.h:73
AbaqusCreepMaterial::~AbaqusCreepMaterial
virtual ~AbaqusCreepMaterial()
Definition: AbaqusCreepMaterial.C:125
AbaqusCreepMaterial::_KINC
int _KINC
Definition: AbaqusCreepMaterial.h:73
SymmTensor::component
Real component(unsigned int i) const
Definition: SymmTensor.h:99
SolidModel::_strain_increment
SymmTensor _strain_increment
In most models, this is the mechanical strain increment, but for inelastic models,...
Definition: SolidModel.h:151
AbaqusCreepMaterial::_trial_stress
MaterialProperty< SymmTensor > & _trial_stress
Definition: AbaqusCreepMaterial.h:87
AbaqusCreepMaterial::_handle
void * _handle
Definition: AbaqusCreepMaterial.h:61
AbaqusCreepMaterial::_PREDEF
Real _PREDEF[1]
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_TEMP
Real _TEMP
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_total_swell
MaterialProperty< Real > & _total_swell
Definition: AbaqusCreepMaterial.h:101
AbaqusCreepMaterial::_total_creep_old
const MaterialProperty< Real > & _total_creep_old
Definition: AbaqusCreepMaterial.h:98
AbaqusCreepMaterial::_state_var_old
const MaterialProperty< std::vector< Real > > & _state_var_old
Definition: AbaqusCreepMaterial.h:86
AbaqusCreepMaterial::_dev_trial_stress_old
const MaterialProperty< SymmTensor > & _dev_trial_stress_old
Definition: AbaqusCreepMaterial.h:90
validParams< AbaqusCreepMaterial >
InputParameters validParams< AbaqusCreepMaterial >()
Definition: AbaqusCreepMaterial.C:22
AbaqusCreepMaterial::_TIME
Real _TIME[2]
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_CMNAME
Real _CMNAME
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_solve_definition
unsigned int _solve_definition
Definition: AbaqusCreepMaterial.h:58
AbaqusCreepMaterial::_eg3
Real _eg3
Definition: AbaqusCreepMaterial.h:76
AbaqusCreepMaterial::_total_swell_old
const MaterialProperty< Real > & _total_swell_old
Definition: AbaqusCreepMaterial.h:102
AbaqusCreepMaterial::_trial_stress_old
const MaterialProperty< SymmTensor > & _trial_stress_old
Definition: AbaqusCreepMaterial.h:88
AbaqusCreepMaterial::_poissons_ratio
Real _poissons_ratio
Definition: AbaqusCreepMaterial.h:57
AbaqusCreepMaterial::_creep_inc_old
const MaterialProperty< Real > & _creep_inc_old
Definition: AbaqusCreepMaterial.h:96
AbaqusCreepMaterial::_eg2
Real _eg2
Definition: AbaqusCreepMaterial.h:76
AbaqusCreepMaterial.h
AbaqusCreepMaterial::_elam
Real _elam
Definition: AbaqusCreepMaterial.h:76
AbaqusCreepMaterial::_stress
MaterialProperty< SymmTensor > & _stress
Definition: AbaqusCreepMaterial.h:93
SolidModel
SolidModel is the base class for all this module's solid mechanics material models.
Definition: SolidModel.h:33
AbaqusCreepMaterial::_DPRED
Real _DPRED[1]
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_P
Real _P
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_DESWA
Real _DESWA[5]
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_STATEV
Real * _STATEV
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_QTILD
Real _QTILD
Definition: AbaqusCreepMaterial.h:67
SymmTensor
Definition: SymmTensor.h:21
AbaqusCreepMaterial
Definition: AbaqusCreepMaterial.h:48
AbaqusCreepMaterial::_elasticity_tensor
Real _elasticity_tensor[3]
Definition: AbaqusCreepMaterial.h:76
AbaqusCreepMaterial::_routine_flag
unsigned int _routine_flag
Definition: AbaqusCreepMaterial.h:58
AbaqusCreepMaterial::AbaqusCreepMaterial
AbaqusCreepMaterial(const InputParameters &parameters)
Definition: AbaqusCreepMaterial.C:45
AbaqusCreepMaterial::_ebulk3
Real _ebulk3
Definition: AbaqusCreepMaterial.h:76
AbaqusCreepMaterial::_creep_inc
MaterialProperty< Real > & _creep_inc
Definition: AbaqusCreepMaterial.h:95
AbaqusCreepMaterial::_integration_flag
unsigned int _integration_flag
Definition: AbaqusCreepMaterial.h:58
validParams< SolidModel >
InputParameters validParams< SolidModel >()
Definition: SolidModel.C:31
AbaqusCreepMaterial::initStatefulProperties
virtual void initStatefulProperties(unsigned n_points)
Definition: AbaqusCreepMaterial.C:133
AbaqusCreepMaterial::_NPT
int _NPT
Definition: AbaqusCreepMaterial.h:73
AbaqusCreepMaterial::_LEND
Real _LEND
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_SERD
Real _SERD
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_creep
creep_t _creep
Definition: AbaqusCreepMaterial.h:64
AbaqusCreepMaterial::_KSTEP
int _KSTEP
Definition: AbaqusCreepMaterial.h:73
AbaqusCreepMaterial::_KSPT
int _KSPT
Definition: AbaqusCreepMaterial.h:73
AbaqusCreepMaterial::_eg
Real _eg
Definition: AbaqusCreepMaterial.h:76
AbaqusCreepMaterial::computeStress
void computeStress()
Compute the stress (sigma += deltaSigma)
Definition: AbaqusCreepMaterial.C:151
AbaqusCreepMaterial::_EC
Real _EC[2]
Definition: AbaqusCreepMaterial.h:70
registerMooseObject
registerMooseObject("SolidMechanicsApp", AbaqusCreepMaterial)
AbaqusCreepMaterial::_DTEMP
Real _DTEMP
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_DECRA
Real _DECRA[5]
Definition: AbaqusCreepMaterial.h:70
AbaqusCreepMaterial::_plugin
FileName _plugin
Definition: AbaqusCreepMaterial.h:56
AbaqusCreepMaterial::_DTIME
Real _DTIME
Definition: AbaqusCreepMaterial.h:67
AbaqusCreepMaterial::_state_var
MaterialProperty< std::vector< Real > > & _state_var
Definition: AbaqusCreepMaterial.h:85
AbaqusCreepMaterial::_dev_trial_stress
MaterialProperty< SymmTensor > & _dev_trial_stress
Definition: AbaqusCreepMaterial.h:89