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.
plasticity_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_PLASTICITY_MODEL_H_INCLUDED )
11 #define KRATOS_PLASTICITY_MODEL_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
20 
21 namespace Kratos
22 {
25 
28 
32 
36 
40 
44 
46 
48  template<class TElasticityModel, class TYieldSurface>
50  {
51  public:
52 
55 
56  //elasticity model
57  typedef TElasticityModel ElasticityModelType;
58 
59  //yield surface
60  typedef TYieldSurface YieldSurfaceType;
61 
62  //common types
68  typedef typename TYieldSurface::PlasticDataType PlasticDataType;
69  typedef typename TYieldSurface::InternalVariablesType InternalVariablesType;
70 
73 
77 
80 
83 
86  {
90  return *this;
91  }
92 
94  ConstitutiveModel::Pointer Clone() const override
95  {
96  return Kratos::make_shared<PlasticityModel>(*this);
97  }
98 
100  ~PlasticityModel() override {}
101 
102 
106 
107 
111 
115  void InitializeMaterial(const Properties& rProperties) override
116  {
117  KRATOS_TRY
118 
119  mElasticityModel.InitializeMaterial(rProperties);
120 
121  KRATOS_CATCH(" ")
122  }
123 
127  void InitializeModel(ModelDataType& rValues) override
128  {
129  KRATOS_TRY
130 
131  mElasticityModel.InitializeModel(rValues);
132 
133  KRATOS_CATCH(" ")
134  }
135 
139  void FinalizeModel(ModelDataType& rValues) override
140  {
141  KRATOS_TRY
142 
143  mElasticityModel.FinalizeModel(rValues);
144 
145  KRATOS_CATCH(" ")
146  }
147 
148 
153  void CalculateStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override
154  {
155  KRATOS_TRY
156 
157  KRATOS_ERROR << "calling the PlasticityModel base class ... illegal operation" << std::endl;
158 
159  KRATOS_CATCH(" ")
160  }
161 
162  void CalculateIsochoricStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override
163  {
164  KRATOS_TRY
165 
166  KRATOS_ERROR << "calling the PlasticityModel base class ... illegal operation" << std::endl;
167 
168  KRATOS_CATCH(" ")
169  }
170 
171  void CalculateVolumetricStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override
172  {
173  KRATOS_TRY
174 
175  mElasticityModel.CalculateVolumetricStressTensor(rValues,rStressMatrix);
176 
177  KRATOS_CATCH(" ")
178  }
179 
180 
184  void CalculateConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override
185  {
186  KRATOS_ERROR << "calling PlasticityModel base class " << std::endl;
187  }
188 
189  void CalculateIsochoricConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override
190  {
191  KRATOS_ERROR << "calling PlasticityModel base class " << std::endl;
192  }
193 
194  void CalculateVolumetricConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override
195  {
196  KRATOS_TRY
197 
198  mElasticityModel.CalculateVolumetricConstitutiveTensor(rValues,rConstitutiveMatrix);
199 
200  KRATOS_CATCH(" ")
201  }
202 
203 
207  void CalculateStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override
208  {
209  KRATOS_ERROR << "calling PlasticityModel base class " << std::endl;
210  }
211 
212  void CalculateIsochoricStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override
213  {
214  KRATOS_ERROR << "calling PlasticityModel base class " << std::endl;
215  }
216 
217  void CalculateVolumetricStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override
218  {
219  KRATOS_ERROR << "calling PlasticityModel base class " << std::endl;
220  }
221 
222 
226  int Check(const Properties& rProperties, const ProcessInfo& rCurrentProcessInfo) override
227  {
228  KRATOS_TRY
229 
230  // if(YOUNG_MODULUS.Key() == 0 || rProperties[YOUNG_MODULUS]<= 0.00)
231  // KRATOS_ERROR << "YOUNG_MODULUS has Key zero or invalid value" << std::endl;
232 
233  // const double& nu = rProperties[POISSON_RATIO];
234  // const bool check = bool( (nu >0.499 && nu<0.501 ) || (nu < -0.999 && nu > -1.01 ) );
235 
236  // if(POISSON_RATIO.Key() == 0 || check==true)
237  // KRATOS_ERROR << "POISSON_RATIO has Key zero invalid value" << std::endl;
238 
239 
240  if(DENSITY.Key() == 0 || rProperties[DENSITY]<0.00)
241  KRATOS_ERROR << "DENSITY has Key zero or invalid value" << std::endl;
242 
243  mElasticityModel.Check(rProperties, rCurrentProcessInfo);
244 
245  return 0;
246 
247  KRATOS_CATCH(" ")
248  }
249 
253 
259  void GetDomainVariablesList(std::vector<Variable<double> >& rScalarVariables,
260  std::vector<Variable<array_1d<double,3> > >& rComponentVariables) override
261  {
262  KRATOS_TRY
263 
264  mElasticityModel.GetDomainVariablesList(rScalarVariables, rComponentVariables);
265 
266  KRATOS_CATCH(" ")
267  }
268 
269 
273  bool Has(const Variable<double>& rThisVariable) override {return false;}
274 
278  void SetValue(const Variable<double>& rVariable,
279  const double& rValue,
280  const ProcessInfo& rCurrentProcessInfo) override {}
284  double& GetValue(const Variable<double>& rThisVariable, double& rValue) override { rValue=0; return rValue;}
285 
286 
287 
289 
293 
294 
298 
300  std::string Info() const override
301  {
302  std::stringstream buffer;
303  buffer << "PlasticityModel" ;
304  return buffer.str();
305  }
306 
308  void PrintInfo(std::ostream& rOStream) const override
309  {
310  rOStream << "PlasticityModel";
311  }
312 
314  void PrintData(std::ostream& rOStream) const override
315  {
316  rOStream << "PlasticityModel Data";
317  }
318 
322 
323 
325 
326  protected:
329 
330 
334 
337 
341 
342 
346 
347  //set internal variables for output print
348 
349  virtual void SetInternalVariables(ModelDataType& rValues, PlasticDataType& rVariables)
350  {
351  KRATOS_TRY
352 
353  KRATOS_CATCH(" ")
354  }
355 
359 
360 
364 
365 
369 
370 
372 
373  private:
376 
377 
381 
382 
386 
387 
391 
392 
396 
397 
401 
402 
406  friend class Serializer;
407 
408  void save(Serializer& rSerializer) const override
409  {
411 
412  rSerializer.save("mElasticityModel",mElasticityModel);
413  rSerializer.save("mYieldSurface",mYieldSurface);
414  }
415 
416  void load(Serializer& rSerializer) override
417  {
419 
420  rSerializer.load("mElasticityModel",mElasticityModel);
421  rSerializer.load("mYieldSurface",mYieldSurface);
422  }
423 
427 
428 
430 
431  }; // Class PlasticityModel
432 
434 
437 
438 
442 
443 
447 
448 
450 
452 
453 
454 } // namespace Kratos.
455 
456 #endif // KRATOS_PLASTICITY_MODEL_H_INCLUDED defined
std::size_t SizeType
Definition: constitutive_model_data.hpp:60
const unsigned int(*)[2] VoigtIndexType
Definition: constitutive_model_data.hpp:59
Short class definition.
Definition: constitutive_model.hpp:52
ConstitutiveModel & operator=(ConstitutiveModel const &rOther)
Assignment operator.
Definition: constitutive_model.cpp:45
Definition: amatrix_interface.h:41
Short class definition.
Definition: plasticity_model.hpp:50
YieldSurfaceType mYieldSurface
Definition: plasticity_model.hpp:336
void CalculateIsochoricStressAndConstitutiveTensors(ModelDataType &rValues, MatrixType &rStressMatrix, Matrix &rConstitutiveMatrix) override
Definition: plasticity_model.hpp:212
void GetDomainVariablesList(std::vector< Variable< double > > &rScalarVariables, std::vector< Variable< array_1d< double, 3 > > > &rComponentVariables) override
Definition: plasticity_model.hpp:259
ElasticityModelType mElasticityModel
Definition: plasticity_model.hpp:335
ElasticityModelType & GetElasticityModel()
Definition: plasticity_model.hpp:288
void FinalizeModel(ModelDataType &rValues) override
Definition: plasticity_model.hpp:139
ConstitutiveModelData::ModelData ModelDataType
Definition: plasticity_model.hpp:67
ConstitutiveModelData::VectorType VectorType
Definition: plasticity_model.hpp:66
void CalculateVolumetricStressAndConstitutiveTensors(ModelDataType &rValues, MatrixType &rStressMatrix, Matrix &rConstitutiveMatrix) override
Definition: plasticity_model.hpp:217
KRATOS_CLASS_POINTER_DEFINITION(PlasticityModel)
Pointer definition of PlasticityModel.
PlasticityModel()
Default constructor.
Definition: plasticity_model.hpp:79
void CalculateIsochoricConstitutiveTensor(ModelDataType &rValues, Matrix &rConstitutiveMatrix) override
Definition: plasticity_model.hpp:189
TYieldSurface YieldSurfaceType
Definition: plasticity_model.hpp:60
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: plasticity_model.hpp:314
void SetValue(const Variable< double > &rVariable, const double &rValue, const ProcessInfo &rCurrentProcessInfo) override
Definition: plasticity_model.hpp:278
void CalculateConstitutiveTensor(ModelDataType &rValues, Matrix &rConstitutiveMatrix) override
Definition: plasticity_model.hpp:184
ConstitutiveModelData::MatrixType MatrixType
Definition: plasticity_model.hpp:65
TYieldSurface::InternalVariablesType InternalVariablesType
Definition: plasticity_model.hpp:69
ConstitutiveModelData::SizeType SizeType
Definition: plasticity_model.hpp:63
void CalculateVolumetricConstitutiveTensor(ModelDataType &rValues, Matrix &rConstitutiveMatrix) override
Definition: plasticity_model.hpp:194
void CalculateIsochoricStressTensor(ModelDataType &rValues, MatrixType &rStressMatrix) override
Definition: plasticity_model.hpp:162
ConstitutiveModelData::VoigtIndexType VoigtIndexType
Definition: plasticity_model.hpp:64
void CalculateStressTensor(ModelDataType &rValues, MatrixType &rStressMatrix) override
Definition: plasticity_model.hpp:153
ConstitutiveModel::Pointer Clone() const override
Clone.
Definition: plasticity_model.hpp:94
double & GetValue(const Variable< double > &rThisVariable, double &rValue) override
Definition: plasticity_model.hpp:284
bool Has(const Variable< double > &rThisVariable) override
Definition: plasticity_model.hpp:273
std::string Info() const override
Turn back information as a string.
Definition: plasticity_model.hpp:300
void InitializeMaterial(const Properties &rProperties) override
Definition: plasticity_model.hpp:115
TElasticityModel ElasticityModelType
Definition: plasticity_model.hpp:57
~PlasticityModel() override
Destructor.
Definition: plasticity_model.hpp:100
void InitializeModel(ModelDataType &rValues) override
Definition: plasticity_model.hpp:127
PlasticityModel & operator=(PlasticityModel const &rOther)
Assignment operator.
Definition: plasticity_model.hpp:85
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: plasticity_model.hpp:308
PlasticityModel(PlasticityModel const &rOther)
Copy constructor.
Definition: plasticity_model.hpp:82
void CalculateStressAndConstitutiveTensors(ModelDataType &rValues, MatrixType &rStressMatrix, Matrix &rConstitutiveMatrix) override
Definition: plasticity_model.hpp:207
int Check(const Properties &rProperties, const ProcessInfo &rCurrentProcessInfo) override
Definition: plasticity_model.hpp:226
void CalculateVolumetricStressTensor(ModelDataType &rValues, MatrixType &rStressMatrix) override
Definition: plasticity_model.hpp:171
TYieldSurface::PlasticDataType PlasticDataType
Definition: plasticity_model.hpp:68
virtual void SetInternalVariables(ModelDataType &rValues, PlasticDataType &rVariables)
Definition: plasticity_model.hpp:349
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
#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:383