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.
linear_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_LINEAR_ELASTIC_MODEL_H_INCLUDED )
11 #define KRATOS_LINEAR_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) LinearElasticModel : public ConstitutiveModel
50  {
51  protected:
52 
54  {
55  private:
56 
57  Flags* mpState;
58  const ModelDataType* mpModelData;
59 
60  public:
61 
63 
64  //Set Data Pointers
65  void SetState (Flags& rState) {mpState = &rState;};
66  void SetModelData (const ModelDataType& rModelData) {mpModelData = &rModelData;};
67 
68  //Get Data Pointers
69  const ModelDataType& GetModelData () const {return *mpModelData;};
70  const MaterialDataType& GetMaterialParameters () const {return mpModelData->GetMaterialParameters();};
71 
72  //Get non const Data
73  Flags& State () {return *mpState;};
74 
75  //Get const Data
76  const Flags& GetState () const {return *mpState;};
77 
78  };
79 
80 
81  public:
82 
86 
87 
90 
94 
97 
100 
102  ConstitutiveModel::Pointer Clone() const override;
103 
106 
108  ~LinearElasticModel() override;
109 
110 
114 
115 
119 
120 
124  void InitializeModel(ModelDataType& rValues) override;
125 
126 
130  void FinalizeModel(ModelDataType& rValues) override;
131 
132 
136  void CalculateStrainEnergy(ModelDataType& rValues, double& rDensityFunction) override;
137 
138 
142  void CalculateStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override;
143 
144  void CalculateIsochoricStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override;
145 
146  void CalculateVolumetricStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override;
147 
148 
149 
153  void CalculateConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override;
154 
155  void CalculateIsochoricConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override;
156 
157  void CalculateVolumetricConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override;
158 
162  void CalculateStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override;
163 
164  void CalculateIsochoricStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override;
165 
166  void CalculateVolumetricStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override;
167 
168 
172  int Check(const Properties& rProperties, const ProcessInfo& rCurrentProcessInfo) override;
173 
177 
178  void SetValue(const Variable<Vector>& rThisVariable, const Vector& rValue,
179  const ProcessInfo& rCurrentProcessInfo ) override
180  {
181  KRATOS_TRY
182 
183  // A method to compute the initial linear strain from the stress is needed
184  //if(rThisVariable == INITIAL_STRESS_VECTOR)
185 
186  // A method to compute the initial linear strain from the stress is needed
187  // if(rThisVariable == INITIAL_STRAIN_VECTOR){
188  // this->mHistoryVector = rValue;
189  // }
190 
191  KRATOS_CATCH(" ")
192  }
193 
194 
195  void SetValue(const Variable<Matrix>& rThisVariable, const Matrix& rValue,
196  const ProcessInfo& rCurrentProcessInfo ) override
197  {
198  KRATOS_TRY
199 
200  // A method to compute the initial linear strain from the stress is needed
201  //if(rThisVariable == INITIAL_STRESS_VECTOR)
202 
203  // A method to compute the initial linear strain from the stress is needed
204  // if(rThisVariable == INITIAL_STRAIN_VECTOR){
205  // this->mHistoryVector = rValue;
206  // }
207 
208  KRATOS_CATCH(" ")
209  }
210 
216  void GetDomainVariablesList(std::vector<Variable<double> >& rScalarVariables,
217  std::vector<Variable<array_1d<double,3> > >& rComponentVariables) override
218  {
219  KRATOS_TRY
220 
221  rComponentVariables.push_back(DISPLACEMENT);
222 
223  KRATOS_CATCH(" ")
224  }
225 
229 
230 
234 
236  std::string Info() const override
237  {
238  std::stringstream buffer;
239  buffer << "LinearElasticModel";
240  return buffer.str();
241  }
242 
244  void PrintInfo(std::ostream& rOStream) const override
245  {
246  rOStream << "LinearElasticModel";
247  }
248 
250  void PrintData(std::ostream& rOStream) const override
251  {
252  rOStream << "LinearElasticModel Data";
253  }
254 
255 
259 
260 
262 
263  protected:
266 
267 
271 
272 
276 
277 
281 
282 
286  virtual void CalculateAndAddStressTensor(ElasticDataType& rVariables, VectorType& rStrainVector, VectorType& rStressVector);
287 
288  virtual void CalculateAndAddIsochoricStressTensor(ElasticDataType& rVariables, VectorType& rStrainVector, VectorType& rStressVector);
289 
290  virtual void CalculateAndAddVolumetricStressTensor(ElasticDataType& rVariables, VectorType& rStrainVector, VectorType& rStressVector);
291 
295  virtual void CalculateAndAddConstitutiveTensor(ElasticDataType& rVariables, Matrix& rConstitutiveMatrix);
296 
297  virtual void CalculateAndAddConstitutiveTensor(ElasticDataType& rVariables);
298 
299  virtual void CalculateAndAddIsochoricConstitutiveTensor(ElasticDataType& rVariables, Matrix& rConstitutiveMatrix);
300 
301  virtual void CalculateAndAddIsochoricConstitutiveTensor(ElasticDataType& rVariables);
302 
303 
304  virtual void CalculateAndAddVolumetricConstitutiveTensor(ElasticDataType& rVariables, Matrix& rConstitutiveMatrix);
305 
306  virtual void CalculateAndAddVolumetricConstitutiveTensor(ElasticDataType& rVariables);
307 
308  //************//
309 
310  void InitializeElasticData(ModelDataType& rValues, ElasticDataType& rVariables);
311 
315 
316 
320 
321 
325 
326 
328 
329  private:
330 
333 
334 
338 
339 
343 
344 
348 
349 
353 
354 
358  friend class Serializer;
359 
360  void save(Serializer& rSerializer) const override
361  {
363  }
364 
365  void load(Serializer& rSerializer) override
366  {
368  }
369 
373 
374 
378 
380 
381  }; // Class LinearElasticModel
382 
384 
387 
388 
392 
394 
396 
397 } // namespace Kratos.
398 
399 #endif // KRATOS_LINEAR_ELASTIC_MODEL_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Short class definition.
Definition: constitutive_model.hpp:52
Definition: flags.h:58
Definition: amatrix_interface.h:41
Short class definition.
Definition: linear_elastic_model.hpp:50
ElasticModelData ElasticDataType
Definition: linear_elastic_model.hpp:85
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: linear_elastic_model.hpp:244
std::string Info() const override
Turn back information as a string.
Definition: linear_elastic_model.hpp:236
void SetValue(const Variable< Vector > &rThisVariable, const Vector &rValue, const ProcessInfo &rCurrentProcessInfo) override
Definition: linear_elastic_model.hpp:178
void GetDomainVariablesList(std::vector< Variable< double > > &rScalarVariables, std::vector< Variable< array_1d< double, 3 > > > &rComponentVariables) override
Definition: linear_elastic_model.hpp:216
void SetValue(const Variable< Matrix > &rThisVariable, const Matrix &rValue, const ProcessInfo &rCurrentProcessInfo) override
Definition: linear_elastic_model.hpp:195
KRATOS_CLASS_POINTER_DEFINITION(LinearElasticModel)
Pointer definition of LinearElasticModel.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: linear_elastic_model.hpp:250
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
def load(f)
Definition: ode_solve.py:307
Definition: constitutive_model_data.hpp:92
Definition: constitutive_model_data.hpp:383
const MaterialData & GetMaterialParameters() const
Definition: constitutive_model_data.hpp:462
Definition: linear_elastic_model.hpp:54
Flags & State()
Definition: linear_elastic_model.hpp:73
void SetModelData(const ModelDataType &rModelData)
Definition: linear_elastic_model.hpp:66
const ModelDataType & GetModelData() const
Definition: linear_elastic_model.hpp:69
const Flags & GetState() const
Definition: linear_elastic_model.hpp:76
BoundedMatrix< double, 6, 6 > ConstitutiveTensor
Definition: linear_elastic_model.hpp:62
void SetState(Flags &rState)
Definition: linear_elastic_model.hpp:65
const MaterialDataType & GetMaterialParameters() const
Definition: linear_elastic_model.hpp:70