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.
constitutive_law.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ \.
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Riccardo Rossi
11 // Janosch Stascheit
12 // Nelson Maireni Lafontaine
13 // Josep Maria Carbonell
14 //
15 
16 
17 #if !defined(KRATOS_CONSTITUTIVE_LAW )
18 #define KRATOS_CONSTITUTIVE_LAW
19 
20 /* System includes */
21 
22 /* External includes */
23 
24 /* Project includes */
25 #include "includes/define.h"
26 #include "includes/serializer.h"
27 #include "includes/variables.h"
28 #include "includes/node.h"
29 #include "includes/properties.h"
30 #include "geometries/geometry.h"
31 #include "utilities/math_utils.h"
32 #include "includes/process_info.h"
36 #include "containers/flags.h"
37 #include "includes/initial_state.h"
38 
39 
40 namespace Kratos
41 {
42 
46 class KRATOS_API(KRATOS_CORE) ConstitutiveLaw : public Flags
47 {
48 public:
49 
50 
52  {
53  StrainMeasure_Infinitesimal, //strain measure small displacements
54  StrainMeasure_GreenLagrange, //strain measure reference configuration
55  StrainMeasure_Almansi, //strain measure current configuration
56 
57  // True strain:
58  StrainMeasure_Hencky_Material, //strain measure reference configuration
59  StrainMeasure_Hencky_Spatial, //strain measure current configuration
60 
61  // Deformation measures:
62  StrainMeasure_Deformation_Gradient, //material deformation gradient as a strain measure
63  StrainMeasure_Right_CauchyGreen, //right cauchy-green tensor as a strain measure
64  StrainMeasure_Left_CauchyGreen, //left cauchy-green tensor as a strain measure
65  StrainMeasure_Velocity_Gradient //spatial velocity gradient as a strain measure
66  };
67 
69  {
70  StressMeasure_PK1, //stress related to reference configuration non-symmetric
71  StressMeasure_PK2, //stress related to reference configuration
72  StressMeasure_Kirchhoff, //stress related to current configuration
73  StressMeasure_Cauchy //stress related to current configuration
74  };
75 
76 
82  typedef std::size_t SizeType;
84 
87  typedef Matrix VoigtSizeMatrixType; // Constitutive Matrix
88  typedef Matrix DeformationGradientMatrixType; // Def. gradient tensor
89 
94 
98  KRATOS_DEFINE_LOCAL_FLAG( USE_ELEMENT_PROVIDED_STRAIN );
99  KRATOS_DEFINE_LOCAL_FLAG( COMPUTE_STRESS );
100  KRATOS_DEFINE_LOCAL_FLAG( COMPUTE_CONSTITUTIVE_TENSOR );
101  KRATOS_DEFINE_LOCAL_FLAG( COMPUTE_STRAIN_ENERGY );
102 
103  KRATOS_DEFINE_LOCAL_FLAG( ISOCHORIC_TENSOR_ONLY );
104  KRATOS_DEFINE_LOCAL_FLAG( VOLUMETRIC_TENSOR_ONLY );
105 
106  KRATOS_DEFINE_LOCAL_FLAG( MECHANICAL_RESPONSE_ONLY );
107  KRATOS_DEFINE_LOCAL_FLAG( THERMAL_RESPONSE_ONLY );
108 
109  KRATOS_DEFINE_LOCAL_FLAG( INCREMENTAL_STRAIN_MEASURE );
110 
111 
114  KRATOS_DEFINE_LOCAL_FLAG( INITIALIZE_MATERIAL_RESPONSE );
115  KRATOS_DEFINE_LOCAL_FLAG( FINALIZE_MATERIAL_RESPONSE );
116 
117 
122  KRATOS_DEFINE_LOCAL_FLAG( FINITE_STRAINS );
123  KRATOS_DEFINE_LOCAL_FLAG( INFINITESIMAL_STRAINS );
124 
125  KRATOS_DEFINE_LOCAL_FLAG( THREE_DIMENSIONAL_LAW );
126  KRATOS_DEFINE_LOCAL_FLAG( PLANE_STRAIN_LAW );
127  KRATOS_DEFINE_LOCAL_FLAG( PLANE_STRESS_LAW );
128  KRATOS_DEFINE_LOCAL_FLAG( AXISYMMETRIC_LAW );
129 
131 
133  KRATOS_DEFINE_LOCAL_FLAG( ANISOTROPIC );
134 
135 
136  struct Features
137  {
138 
140 
154  std::vector< StrainMeasure > mStrainMeasures;
155 
160  {
161  }
162 
167  {
168  }
169 
170  // Set variables
171  void SetOptions (const Flags& rOptions) {mOptions=rOptions;};
172  void SetStrainSize (const SizeType StrainSize) {mStrainSize=StrainSize;};
173  void SetSpaceDimension (const SizeType SpaceDimension) {mSpaceDimension=SpaceDimension;};
174  void SetStrainMeasure (const StrainMeasure Measure) {mStrainMeasures.push_back(Measure);};
175 
176  void SetStrainMeasures (const std::vector<StrainMeasure> MeasuresVector) {mStrainMeasures = MeasuresVector;};
177 
178  // Get variables
179  const Flags& GetOptions () {return mOptions;};
180 
181  const SizeType& GetStrainSize() {return mStrainSize;};
182  const SizeType& GetSpaceDimension() {return mSpaceDimension;};
183  std::vector<StrainMeasure>& GetStrainMeasures() {return mStrainMeasures;};
184  };
185 
186 
187 
188  struct Parameters
189  {
191 
221  private:
222 
223  /*** NOTE: Member Pointers are used only to point to a certain variable, no "new" or "malloc" can be used for this Parameters ***/
224 
225  Flags mOptions;
226  double mDeterminantF;
227 
228  StrainVectorType* mpStrainVector;
229  StressVectorType* mpStressVector;
230 
231  const Vector* mpShapeFunctionsValues;
232  const Matrix* mpShapeFunctionsDerivatives;
233 
234  const DeformationGradientMatrixType* mpDeformationGradientF;
235  VoigtSizeMatrixType* mpConstitutiveMatrix;
236 
237  const ProcessInfo* mpCurrentProcessInfo;
238  const Properties* mpMaterialProperties;
239  const GeometryType* mpElementGeometry;
240 
241  public:
242 
243 
248  {
249  //Initialize pointers to NULL
250  mDeterminantF=0;
251  mpStrainVector=NULL;
252  mpStressVector=NULL;
253  mpShapeFunctionsValues=NULL;
254  mpShapeFunctionsDerivatives=NULL;
255  mpDeformationGradientF=NULL;
256  mpConstitutiveMatrix=NULL;
257  mpCurrentProcessInfo=NULL;
258  mpMaterialProperties=NULL;
259  mpElementGeometry=NULL;
260  };
261 
262 
267  const GeometryType& rElementGeometry,
268  const Properties& rMaterialProperties,
269  const ProcessInfo& rCurrentProcessInfo)
270  :mpCurrentProcessInfo(&rCurrentProcessInfo)
271  ,mpMaterialProperties(&rMaterialProperties)
272  ,mpElementGeometry(&rElementGeometry)
273  {
274  //Initialize pointers to NULL
275  mDeterminantF=0;
276  mpStrainVector=NULL;
277  mpStressVector=NULL;
278  mpShapeFunctionsValues=NULL;
279  mpShapeFunctionsDerivatives=NULL;
280  mpDeformationGradientF=NULL;
281  mpConstitutiveMatrix=NULL;
282  };
283 
287  Parameters (const Parameters & rNewParameters)
288  :mOptions(rNewParameters.mOptions)
289  ,mDeterminantF(rNewParameters.mDeterminantF)
290  ,mpStrainVector(rNewParameters.mpStrainVector)
291  ,mpStressVector(rNewParameters.mpStressVector)
292  ,mpShapeFunctionsValues(rNewParameters.mpShapeFunctionsValues)
293  ,mpShapeFunctionsDerivatives(rNewParameters.mpShapeFunctionsDerivatives)
294  ,mpDeformationGradientF(rNewParameters.mpDeformationGradientF)
295  ,mpConstitutiveMatrix(rNewParameters.mpConstitutiveMatrix)
296  ,mpCurrentProcessInfo(rNewParameters.mpCurrentProcessInfo)
297  ,mpMaterialProperties(rNewParameters.mpMaterialProperties)
298  ,mpElementGeometry(rNewParameters.mpElementGeometry)
299  {
300  };
301 
306  {
307  }
308 
314  {
315  if(CheckMechanicalVariables() && CheckShapeFunctions() && CheckInfoMaterialGeometry ())
316  return 1;
317  else
318  return 0;
319  }
320 
321 
327  {
328  if(!mpShapeFunctionsValues)
329  KRATOS_ERROR << "ShapeFunctionsValues NOT SET" << std::endl;
330 
331  if(!mpShapeFunctionsDerivatives)
332  KRATOS_ERROR << "ShapeFunctionsDerivatives NOT SET" << std::endl;
333 
334  return 1;
335  }
336 
342  {
343  if(!mpCurrentProcessInfo)
344  KRATOS_ERROR << "CurrentProcessInfo NOT SET" << std::endl;
345 
346  if(!mpMaterialProperties)
347  KRATOS_ERROR << "MaterialProperties NOT SET" << std::endl;
348 
349  if(!mpElementGeometry)
350  KRATOS_ERROR << "ElementGeometry NOT SET" << std::endl;
351 
352  return 1;
353  }
354 
355 
361  {
362  if(mDeterminantF<=0)
363  KRATOS_ERROR << "DeterminantF NOT SET, value <= 0" << std::endl;
364 
365  if(!mpDeformationGradientF)
366  KRATOS_ERROR << "DeformationGradientF NOT SET" << std::endl;
367 
368  if(!mpStrainVector)
369  KRATOS_ERROR << "StrainVector NOT SET" << std::endl;
370 
371  if(!mpStressVector)
372  KRATOS_ERROR << "StressVector NOT SET" << std::endl;
373 
374  if(!mpConstitutiveMatrix)
375  KRATOS_ERROR << "ConstitutiveMatrix NOT SET" << std::endl;
376 
377  return 1;
378  }
379 
380 
389  void Set (Flags ThisFlag) {mOptions.Set(ThisFlag);};
390  void Reset (Flags ThisFlag) {mOptions.Reset(ThisFlag);};
391 
392  void SetOptions (const Flags& rOptions) {mOptions=rOptions;};
393  void SetDeterminantF (const double DeterminantF) {mDeterminantF=DeterminantF;};
394  //void SetDeterminantF (const double& rDeterminantF) {mDeterminantF=&rDeterminantF;};
395 
396  void SetShapeFunctionsValues (const Vector& rShapeFunctionsValues) {mpShapeFunctionsValues=&rShapeFunctionsValues;};
397  void SetShapeFunctionsDerivatives (const Matrix& rShapeFunctionsDerivatives) {mpShapeFunctionsDerivatives=&rShapeFunctionsDerivatives;};
398 
399  void SetDeformationGradientF (const DeformationGradientMatrixType& rDeformationGradientF) {mpDeformationGradientF=&rDeformationGradientF;};
400 
401  void SetStrainVector (StrainVectorType& rStrainVector) {mpStrainVector=&rStrainVector;};
402  void SetStressVector (StressVectorType& rStressVector) {mpStressVector=&rStressVector;};
403  void SetConstitutiveMatrix (VoigtSizeMatrixType& rConstitutiveMatrix) {mpConstitutiveMatrix =&rConstitutiveMatrix;};
404 
405  void SetProcessInfo (const ProcessInfo& rProcessInfo) {mpCurrentProcessInfo =&rProcessInfo;};
406  void SetMaterialProperties (const Properties& rMaterialProperties) {mpMaterialProperties =&rMaterialProperties;};
407  void SetElementGeometry (const GeometryType& rElementGeometry) {mpElementGeometry =&rElementGeometry;};
408 
412  Flags& GetOptions () {return mOptions;};
413 
414  const double& GetDeterminantF()
415  {
416  KRATOS_DEBUG_ERROR_IF_NOT(IsSetDeterminantF()) << "DeterminantF is not set!" << std::endl;
417  return mDeterminantF;
418  }
420  {
421  KRATOS_DEBUG_ERROR_IF_NOT(IsSetShapeFunctionsValues()) << "ShapeFunctionsValues is not set!" << std::endl;
422  return *mpShapeFunctionsValues;
423  }
425  {
426  KRATOS_DEBUG_ERROR_IF_NOT(IsSetShapeFunctionsDerivatives()) << "ShapeFunctionsDerivatives is not set!" << std::endl;
427  return *mpShapeFunctionsDerivatives;
428  }
430  {
431  KRATOS_DEBUG_ERROR_IF_NOT(IsSetDeformationGradientF()) << "DeformationGradientF is not set!" << std::endl;
432  return *mpDeformationGradientF;
433  }
434 
436  {
437  KRATOS_DEBUG_ERROR_IF_NOT(IsSetStrainVector()) << "StrainVector is not set!" << std::endl;
438  return *mpStrainVector;
439  }
441  {
442  KRATOS_DEBUG_ERROR_IF_NOT(IsSetStressVector()) << "StressVector is not set!" << std::endl;
443  return *mpStressVector;
444  }
445 
447  {
448  KRATOS_DEBUG_ERROR_IF_NOT(IsSetConstitutiveMatrix()) << "ConstitutiveMatrix is not set!" << std::endl;
449  return *mpConstitutiveMatrix;
450  }
451 
453  {
454  KRATOS_DEBUG_ERROR_IF_NOT(IsSetProcessInfo()) << "ProcessInfo is not set!" << std::endl;
455  return *mpCurrentProcessInfo;
456  }
458  {
459  KRATOS_DEBUG_ERROR_IF_NOT(IsSetMaterialProperties()) << "MaterialProperties is not set!" << std::endl;
460  return *mpMaterialProperties;
461  }
463  {
464  KRATOS_DEBUG_ERROR_IF_NOT(IsSetElementGeometry()) << "ElementGeometry is not set!" << std::endl;
465  return *mpElementGeometry;
466  }
467 
472  double& GetDeterminantF (double & rDeterminantF) {rDeterminantF=mDeterminantF; return rDeterminantF;};
473  StrainVectorType& GetStrainVector (StrainVectorType & rStrainVector) {rStrainVector=*mpStrainVector; return rStrainVector;};
474  DeformationGradientMatrixType& GetDeformationGradientF (DeformationGradientMatrixType & rDeformationGradientF) {rDeformationGradientF=*mpDeformationGradientF; return rDeformationGradientF;};
475  StressVectorType& GetStressVector (StressVectorType & rStressVector) {rStressVector=*mpStressVector; return rStressVector;};
476  VoigtSizeMatrixType& GetConstitutiveMatrix (VoigtSizeMatrixType & rConstitutiveMatrix) {rConstitutiveMatrix=*mpConstitutiveMatrix; return rConstitutiveMatrix;};
477 
482  bool IsSetDeterminantF () {return (mDeterminantF > 0.0);};
483  bool IsSetShapeFunctionsValues () {return (mpShapeFunctionsValues != NULL);};
484  bool IsSetShapeFunctionsDerivatives () {return (mpShapeFunctionsDerivatives != NULL);};
485  bool IsSetDeformationGradientF () {return (mpDeformationGradientF != NULL);};
486 
487  bool IsSetStrainVector () {return (mpStrainVector != NULL);};
488  bool IsSetStressVector () {return (mpStressVector != NULL);};
489 
490  bool IsSetConstitutiveMatrix () {return (mpConstitutiveMatrix != NULL);};
491 
492  bool IsSetProcessInfo () {return (mpCurrentProcessInfo != NULL);};
493  bool IsSetMaterialProperties () {return (mpMaterialProperties != NULL);};
494  bool IsSetElementGeometry () {return (mpElementGeometry != NULL);};
495 
496  };// struct Parameters end
497 
501  ConstitutiveLaw();
502 
506  ~ConstitutiveLaw() override{};
507 
515  virtual ConstitutiveLaw::Pointer Clone() const;
516 
522  virtual Pointer Create(Kratos::Parameters NewParameters) const;
523 
530  virtual Pointer Create(
531  Kratos::Parameters NewParameters,
532  const Properties& rProperties
533  ) const;
534 
539  virtual SizeType WorkingSpaceDimension();
540 
545  virtual SizeType GetStrainSize() const;
546 
550  void SetInitialState(InitialState::Pointer pInitialState)
551  {
552  mpInitialState = pInitialState;
553  }
554 
558  InitialState::Pointer pGetInitialState()
559  {
560  return mpInitialState;
561  }
562 
567  {
568  return *mpInitialState;
569  }
570 
574  bool HasInitialState() const
575  {
576  return mpInitialState != nullptr;
577  }
578 
582  template<typename TVectorType>
583  void AddInitialStressVectorContribution(TVectorType& rStressVector)
584  {
585  if (this->HasInitialState()) {
586  const auto& r_initial_state = GetInitialState();
587  noalias(rStressVector) += r_initial_state.GetInitialStressVector();
588  }
589  }
590 
594  template<typename TVectorType>
595  void AddInitialStrainVectorContribution(TVectorType& rStrainVector)
596  {
597  if (this->HasInitialState()) {
598  const auto& r_initial_state = GetInitialState();
599  noalias(rStrainVector) -= r_initial_state.GetInitialStrainVector();
600  }
601  }
602 
606  template<typename TMatrixType>
608  {
609  if (this->HasInitialState()) {
610  const auto& r_initial_state = GetInitialState();
611  rF = prod(r_initial_state.GetInitialDeformationGradientMatrix(), rF);
612  }
613  }
614 
620  virtual bool Has(const Variable<bool>& rThisVariable);
621 
627  virtual bool Has(const Variable<int>& rThisVariable);
628 
634  virtual bool Has(const Variable<double>& rThisVariable);
635 
641  virtual bool Has(const Variable<Vector>& rThisVariable);
642 
648  virtual bool Has(const Variable<Matrix>& rThisVariable);
649 
656  virtual bool Has(const Variable<array_1d<double, 3 > >& rThisVariable);
657 
664  virtual bool Has(const Variable<array_1d<double, 6 > >& rThisVariable);
665 
672  virtual bool& GetValue(const Variable<bool>& rThisVariable, bool& rValue);
673 
680  virtual int& GetValue(const Variable<int>& rThisVariable, int& rValue);
681 
688  virtual double& GetValue(const Variable<double>& rThisVariable, double& rValue);
689 
696  virtual Vector& GetValue(const Variable<Vector>& rThisVariable, Vector& rValue);
697 
703  virtual Matrix& GetValue(const Variable<Matrix>& rThisVariable, Matrix& rValue);
704 
711  virtual array_1d<double, 3 > & GetValue(const Variable<array_1d<double, 3 > >& rThisVariable,
712  array_1d<double, 3 > & rValue);
713 
720  virtual array_1d<double, 6 > & GetValue(const Variable<array_1d<double, 6 > >& rThisVariable,
721  array_1d<double, 6 > & rValue);
722 
729  virtual void SetValue(const Variable<bool>& rVariable,
730  const bool& Value,
731  const ProcessInfo& rCurrentProcessInfo);
732 
739  virtual void SetValue(const Variable<int>& rVariable,
740  const int& Value,
741  const ProcessInfo& rCurrentProcessInfo);
742 
749  virtual void SetValue(const Variable<double>& rVariable,
750  const double& rValue,
751  const ProcessInfo& rCurrentProcessInfo);
752 
759  virtual void SetValue(const Variable<Vector >& rVariable,
760  const Vector& rValue,
761  const ProcessInfo& rCurrentProcessInfo);
762 
769  virtual void SetValue(const Variable<Matrix >& rVariable,
770  const Matrix& rValue,
771  const ProcessInfo& rCurrentProcessInfo);
772 
779  virtual void SetValue(const Variable<array_1d<double, 3 > >& rVariable,
780  const array_1d<double, 3 > & rValue,
781  const ProcessInfo& rCurrentProcessInfo);
782 
789  virtual void SetValue(const Variable<array_1d<double, 6 > >& rVariable,
790  const array_1d<double, 6 > & rValue,
791  const ProcessInfo& rCurrentProcessInfo);
792 
800  virtual bool& CalculateValue(Parameters& rParameterValues, const Variable<bool>& rThisVariable, bool& rValue);
801 
809  virtual int& CalculateValue(Parameters& rParameterValues, const Variable<int>& rThisVariable, int& rValue);
810 
818  virtual double& CalculateValue(Parameters& rParameterValues, const Variable<double>& rThisVariable, double& rValue);
819 
827  virtual Vector& CalculateValue(Parameters& rParameterValues, const Variable<Vector>& rThisVariable, Vector& rValue);
828 
836  virtual Matrix& CalculateValue(Parameters& rParameterValues, const Variable<Matrix>& rThisVariable, Matrix& rValue);
837 
845  virtual array_1d<double, 3 > & CalculateValue(Parameters& rParameterValues, const Variable<array_1d<double, 3 > >& rVariable,
846  array_1d<double, 3 > & rValue);
847 
854  virtual array_1d<double, 6 > & CalculateValue(Parameters& rParameterValues, const Variable<array_1d<double, 6 > >& rVariable,
855  array_1d<double, 6 > & rValue);
856 
899  virtual void CalculateDerivative(
900  Parameters& rParameterValues,
901  const Variable<double>& rFunctionVariable,
902  const Variable<double>& rDerivativeVariable,
903  double& rOutput);
904 
919  virtual void CalculateDerivative(
920  Parameters& rParameterValues,
921  const Variable<Vector>& rFunctionVariable,
922  const Variable<double>& rDerivativeVariable,
923  Vector& rOutput);
924 
939  virtual void CalculateDerivative(
940  Parameters& rParameterValues,
941  const Variable<Matrix>& rFunctionVariable,
942  const Variable<double>& rDerivativeVariable,
943  Matrix& rOutput);
944 
959  virtual void CalculateDerivative(
960  Parameters& rParameterValues,
961  const Variable<array_1d<double, 3>>& rFunctionVariable,
962  const Variable<double>& rDerivativeVariable,
963  array_1d<double, 3>& rOutput);
964 
965 
974  virtual bool ValidateInput(const Properties& rMaterialProperties);
975 
976 
981  virtual StrainMeasure GetStrainMeasure();
982 
987  virtual StressMeasure GetStressMeasure();
988 
994  virtual bool IsIncremental();
995 
1004  virtual void InitializeMaterial(const Properties& rMaterialProperties,
1005  const GeometryType& rElementGeometry,
1006  const Vector& rShapeFunctionsValues);
1007 
1016  KRATOS_DEPRECATED_MESSAGE("Please do not use this method - Use InitializeMaterialResponse instead\"")
1017  virtual void InitializeSolutionStep(const Properties& rMaterialProperties,
1018  const GeometryType& rElementGeometry, //this is just to give the array of nodes
1019  const Vector& rShapeFunctionsValues,
1020  const ProcessInfo& rCurrentProcessInfo);
1021 
1030  KRATOS_DEPRECATED_MESSAGE("Please do not use this method - Use FinalizeMaterialResponse instead\"")
1031  virtual void FinalizeSolutionStep(const Properties& rMaterialProperties,
1032  const GeometryType& rElementGeometry,
1033  const Vector& rShapeFunctionsValues,
1034  const ProcessInfo& rCurrentProcessInfo);
1035 
1036 
1037 
1046  KRATOS_DEPRECATED_MESSAGE("Please do not use this method - There is no equivalent for this\"")
1047  virtual void InitializeNonLinearIteration(const Properties& rMaterialProperties,
1048  const GeometryType& rElementGeometry,
1049  const Vector& rShapeFunctionsValues,
1050  const ProcessInfo& rCurrentProcessInfo);
1051 
1052 
1053 
1062  KRATOS_DEPRECATED_MESSAGE("Please do not use this method - There is no equivalent for this\"")
1063  virtual void FinalizeNonLinearIteration(const Properties& rMaterialProperties,
1064  const GeometryType& rElementGeometry,
1065  const Vector& rShapeFunctionsValues,
1066  const ProcessInfo& rCurrentProcessInfo);
1067 
1068 
1069 
1075  void CalculateMaterialResponse (Parameters& rValues,const StressMeasure& rStressMeasure);
1076 
1077 
1078 
1083  virtual void CalculateMaterialResponsePK1 (Parameters& rValues);
1084 
1085 
1090  virtual void CalculateMaterialResponsePK2 (Parameters& rValues);
1091 
1092 
1097  virtual void CalculateMaterialResponseKirchhoff (Parameters& rValues);
1098 
1099 
1104  virtual void CalculateMaterialResponseCauchy (Parameters& rValues);
1105 
1109  virtual bool RequiresInitializeMaterialResponse()
1110  {
1111  return true;
1112  }
1113 
1118  virtual void CalculateStressResponse (Parameters& rValues, Vector& rInternalVariables);
1119 
1125  void InitializeMaterialResponse (Parameters& rValues,const StressMeasure& rStressMeasure);
1126 
1132  virtual void InitializeMaterialResponsePK1 (Parameters& rValues);
1133 
1139  virtual void InitializeMaterialResponsePK2 (Parameters& rValues);
1140 
1146  virtual void InitializeMaterialResponseKirchhoff (Parameters& rValues);
1147 
1153  virtual void InitializeMaterialResponseCauchy (Parameters& rValues);
1154 
1159  {
1160  return true;
1161  }
1162 
1168  void FinalizeMaterialResponse (Parameters& rValues,const StressMeasure& rStressMeasure);
1169 
1170 
1176  virtual void FinalizeMaterialResponsePK1 (Parameters& rValues);
1177 
1183  virtual void FinalizeMaterialResponsePK2 (Parameters& rValues);
1184 
1190  virtual void FinalizeMaterialResponseKirchhoff (Parameters& rValues);
1191 
1197  virtual void FinalizeMaterialResponseCauchy (Parameters& rValues);
1198 
1199 
1200 
1201 
1210  virtual void ResetMaterial(const Properties& rMaterialProperties,
1211  const GeometryType& rElementGeometry,
1212  const Vector& rShapeFunctionsValues);
1213 
1214 
1223  virtual Vector& TransformStrains (Vector& rStrainVector,
1224  const Matrix &rF,
1225  StrainMeasure rStrainInitial,
1226  StrainMeasure rStrainFinal);
1227 
1236  virtual Matrix& TransformStresses (Matrix& rStressMatrix,
1237  const Matrix &rF,
1238  const double &rdetF,
1239  StressMeasure rStressInitial,
1240  StressMeasure rStressFinal);
1241 
1242 
1251  virtual Vector& TransformStresses (Vector& rStressVector,
1252  const Matrix &rF,
1253  const double &rdetF,
1254  StressMeasure rStressInitial,
1255  StressMeasure rStressFinal);
1256 
1257 
1258 
1266  Vector& TransformPK1Stresses (Vector& rStressVector,
1267  const Matrix &rF,
1268  const double &rdetF,
1269  StressMeasure rStressFinal);
1270 
1278  Vector& TransformPK2Stresses (Vector& rStressVector,
1279  const Matrix &rF,
1280  const double &rdetF,
1281  StressMeasure rStressFinal);
1282 
1290  Vector& TransformKirchhoffStresses (Vector& rStressVector,
1291  const Matrix &rF,
1292  const double &rdetF,
1293  StressMeasure rStressFinal);
1294 
1302  Vector& TransformCauchyStresses (Vector& rStressVector,
1303  const Matrix &rF,
1304  const double &rdetF,
1305  StressMeasure rStressFinal);
1306 
1307 
1308 
1318  void PullBackConstitutiveMatrix ( Matrix& rConstitutiveMatrix,
1319  const Matrix & rF );
1320 
1321 
1325  void PushForwardConstitutiveMatrix ( Matrix& rConstitutiveMatrix,
1326  const Matrix & rF );
1327 
1328 
1333  virtual void GetLawFeatures(Features& rFeatures);
1334 
1335 
1345  virtual int Check(const Properties& rMaterialProperties,
1346  const GeometryType& rElementGeometry,
1347  const ProcessInfo& rCurrentProcessInfo) const;
1348 
1349 
1350  // VM
1351 
1352  virtual void CalculateCauchyStresses(Vector& Cauchy_StressVector,
1353  const Matrix& F,
1354  const Vector& PK2_StressVector,
1355  const Vector& GreenLagrangeStrainVector);
1356 
1357 
1363  inline static bool HasSameType(const ConstitutiveLaw& rLHS, const ConstitutiveLaw& rRHS) {
1364  return (typeid(rLHS) == typeid(rRHS));
1365  }
1366 
1372  inline static bool HasSameType(const ConstitutiveLaw* rLHS, const ConstitutiveLaw* rRHS) {
1373  return ConstitutiveLaw::HasSameType(*rLHS, *rRHS);
1374  }
1375 
1383 
1385  std::string Info() const override
1386  {
1387  std::stringstream buffer;
1388  buffer << "ConstitutiveLaw";
1389  return buffer.str();
1390  }
1391 
1393  void PrintInfo(std::ostream& rOStream) const override
1394  {
1395  rOStream << "ConstitutiveLaw";
1396  }
1397 
1399  void PrintData(std::ostream& rOStream) const override
1400  {
1401  rOStream << "ConstitutiveLaw has no data";
1402  }
1403 
1404 
1409 
1410 protected:
1411 
1414  static const unsigned int msIndexVoigt3D6C [6][2];
1415  static const unsigned int msIndexVoigt2D4C [4][2];
1416  static const unsigned int msIndexVoigt2D3C [3][2];
1426 
1431  void ContraVariantPushForward( Matrix& rMatrix,
1432  const Matrix& rF );
1433 
1438  void ContraVariantPullBack( Matrix& rMatrix,
1439  const Matrix& rF );
1440 
1441 
1446  void CoVariantPushForward( Matrix& rMatrix,
1447  const Matrix& rF );
1448 
1449 
1454  void CoVariantPullBack( Matrix& rMatrix,
1455  const Matrix& rF );
1456 
1457 
1461  void ConstitutiveMatrixTransformation ( Matrix& rConstitutiveMatrix,
1462  const Matrix& rOriginalConstitutiveMatrix,
1463  const Matrix & rF );
1464 
1465 
1469  double& TransformConstitutiveComponent(double & rCabcd,
1470  const Matrix & rConstitutiveMatrix,
1471  const Matrix & rF,
1472  const unsigned int& a, const unsigned int& b,
1473  const unsigned int& c, const unsigned int& d);
1474 
1479  double& GetConstitutiveComponent(double & rCabcd,
1480  const Matrix& rConstitutiveMatrix,
1481  const unsigned int& a, const unsigned int& b,
1482  const unsigned int& c, const unsigned int& d);
1483 
1484 
1488 
1489 
1493 
1494 
1498 
1499 
1501 
1502 
1503 private:
1504 
1507 
1508 
1512  InitialState::Pointer mpInitialState = nullptr;
1513 
1517 
1518 
1522 
1523 
1528 
1532 
1533  friend class Serializer;
1534 
1535 
1536  void save(Serializer& rSerializer) const override
1537  {
1538  KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, Flags );
1539  rSerializer.save("InitialState",mpInitialState);
1540  }
1541 
1542  void load(Serializer& rSerializer) override
1543  {
1544  KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, Flags );
1545  rSerializer.load("InitialState",mpInitialState);
1546  }
1547 
1548 
1552 
1553 
1557 
1559 
1560 }; /* Class ConstitutiveLaw */
1561 
1568 
1570 inline std::istream & operator >>(std::istream& rIStream,
1571  ConstitutiveLaw& rThis);
1572 
1574 
1575 inline std::ostream & operator <<(std::ostream& rOStream,
1576  const ConstitutiveLaw& rThis)
1577 {
1578  rThis.PrintInfo(rOStream);
1579  rOStream << " : " << std::endl;
1580  rThis.PrintData(rOStream);
1581 
1582  return rOStream;
1583 }
1584 
1587 
1590 
1591 void KRATOS_API(KRATOS_CORE) AddKratosComponent(std::string const& Name, ConstitutiveLaw const& ThisComponent);
1592 void KRATOS_API(KRATOS_CORE) AddKratosComponent(std::string const& Name, Variable<ConstitutiveLaw::Pointer> const& ThisComponent);
1593 
1598 #undef KRATOS_EXPORT_MACRO
1599 #define KRATOS_EXPORT_MACRO KRATOS_API
1600 
1601 KRATOS_DEFINE_VARIABLE(ConstitutiveLaw::Pointer, CONSTITUTIVE_LAW)
1602 
1603 #undef KRATOS_EXPORT_MACRO
1604 #define KRATOS_EXPORT_MACRO KRATOS_NO_EXPORT
1605 
1606 
1607 } /* namespace Kratos.*/
1608 #endif /* KRATOS_CONSTITUTIVE_LAW defined */
Definition: constitutive_law.h:47
KRATOS_DEFINE_LOCAL_FLAG(AXISYMMETRIC_LAW)
virtual bool RequiresFinalizeMaterialResponse()
If the CL requires to finalize the material response, called by the element in FinalizeSolutionStep.
Definition: constitutive_law.h:1158
void AddInitialDeformationGradientMatrixContribution(TMatrixType &rF)
Adds the initial strain vector if it is defined in the InitialState.
Definition: constitutive_law.h:607
bool HasInitialState() const
Definition: constitutive_law.h:574
void SetInitialState(InitialState::Pointer pInitialState)
Definition: constitutive_law.h:550
KRATOS_DEFINE_LOCAL_FLAG(USE_ELEMENT_PROVIDED_STRAIN)
static bool HasSameType(const ConstitutiveLaw &rLHS, const ConstitutiveLaw &rRHS)
This method is used to check that two Constitutive Laws are the same type (references)
Definition: constitutive_law.h:1363
KRATOS_DEFINE_LOCAL_FLAG(PLANE_STRESS_LAW)
Vector StrainVectorType
Definition: constitutive_law.h:85
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_STRAIN_ENERGY)
void AddInitialStressVectorContribution(TVectorType &rStressVector)
Adds the initial stress vector if it is defined in the InitialState.
Definition: constitutive_law.h:583
KRATOS_DEFINE_LOCAL_FLAG(INCREMENTAL_STRAIN_MEASURE)
StrainMeasure
Definition: constitutive_law.h:52
@ StrainMeasure_GreenLagrange
Definition: constitutive_law.h:54
@ StrainMeasure_Right_CauchyGreen
Definition: constitutive_law.h:63
@ StrainMeasure_Almansi
Definition: constitutive_law.h:55
@ StrainMeasure_Infinitesimal
Definition: constitutive_law.h:53
@ StrainMeasure_Hencky_Spatial
Definition: constitutive_law.h:59
@ StrainMeasure_Hencky_Material
Definition: constitutive_law.h:58
@ StrainMeasure_Left_CauchyGreen
Definition: constitutive_law.h:64
@ StrainMeasure_Deformation_Gradient
Definition: constitutive_law.h:62
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: constitutive_law.h:1399
StressMeasure
Definition: constitutive_law.h:69
@ StressMeasure_PK1
Definition: constitutive_law.h:70
@ StressMeasure_Kirchhoff
Definition: constitutive_law.h:72
@ StressMeasure_PK2
Definition: constitutive_law.h:71
InitialState::Pointer pGetInitialState()
Definition: constitutive_law.h:558
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_STRESS)
InitialState & GetInitialState()
Definition: constitutive_law.h:566
static bool HasSameType(const ConstitutiveLaw *rLHS, const ConstitutiveLaw *rRHS)
This method is used to check that two Constitutive Laws are the same type (pointers)
Definition: constitutive_law.h:1372
KRATOS_DEFINE_LOCAL_FLAG(ISOTROPIC)
Geometry< Node > GeometryType
Definition: constitutive_law.h:83
std::string Info() const override
Turn back information as a string.
Definition: constitutive_law.h:1385
KRATOS_DEFINE_LOCAL_FLAG(INFINITESIMAL_STRAINS)
KRATOS_DEFINE_LOCAL_FLAG(FINITE_STRAINS)
Matrix DeformationGradientMatrixType
Definition: constitutive_law.h:88
KRATOS_DEFINE_LOCAL_FLAG(PLANE_STRAIN_LAW)
void AddInitialStrainVectorContribution(TVectorType &rStrainVector)
Adds the initial strain vector if it is defined in the InitialState.
Definition: constitutive_law.h:595
KRATOS_DEFINE_LOCAL_FLAG(MECHANICAL_RESPONSE_ONLY)
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: constitutive_law.h:1393
KRATOS_DEFINE_LOCAL_FLAG(VOLUMETRIC_TENSOR_ONLY)
KRATOS_DEFINE_LOCAL_FLAG(FINALIZE_MATERIAL_RESPONSE)
KRATOS_CLASS_POINTER_DEFINITION(ConstitutiveLaw)
KRATOS_DEFINE_LOCAL_FLAG(THERMAL_RESPONSE_ONLY)
Matrix VoigtSizeMatrixType
Definition: constitutive_law.h:87
KRATOS_DEFINE_LOCAL_FLAG(U_P_LAW)
std::size_t SizeType
Definition: constitutive_law.h:82
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_CONSTITUTIVE_TENSOR)
KRATOS_DEFINE_LOCAL_FLAG(INITIALIZE_MATERIAL_RESPONSE)
KRATOS_DEFINE_LOCAL_FLAG(THREE_DIMENSIONAL_LAW)
ProcessInfo ProcessInfoType
Definition: constitutive_law.h:81
~ConstitutiveLaw() override
Definition: constitutive_law.h:506
Vector StressVectorType
Definition: constitutive_law.h:86
KRATOS_DEFINE_LOCAL_FLAG(ANISOTROPIC)
KRATOS_DEFINE_LOCAL_FLAG(ISOCHORIC_TENSOR_ONLY)
Definition: flags.h:58
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
void Reset(const Flags ThisFlag)
Definition: flags.h:193
Geometry base class.
Definition: geometry.h:71
Define the initial state of the material in terms of initial stress/strain/F.
Definition: initial_state.h:41
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
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
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_DEBUG_ERROR_IF_NOT(conditional)
Definition: exception.h:172
#define KRATOS_API_EXTERN
Definition: kratos_export_api.h:57
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
void InitializeSolutionStep(ConstructionUtility &rThisUtil, std::string ThermalSubModelPartName, std::string MechanicalSubModelPartName, std::string HeatFluxSubModelPartName, std::string HydraulicPressureSubModelPartName, bool thermal_conditions, bool mechanical_conditions, int phase)
Definition: add_custom_utilities_to_python.cpp:45
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
void AddKratosComponent(std::string const &Name, ExplicitBuilderType const &ThisComponent)
Definition: register_factories.cpp:23
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
namespace KRATOS_DEPRECATED_MESSAGE("Please use std::filesystem directly") filesystem
Definition: kratos_filesystem.h:33
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
KRATOS_DEFINE_VARIABLE(Vector, BIOT_STRAIN_VECTOR)
def SetValue(entity, variable, value)
Definition: coupling_interface_data.py:256
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
F
Definition: hinsberg_optimization.py:144
def load(f)
Definition: ode_solve.py:307
tuple const
Definition: ode_solve.py:403
int d
Definition: ode_solve.py:397
Definition: constitutive_law.h:137
SizeType mStrainSize
Definition: constitutive_law.h:152
std::vector< StrainMeasure > mStrainMeasures
Definition: constitutive_law.h:154
~Features()
Definition: constitutive_law.h:166
Features()
Definition: constitutive_law.h:159
std::vector< StrainMeasure > & GetStrainMeasures()
Definition: constitutive_law.h:183
void SetOptions(const Flags &rOptions)
Definition: constitutive_law.h:171
SizeType mSpaceDimension
Definition: constitutive_law.h:153
const SizeType & GetStrainSize()
Definition: constitutive_law.h:181
void SetSpaceDimension(const SizeType SpaceDimension)
Definition: constitutive_law.h:173
void SetStrainMeasures(const std::vector< StrainMeasure > MeasuresVector)
Definition: constitutive_law.h:176
const SizeType & GetSpaceDimension()
Definition: constitutive_law.h:182
void SetStrainMeasure(const StrainMeasure Measure)
Definition: constitutive_law.h:174
void SetStrainSize(const SizeType StrainSize)
Definition: constitutive_law.h:172
Flags mOptions
Definition: constitutive_law.h:151
const Flags & GetOptions()
Definition: constitutive_law.h:179
Definition: constitutive_law.h:189
void SetMaterialProperties(const Properties &rMaterialProperties)
Definition: constitutive_law.h:406
void SetConstitutiveMatrix(VoigtSizeMatrixType &rConstitutiveMatrix)
Definition: constitutive_law.h:403
void Set(Flags ThisFlag)
Definition: constitutive_law.h:389
const GeometryType & GetElementGeometry()
Definition: constitutive_law.h:462
const Matrix & GetShapeFunctionsDerivatives()
Definition: constitutive_law.h:424
void SetStrainVector(StrainVectorType &rStrainVector)
Definition: constitutive_law.h:401
const double & GetDeterminantF()
Definition: constitutive_law.h:414
bool IsSetDeformationGradientF()
Definition: constitutive_law.h:485
~Parameters()
Definition: constitutive_law.h:305
bool IsSetElementGeometry()
Definition: constitutive_law.h:494
bool CheckInfoMaterialGeometry()
Definition: constitutive_law.h:341
const Vector & GetShapeFunctionsValues()
Definition: constitutive_law.h:419
bool IsSetShapeFunctionsValues()
Definition: constitutive_law.h:483
Flags & GetOptions()
Definition: constitutive_law.h:412
StrainVectorType & GetStrainVector()
Definition: constitutive_law.h:435
bool IsSetProcessInfo()
Definition: constitutive_law.h:492
bool IsSetDeterminantF()
Definition: constitutive_law.h:482
const DeformationGradientMatrixType & GetDeformationGradientF()
Definition: constitutive_law.h:429
bool CheckAllParameters()
Definition: constitutive_law.h:313
bool CheckMechanicalVariables()
Definition: constitutive_law.h:360
bool IsSetMaterialProperties()
Definition: constitutive_law.h:493
Parameters(const GeometryType &rElementGeometry, const Properties &rMaterialProperties, const ProcessInfo &rCurrentProcessInfo)
Definition: constitutive_law.h:266
void SetOptions(const Flags &rOptions)
Definition: constitutive_law.h:392
StrainVectorType & GetStrainVector(StrainVectorType &rStrainVector)
Definition: constitutive_law.h:473
double & GetDeterminantF(double &rDeterminantF)
Definition: constitutive_law.h:472
void SetStressVector(StressVectorType &rStressVector)
Definition: constitutive_law.h:402
DeformationGradientMatrixType & GetDeformationGradientF(DeformationGradientMatrixType &rDeformationGradientF)
Definition: constitutive_law.h:474
const ProcessInfo & GetProcessInfo()
Definition: constitutive_law.h:452
StressVectorType & GetStressVector(StressVectorType &rStressVector)
Definition: constitutive_law.h:475
const Properties & GetMaterialProperties()
Definition: constitutive_law.h:457
VoigtSizeMatrixType & GetConstitutiveMatrix()
Definition: constitutive_law.h:446
bool IsSetStressVector()
Definition: constitutive_law.h:488
void SetShapeFunctionsDerivatives(const Matrix &rShapeFunctionsDerivatives)
Definition: constitutive_law.h:397
StressVectorType & GetStressVector()
Definition: constitutive_law.h:440
void Reset(Flags ThisFlag)
Definition: constitutive_law.h:390
bool IsSetShapeFunctionsDerivatives()
Definition: constitutive_law.h:484
void SetElementGeometry(const GeometryType &rElementGeometry)
Definition: constitutive_law.h:407
VoigtSizeMatrixType & GetConstitutiveMatrix(VoigtSizeMatrixType &rConstitutiveMatrix)
Definition: constitutive_law.h:476
void SetShapeFunctionsValues(const Vector &rShapeFunctionsValues)
Definition: constitutive_law.h:396
void SetProcessInfo(const ProcessInfo &rProcessInfo)
Definition: constitutive_law.h:405
void SetDeformationGradientF(const DeformationGradientMatrixType &rDeformationGradientF)
Definition: constitutive_law.h:399
bool IsSetConstitutiveMatrix()
Definition: constitutive_law.h:490
void SetDeterminantF(const double DeterminantF)
Definition: constitutive_law.h:393
bool CheckShapeFunctions()
Definition: constitutive_law.h:326
Parameters()
Definition: constitutive_law.h:247
bool IsSetStrainVector()
Definition: constitutive_law.h:487
Parameters(const Parameters &rNewParameters)
Definition: constitutive_law.h:287