v0.16.3
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE > Struct Template Reference
Inheritance diagram for MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >:
[legend]
Collaboration diagram for MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >:
[legend]

Public Types

using Base = MatUmatImpl< DIM, MODEL_TYPE >
 
- Public Types inherited from MatOps::MatUmatImpl< DIM, MODEL_TYPE >
using A = MatPiolaResponse
 
using UmatInterfaceType = MoFEM::UmatInterface< MODEL_TYPE >
 
- Public Types inherited from MatOps::PhysicalEquations
using HookFunction = std::function< MoFEMErrorCode(boost::shared_ptr< MatOpsData >, int, EntityHandle, int)>
 

Public Member Functions

MoFEMErrorCode readElasticProperties (FEMethod *fe_ptr, int nb_gauss_pts, const double *&young_modulus, double &poisson_ratio, const double *endpoint_modulus) const
 
MoFEMErrorCode getOptions (MoFEM::Interface *m_field_ptr=nullptr) override
 
MoFEMErrorCode setParams (FEMethod *fe_ptr, int gg) override
 
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
 
MoFEMErrorCode evaluateVariable (int tag, EntityHandle entity, int gg) override
 
MoFEMErrorCode updateState (int tag, EntityHandle entity, int gg) override
 
MoFEMErrorCode storeCurrentFieldVariables (EntityHandle entity, int gg)
 
MoFEMErrorCode bindAuxiliaryStateTags (MoFEM::Interface &m_field) override
 
MoFEMErrorCode loadPredef (EntityHandle entity, int gg) override
 
MoFEMErrorCode removeThermalStrain ()
 
- Public Member Functions inherited from MatOps::MatUmatImpl< DIM, MODEL_TYPE >
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
 
MoFEMErrorCode getOptions (MoFEM::Interface *m_field_ptr=nullptr) override
 
MoFEMErrorCode setParams (FEMethod *fe_ptr, int gg) override
 
MoFEMErrorCode recordTape () override
 
MoFEMErrorCode evaluateVariable (int, EntityHandle entity, int gg) override
 
MoFEMErrorCode evaluateDerivatives (int, EntityHandle entity, int gg) override
 
MoFEMErrorCode updateState (int, EntityHandle entity, int gg) override
 
- Public Member Functions inherited from MatOps::MatPiolaResponse
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
- Public Member Functions inherited from MatOps::PhysicalEquations
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
virtual ~PhysicalEquations ()=default
 
virtual MoFEMErrorCode addBlockParameters (MoFEM::Interface &m_field, const std::string &block_name, int block_id, const Range &block_entities, const std::vector< double > &block_data)
 

Public Attributes

AmentumTimeSource timeSource
 
double debugTag = 0.0
 
- Public Attributes inherited from MatOps::PhysicalEquations
HookFunction hookEvaluateVariable = AdolCEvaluation::evaluateVariable
 
HookFunction hookEvaluateDerivatives = AdolCEvaluation::evaluateDerivatives
 
HookFunction hookUpdateState = AdolCEvaluation::evaluateVariable
 
int tAg
 
boost::shared_ptr< std::map< int, Range > > tagVsRangePtr
 
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
 
boost::shared_ptr< MatOpsData > matOpsDataPtr
 

Static Public Attributes

static constexpr auto IRRA_TAG_NAME = "AMENTUM_FIELD_IRRA"
 
static constexpr auto PREDEF_TEMP_TAG_NAME = "AMENTUM_FIELD_PREDEF_TEMP"
 
static constexpr auto CORR_TAG_NAME = "AMENTUM_FIELD_CORR"
 
static constexpr auto TEMP_TAG_NAME = "AMENTUM_TEMP"
 
static constexpr auto DTEMP_TAG_NAME = "AMENTUM_DTEMP"
 
static constexpr auto PIOLA_TAG_NAME = "FIRST_PIOLA_TAG"
 
static constexpr int CTE0R_PROP_INDEX = 10
 
- Static Public Attributes inherited from MatOps::MatUmatImpl< DIM, MODEL_TYPE >
static constexpr auto DFGRD0_TAG_NAME = "UMAT_DFGRD0"
 
static constexpr auto STRESS_TAG_NAME = "UMAT_STRESS"
 
static constexpr char STATEV_TAG_NAME [] = "UMAT_STATEV"
 
- Static Public Attributes inherited from MatOps::MatPiolaResponse
static bool useDeformationGradient
 Otherwise the displacement gradient is supplied and I is added.
 

Protected Member Functions

