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.
isochoric_hypo_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 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_ISOCHORIC_HYPO_ELASTIC_MODEL_H_INCLUDED )
11 #define KRATOS_ISOCHORIC_HYPO_ELASTIC_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) IsochoricHypoElasticModel : public HypoElasticModel
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<IsochoricHypoElasticModel>(*this);
78  }
79 
82 
83 
87 
88 
92 
93 
94  void CalculateStrainEnergy(ModelDataType& rValues, double& rDensityFunction) override
95  {
97 
98  ElasticDataType Variables;
99  this->InitializeElasticData(rValues,Variables);
100 
101  rDensityFunction = 0;
102  this->CalculateAndAddIsochoricStrainEnergy( Variables, rDensityFunction );
103  this->CalculateAndAddVolumetricStrainEnergy( Variables, rDensityFunction );
104 
105 
106  KRATOS_CATCH(" ")
107  }
108 
109 
110  void CalculateStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override
111  {
112  KRATOS_TRY
113 
114  ElasticDataType Variables;
115  this->InitializeElasticData(rValues,Variables);
116 
117  VectorType StrainVector;
118  ConstitutiveModelUtilities::StrainTensorToVector(Variables.StrainMatrix, StrainVector);
119 
120  this->CalculateAndAddConstitutiveTensor(Variables);
121 
122  VectorType StressVector;
123  noalias(StressVector) = ZeroVector(6);
124  this->CalculateAndAddIsochoricStressTensor(Variables,StrainVector,StressVector);
125 
126  rValues.StressMatrix = ConstitutiveModelUtilities::VectorToSymmetricTensor(StressVector,rValues.StressMatrix); //store isochoric stress matrix as StressMatrix
127 
128  this->CalculateAndAddVolumetricStressTensor(Variables,StrainVector,StressVector);
129 
130  rStressMatrix = ConstitutiveModelUtilities::VectorToSymmetricTensor(StressVector,rStressMatrix);
131 
132  // Rate to stress value
133  rStressMatrix *= rValues.GetProcessInfo()[DELTA_TIME];
134 
135  // Isochoric stress stored in the HistoryVector
136  this->AddHistoricalStress(rValues, rStressMatrix);
137 
138  Variables.State().Set(ConstitutiveModelData::STRESS_COMPUTED);
139 
140  KRATOS_CATCH(" ")
141  }
142 
143 
144  void CalculateStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override
145  {
146  KRATOS_TRY
147 
148  ElasticDataType Variables;
149  this->InitializeElasticData(rValues,Variables);
150 
151  VectorType StrainVector;
152  ConstitutiveModelUtilities::StrainTensorToVector(Variables.StrainMatrix, StrainVector);
153 
154  //Calculate Constitutive Matrix
155  this->CalculateAndAddConstitutiveTensor(Variables,rConstitutiveMatrix);
156 
157  //Calculate Stress Matrix
158  VectorType StressVector;
159  noalias(StressVector) = ZeroVector(6);
160  this->CalculateAndAddIsochoricStressTensor(Variables,StrainVector,StressVector);
161 
162  rValues.StressMatrix = ConstitutiveModelUtilities::VectorToSymmetricTensor(StressVector,rValues.StressMatrix); //store isochoric stress matrix as StressMatrix
163 
164  this->CalculateAndAddVolumetricStressTensor(Variables,StrainVector,StressVector);
165 
166  rStressMatrix = ConstitutiveModelUtilities::VectorToSymmetricTensor(StressVector,rStressMatrix);
167 
168  // Rate to stress value
169  rStressMatrix *= rValues.GetProcessInfo()[DELTA_TIME];
170 
171  // Isochoric stress stored in the HistoryVector
172  this->AddHistoricalStress(rValues, rStressMatrix);
173 
174  Variables.State().Set(ConstitutiveModelData::STRESS_COMPUTED);
175 
176  KRATOS_CATCH(" ")
177  }
178 
182 
183 
187 
188 
192 
194  std::string Info() const override
195  {
196  std::stringstream buffer;
197  buffer << "IsochoricHypoElasticModel";
198  return buffer.str();
199  }
200 
202  void PrintInfo(std::ostream& rOStream) const override
203  {
204  rOStream << "IsochoricHypoElasticModel";
205  }
206 
208  void PrintData(std::ostream& rOStream) const override
209  {
210  rOStream << "IsochoricHypoElasticModel Data";
211  }
212 
216 
217 
219 
220  protected:
221 
224 
225 
229 
230 
234 
235 
239 
240 
241  void CalculateAndAddIsochoricStressTensor(ElasticDataType& rVariables, VectorType& rStrainVector, VectorType& rStressVector) override
242  {
243  KRATOS_TRY
244 
245  //total stress
246  VectorType StressVector;
247  this->CalculateAndAddStressTensor(rVariables,rStrainVector,StressVector);
248 
249  //deviatoric stress
250  double MeanStress = (1.0/3.0) * (StressVector[0]+StressVector[1]+StressVector[2]);
251  for (unsigned int i = 0; i < 3; i++)
252  StressVector[i] -= MeanStress;
253 
254  rStressVector += StressVector;
255 
256  KRATOS_CATCH(" ")
257  }
258 
259 
260  void CalculateAndAddVolumetricStressTensor(ElasticDataType& rVariables, VectorType& rStrainVector, VectorType& rStressVector) override
261  {
262  KRATOS_TRY
263 
264  //total stress
265  VectorType StressVector;
266  this->CalculateAndAddStressTensor(rVariables,rStrainVector,StressVector);
267 
268  //volumetric stress
269  double MeanStress = (1.0/3.0) * (StressVector[0]+StressVector[1]+StressVector[2]);
270  for (unsigned int i = 0; i < 3; i++)
271  rStressVector[i] += MeanStress;
272 
273  KRATOS_CATCH(" ")
274  }
275 
276 
277  void CalculateAndAddIsochoricStrainEnergy(ElasticDataType& rVariables, double& rIsochoricDensityFunction) override
278  {
279  KRATOS_TRY
280 
281  KRATOS_ERROR << "calling the class function in IsochoricHypoElasticModel ... illegal operation" << std::endl;
282 
283  KRATOS_CATCH(" ")
284  }
285 
286  void CalculateAndAddVolumetricStrainEnergy(ElasticDataType& rVariables, double& rVolumetricDensityFunction) override
287  {
288  KRATOS_TRY
289 
290  KRATOS_ERROR << "calling the class function in IsochoricHypoElasticModel ... illegal operation" << std::endl;
291 
292  KRATOS_CATCH(" ")
293  }
294 
295 
299 
300 
304 
305 
309 
310 
312 
313  private:
314 
317 
318 
322 
323 
327 
328 
332 
333 
337 
338 
342  friend class Serializer;
343 
344 
345  void save(Serializer& rSerializer) const override
346  {
348  }
349 
350  void load(Serializer& rSerializer) override
351  {
353  }
354 
358 
359 
363 
365 
366  }; // Class IsochoricHypoElasticModel
367 
369 
372 
373 
377 
378 
380 
382 
383 } // namespace Kratos.
384 
385 #endif // KRATOS_ISOCHORIC_HYPO_ELASTIC_MODEL_H_INCLUDED defined
static MatrixType & VectorToSymmetricTensor(const array_1d< double, 6 > &rVector, MatrixType &rMatrix)
Definition: constitutive_model_utilities.hpp:568
static void StrainTensorToVector(const MatrixType &rMatrix, array_1d< double, 6 > &rVector)
Definition: constitutive_model_utilities.hpp:646
Short class definition.
Definition: hypo_elastic_model.hpp:50
HypoElasticModel & operator=(HypoElasticModel const &rOther)
Assignment operator.
Definition: hypo_elastic_model.cpp:46
Definition: amatrix_interface.h:41
Short class definition.
Definition: isochoric_hypo_elastic_model.hpp:48
void CalculateStressTensor(ModelDataType &rValues, MatrixType &rStressMatrix) override
Definition: isochoric_hypo_elastic_model.hpp:110
void CalculateAndAddIsochoricStrainEnergy(ElasticDataType &rVariables, double &rIsochoricDensityFunction) override
Definition: isochoric_hypo_elastic_model.hpp:277
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: isochoric_hypo_elastic_model.hpp:202
std::string Info() const override
Turn back information as a string.
Definition: isochoric_hypo_elastic_model.hpp:194
void CalculateStressAndConstitutiveTensors(ModelDataType &rValues, MatrixType &rStressMatrix, Matrix &rConstitutiveMatrix) override
Definition: isochoric_hypo_elastic_model.hpp:144
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: isochoric_hypo_elastic_model.hpp:208
IsochoricHypoElasticModel & operator=(IsochoricHypoElasticModel const &rOther)
Assignment operator.
Definition: isochoric_hypo_elastic_model.hpp:68
void CalculateAndAddVolumetricStrainEnergy(ElasticDataType &rVariables, double &rVolumetricDensityFunction) override
Definition: isochoric_hypo_elastic_model.hpp:286
KRATOS_CLASS_POINTER_DEFINITION(IsochoricHypoElasticModel)
Pointer definition of IsochoricHypoElasticModel.
IsochoricHypoElasticModel(IsochoricHypoElasticModel const &rOther)
Copy constructor.
Definition: isochoric_hypo_elastic_model.hpp:65
~IsochoricHypoElasticModel() override
Destructor.
Definition: isochoric_hypo_elastic_model.hpp:81
void CalculateAndAddVolumetricStressTensor(ElasticDataType &rVariables, VectorType &rStrainVector, VectorType &rStressVector) override
Definition: isochoric_hypo_elastic_model.hpp:260
ConstitutiveModel::Pointer Clone() const override
Clone.
Definition: isochoric_hypo_elastic_model.hpp:75
IsochoricHypoElasticModel()
Default constructor.
Definition: isochoric_hypo_elastic_model.hpp:62
void CalculateStrainEnergy(ModelDataType &rValues, double &rDensityFunction) override
Definition: isochoric_hypo_elastic_model.hpp:94
void CalculateAndAddIsochoricStressTensor(ElasticDataType &rVariables, VectorType &rStrainVector, VectorType &rStressVector) override
Definition: isochoric_hypo_elastic_model.hpp:241
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
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
def load(f)
Definition: ode_solve.py:307
integer i
Definition: TensorModule.f:17
Definition: constitutive_model_data.hpp:383
const ProcessInfo & GetProcessInfo() const
Definition: constitutive_model_data.hpp:435
MatrixType StressMatrix
Definition: constitutive_model_data.hpp:401
Definition: hypo_elastic_model.hpp:54