KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
generic_small_strain_high_cycle_fatigue_law.h
Go to the documentation of this file.
1 // KRATOS ___ _ _ _ _ _ __ _
2 // / __\___ _ __ ___| |_(_) |_ _ _| |_(_)_ _____ / / __ ___ _____ /_\ _ __ _ __
3 // / / / _ \| '_ \/ __| __| | __| | | | __| \ \ / / _ \/ / / _` \ \ /\ / / __| //_\\| '_ \| '_ |
4 // / /__| (_) | | | \__ \ |_| | |_| |_| | |_| |\ V / __/ /__| (_| |\ V V /\__ \/ _ \ |_) | |_) |
5 // \____/\___/|_| |_|___/\__|_|\__|\__,_|\__|_| \_/ \___\____/\__,_| \_/\_/ |___/\_/ \_/ .__/| .__/
6 // |_| |_|
7 //
8 // License: BSD License
9 // license: structural_mechanics_application/license.txt
10 //
11 // Main authors: Sergio Jimenez/Alejandro Cornejo/Lucia Barbu
12 // Collaborator:
13 //
14 
15 #pragma once
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
23 
24 namespace Kratos
25 {
28 
32 
33 // The size type definition
34 typedef std::size_t SizeType;
35 
39 
43 
47 
55 template <class TConstLawIntegratorType>
56 class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) GenericSmallStrainHighCycleFatigueLaw
57  : public GenericSmallStrainIsotropicDamage<TConstLawIntegratorType>
58 {
59 public:
62 
64  static constexpr SizeType Dimension = TConstLawIntegratorType::Dimension;
65 
67  static constexpr SizeType VoigtSize = TConstLawIntegratorType::VoigtSize;
68 
71 
73  typedef Node NodeType;
74 
77 
79  static constexpr double tolerance = std::numeric_limits<double>::epsilon();
80  static constexpr double threshold_tolerance = 1.0e-5;
81 
84 
88 
93  {
94  }
95 
96  GenericSmallStrainHighCycleFatigueLaw( const double FatigueReductionFactor,
97  const double PreviousStress0,
98  const double PreviousStress1,
99  const double MaxStress,
100  const double MinStress,
101  const unsigned int NumberOfCyclesGlobal,
102  const double FatigueReductionParameter)
103  {
104  mFatigueReductionFactor = FatigueReductionFactor;
105  Vector PreviousStresses = ZeroVector(2);
106  PreviousStresses[0] = PreviousStress0;
107  PreviousStresses[1] = PreviousStress1;
108  mPreviousStresses = PreviousStresses;
109  mMaxStress = MaxStress;
110  mMinStress = MinStress;
111  mNumberOfCyclesGlobal = NumberOfCyclesGlobal;
112  mFatigueReductionParameter = FatigueReductionParameter;
113  }
117  ConstitutiveLaw::Pointer Clone() const override
118  {
119  return Kratos::make_shared<GenericSmallStrainHighCycleFatigueLaw<TConstLawIntegratorType>>(*this);
120  }
121 
126  : GenericSmallStrainIsotropicDamage<TConstLawIntegratorType>(rOther),
127  mFatigueReductionFactor(rOther.mFatigueReductionFactor),
128  mPreviousStresses(rOther.mPreviousStresses),
129  mMaxStress(rOther.mMaxStress),
130  mMinStress(rOther.mMinStress),
131  mPreviousMaxStress(rOther.mPreviousMaxStress),
132  mPreviousMinStress(rOther.mPreviousMinStress),
133  mNumberOfCyclesGlobal(rOther.mNumberOfCyclesGlobal),
134  mNumberOfCyclesLocal(rOther.mNumberOfCyclesLocal),
135  mFatigueReductionParameter(rOther.mFatigueReductionParameter),
136  mStressVector(rOther.mStressVector),
137  mMaxDetected(rOther.mMaxDetected),
138  mMinDetected(rOther.mMinDetected),
139  mWohlerStress(rOther.mWohlerStress)
140  {
141  }
142 
147  {
148  }
149 
153 
157 
162  void InitializeMaterialResponsePK1 (ConstitutiveLaw::Parameters& rValues) override;
163 
168  void InitializeMaterialResponsePK2 (ConstitutiveLaw::Parameters& rValues) override;
169 
174  void InitializeMaterialResponseKirchhoff (ConstitutiveLaw::Parameters& rValues) override;
175 
180  void InitializeMaterialResponseCauchy (ConstitutiveLaw::Parameters& rValues) override;
181 
186  void CalculateMaterialResponsePK1(ConstitutiveLaw::Parameters &rValues) override;
187 
192  void CalculateMaterialResponsePK2(ConstitutiveLaw::Parameters &rValues) override;
193 
198  void CalculateMaterialResponseKirchhoff(ConstitutiveLaw::Parameters &rValues) override;
199 
204  void CalculateMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) override;
205 
211  bool Has(const Variable<bool>& rThisVariable) override;
212 
218  bool Has(const Variable<double>& rThisVariable) override;
219 
225  using ConstitutiveLaw::Has;
226  bool Has(const Variable<int>& rThisVariable) override;
227 
234  void SetValue(
235  const Variable<bool>& rThisVariable,
236  const bool& Value,
237  const ProcessInfo& rCurrentProcessInfo) override;
238 
246  void SetValue(
247  const Variable<int>& rThisVariable,
248  const int& rValue,
249  const ProcessInfo& rCurrentProcessInfo) override;
250 
257  void SetValue(
258  const Variable<double>& rThisVariable,
259  const double& rValue,
260  const ProcessInfo& rCurrentProcessInfo) override;
261 
268  bool& GetValue(
269  const Variable<bool>& rThisVariable,
270  bool& rValue) override;
271 
279  int& GetValue(
280  const Variable<int>& rThisVariable,
281  int& rValue) override;
282 
289  double& GetValue(
290  const Variable<double>& rThisVariable,
291  double& rValue) override;
292 
300  double& CalculateValue(
301  ConstitutiveLaw::Parameters& rParameterValues,
302  const Variable<double>& rThisVariable,
303  double& rValue) override;
304 
312  Matrix& CalculateValue(
313  ConstitutiveLaw::Parameters& rParameterValues,
314  const Variable<Matrix>& rThisVariable,
315  Matrix& rValue
316  ) override;
317 
322  {
323  return true;
324  }
325 
330  {
331  return true;
332  }
333 
338  void FinalizeMaterialResponseCauchy(ConstitutiveLaw::Parameters& rValues) override;
339 
344  void FinalizeMaterialResponsePK1(ConstitutiveLaw::Parameters& rValues) override;
345 
350  void FinalizeMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) override;
351 
356  void FinalizeMaterialResponseKirchhoff(ConstitutiveLaw::Parameters& rValues) override;
357 
361 
365 
369 
371 
372 protected:
375 
377 
380 
384 
388 
392 
396 
400 
402 
403 private:
406 
410  Vector GetStressVector() {return mStressVector;}
411  void SetStressVector(const Vector& toStressVector) {mStressVector = toStressVector;}
415  double mFatigueReductionFactor = 1.0;
416  Vector mPreviousStresses = ZeroVector(2); // [S_t-2, S_t-1]
417  double mMaxStress = 0.0;
418  double mMinStress = 0.0;
419  double mPreviousMaxStress = 0.0;
420  double mPreviousMinStress = 0.0;
421  unsigned int mNumberOfCyclesGlobal = 1; // Total number of cycles in the whole analysis
422  unsigned int mNumberOfCyclesLocal = 1; // Equivalent number of cycles for the current cyclic load
423  double mFatigueReductionParameter = 0.0; // B0
424  Vector mStressVector = ZeroVector(VoigtSize);
425  bool mMaxDetected = false; // Maximum's indicator in the current cycle
426  bool mMinDetected = false; // Minimum's indicator in the current cycle
427  double mWohlerStress = 1.0; // Normalised Wohler stress required for building the life prediction curves (SN curves)
428  double mThresholdStress = 0.0; // Endurance limit of the fatigue model.
429  double mReversionFactorRelativeError = 0.0; // Relative error of the R = Smin / Smax between cycles inducing recalculation of Nlocal and advanciing process.
430  double mMaxStressRelativeError = 0.0; // Relative error of Smax between cycles inducing recalculation of Nlocal and advanciing process.
431  bool mNewCycleIndicator = false; // New cycle identifier required for the advancing process.
432  double mCyclesToFailure = 0.0; // Nf. Required for the advanciing process.
433  double mPreviousCycleTime = 0.0; // Instanced variable used in the advanciing process for the conversion between time and number of cycles.
434  double mPeriod = 0.0; // Instanced variable used in the advanciing process for the conversion between time and number of cycles.
435 
439 
443 
445 
447 
448  // Serialization
449 
450  friend class Serializer;
451 
452  void save(Serializer &rSerializer) const override
453  {
455  rSerializer.save("FatigueReductionFactor", mFatigueReductionFactor);
456  rSerializer.save("PreviousStresses", mPreviousStresses);
457  rSerializer.save("MaxStress", mMaxStress);
458  rSerializer.save("MinStress", mMinStress);
459  rSerializer.save("PreviousMaxStress", mPreviousMaxStress);
460  rSerializer.save("PreviousMinStress", mPreviousMinStress);
461  rSerializer.save("NumberOfCyclesGlobal", mNumberOfCyclesGlobal);
462  rSerializer.save("NumberOfCyclesLocal", mNumberOfCyclesLocal);
463  rSerializer.save("FatigueReductionParameter", mFatigueReductionParameter);
464  rSerializer.save("StressVector", mStressVector);
465  rSerializer.save("MaxDetected", mMaxDetected);
466  rSerializer.save("MinDetected", mMinDetected);
467  rSerializer.save("WohlerStress", mWohlerStress);
468  rSerializer.save("ThresholdStress", mThresholdStress);
469  rSerializer.save("ReversionFactorRelativeError", mReversionFactorRelativeError);
470  rSerializer.save("MaxStressRelativeError", mMaxStressRelativeError);
471  rSerializer.save("NewCycleIndicator", mNewCycleIndicator);
472  rSerializer.save("CyclesToFailure", mCyclesToFailure);
473  rSerializer.save("PreviousCycleTime", mPreviousCycleTime);
474  rSerializer.save("Period", mPeriod);
475  }
476 
477  void load(Serializer &rSerializer) override
478  {
480  rSerializer.load("FatigueReductionFactor", mFatigueReductionFactor);
481  rSerializer.load("PreviousStresses", mPreviousStresses);
482  rSerializer.load("MaxStress", mMaxStress);
483  rSerializer.load("MinStress", mMinStress);
484  rSerializer.load("PreviousMaxStress", mPreviousMaxStress);
485  rSerializer.load("PreviousMinStress", mPreviousMinStress);
486  rSerializer.load("NumberOfCyclesGlobal", mNumberOfCyclesGlobal);
487  rSerializer.load("NumberOfCyclesLocal", mNumberOfCyclesLocal);
488  rSerializer.load("FatigueReductionParameter", mFatigueReductionParameter);
489  rSerializer.load("StressVector", mStressVector);
490  rSerializer.load("MaxDetected", mMaxDetected);
491  rSerializer.load("MinDetected", mMinDetected);
492  rSerializer.load("WohlerStress", mWohlerStress);
493  rSerializer.load("ThresholdStress", mThresholdStress);
494  rSerializer.load("ReversionFactorRelativeError", mReversionFactorRelativeError);
495  rSerializer.load("MaxStressRelativeError", mMaxStressRelativeError);
496  rSerializer.load("NewCycleIndicator", mNewCycleIndicator);
497  rSerializer.load("CyclesToFailure", mCyclesToFailure);
498  rSerializer.load("PreviousCycleTime", mPreviousCycleTime);
499  rSerializer.load("Period", mPeriod);
500  }
502 
503 }; // Class GenericYieldSurface
504 
505 } // namespace Kratos
Definition: constitutive_law.h:47
virtual bool Has(const Variable< bool > &rThisVariable)
Returns whether this constitutive Law has specified variable (boolean)
Definition: constitutive_law.cpp:128
virtual void SetValue(const Variable< bool > &rVariable, const bool &Value, const ProcessInfo &rCurrentProcessInfo)
Sets the value of a specified variable (boolean)
Definition: constitutive_law.cpp:279
virtual bool & GetValue(const Variable< bool > &rThisVariable, bool &rValue)
Returns the value of a specified variable (boolean)
Definition: constitutive_law.cpp:201
This class is the base class which defines the constitutive law used for high cycle fatigue (HCF) in ...
Definition: generic_small_strain_high_cycle_fatigue_law.h:58
Geometry< NodeType > GeometryType
The geometry definition.
Definition: generic_small_strain_high_cycle_fatigue_law.h:76
bool RequiresFinalizeMaterialResponse() override
If the CL requires to initialize the material response, called by the element in InitializeSolutionSt...
Definition: generic_small_strain_high_cycle_fatigue_law.h:329
Node NodeType
The node definition.
Definition: generic_small_strain_high_cycle_fatigue_law.h:73
GenericSmallStrainHighCycleFatigueLaw(const double FatigueReductionFactor, const double PreviousStress0, const double PreviousStress1, const double MaxStress, const double MinStress, const unsigned int NumberOfCyclesGlobal, const double FatigueReductionParameter)
Definition: generic_small_strain_high_cycle_fatigue_law.h:96
GenericSmallStrainIsotropicDamage< TConstLawIntegratorType > BaseType
Definition of the base class.
Definition: generic_small_strain_high_cycle_fatigue_law.h:83
GenericSmallStrainHighCycleFatigueLaw()
Definition: generic_small_strain_high_cycle_fatigue_law.h:92
GenericSmallStrainHighCycleFatigueLaw(const GenericSmallStrainHighCycleFatigueLaw &rOther)
Definition: generic_small_strain_high_cycle_fatigue_law.h:125
~GenericSmallStrainHighCycleFatigueLaw() override
Definition: generic_small_strain_high_cycle_fatigue_law.h:146
KRATOS_CLASS_POINTER_DEFINITION(GenericSmallStrainHighCycleFatigueLaw)
Counted pointer of GenericYieldSurface.
bool RequiresInitializeMaterialResponse() override
If the CL requires to initialize the material response, called by the element in InitializeSolutionSt...
Definition: generic_small_strain_high_cycle_fatigue_law.h:321
ConstitutiveLaw::Pointer Clone() const override
Definition: generic_small_strain_high_cycle_fatigue_law.h:117
This class is the base class which define all the constitutive laws for damage in small deformation.
Definition: generic_small_strain_isotropic_damage.h:58
Geometry base class.
Definition: geometry.h:71
This class defines the node.
Definition: node.h:65
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
def SetValue(entity, variable, value)
Definition: coupling_interface_data.py:256
def load(f)
Definition: ode_solve.py:307
Definition: constitutive_law.h:189