MoFEMErrorCode getFieldShapeFunctions (int gg, VectorDouble &v_shape)
 
MoFEMErrorCode evaluateFieldVariables (EntityHandle entity, const VectorDouble &v_shape, double time, double &irra, double &temp, double &corr)
 
bool isShutdownTime (PetscReal time_offset) const
 
- Protected Member Functions inherited from MatOps::MatUmatImpl< DIM, MODEL_TYPE >
MoFEMErrorCode initialiseUmatOnDemand ()
 
virtual MoFEMErrorCode recordAuxiliaryMatOpsData ()
 
virtual MoFEMErrorCode loadCoordinates (EntityHandle entity, int gg)
 
MoFEMErrorCode loadPreviousDeformationGradient (EntityHandle entity, int gg)
 
MoFEMErrorCode storeCurrentDeformationGradient (EntityHandle entity, int gg)
 
MoFEMErrorCode loadPreviousStress (EntityHandle entity, int gg)
 
MoFEMErrorCode loadPreviousStateVariables (EntityHandle entity, int gg)
 
MoFEMErrorCode storeCurrentStress (EntityHandle entity, int gg)
 
MoFEMErrorCode storeCurrentStateVariables (EntityHandle entity, int gg)
 

Protected Attributes

boost::shared_ptr< AgingFpyTimeScale > stepScalingPtr
 
std::vector< PetscReal > shutdownTimes
 
PetscBool subtractThermalStrain = PETSC_TRUE
 
PetscReal thermalReferenceTemp = 20.0
 
- Protected Attributes inherited from MatOps::MatUmatImpl< DIM, MODEL_TYPE >
MoFEM::Interface * mField = nullptr
 
std::unique_ptr< UmatInterfaceType > umatInterfacePtr
 
std::string libraryPath = UmatInterfaceType::DEFAULT_LIBRARY_PATH
 
std::string materialName = "UMAT"
 
StrainType strainType = StrainType::SMALL
 
PetscInt currentTimeStep = 0
 
PetscReal currentTime = 0
 
PetscReal currentTimeIncrement = 0
 
double youngModulus = 1.0
 
double poissonRatio = 0.3
 
int numberStateVariables = 1
 
int numberMaterialProperties = 2
 
std::vector< double > defaultMaterialParameters = {youngModulus, poissonRatio}
 
std::vector< double > currentMaterialParameters = defaultMaterialParameters
 
std::vector< double > stateVar = std::vector<double>(numberStateVariables, 0.0)
 
std::vector< std::string > vStateVariableTagNames
 
std::unique_ptr< StrainHandler< DIM, MODEL_TYPE > > strainHandler
 

Additional Inherited Members

- Static Public Member Functions inherited from MatOps::MatUmatImpl< DIM, MODEL_TYPE >
static std::string getStateVariableTagName (const int index)
 

Detailed Description

template<int DIM, int MODEL_TYPE>
struct MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >

Definition at line 47 of file MatAmentumUmat.cpp.

Member Typedef Documentation

◆ Base

template<int DIM, int MODEL_TYPE>
using MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::Base = MatUmatImpl<DIM, MODEL_TYPE>

Definition at line 48 of file MatAmentumUmat.cpp.

Member Function Documentation

◆ bindAuxiliaryStateTags()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::bindAuxiliaryStateTags ( MoFEM::Interface &  m_field)
overridevirtual

Reimplemented from MatOps::MatUmatImpl< DIM, MODEL_TYPE >.

Definition at line 254 of file MatAmentumUmat.cpp.

255 {
257 CHKERR Base::A::matOpsDataPtr->bindStateTag(m_field, IRRA_TAG_NAME, 1);
258 CHKERR Base::A::matOpsDataPtr->bindStateTag(m_field, PREDEF_TEMP_TAG_NAME, 1);
259 CHKERR Base::A::matOpsDataPtr->bindStateTag(m_field, CORR_TAG_NAME, 1);
260 CHKERR Base::A::matOpsDataPtr->bindStateTag(m_field, TEMP_TAG_NAME, 1);
261 CHKERR Base::A::matOpsDataPtr->bindStateTag(m_field, DTEMP_TAG_NAME, 1);
262 CHKERR Base::A::matOpsDataPtr->bindStateTag(m_field, PIOLA_TAG_NAME,
263 DIM * DIM);
265}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
static constexpr auto DTEMP_TAG_NAME
static constexpr auto CORR_TAG_NAME
static constexpr auto IRRA_TAG_NAME
static constexpr auto PREDEF_TEMP_TAG_NAME
static constexpr auto TEMP_TAG_NAME
static constexpr auto PIOLA_TAG_NAME
boost::shared_ptr< MatOpsData > matOpsDataPtr
Definition MatOps.hpp:201

