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.
hyper_elastic_model.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosConstitutiveModelsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: April 2017 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_HYPER_ELASTIC_MODEL_H_INCLUDED )
11 #define KRATOS_HYPER_ELASTIC_MODEL_H_INCLUDED
12 
13 // System includes
14 #include <string>
15 #include <iostream>
16 
17 // External includes
18 
19 // Project includes
21 
22 namespace Kratos
23 {
26 
29 
33 
37 
41 
45 
47 
49  class KRATOS_API(CONSTITUTIVE_MODELS_APPLICATION) HyperElasticModel : public ConstitutiveModel
50  {
51  protected:
52 
53 
55  {
56  double I1;
57  double I2;
58  double I3;
59 
60  double J;
61  double J_13;
62 
63  };
64 
65 
67  {
68  double Alpha1; //1st derivative I1
69  double Alpha2; //1st derivative I2
70  double Alpha3; //1st derivative I3
71  double Alpha4; //1st derivative J
72 
73  double Beta1; //2nd derivative I1
74  double Beta2; //2nd derivative I2
75  double Beta3; //2nd derivative I3
76  double Beta4; //2nd derivative J
77 
78  // the implementation of the crossed derivatives have to be added for a more general form (usually they are zero)
79  // double Gamma21; //2nd derivative ddW/dI2dI1
80  // double Gamma31; //2nd derivative ddW/dI3dI1
81  // double Gamma12; //2nd derivative ddW/dI1dI2
82  // double Gamma32; //2nd derivative ddW/dI3dI2
83  // double Gamma13; //2nd derivative ddW/dI1dI3
84  // double Gamma23; //2nd derivative ddW/dI2dI3
85 
86  };
87 
89  {
92  };
93 
94 
95  struct StrainData
96  {
97 
100 
101  MatrixType Matrix; //left(b) or right(C) cauchy green
102  MatrixType InverseMatrix; //insverse right(C) cauchy green
103 
104  };
105 
106 
108  {
109  private:
110 
111  Flags* mpState;
112  const ModelDataType* mpModelData;
113 
114  public:
115 
118 
119  //Set Data Pointers
120  void SetState (Flags& rState) {mpState = &rState;};
121  void SetModelData (const ModelDataType& rModelData) {mpModelData = &rModelData;};
122 
123  //Get Data Pointers
124  const ModelDataType& GetModelData () const {return *mpModelData;};
125  const MaterialDataType& GetMaterialParameters () const {return mpModelData->GetMaterialParameters();};
126 
127  //Get non const Data
128  Flags& State () {return *mpState;};
129 
130  //Get const Data
131  const Flags& GetState () const {return *mpState;};
132 
133 
134  };
135 
136 
137  public:
138 
142 
145 
149 
152 
154  HyperElasticModel(HyperElasticModel const& rOther);
155 
158 
160  ConstitutiveModel::Pointer Clone() const override;
161 
162 
164  ~HyperElasticModel() override;
165 
166 
170 
171 
175 
179  void InitializeModel(ModelDataType& rValues) override;
180 
184  void FinalizeModel(ModelDataType& rValues) override;
185 
186 
190  void CalculateStrainEnergy(ModelDataType& rValues, double& rDensityFunction) override;
191 
192 
196  void CalculateStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override;
197 
198  void CalculateIsochoricStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override;
199 
200  void CalculateVolumetricStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override;
201 
202 
206  void CalculateConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override;
207 
208  void CalculateIsochoricConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override;
209 
210  void CalculateVolumetricConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override;
211 
212 
216  void CalculateStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override;
217 
218  void CalculateIsochoricStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override;
219 
220  void CalculateVolumetricStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override;
221 
222 
226  int Check(const Properties& rProperties, const ProcessInfo& rCurrentProcessInfo) override;
227 
231 
232  void SetValue(const Variable<Vector>& rThisVariable, const Vector& rValue,
233  const ProcessInfo& rCurrentProcessInfo ) override
234  {
235  KRATOS_TRY
236 
237  // A method to compute the initial linear strain from the stress is needed
238  //if(rThisVariable == INITIAL_STRESS_VECTOR)
239 
240  // A method to compute the initial linear strain from the stress is needed
241  // if(rThisVariable == INITIAL_STRAIN_VECTOR){
242  // this->mHistoryVector = rValue;
243  // }
244 
245  KRATOS_CATCH(" ")
246  }
247 
248 
249  void SetValue(const Variable<Matrix>& rThisVariable, const Matrix& rValue,
250  const ProcessInfo& rCurrentProcessInfo ) override
251  {
252  KRATOS_TRY
253 
254  // A method to compute the initial linear strain from the stress is needed
255  //if(rThisVariable == INITIAL_STRESS_VECTOR)
256 
257  // A method to compute the initial linear strain from the stress is needed
258  // if(rThisVariable == INITIAL_STRAIN_VECTOR){
259  // this->mHistoryVector = rValue;
260  // }
261 
262  KRATOS_CATCH(" ")
263  }
264 
270  void GetDomainVariablesList(std::vector<Variable<double> >& rScalarVariables,
271  std::vector<Variable<array_1d<double,3> > >& rComponentVariables) override
272  {
273  KRATOS_TRY
274 
275  rComponentVariables.push_back(DISPLACEMENT);
276 
277  KRATOS_CATCH(" ")
278  }
279 
280 
284 
285 
289 
291  std::string Info() const override
292  {
293  std::stringstream buffer;
294  buffer << "HyperElasticModel";
295  return buffer.str();
296  }
297 
299  void PrintInfo(std::ostream& rOStream) const override
300  {
301  rOStream << "HyperElasticModel";
302  }
303 
305  void PrintData(std::ostream& rOStream) const override
306  {
307  rOStream << "HyperElasticModel Data";
308  }
309 
310 
314 
315 
317 
318  protected:
321 
323 
324 
328 
332 
333 
337 
338 
342  virtual void CalculateAndAddStressTensor(HyperElasticDataType& rVariables, MatrixType& rStressMatrix);
343 
344  virtual void CalculateAndAddIsochoricStressTensor(HyperElasticDataType& rVariables, MatrixType& rStressMatrix);
345 
346  virtual void CalculateAndAddVolumetricStressTensor(HyperElasticDataType& rVariables, MatrixType& rStressMatrix);
347 
351  virtual void CalculateAndAddConstitutiveTensor(HyperElasticDataType& rVariables, Matrix& rConstitutiveMatrix);
352 
353  virtual void CalculateAndAddIsochoricConstitutiveTensor(HyperElasticDataType& rVariables, Matrix& rConstitutiveMatrix);
354 
355  virtual void CalculateAndAddVolumetricConstitutiveTensor(HyperElasticDataType& rVariables, Matrix& rConstitutiveMatrix);
356 
361  virtual double& AddConstitutiveComponent(HyperElasticDataType& rVariables, double &rCabcd,
362  const unsigned int& a, const unsigned int& b,
363  const unsigned int& c, const unsigned int& d);
364 
365 
366  virtual double& AddIsochoricConstitutiveComponent(HyperElasticDataType& rVariables, double &rCabcd,
367  const unsigned int& a, const unsigned int& b,
368  const unsigned int& c, const unsigned int& d);
369 
370 
371  virtual double& AddVolumetricConstitutiveComponent(HyperElasticDataType& rVariables, double &rCabcd,
372  const unsigned int& a, const unsigned int& b,
373  const unsigned int& c, const unsigned int& d);
374 
375 
376  //************// Strain Data
377 
378 
379  virtual void CalculateStrainData(ModelDataType& rValues, HyperElasticDataType& rVariables);
380 
381  virtual void CalculateInvariants(HyperElasticDataType& rVariables);
382 
383  virtual void CalculateScalingFactors(HyperElasticDataType& rVariables);
384 
385  void CalculateStrainInvariants(const MatrixType& rStrainMatrix, double& rI1, double& rI2, double& rI3);
386 
387 
388  //************//W
389 
390  virtual void CalculateAndAddIsochoricStrainEnergy(HyperElasticDataType& rVariables, double& rIsochoricDensityFunction);
391 
392  virtual void CalculateAndAddVolumetricStrainEnergy(HyperElasticDataType& rVariables, double& rVolumetricDensityFunction);
393 
394 
395  //************// dW
396 
397  virtual double& GetVolumetricFunction1stJDerivative(HyperElasticDataType& rVariables, double& rDerivative); //dU/dJ
398 
399  virtual double& GetVolumetricFunction2ndJDerivative(HyperElasticDataType& rVariables, double& rDerivative); //ddU/dJdJ
400 
401 
402  //************// right cauchy green: C
403  MatrixType& GetJRightCauchyGreenDerivative(const StrainData& rStrain, MatrixType& rDerivative); //dJ/dC
404 
405  double& GetJRightCauchyGreen1stDerivative(const StrainData& rStrain,
406  double& rDerivative,
407  const double& a,
408  const double& b);
409 
410  double& GetJRightCauchyGreenSquare1stDerivative(const StrainData& rStrain,
411  double& rDerivative,
412  const double& a,
413  const double& b,
414  const double& c,
415  const double& d); //dJ/dC * dJ/dC
416 
417  double& GetJRightCauchyGreen2ndDerivative(const StrainData& rStrain,
418  double& rDerivative,
419  const double& a,
420  const double& b,
421  const double& c,
422  const double& d); //ddJ/dCdC
423 
424  //************// left cauchy green : b
425 
426  MatrixType& GetJLeftCauchyGreenDerivative(const StrainData& rStrain, MatrixType& rDerivative); //dJ/db
427 
428  double& GetJLeftCauchyGreen1stDerivative(const StrainData& rStrain,
429  double& rDerivative,
430  const double& a,
431  const double& b); //dJ/db
432 
433  double& GetJLeftCauchyGreenSquare1stDerivative(const StrainData& rStrain,
434  double& rDerivative,
435  const double& a,
436  const double& b,
437  const double& c,
438  const double& d); //dJ/db * dJ/db
439 
440  double& GetJLeftCauchyGreen2ndDerivative(const StrainData& rStrain,
441  double& rDerivative,
442  const double& a,
443  const double& b,
444  const double& c,
445  const double& d); //ddJ/dbdb
446 
447 
451 
452 
456 
457 
461 
462 
464 
465  private:
466 
469 
470 
474 
475 
479 
480 
484 
485 
489 
490 
494  friend class Serializer;
495 
496 
497  void save(Serializer& rSerializer) const override
498  {
500  }
501 
502  void load(Serializer& rSerializer) override
503  {
505  }
506 
510 
511 
515 
517 
518  }; // Class HyperElasticModel
519 
521 
524 
525 
529 
530 
532 
534 
535 } // namespace Kratos.
536 
537 #endif // KRATOS_HYPER_ELASTIC_MODEL_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Short class definition.
Definition: constitutive_model.hpp:52
Definition: flags.h:58
Short class definition.
Definition: hyper_elastic_model.hpp:50
void SetValue(const Variable< Matrix > &rThisVariable, const Matrix &rValue, const ProcessInfo &rCurrentProcessInfo) override
Definition: hyper_elastic_model.hpp:249
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: hyper_elastic_model.hpp:305
std::string Info() const override
Turn back information as a string.
Definition: hyper_elastic_model.hpp:291
HyperElasticModelData HyperElasticDataType
Definition: hyper_elastic_model.hpp:141
void GetDomainVariablesList(std::vector< Variable< double > > &rScalarVariables, std::vector< Variable< array_1d< double, 3 > > > &rComponentVariables) override
Definition: hyper_elastic_model.hpp:270
static const MatrixType msIdentityMatrix
Definition: hyper_elastic_model.hpp:322
void SetValue(const Variable< Vector > &rThisVariable, const Vector &rValue, const ProcessInfo &rCurrentProcessInfo) override
Definition: hyper_elastic_model.hpp:232
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: hyper_elastic_model.hpp:299
KRATOS_CLASS_POINTER_DEFINITION(HyperElasticModel)
Pointer definition of HyperElasticModel.
Definition: amatrix_interface.h:41
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
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_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
double CalculateStrainEnergy(Element &rElement)
Definition: mpm_energy_calculation_utility.cpp:89
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
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
def load(f)
Definition: ode_solve.py:307
int d
Definition: ode_solve.py:397
Definition: constitutive_model_data.hpp:92
Definition: constitutive_model_data.hpp:383
const MaterialData & GetMaterialParameters() const
Definition: constitutive_model_data.hpp:462
Definition: hyper_elastic_model.hpp:67
double Alpha3
Definition: hyper_elastic_model.hpp:70
double Alpha1
Definition: hyper_elastic_model.hpp:68
double Alpha4
Definition: hyper_elastic_model.hpp:71
double Beta4
Definition: hyper_elastic_model.hpp:76
double Alpha2
Definition: hyper_elastic_model.hpp:69
double Beta1
Definition: hyper_elastic_model.hpp:73
double Beta2
Definition: hyper_elastic_model.hpp:74
double Beta3
Definition: hyper_elastic_model.hpp:75
Definition: hyper_elastic_model.hpp:108
StrainData Strain
Definition: hyper_elastic_model.hpp:117
Flags & State()
Definition: hyper_elastic_model.hpp:128
const Flags & GetState() const
Definition: hyper_elastic_model.hpp:131
void SetState(Flags &rState)
Definition: hyper_elastic_model.hpp:120
HyperElasticFactors Factors
Definition: hyper_elastic_model.hpp:116
void SetModelData(const ModelDataType &rModelData)
Definition: hyper_elastic_model.hpp:121
const MaterialDataType & GetMaterialParameters() const
Definition: hyper_elastic_model.hpp:125
const ModelDataType & GetModelData() const
Definition: hyper_elastic_model.hpp:124
Definition: hyper_elastic_model.hpp:96
StrainEigenData Eigen
Definition: hyper_elastic_model.hpp:99
MatrixType InverseMatrix
Definition: hyper_elastic_model.hpp:102
StrainInvariants Invariants
Definition: hyper_elastic_model.hpp:98
MatrixType Matrix
Definition: hyper_elastic_model.hpp:101
Definition: hyper_elastic_model.hpp:89
MatrixType Vectors
Definition: hyper_elastic_model.hpp:91
array_1d< double, 3 > Values
Definition: hyper_elastic_model.hpp:90
Definition: hyper_elastic_model.hpp:55
double I2
Definition: hyper_elastic_model.hpp:57
double J
Definition: hyper_elastic_model.hpp:60
double I1
Definition: hyper_elastic_model.hpp:56
double J_13
Definition: hyper_elastic_model.hpp:61
double I3
Definition: hyper_elastic_model.hpp:58