16#include "libmesh/int_range.h"
20#define QUOTE(macro) stringifyName(macro)
30 "plugin",
"The path to the compiled dynamic library for the plugin you want to use");
32 "use_one_based_indexing",
33 "Parameter to control whether indexing for element and integration points as presented to "
34 "UMAT models is based on 1 (true) or 0 (false). This does not affect internal MOOSE "
35 "numbering. The option to use 0-based numbering is deprecated and will be removed soon.");
37 "constant_properties",
"Constant mechanical and thermal material properties (PROPS)");
39 "The number of state variables this UMAT is going to use");
40 params.
addCoupledVar(
"temperature", 0.0,
"Coupled temperature");
42 "The external fields that can be used in the UMAT subroutine");
43 params.
addParam<std::vector<MaterialPropertyName>>(
"external_properties", {},
"");
46 "Method to calculate the strain kinematics.");
50 "Whether or not this object should use the "
51 "displaced mesh for computing displacements and quantities based on the deformed state.");
53 "analysis_step_user_object",
54 "The AnalysisStepUserObject that provides times from simulation loading steps.");
57 "Euler angles that describe the orientation of the local material coordinate system.");
62#error "The METHOD preprocessor symbol must be supplied by the build system."
67 _plugin(getParam<FileName>(
"plugin")),
68 _library(_plugin +
std::string(
"-") + QUOTE(METHOD) +
".plugin"),
69 _umat(_library.getFunction<umat_t>(
"umat_")),
70 _aqNSTATV(getParam<unsigned
int>(
"num_state_vars")),
72 _aqPROPS(getParam<
std::vector<Real>>(
"constant_properties")),
73 _aqNPROPS(_aqPROPS.size()),
74 _stress_old(getMaterialPropertyOld<
RankTwoTensor>(_base_name +
"stress")),
75 _total_strain_old(getMaterialPropertyOld<
RankTwoTensor>(_base_name +
"total_strain")),
76 _strain_increment(getOptionalMaterialProperty<
RankTwoTensor>(_base_name +
"strain_increment")),
77 _jacobian_mult(declareProperty<
RankFourTensor>(_base_name +
"Jacobian_mult")),
78 _Fbar(getOptionalMaterialProperty<
RankTwoTensor>(_base_name +
"deformation_gradient")),
79 _Fbar_old(getOptionalMaterialPropertyOld<
RankTwoTensor>(_base_name +
"deformation_gradient")),
80 _state_var(declareProperty<
std::vector<Real>>(_base_name +
"state_var")),
81 _state_var_old(getMaterialPropertyOld<
std::vector<Real>>(_base_name +
"state_var")),
82 _elastic_strain_energy(declareProperty<Real>(_base_name +
"elastic_strain_energy")),
83 _elastic_strain_energy_old(getMaterialPropertyOld<Real>(_base_name +
"elastic_strain_energy")),
84 _plastic_dissipation(declareProperty<Real>(_base_name +
"plastic_dissipation")),
85 _plastic_dissipation_old(getMaterialPropertyOld<Real>(_base_name +
"plastic_dissipation")),
86 _creep_dissipation(declareProperty<Real>(_base_name +
"creep_dissipation")),
87 _creep_dissipation_old(getMaterialPropertyOld<Real>(_base_name +
"creep_dissipation")),
88 _material_timestep(declareProperty<Real>(_base_name +
"material_timestep_limit")),
90 getOptionalMaterialProperty<
RankTwoTensor>(_base_name +
"rotation_increment")),
91 _rotation_increment_old(
92 getOptionalMaterialPropertyOld<
RankTwoTensor>(_base_name +
"rotation_increment")),
93 _temperature(coupledValue(
"temperature")),
94 _temperature_old(coupledValueOld(
"temperature")),
95 _external_fields(isCoupled(
"external_fields") ? coupledValues(
"external_fields")
97 _external_fields_old(isCoupled(
"external_fields") ? coupledValuesOld(
"external_fields")
99 _number_external_fields(_external_fields.size()),
100 _external_property_names(getParam<std::vector<MaterialPropertyName>>(
"external_properties")),
101 _number_external_properties(_external_property_names.size()),
102 _external_properties(_number_external_properties),
103 _external_properties_old(_number_external_properties),
104 _use_one_based_indexing(getParam<bool>(
"use_one_based_indexing")),
105 _use_orientation(isParamValid(
"orientation")),
106 _R(_use_orientation ? getParam<RealVectorValue>(
"orientation") :
RealVectorValue(0.0)),
107 _total_rotation(declareProperty<
RankTwoTensor>(
"total_rotation")),
108 _total_rotation_old(getMaterialPropertyOld<
RankTwoTensor>(
"total_rotation")),
109 _decomposition_method(
112 if (!_use_one_based_indexing)
114 "AbaqusUMATStress has transitioned to 1-based indexing in the element (NOEL) and "
115 "integration point (NPT) numbers to ensure maximum compatibility with legacy UMAT files. "
116 "Please ensure that any new UMAT plugins using these quantities are using the correct "
117 "indexing. 0-based indexing will be deprecated soon.");
120 for (std::size_t i = 0; i < _number_external_properties; ++i)
122 _external_properties[i] = &getMaterialProperty<Real>(_external_property_names[i]);
123 _external_properties_old[i] = &getMaterialPropertyOld<Real>(_external_property_names[i]);
131 _aqDDSDDT.resize(_aqNTENS);
132 _aqDRPLDE.resize(_aqNTENS);
133 _aqSTRAN.resize(_aqNTENS);
137 _aqSTRESS.resize(_aqNTENS);
138 _aqDDSDDE.resize(_aqNTENS * _aqNTENS);
139 _aqDSTRAN.resize(_aqNTENS);
140 _aqPREDEF.resize(_number_external_fields + _number_external_properties);
141 _aqDPRED.resize(_number_external_fields + _number_external_properties);
153 "': Incremental strain quantities are not available. You likely are using a total "
154 "strain formulation. Specify `incremental = true` in the tensor mechanics action, "
155 "or use ComputeIncrementalStrain in your input file.");
159 if (!isParamSetByUser(
"analysis_step_user_object"))
162 _step_user_object = &getUserObject<AnalysisStepUserObject>(
"analysis_step_user_object");
172 for (
const auto i : make_range(
_aqNSTATV))
186 _aqCELENT = std::pow(_current_elem->volume(), 1.0 / _current_elem->dim());
210 ComputeGeneralStressBase::computeProperties();
236 const Real * myDFGRD0 = &(FBar_old_fortran(0, 0));
237 const Real * myDFGRD1 = &(FBar_fortran(0, 0));
238 const Real * myDROT = &(DROT_fortran(0, 0));
264 for (
const auto i : make_range(9))
272 for (
const auto i : make_range(
_aqNSTATV))
281 static const std::array<Real, 6> strain_factor{{1, 1, 1, 2, 2, 2}};
284 static const std::array<std::pair<unsigned int, unsigned int>, 6> component{
285 {{0, 0}, {1, 1}, {2, 2}, {0, 1}, {0, 2}, {1, 2}}};
287 for (
const auto i : make_range(
_aqNTENS))
289 const auto a = component[i].first;
290 const auto b = component[i].second;
292 _aqSTRAN[i] = total_strain_old(
a,
b) * strain_factor[i];
293 _aqDSTRAN[i] = strain_increment(
a,
b) * strain_factor[i];
305 _aqPNEWDT = std::numeric_limits<Real>::max();
401 const unsigned int ntens = N * (N + 1) / 2;
402 const int nskip = N - 1;
404 for (
const auto i : make_range(N))
405 for (
const auto j : make_range(N))
406 for (
const auto k : make_range(N))
407 for (
const auto l : make_range(N))
415 k == l ?
_aqDDSDDE[(nskip + i + j) * ntens + k]
416 :
_aqDDSDDE[(nskip + i + j) * ntens + k + nskip + l];
registerMooseObject("SolidMechanicsApp", AbaqusUMATStress)
void mooseError(Args &&... args)
void mooseDeprecated(Args &&... args)
void ErrorVector unsigned int
Coupling material to use Abaqus UMAT models in MOOSE.
const OptionalMaterialProperty< RankTwoTensor > & _strain_increment
void initialSetup() override
check optional material properties for consistency
std::array< Real, 3 > _aqCOORDS
An array containing the coordinates of this point.
MaterialProperty< RankTwoTensor > & _total_rotation
const MaterialProperty< Real > & _plastic_dissipation_old
const VariableValue & _temperature_old
const std::vector< const VariableValue * > _external_fields_old
const OptionalMaterialProperty< RankTwoTensor > & _rotation_increment_old
int _aqNOEL
Element number.
const MaterialProperty< Real > & _creep_dissipation_old
std::vector< Real > _aqDFGRD0
Array containing the deformation gradient at the beginning of the increment.
int _aqKINC
Increment number (_t_step).
const MaterialProperty< RankTwoTensor > & _total_strain_old
int _aqKSTEP
The step number (as per Abaqus definition) can be set by the user.
int _aqLAYER
Layer number (for composite shells and layered solids). (not supported)
std::vector< Real > _aqDROT
Rotation increment matrix.
std::vector< Real > _aqDDSDDE
Jacobian matrix of the model (out)
std::vector< const MaterialProperty< Real > * > _external_properties_old
Real _aqCELENT
Characteristic element length, which is a typical length of a line across an element for a first-orde...
std::vector< Real > _aqDRPLDE
Variation of RPL with respect to the strain increments.
const std::vector< const VariableValue * > _external_fields
int _aqNTENS
Size of the stress or strain component array (NDI + NSHR).
const OptionalMaterialProperty< RankTwoTensor > & _rotation_increment
const bool _use_orientation
Rotation information.
std::vector< Real > _aqDFGRD1
Array containing the deformation gradient at the end of the increment.
const std::size_t _number_external_properties
const AnalysisStepUserObject * _step_user_object
User object that determines step number.
void initQpStatefulProperties() override
std::vector< Real > _aqPROPS
User-specified array of material constants associated with this user material.
unsigned int _aqNPT
Integration point number.
MaterialProperty< std::vector< Real > > & _state_var
const MaterialProperty< std::vector< Real > > & _state_var_old
std::vector< Real > _aqDDSDDT
Variation of the stress increments with respect to the temperature.
char _aqCMNAME[80]
Model name buffer.
MaterialProperty< Real > & _creep_dissipation
std::vector< Real > _aqSTRAN
An array containing the total strains at the beginning of the increment.
MaterialProperty< RankFourTensor > & _jacobian_mult
Jacobian multiplier.
const ComputeFiniteStrain::DecompMethod _decomposition_method
Method being used to compute strain and rotation increments.
const VariableValue & _temperature
std::vector< Real > _aqPREDEF
Array of interpolated values of predefined field variables at this point at the start of the incremen...
Real _aqRPL
Volumetric heat generation per unit time at the end of the increment caused by mechanical working of ...
std::vector< Real > _aqSTATEV
const bool _use_one_based_indexing
parameter to assist with the transition to 1-based indexing
const OptionalMaterialProperty< RankTwoTensor > & _Fbar
int _aqNSHR
Number of engineering shear stress components at this point.
const MaterialProperty< RankTwoTensor > & _total_rotation_old
const MaterialProperty< Real > & _elastic_strain_energy_old
std::vector< Real > _aqDSTRAN
Array of strain increments.
const std::size_t _number_external_fields
int _aqNPROPS
User-defined number of material constants associated with this user material.
Real _aqDRPLDT
Variation of the volumetric heat generation (RPL) with respect to the temperature.
Real _aqDTIME
Time increment.
Real _aqTEMP
Temperature at the start of the increment.
int _aqNSTATV
Number of solution-dependent state variables that are associated with this material type.
const MaterialProperty< RankTwoTensor > & _stress_old
void computeProperties() override
perform per-element computation/initialization
std::array< Real, 2 > _aqTIME
Value of step time at the beginning of the current increment, total time at the beginning of the curr...
void computeQpStress() override
Compute the stress and store it in the _stress material property for the current quadrature point.
AbaqusUMATStress(const InputParameters ¶meters)
std::vector< const MaterialProperty< Real > * > _external_properties
const OptionalMaterialProperty< RankTwoTensor > & _Fbar_old
int _aqNDI
Number of direct stress components at this point.
MaterialProperty< Real > & _elastic_strain_energy
Real _aqDTEMP
Increment of temperature.
MaterialProperty< Real > & _material_timestep
recommended maximum timestep for this model under the current conditions
MaterialProperty< Real > & _plastic_dissipation
int _aqKSPT
Section point number within the current layer. (not supported)
std::vector< Real > _aqDPRED
Array of increments of predefined field variables.
std::vector< Real > _aqSTRESS
Stress tensor (in: old stress, out: updated stress)
Real _aqPNEWDT
Ratio of suggested new time increment to the time increment being used (out)
static InputParameters validParams()
virtual void getAnalysisStepUserObject(const FEProblemBase &fe_problem, const AnalysisStepUserObject *&step_user_object, const std::string &name)
unsigned int getStep(const Real &time) const
Real getStartTime(const unsigned int &step) const
ComputeFiniteStrain defines a strain increment and rotation increment, for finite strains.
static MooseEnum decompositionType()
ComputeGeneralStressBase is the direct base class for stress calculator materials that may leverage q...
virtual void initQpStatefulProperties() override
static InputParameters validParams()
MaterialProperty< RankTwoTensor > & _stress
Stress material property.
virtual void resize(const std::size_t size) override final
void rotate(const RankTwoTensorTempl< T > &R)
RankTwoTensorTempl< T > transpose() const
static RankTwoTensorTempl Identity()
VariableValueTempl< false > VariableValue
static constexpr std::size_t dim
VectorValue< Real > RealVectorValue