◆ createOp()

template<int DIM, int MODEL_TYPE>
ForcesAndSourcesCore::UserDataOperator * MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::createOp ( boost::shared_ptr< PhysicalEquations >  physical_ptr,
bool  eval_stress,
bool  eval_tangent,
bool  update 
)
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 216 of file MatAmentumUmat.cpp.

217 {
218 return Base::createOp(physical_ptr, eval_stress, eval_tangent, update);
219 }
ForcesAndSourcesCore::UserDataOperator * createOp(boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
Definition MatUmat.cpp:21

◆ evaluateFieldVariables()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::evaluateFieldVariables ( EntityHandle  entity,
const VectorDouble &  v_shape,
double  time,
double &  irra,
double &  temp,
double &  corr 
)
protected

Definition at line 320 of file MatAmentumUmat.cpp.

322 {
324
325 if (!Base::mField) {
326 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
327 "Amentum UMAT needs MoFEM interface to read MOAB tags");
328 }
329
330 if (!stepScalingPtr) {
331 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
332 "Time scaling object is not initialized for Amentum UMAT");
333 }
334
335 auto &moab = Base::mField->get_moab();
336 const EntityHandle *conn = nullptr;
337 int num_nodes = 0;
338 CHKERR moab.get_connectivity(entity, conn, num_nodes, true);
339 if (num_nodes != v_shape.size()) {
340 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
341 "Amentum UMAT connectivity does not match the shape functions");
342 }
343
344 auto get_nodal_tag_values = [&](const char *tag_name,
345 VectorDouble &v_nodal_values) {
347 Tag tag = 0;
348 const auto tag_error = moab.tag_get_handle(tag_name, tag);
349 if (tag_error != MB_SUCCESS) {
350 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
351 "Required Amentum UMAT tag '%s' not found. Check "
352 "aging_fpy_history.txt and the projected tag mesh.",
353 tag_name);
354 }
355 int tag_length = 0;
356 DataType tag_type;
357 CHKERR moab.tag_get_length(tag, tag_length);
358 CHKERR moab.tag_get_data_type(tag, tag_type);
359 if (tag_length != 1 || tag_type != MB_TYPE_DOUBLE) {
360 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
361 "Amentum UMAT tag '%s' must contain one double per node",
362 tag_name);
363 }
364 v_nodal_values.resize(num_nodes, false);
365 CHKERR moab.tag_get_data(tag, conn, num_nodes, v_nodal_values.data().data());
367 };
368
369 auto evaluate_at_gauss_point = [&](const VectorDouble &v_nodal_values) {
370 return inner_prod(v_shape, v_nodal_values);
371 };
372
373 auto make_step_tag_name = [&](const char *prefix, int step) {
374 return (boost::format("%s_%d") % prefix % step).str();
375 };
376
377 auto load_step_tags = [&](int step, double &irra, double &temp,
378 double &corr) {
380 VectorDouble v_irra, v_temp, v_corr;
381 CHKERR get_nodal_tag_values(
382 make_step_tag_name("MED_IRRA_ALLIRRA", step).c_str(), v_irra);
383 CHKERR get_nodal_tag_values(
384 make_step_tag_name("MED_TEMP_ALLNEUT", step).c_str(), v_temp);
385 CHKERR get_nodal_tag_values(
386 make_step_tag_name("MED_CORR_ALLNEUT", step).c_str(), v_corr);
387 irra = evaluate_at_gauss_point(v_irra);
388 temp = evaluate_at_gauss_point(v_temp);
389 corr = evaluate_at_gauss_point(v_corr);
391 };
392
393 auto interpolate_predef_at_equiv_step = [&](double equiv_step, double &irra,
394 double &temp, double &corr) {
395 const int step_before = static_cast<int>(std::floor(equiv_step));
396 const int step_after = static_cast<int>(std::ceil(equiv_step));
397 double irra_b = 0.0, temp_b = 0.0, corr_b = 0.0;
398 double irra_a = 0.0, temp_a = 0.0, corr_a = 0.0;
399 CHKERR load_step_tags(step_before, irra_b, temp_b, corr_b);
400 CHKERR load_step_tags(step_after, irra_a, temp_a, corr_a);
401
402 const double alpha =
403 (step_after != step_before)
404 ? (equiv_step - step_before) / (step_after - step_before)
405 : 0.0;
406
407 irra = irra_b + alpha * (irra_a - irra_b);
408 temp = temp_b + alpha * (temp_a - temp_b);
409 corr = corr_b + alpha * (corr_a - corr_b);
410
411 return 0;
412 };
413
414 const double equiv_step = stepScalingPtr->TimeScale::getScale(time);
415 CHKERR interpolate_predef_at_equiv_step(equiv_step, irra, temp, corr);
416
418}
Tag tag
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
void temp(int x, int y=10)
Definition simple.cpp:4
boost::shared_ptr< AgingFpyTimeScale > stepScalingPtr
MoFEM::Interface * mField
virtual moab::Interface & get_moab()=0

