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.
neo_hookean_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_NEO_HOOKEAN_MODEL_H_INCLUDED)
11 #define KRATOS_NEO_HOOKEAN_MODEL_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
19 
20 namespace Kratos
21 {
24 
27 
31 
35 
39 
43 
45 
47  class KRATOS_API(CONSTITUTIVE_MODELS_APPLICATION) NeoHookeanModel : public MooneyRivlinModel
48  {
49  public:
50 
53 
56 
60 
63 
66 
69  {
71  return *this;
72  }
73 
75  ConstitutiveModel::Pointer Clone() const override
76  {
77  return Kratos::make_shared<NeoHookeanModel>(*this);
78  }
79 
81  ~NeoHookeanModel() override {}
82 
83 
87 
88 
92 
93  void CalculateStrainEnergy(ModelDataType& rValues, double& rDensityFunction) override
94  {
96 
97  HyperElasticDataType Variables;
98  this->CalculateStrainData(rValues, Variables);
99 
100  this->CalculateAndAddVolumetricStrainEnergy( Variables, rDensityFunction );
101 
102  rDensityFunction += rValues.MaterialParameters.GetModelParameters()[0] * ( Variables.Strain.Invariants.I1 - 3.0);
103 
104  KRATOS_CATCH(" ")
105  }
106 
107 
108 
109  int Check(const Properties& rProperties, const ProcessInfo& rCurrentProcessInfo) override
110  {
111  KRATOS_TRY
112 
113  MooneyRivlinModel::Check(rProperties,rCurrentProcessInfo);
114 
115  if( C10.Key() == 0 || rProperties[C10] <= 0.00 )
116  KRATOS_ERROR << "C10 has an invalid key or value" << std::endl;
117  if( BULK_MODULUS.Key() == 0 || rProperties[BULK_MODULUS] <= 0.00 )
118  KRATOS_ERROR << "BULK_MODULUS has an invalid key or value" << std::endl;
119 
120  return 0;
121 
122  KRATOS_CATCH(" ")
123  }
124 
125 
129 
130 
134 
135 
139 
141  std::string Info() const override
142  {
143  std::stringstream buffer;
144  buffer << "NeoHookeanModel";
145  return buffer.str();
146  }
147 
149  void PrintInfo(std::ostream& rOStream) const override
150  {
151  rOStream << "NeoHookeanModel";
152  }
153 
155  void PrintData(std::ostream& rOStream) const override
156  {
157  rOStream << "NeoHookeanModel Data";
158  }
159 
163 
164 
166 
167  protected:
168 
171 
175 
179 
180 
184 
185 
186  // specialized methods:
187 
188  virtual void CalculateVolumetricFactor(HyperElasticDataType& rVariables, double& rFactor)
189  {
190  KRATOS_TRY
191 
192  rFactor = 0.5 * (rVariables.Strain.Invariants.I3-1.0);
193 
194  KRATOS_CATCH(" ")
195  }
196 
197  virtual void CalculateConstitutiveMatrixFactor(HyperElasticDataType& rVariables, double& rFactor)
198  {
199  KRATOS_TRY
200 
201  rFactor = rVariables.Strain.Invariants.I3;
202 
203  KRATOS_CATCH(" ")
204  }
205 
206 
207  //**** Particular calculation for the basic neo-hookean models ****//
208 
209  // virtual void CalculateAndAddStressTensor(HyperElasticDataType& rVariables, MatrixType& rStressMatrix) override
210  // {
211  // KRATOS_TRY
212 
213  // const ModelDataType& rModelData = rVariables.GetModelData();
214  // const StressMeasureType& rStressMeasure = rModelData.GetStressMeasure();
215 
216  // MatrixType StressMatrix;
217 
218  // const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
219 
220  // double Factor = 0;
221  // this->CalculateVolumetricFactor(rVariables,Factor);
222 
223  // if( rStressMeasure == ConstitutiveModelData::StressMeasureType::StressMeasure_PK2 ){ //mStrainMatrix = RightCauchyGreen (C)
224 
225  // StressMatrix = rMaterial.GetLameLambda() * Factor * rVariables.Strain.InverseMatrix;
226  // StressMatrix += rMaterial.GetLameMu() * ( msIdentityMatrix - rVariables.Strain.InverseMatrix);
227 
228  // rStressMatrix += StressMatrix;
229 
230  // }
231  // else if( rStressMeasure == ConstitutiveModelData::StressMeasureType::StressMeasure_Kirchhoff ){ //mStrainMatrix = LeftCauchyGreen (b)
232 
233  // StressMatrix = rMaterial.GetLameLambda() * Factor * msIdentityMatrix;
234  // StressMatrix += rMaterial.GetLameMu() * ( rVariables.Strain.Matrix - msIdentityMatrix );
235 
236  // rStressMatrix += StressMatrix;
237  // }
238 
239  // rVariables.State().Set(ConstitutiveModelData::STRESS_COMPUTED);
240 
241  // KRATOS_CATCH(" ")
242  // }
243 
244 
245  // virtual double& AddConstitutiveComponent(HyperElasticDataType& rVariables, double &rCabcd,
246  // const unsigned int& a, const unsigned int& b,
247  // const unsigned int& c, const unsigned int& d) override
248  // {
249  // KRATOS_TRY
250 
251 
252  // double Cabcd = 0;
253 
254  // const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
255 
256  // const ModelDataType& rModelData = rVariables.GetModelData();
257  // const StressMeasureType& rStressMeasure = rModelData.GetStressMeasure();
258 
259  // double FactorA = 0;
260  // this->CalculateConstitutiveMatrixFactor(rVariables,FactorA);
261 
262  // double FactorB = 0;
263  // this->CalculateVolumetricFactor(rVariables,FactorB);
264 
265  // if( rStressMeasure == ConstitutiveModelData::StressMeasureType::StressMeasure_PK2 ){ //mStrainMatrix = RightCauchyGreen (C)
266  // Cabcd = FactorA * rMaterial.GetLameLambda() * (rVariables.Strain.InverseMatrix(a,b)*rVariables.Strain.InverseMatrix(c,d));
267  // Cabcd += (rMaterial.GetLameMu() - rMaterial.GetLameLambda() * FactorB) * (rVariables.Strain.InverseMatrix(a,c)*rVariables.Strain.InverseMatrix(b,d)+rVariables.Strain.InverseMatrix(a,d)*rVariables.Strain.InverseMatrix(b,c));
268  // }
269  // else if( rStressMeasure == ConstitutiveModelData::StressMeasureType::StressMeasure_Kirchhoff ){ //mStrainMatrix = LeftCauchyGreen (b)
270  // Cabcd = FactorA * rMaterial.GetLameLambda() * (msIdentityMatrix(a,b)*msIdentityMatrix(c,d));
271  // Cabcd += (rMaterial.GetLameMu() - rMaterial.GetLameLambda() * FactorB) * (msIdentityMatrix(a,c)*msIdentityMatrix(b,d)+msIdentityMatrix(a,d)*msIdentityMatrix(b,c));
272  // }
273 
274  // rCabcd += Cabcd;
275 
276  // rVariables.State().Set(ConstitutiveModelData::CONSTITUTIVE_MATRIX_COMPUTED);
277 
278  // return rCabcd;
279 
280  // KRATOS_CATCH(" ")
281  // }
282 
283  //**** Particular calculation for the basic neo-hookean models ****//
284 
285  //************// W
286 
287  //option: g(J) = (lambda/4)*(J²-1) - (lamda/2)*lnJ - (mu)*lnJ (default implemented)
288 
289  void CalculateAndAddVolumetricStrainEnergy(HyperElasticDataType& rVariables, double& rVolumetricDensityFunction) override
290  {
291  KRATOS_TRY
292 
293  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
294 
295  //g(J) = (lambda/4)*(J²-1) - (lamda/2)*lnJ - (mu)*lnJ
296  rVolumetricDensityFunction = rMaterial.GetLameLambda() * 0.25 * ( rVariables.Strain.Invariants.I3 - 1.0);
297  rVolumetricDensityFunction -= rMaterial.GetLameLambda() * 0.5 * std::log( rVariables.Strain.Invariants.J );
298  rVolumetricDensityFunction -= rMaterial.GetLameMu() * std::log( rVariables.Strain.Invariants.J );
299 
300  KRATOS_CATCH(" ")
301  }
302 
303  //************// dW
304 
305  double& GetFunction1stI1Derivative(HyperElasticDataType& rVariables, double& rDerivative) override //dW/dI1
306  {
307  KRATOS_TRY
308 
309  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
310  rDerivative = rMaterial.GetModelParameters()[0];
311 
312  return rDerivative;
313 
314  KRATOS_CATCH(" ")
315  }
316 
317  double& GetFunction1stI2Derivative(HyperElasticDataType& rVariables, double& rDerivative) override //dW/dI2
318  {
319  KRATOS_TRY
320 
321  rDerivative = 0.0;
322 
323  return rDerivative;
324 
325  KRATOS_CATCH(" ")
326  }
327 
328  double& GetFunction1stI3Derivative(HyperElasticDataType& rVariables, double& rDerivative) override //dW/dI3
329  {
330  KRATOS_TRY
331 
332  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
333 
334  //derivative of "g(J) = (lambda/4)*(J²-1) - (lamda/2)*lnJ - (mu)*lnJ"
335  //dg(J)/dI3 = (lambda/4) - (lambda/2)*(1/J²)/2 - (mu)*(1/J²)/2
336  rDerivative = rMaterial.GetLameLambda();
337  rDerivative += 2.0 * rMaterial.GetLameMu();
338  rDerivative /= -rVariables.Strain.Invariants.I3;
339  rDerivative += rMaterial.GetLameLambda();
340  rDerivative *= 0.25;
341 
342  return rDerivative;
343 
344  KRATOS_CATCH(" ")
345  }
346 
347 
348  double& GetFunction2ndI1Derivative(HyperElasticDataType& rVariables, double& rDerivative) override //ddW/dI1dI1
349  {
350  KRATOS_TRY
351 
352  rDerivative = 0.0;
353 
354  return rDerivative;
355 
356  KRATOS_CATCH(" ")
357  }
358 
359  double& GetFunction2ndI2Derivative(HyperElasticDataType& rVariables, double& rDerivative) override //ddW/dI2dI2
360  {
361  KRATOS_TRY
362 
363  rDerivative = 0.0;
364 
365  return rDerivative;
366 
367  KRATOS_CATCH(" ")
368  }
369 
370  double& GetFunction2ndI3Derivative(HyperElasticDataType& rVariables, double& rDerivative) override //ddW/dI3dI3
371  {
372  KRATOS_TRY
373 
374  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
375 
376  //ddg(J)/dI3dI3 = (lambda/4)*(1/J⁴) + (mu/2)*(1/J⁴)
377  rDerivative = 0.25 * rMaterial.GetLameLambda();
378  rDerivative += 0.5 * rMaterial.GetLameMu();
379  rDerivative /= (rVariables.Strain.Invariants.I3 * rVariables.Strain.Invariants.I3);
380 
381  return rDerivative;
382 
383  KRATOS_CATCH(" ")
384  }
385 
386 
390 
391 
395 
396 
400 
401 
403 
404  private:
405 
408 
409 
413 
414 
418 
419 
423 
424 
428 
429 
433  friend class Serializer;
434 
435 
436  void save(Serializer& rSerializer) const override
437  {
439  }
440 
441  void load(Serializer& rSerializer) override
442  {
444  }
445 
449 
450 
454 
456 
457  }; // Class NeoHookeanModel
458 
460 
463 
464 
468 
469 
471 
473 
474 } // namespace Kratos.
475 
476 #endif // KRATOS_NEO_HOOKEAN_MODEL_H_INCLUDED defined
Short class definition.
Definition: mooney_rivlin_model.hpp:50
int Check(const Properties &rProperties, const ProcessInfo &rCurrentProcessInfo) override
Definition: mooney_rivlin_model.cpp:947
MooneyRivlinModel & operator=(MooneyRivlinModel const &rOther)
Assignment operator.
Definition: mooney_rivlin_model.cpp:47
Short class definition.
Definition: neo_hookean_model.hpp:48
void CalculateAndAddVolumetricStrainEnergy(HyperElasticDataType &rVariables, double &rVolumetricDensityFunction) override
Definition: neo_hookean_model.hpp:289
double & GetFunction1stI1Derivative(HyperElasticDataType &rVariables, double &rDerivative) override
Definition: neo_hookean_model.hpp:305
void CalculateStrainEnergy(ModelDataType &rValues, double &rDensityFunction) override
Definition: neo_hookean_model.hpp:93
int Check(const Properties &rProperties, const ProcessInfo &rCurrentProcessInfo) override
Definition: neo_hookean_model.hpp:109
std::string Info() const override
Turn back information as a string.
Definition: neo_hookean_model.hpp:141
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: neo_hookean_model.hpp:149
~NeoHookeanModel() override
Destructor.
Definition: neo_hookean_model.hpp:81
NeoHookeanModel & operator=(NeoHookeanModel const &rOther)
Assignment operator.
Definition: neo_hookean_model.hpp:68
double & GetFunction2ndI2Derivative(HyperElasticDataType &rVariables, double &rDerivative) override
Definition: neo_hookean_model.hpp:359
KRATOS_CLASS_POINTER_DEFINITION(NeoHookeanModel)
Pointer definition of NeoHookeanModel.
double & GetFunction2ndI3Derivative(HyperElasticDataType &rVariables, double &rDerivative) override
Definition: neo_hookean_model.hpp:370
virtual void CalculateVolumetricFactor(HyperElasticDataType &rVariables, double &rFactor)
Definition: neo_hookean_model.hpp:188
double & GetFunction1stI2Derivative(HyperElasticDataType &rVariables, double &rDerivative) override
Definition: neo_hookean_model.hpp:317
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: neo_hookean_model.hpp:155
NeoHookeanModel(NeoHookeanModel const &rOther)
Copy constructor.
Definition: neo_hookean_model.hpp:65
virtual void CalculateConstitutiveMatrixFactor(HyperElasticDataType &rVariables, double &rFactor)
Definition: neo_hookean_model.hpp:197
ConstitutiveModel::Pointer Clone() const override
Clone.
Definition: neo_hookean_model.hpp:75
double & GetFunction2ndI1Derivative(HyperElasticDataType &rVariables, double &rDerivative) override
Definition: neo_hookean_model.hpp:348
double & GetFunction1stI3Derivative(HyperElasticDataType &rVariables, double &rDerivative) override
Definition: neo_hookean_model.hpp:328
NeoHookeanModel()
Default constructor.
Definition: neo_hookean_model.hpp:62
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
#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
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
def load(f)
Definition: ode_solve.py:307
Definition: constitutive_model_data.hpp:92
const double & GetLameLambda() const
Definition: constitutive_model_data.hpp:113
const std::vector< double > & GetModelParameters() const
Definition: constitutive_model_data.hpp:116
Definition: constitutive_model_data.hpp:383
MaterialData MaterialParameters
Definition: constitutive_model_data.hpp:403
Definition: hyper_elastic_model.hpp:108
StrainData Strain
Definition: hyper_elastic_model.hpp:117
const MaterialDataType & GetMaterialParameters() const
Definition: hyper_elastic_model.hpp:125
StrainInvariants Invariants
Definition: hyper_elastic_model.hpp:98
double J
Definition: hyper_elastic_model.hpp:60
double I3
Definition: hyper_elastic_model.hpp:58