◆ evaluateVariable()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::evaluateVariable ( int  tag,
EntityHandle  entity,
int  gg 
)
inlineoverridevirtual

Reimplemented from MatOps::PhysicalEquations.

Definition at line 221 of file MatAmentumUmat.cpp.

222 {
224 CHKERR Base::evaluateVariable(tag, entity, gg);
226 }
MoFEMErrorCode evaluateVariable(int, EntityHandle entity, int gg) override

◆ getFieldShapeFunctions()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::getFieldShapeFunctions ( int  gg,
VectorDouble &  v_shape 
)
protected

Definition at line 268 of file MatAmentumUmat.cpp.

269 {
271
272 auto mat_ops_data_ptr = Base::A::matOpsDataPtr;
273 auto umat_data_ptr =
274 boost::dynamic_pointer_cast<UMatOpData>(mat_ops_data_ptr->getUserDataPtr());
275 if (!umat_data_ptr || !umat_data_ptr->rawOpPtr) {
276 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
277 "Amentum UMAT needs the active material operator");
278 }
279 auto raw_op_ptr = umat_data_ptr->rawOpPtr;
280 const auto &gauss_pts = raw_op_ptr->getGaussPts();
281 const auto entity_type = raw_op_ptr->getFEType();
282 const int nb_gauss_pts = gauss_pts.size2();
283 if (gg < 0 || gg >= nb_gauss_pts) {
284 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
285 "Invalid Amentum UMAT integration point %d", gg);
286 }
287
288 // Shape values at gg follow the corner-node connectivity ordering.
289 switch (entity_type) {
290 case MBTET:
291 v_shape.resize(4, false);
292 CHKERR Tools::shapeFunMBTET(v_shape.data().data(), &gauss_pts(0, gg),
293 &gauss_pts(1, gg), &gauss_pts(2, gg), 1);
294 break;
295 case MBHEX: {
296 v_shape.resize(8, false);
297 const double ksi = gauss_pts(0, gg);
298 const double eta = gauss_pts(1, gg);
299 const double zeta = gauss_pts(2, gg);
300 v_shape[0] = N_MBHEX0(ksi, eta, zeta);
301 v_shape[1] = N_MBHEX1(ksi, eta, zeta);
302 v_shape[2] = N_MBHEX2(ksi, eta, zeta);
303 v_shape[3] = N_MBHEX3(ksi, eta, zeta);
304 v_shape[4] = N_MBHEX4(ksi, eta, zeta);
305 v_shape[5] = N_MBHEX5(ksi, eta, zeta);
306 v_shape[6] = N_MBHEX6(ksi, eta, zeta);
307 v_shape[7] = N_MBHEX7(ksi, eta, zeta);
308 break;
309 }
310 default:
311 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
312 "Amentum UMAT shape functions not implemented for entity type %d",
313 entity_type);
314 }
315
317}
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define N_MBHEX7(x, y, z)
Definition fem_tools.h:78
#define N_MBHEX3(x, y, z)
Definition fem_tools.h:74
#define N_MBHEX5(x, y, z)
Definition fem_tools.h:76
#define N_MBHEX4(x, y, z)
Definition fem_tools.h:75
#define N_MBHEX0(x, y, z)
Definition fem_tools.h:71
#define N_MBHEX6(x, y, z)
Definition fem_tools.h:77
#define N_MBHEX2(x, y, z)
Definition fem_tools.h:73
#define N_MBHEX1(x, y, z)
Definition fem_tools.h:72
double eta
double zeta
Viscous hardening.
Definition plastic.cpp:131
static MoFEMErrorCode shapeFunMBTET(double *shape, const double *ksi, const double *eta, const double *zeta, const double nb)
Calculate shape functions on tetrahedron.
Definition Tools.hpp:809

◆ getOptions()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::getOptions ( MoFEM::Interface *  m_field_ptr = nullptr)
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 121 of file MatAmentumUmat.cpp.

121 {
123 CHKERR Base::getOptions(m_field_ptr);
124
126
127 char props_file[PETSC_MAX_PATH_LEN] = "amentum_umat_props.inc";
128 PetscOptionsBegin(PETSC_COMM_WORLD, "umat_", "", "none");
129 CHKERR PetscOptionsString("-props_file", "Path to UMAT properties file", "",
130 props_file, props_file, sizeof(props_file),
131 PETSC_NULLPTR);
132 CHKERR PetscOptionsBool("-subtract_thermal_strain",
133 "Subtract isotropic thermal strain before UMAT", "",
135 PETSC_NULLPTR);
136 CHKERR PetscOptionsScalar(
137 "-thermal_reference_temp", "Reference temperature for thermal strain",
138 "", thermalReferenceTemp, &thermalReferenceTemp, PETSC_NULLPTR);
139 PetscOptionsEnd();
140
141 std::ifstream file(props_file);
142 if (!file.is_open()) {
143 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
144 "Could not open UMAT properties file %s", props_file);
145 }
146
147 std::vector<double> props;
148 std::string line;
149 while (std::getline(file, line)) {
150 const auto equal_pos = line.find('=');
151 if (equal_pos == std::string::npos)
152 continue;
153
154 std::istringstream value_stream(line.substr(equal_pos + 1));
155 double value = 0.0;
156 if (!(value_stream >> value)) {
157 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
158 "Could not read UMAT property value from line: %s",
159 line.c_str());
160 }
161 std::string trailing;
162 if (value_stream >> trailing) {
163 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
164 "Unexpected text after UMAT property value in line: %s",
165 line.c_str());
166 }
167
168 props.push_back(value);
169 }
170
171 if (props.size() !=
172 static_cast<std::size_t>(Base::numberMaterialProperties)) {
173 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
174 "UMAT properties file %s has %d values, expected %d", props_file,
175 static_cast<int>(props.size()), Base::numberMaterialProperties);
176 }
177
179 for (auto &range_and_parameters : Base::A::paramVecByRange)
180 range_and_parameters.second = Base::defaultMaterialParameters;
181
185 for (int i = 0; i < Base::numberMaterialProperties; ++i) {
187 }
188
189 Base::umatInterfacePtr->predef.assign(5, 0.0);
190 Base::umatInterfacePtr->dpred.assign(5, 0.0);
191
193 boost::make_shared<AgingFpyTimeScale>("aging_fpy_history.txt");
195
197 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "Amentum Umat")
198 << " subtracting thermal strain with CTE0R = "
200 << " reference_temp = " << thermalReferenceTemp;
201 }
202
204 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
FTensor::Index< 'i', SPACE_DIM > i
static MoFEMErrorCode getShutdownTimesFromOptions(std::vector< PetscReal > &shutdown_times_vec)
static constexpr int CTE0R_PROP_INDEX
MatUmatImpl< DIM, MODEL_TYPE > Base
std::vector< PetscReal > shutdownTimes
MoFEMErrorCode getOptions(MoFEM::Interface *m_field_ptr=nullptr) override
std::vector< double > defaultMaterialParameters
std::vector< double > currentMaterialParameters
std::unique_ptr< UmatInterfaceType > umatInterfacePtr
MatPiolaResponse A
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
Definition MatOps.hpp:199

◆ isShutdownTime()

template<int DIM, int MODEL_TYPE>
bool MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::isShutdownTime ( PetscReal  time_offset) const
protected

Definition at line 421 of file MatAmentumUmat.cpp.

422 {
423 const PetscReal shutdown_time = Base::currentTime - time_offset;
424 const auto time_it = std::lower_bound(
425 shutdownTimes.begin(), shutdownTimes.end(),
426 shutdown_time - AMENTUM_SHUTDOWN_TIME_TOL);
427 return time_it != shutdownTimes.end() &&
428 PetscAbsReal(shutdown_time - *time_it) < AMENTUM_SHUTDOWN_TIME_TOL;
429}
static constexpr PetscReal AMENTUM_SHUTDOWN_TIME_TOL

◆ loadPredef()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::loadPredef ( EntityHandle  entity,
int  gg 
)
overridevirtual

Reimplemented from MatOps::MatUmatImpl< DIM, MODEL_TYPE >.

Definition at line 433 of file MatAmentumUmat.cpp.

433 {
435
436 VectorDouble v_shape;
437 CHKERR getFieldShapeFunctions(gg, v_shape);
438
440 umat.predef.assign(5, 0.0);
441 umat.dpred.assign(5, 0.0);
442 umat.temp = 20.0;
443 umat.dtemp = 0.0;
444
445 double current_irra = 0.0, current_predef_temp = 0.0, current_corr = 0.0;
447 current_irra, current_predef_temp, current_corr);
448
449 double prev_irra = 0.0, prev_predef_temp = 0.0, prev_corr = 0.0;
450 double prev_temp = 0.0;
451
452 PetscReal prev_time = Base::currentTime - Base::currentTimeIncrement;
453 CHKERR evaluateFieldVariables(entity, v_shape, prev_time, prev_irra,
454 prev_predef_temp, prev_corr);
455 prev_temp = prev_predef_temp;
456
457 double prev_irra_test = 0.0, prev_predef_temp_test = 0.0,
458 prev_corr_test = 0.0;
459 double prev_temp_test = 0.0;
460 double debug_time_test = 0.0, debug_dt_test = 0.0, debug_step_test = 0.0;
461 auto get_previous_scalar_tag = [&](const char *tag_name, double &value) {
463 auto state_ptr =
464 Base::A::matOpsDataPtr->getStateDataPtr(tag_name, entity, gg);
465 value = (*state_ptr)(0, 0);
467 };
468
469 if (Base::currentTime == 0) {
470 prev_temp = 20.0;
471 prev_predef_temp = 20.0;
472 }
473
474 umat.predef[2] = prev_irra;
475 umat.predef[3] = prev_predef_temp;
476 umat.predef[4] = prev_corr;
477
478 umat.dpred[0] = 0.0;
479 umat.dpred[1] = 0.0;
480
481 umat.dpred[2] = current_irra - prev_irra;
482 // umat.dpred[3] = current_predef_temp - prev_predef_temp;
483 umat.dpred[4] = current_corr - prev_corr;
484
485 const bool shutdown_step =
487 const bool restore_step =
489
490 if (shutdown_step) {
491 current_predef_temp = 20.;
492 // Cooling is already committed during iterations at the same physical age.
494 prev_temp = current_predef_temp;
495 prev_predef_temp = current_predef_temp;
496 umat.predef[3] = prev_predef_temp;
497 }
498 } else if (restore_step) {
499 CHKERR get_previous_scalar_tag(PREDEF_TEMP_TAG_NAME, prev_temp);
500 prev_predef_temp = prev_temp;
501 umat.predef[3] = prev_predef_temp;
502 }
503
504 umat.temp = prev_temp;
505 umat.dpred[3] = current_predef_temp - prev_predef_temp;
506 umat.dtemp = current_predef_temp - prev_temp;
507 debugTag = prev_temp;
508
510
512}
static constexpr PetscReal AMENTUM_SHUTDOWN_STEP_LEN
MoFEMErrorCode getFieldShapeFunctions(int gg, VectorDouble &v_shape)
MoFEMErrorCode removeThermalStrain()
bool isShutdownTime(PetscReal time_offset) const
MoFEMErrorCode evaluateFieldVariables(EntityHandle entity, const VectorDouble &v_shape, double time, double &irra, double &temp, double &corr)
PetscReal currentTimeIncrement
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)

◆ readElasticProperties()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::readElasticProperties ( FEMethod *  fe_ptr,
int  nb_gauss_pts,
const double *&  young_modulus,
double &  poisson_ratio,
const double *  endpoint_modulus 
) const
inline

Definition at line 62 of file MatAmentumUmat.cpp.

65 {
67 const auto entity = fe_ptr->getFEEntityHandle();
68 const auto *properties = &this->defaultMaterialParameters;
69 for (const auto &[range, values] : Base::paramVecByRange)
70 if (range.find(entity) != range.end()) {
71 properties = &values;
72 break;
73 }
74 // Fortran PRATIO = PROPS(5), E = STATEV(8).
75 if (properties->size() < 5)
76 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
77 "Amentum elastic properties require PROPS(5)");
78 poisson_ratio = (*properties)[4];
79 if (!std::isfinite(poisson_ratio) || poisson_ratio <= -1. ||
80 poisson_ratio >= .5)
81 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
82 "Invalid Amentum elastic Poisson ratio %g", poisson_ratio);
83
84 young_modulus = endpoint_modulus;
85 if (young_modulus) {
86 for (int gg = 0; gg != nb_gauss_pts; ++gg)
87 if (!std::isfinite(young_modulus[gg]) || young_modulus[gg] <= 0.)
88 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
89 "Invalid converged Amentum modulus at point %d", gg);
91 }
92 const auto state_tags = Base::matOpsDataPtr->getStateTags();
93 const auto name = Base::getStateVariableTagName(7);
94 const auto state =
95 std::find_if(state_tags.begin(), state_tags.end(),
96 [&](const auto &entry) { return entry.name == name; });
97 if (state == state_tags.end() || state->numComponents != 1)
98 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
99 "Amentum elastic modulus requires scalar UMAT_STATEV_7");
100 const void *values = nullptr;
101 int size = 0;
102 const auto result = Base::mField->get_moab().tag_get_by_ptr(
103 state->tag, &entity, 1, &values, &size);
104 if (result == MB_TAG_NOT_FOUND)
107 if (!values || !size)
109 if (size != nb_gauss_pts)
110 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
111 "Amentum elastic modulus does not match volume quadrature");
112 young_modulus = static_cast<const double *>(values);
113 for (int gg = 0; gg != nb_gauss_pts; ++gg)
114 if (!std::isfinite(young_modulus[gg]) || young_modulus[gg] <= 0.)
115 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
116 "Invalid Amentum elastic modulus %g at point %d",
117 young_modulus[gg], gg);
119 }
TetMeshData result
std::vector< int > size
PyGILState_STATE state
Definition SDFPython.cpp:13
It end
Definition Schur.cpp:2568
SmartPetscObj< Vec > values
std::string name
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
double young_modulus
Young modulus.
Definition plastic.cpp:126
double poisson_ratio
Poisson ratio.
Definition plastic.cpp:127
static std::string getStateVariableTagName(const int index)
EntityHandle getFEEntityHandle() const
Get the entity handle of the current finite element.

◆ removeThermalStrain()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::removeThermalStrain ( )

Definition at line 515 of file MatAmentumUmat.cpp.

515 {
517
520
522 const double thermal_strain_alpha =
524 const double previous_thermal_strain =
525 thermal_strain_alpha * (umat.temp - thermalReferenceTemp);
526 const double thermal_strain_increment = thermal_strain_alpha * umat.dtemp;
527
528 for (int ii = 0; ii != Base::UmatInterfaceType::NDI; ++ii) {
529 umat.stran[ii] -= previous_thermal_strain;
530 umat.dstran[ii] -= thermal_strain_increment;
531 }
532
534}
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...

◆ setParams()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::setParams ( FEMethod *  fe_ptr,
int  gg 
)
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 206 of file MatAmentumUmat.cpp.

206 {
208 CHKERR Base::setParams(fe_ptr, gg);
209 if (timeSource)
213 }
MoFEMErrorCode setParams(FEMethod *fe_ptr, int gg) override

◆ storeCurrentFieldVariables()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::storeCurrentFieldVariables ( EntityHandle  entity,
int  gg 
)

Definition at line 537 of file MatAmentumUmat.cpp.

538 {
540
541 VectorDouble v_shape;
542 CHKERR getFieldShapeFunctions(gg, v_shape);
543 double current_irra = 0.0, current_predef_temp = 0.0, current_corr = 0.0;
545 current_irra, current_predef_temp, current_corr);
547 current_predef_temp = 20.0;
548
550
551 auto set_scalar_tag = [&](const char *tag_name, double value) {
553 auto state_ptr =
554 Base::A::matOpsDataPtr->getStateDataPtr(tag_name, entity, gg);
555 (*state_ptr)(0, 0) = value;
557 };
558
559 CHKERR set_scalar_tag(IRRA_TAG_NAME, current_irra);
560 CHKERR set_scalar_tag(PREDEF_TEMP_TAG_NAME, current_predef_temp);
561 CHKERR set_scalar_tag(CORR_TAG_NAME, current_corr);
562 CHKERR set_scalar_tag(TEMP_TAG_NAME, umat.temp);
563 CHKERR set_scalar_tag(DTEMP_TAG_NAME, umat.dtemp);
564
565 // auto piola_ptr = Base::A::matOpsDataPtr->getDependentDataPtr("P");
566 auto piola_ptr = Base::A::matOpsDataPtr->getStateDataPtr(
567 Base::STRESS_TAG_NAME, entity, gg);
568
569 auto piola_state_ptr =
570 Base::A::matOpsDataPtr->getStateDataPtr(PIOLA_TAG_NAME, entity, gg);
571 constexpr int voigt_map[3][3] = {{0, 3, 4}, {3, 1, 5}, {4, 5, 2}};
572
573 for (int i = 0; i < DIM; ++i) {
574 for (int j = 0; j < DIM; ++j) {
575 (*piola_state_ptr)(i *DIM + j, 0) = (*piola_ptr)(voigt_map[i][j], 0);
576 }
577 }
578
580}
FTensor::Index< 'j', 3 > j
static constexpr auto STRESS_TAG_NAME

◆ updateState()

template<int DIM, int MODEL_TYPE>
MoFEMErrorCode MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::updateState ( int  tag,
EntityHandle  entity,
int  gg 
)
inlineoverridevirtual

Reimplemented from MatOps::PhysicalEquations.

Definition at line 228 of file MatAmentumUmat.cpp.

228 {
230 CHKERR Base::updateState(tag, entity, gg);
231 CHKERR this->storeCurrentFieldVariables(entity, gg);
233 }
MoFEMErrorCode storeCurrentFieldVariables(EntityHandle entity, int gg)
MoFEMErrorCode updateState(int, EntityHandle entity, int gg) override

Member Data Documentation

◆ CORR_TAG_NAME

template<int DIM, int MODEL_TYPE>
constexpr auto MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::CORR_TAG_NAME = "AMENTUM_FIELD_CORR"
staticconstexpr

Definition at line 56 of file MatAmentumUmat.cpp.

◆ CTE0R_PROP_INDEX

template<int DIM, int MODEL_TYPE>
constexpr int MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::CTE0R_PROP_INDEX = 10
staticconstexpr

Definition at line 60 of file MatAmentumUmat.cpp.

◆ debugTag

template<int DIM, int MODEL_TYPE>
double MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::debugTag = 0.0

Definition at line 53 of file MatAmentumUmat.cpp.

◆ DTEMP_TAG_NAME

template<int DIM, int MODEL_TYPE>
constexpr auto MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::DTEMP_TAG_NAME = "AMENTUM_DTEMP"
staticconstexpr

Definition at line 58 of file MatAmentumUmat.cpp.

◆ IRRA_TAG_NAME

template<int DIM, int MODEL_TYPE>
constexpr auto MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::IRRA_TAG_NAME = "AMENTUM_FIELD_IRRA"
staticconstexpr

Definition at line 54 of file MatAmentumUmat.cpp.

◆ PIOLA_TAG_NAME

template<int DIM, int MODEL_TYPE>
constexpr auto MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::PIOLA_TAG_NAME = "FIRST_PIOLA_TAG"
staticconstexpr

Definition at line 59 of file MatAmentumUmat.cpp.

◆ PREDEF_TEMP_TAG_NAME

template<int DIM, int MODEL_TYPE>
constexpr auto MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::PREDEF_TEMP_TAG_NAME = "AMENTUM_FIELD_PREDEF_TEMP"
staticconstexpr

Definition at line 55 of file MatAmentumUmat.cpp.

◆ shutdownTimes

template<int DIM, int MODEL_TYPE>
std::vector<PetscReal> MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::shutdownTimes
protected

Definition at line 248 of file MatAmentumUmat.cpp.

◆ stepScalingPtr

template<int DIM, int MODEL_TYPE>
boost::shared_ptr<AgingFpyTimeScale> MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::stepScalingPtr
protected

Definition at line 247 of file MatAmentumUmat.cpp.

◆ subtractThermalStrain

template<int DIM, int MODEL_TYPE>
PetscBool MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::subtractThermalStrain = PETSC_TRUE
protected

Definition at line 249 of file MatAmentumUmat.cpp.

◆ TEMP_TAG_NAME

template<int DIM, int MODEL_TYPE>
constexpr auto MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::TEMP_TAG_NAME = "AMENTUM_TEMP"
staticconstexpr

Definition at line 57 of file MatAmentumUmat.cpp.

◆ thermalReferenceTemp

template<int DIM, int MODEL_TYPE>
PetscReal MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::thermalReferenceTemp = 20.0
protected

Definition at line 250 of file MatAmentumUmat.cpp.

◆ timeSource

template<int DIM, int MODEL_TYPE>
AmentumTimeSource MatOps::MatAmentumUmatImpl< DIM, MODEL_TYPE >::timeSource

Definition at line 51 of file MatAmentumUmat.cpp.


The documentation for this struct was generated from the following file: