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.
particle_flow_rule.hpp
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Ilaria Iaconeta, Bodhinanda Chandra
11 //
12 
13 
14 #if !defined(KRATOS_MPM_FLOW_RULE_H_INCLUDED )
15 #define KRATOS_MPM_FLOW_RULE_H_INCLUDED
16 
17 // System includes
18 #include <string>
19 #include <iostream>
20 
21 // External includes
22 
23 // Project includes
24 #include "includes/define.h"
25 #include "includes/serializer.h"
26 #include "includes/properties.h"
27 #include "utilities/math_utils.h"
28 #include "input_output/logger.h"
29 
32 
33 namespace Kratos
34 {
37 
40 
44 
48 
52 
56 
58 
60 class KRATOS_API(PARTICLE_MECHANICS_APPLICATION) ParticleFlowRule
61 {
62 public:
65 
66  typedef ParticleYieldCriterion::Pointer YieldCriterionPointer;
67 
68  typedef ParticleHardeningLaw::Pointer HardeningLawPointer;
69 
70  typedef const Properties* PropertiesPointer;
71 
72  KRATOS_DEFINE_LOCAL_FLAG( IMPLEX_ACTIVE );
73  KRATOS_DEFINE_LOCAL_FLAG( PLASTIC_REGION );
74  KRATOS_DEFINE_LOCAL_FLAG( PLASTIC_RATE_REGION );
75  KRATOS_DEFINE_LOCAL_FLAG( RETURN_MAPPING_COMPUTED );
76 
78  {
79  double Beta0;
80  double Beta1;
81  double Beta2;
82  double Beta3;
83  double Beta4;
84  double Beta5;
85 
88  };
89 
91  {
94 
95  public:
96 
97  void clear()
98  {
99  PlasticDissipation = 0;
100  DeltaPlasticDissipation = 0;
101  }
102 
103  void print()
104  {
105  KRATOS_INFO("ParticleFlowRule.ThermalVariables") << "PlasticDissipation = " << PlasticDissipation <<std::endl;
106  KRATOS_INFO("ParticleFlowRule.ThermalVariables") << "DeltaPlasticDissipation = " << DeltaPlasticDissipation <<std::endl;
107  }
108 
109  private:
110 
111  friend class Serializer;
112 
113  // A private default constructor necessary for serialization
114  void save(Serializer& rSerializer) const
115  {
116  rSerializer.save("PlasticDissipation",PlasticDissipation);
117  rSerializer.save("DeltaPlasticDissipation",DeltaPlasticDissipation);
118  };
119 
120  void load(Serializer& rSerializer)
121  {
122  rSerializer.load("PlasticDissipation",PlasticDissipation);
123  rSerializer.load("DeltaPlasticDissipation",DeltaPlasticDissipation);
124  };
125 
126  };
127 
128 
130  {
132 
135  double TraceStress;
136 
137  double DeltaGamma;
138  double DeltaBeta;
139 
140  double LameMu_bar;
141  double Friction;
142  double Dilatancy;
143  double BulkModulus;
144  double DeltaTime;
145 
147 
148  double Temperature;
149 
151 
152  Matrix TrialIsoStressMatrix = ZeroMatrix(3,3);
153 
154  Matrix StrainMatrix = ZeroMatrix(3,3);
155 
156  Matrix MainDirections = IdentityMatrix(3);
157 
159 
160  public:
161 
162  void clear()
163  {
164  NormIsochoricStress = 0;
165  TrialStateFunction = 0;
166  TraceStress = 0;
167 
168  DeltaGamma = 0;
169  DeltaBeta = 0;
170 
171  LameMu_bar = 0;
172  Friction = 0;
173  Dilatancy = 0;
174  BulkModulus = 0;
175  DeltaTime = 1;
176  Temperature = 0;
177  }
178 
179  void initialize()
180  {
181  Options.Set(IMPLEX_ACTIVE,false);
182  Options.Set(PLASTIC_REGION,false);
183  Options.Set(PLASTIC_RATE_REGION,false);
184  Options.Set(RETURN_MAPPING_COMPUTED,false);
185 
186  clear();
187  }
188 
189  };
190 
192  {
200 
201  double LameMu_bar;
202  double Friction;
203  double Dilatancy;
204  double BulkModulus;
205  //needed in IMPLEX calculation
207 
208  public:
209 
210  void clear()
211  {
212  EquivalentPlasticStrain = 0;
213  AccumulatedPlasticVolumetricStrain = 0;
214  AccumulatedPlasticDeviatoricStrain = 0;
215  DeltaPlasticStrain = 0;
216  DeltaPlasticVolumetricStrain = 0;
217  DeltaPlasticDeviatoricStrain = 0;
218  Normal.clear();
219  LameMu_bar = 0;
220  Friction = 0;
221  Dilatancy = 0;
222  BulkModulus = 0;
223  EquivalentPlasticStrainOld = 0;
224  }
225 
226  void print()
227  {
228  KRATOS_INFO("ParticleFlowRule.InternalVariables") << " EquivalentPlasticStrain: "<<EquivalentPlasticStrain<<std::endl;
229  KRATOS_INFO("ParticleFlowRule.InternalVariables") << " DeltaPlasticStrain: "<<DeltaPlasticStrain<<std::endl;
230  KRATOS_INFO("ParticleFlowRule.InternalVariables") << " AccumulatedPlasticVolumetricStrain: "<<AccumulatedPlasticVolumetricStrain<<std::endl;
231  KRATOS_INFO("ParticleFlowRule.InternalVariables") << " DeltaPlasticVolumetricStrain: "<<DeltaPlasticVolumetricStrain<<std::endl;
232  KRATOS_INFO("ParticleFlowRule.InternalVariables") << " AccumulatedPlasticDeviatoricStrain: "<<AccumulatedPlasticDeviatoricStrain<<std::endl;
233  KRATOS_INFO("ParticleFlowRule.InternalVariables") << " DeltaPlasticDeviatoricStrain: "<<DeltaPlasticDeviatoricStrain<<std::endl;
234  KRATOS_INFO("ParticleFlowRule.InternalVariables") << " EquivalentPlasticStrainOld: "<<EquivalentPlasticStrainOld<<std::endl;
235  }
236 
237  private:
238 
239  friend class Serializer;
240 
241  // A private default constructor necessary for serialization
242  void save(Serializer& rSerializer) const
243  {
244  rSerializer.save("EquivalentPlasticStrain",EquivalentPlasticStrain);
245  rSerializer.save("DeltaPlasticStrain",DeltaPlasticStrain);
246  rSerializer.save("AccumulatedPlasticVolumetricStrain",AccumulatedPlasticVolumetricStrain);
247  rSerializer.save("DeltaPlasticVolumetricStrain",DeltaPlasticVolumetricStrain);
248  rSerializer.save("AccumulatedPlasticDeviatoricStrain",AccumulatedPlasticDeviatoricStrain);
249  rSerializer.save("DeltaPlasticDeviatoricStrain",DeltaPlasticDeviatoricStrain);
250  rSerializer.save("EquivalentPlasticStrainOld",EquivalentPlasticStrainOld);
251  };
252 
253  void load(Serializer& rSerializer)
254  {
255  rSerializer.load("EquivalentPlasticStrain",EquivalentPlasticStrain);
256  rSerializer.load("DeltaPlasticStrain",DeltaPlasticStrain);
257  rSerializer.load("AccumulatedPlasticVolumetricStrain",AccumulatedPlasticVolumetricStrain);
258  rSerializer.load("DeltaPlasticVolumetricStrain",DeltaPlasticVolumetricStrain);
259  rSerializer.load("AccumulatedPlasticDeviatoricStrain",AccumulatedPlasticDeviatoricStrain);
260  rSerializer.load("DeltaPlasticDeviatoricStrain",DeltaPlasticDeviatoricStrain);
261  rSerializer.load("EquivalentPlasticStrainOld",EquivalentPlasticStrainOld);
262  };
263  };
264 
265 
268 
272 
275  {
276  };
277 
280  :mpYieldCriterion(pYieldCriterion)
281  {
282  };
283 
286  :mInternalVariables(rOther.mInternalVariables)
287  ,mThermalVariables(rOther.mThermalVariables)
288  ,mpYieldCriterion(rOther.mpYieldCriterion)
289  //,mpHardeningLaw(rOther.mpHardeningLaw)
290  //,mpProperties(rOther.mpProperties)
291  {
292  };
293 
294 
297  {
298  mInternalVariables = rOther.mInternalVariables;
299  mThermalVariables = rOther.mThermalVariables;
300  mpYieldCriterion = rOther.mpYieldCriterion;
301  //mpHardeningLaw = rOther.mpHardeningLaw;
302  //mpProperties = rOther.mpProperties;
303 
304  return *this;
305  };
306 
308  virtual ~ParticleFlowRule() {};
309 
310 
314 
315 
320  virtual ParticleFlowRule::Pointer Clone() const
321  {
322  ParticleFlowRule::Pointer p_clone(new ParticleFlowRule(*this));
323  return p_clone;
324  }
325 
326 
330 
331  virtual void InitializeMaterial (YieldCriterionPointer& pYieldCriterion, HardeningLawPointer& pHardeningLaw, const Properties& rMaterialProperties)
332  {
333  // Set yield criterion
334  mpYieldCriterion = pYieldCriterion;
335  mpYieldCriterion->InitializeMaterial(pHardeningLaw, rMaterialProperties);
336 
337  // Initialize material variables
338  mInternalVariables.clear();
339  mThermalVariables.clear();
340 
341  };
342 
343  virtual void InitializeMaterial (const Properties& rMaterialProperties)
344  {
345 
346  // Initialize material variables
347  mInternalVariables.clear();
348  mThermalVariables.clear();
349 
350  };
351 
352 
354  {
355  return mInternalVariables;
356  };
357 
359  {
360  return mThermalVariables;
361  };
362 
363  virtual bool CalculateReturnMapping( RadialReturnVariables& rReturnMappingVariables, Matrix& rIsoStressMatrix, const Properties& rProp )
364  {
365  KRATOS_ERROR << "Calling the base class function (CalculateReturnMapping) in MPM FlowRule:: illegal operation!" << std::endl;
366  return 0;
367  };
368 
369  virtual bool CalculateReturnMapping( RadialReturnVariables& rReturnMappingVariables, const Matrix& rIncrementalDeformationGradient, Matrix& rStressMatrix, Matrix& rNewElasticLeftCauchyGreen, const Properties& rProp)
370  {
371  KRATOS_ERROR << "Calling the base class function (CalculateReturnMapping) in MPM FlowRule:: illegal operation!" << std::endl;
372  return 0;
373  };
374 
375  virtual void ComputeElastoPlasticTangentMatrix( const RadialReturnVariables& rReturnMappingVariables, const Matrix& rElasticLeftCauchyGreen, const double& rAlpha, Matrix& rElastoPlasticMatrix, const Properties& rProp)
376  {
377  KRATOS_ERROR << "Calling the base class function (ComputeElastoPlasticTangentMatrix) in MPM FlowRule:: illegal operation!" << std::endl;
378  };
379 
380  virtual void CalculateScalingFactors(const RadialReturnVariables& rReturnMappingVariables, PlasticFactors& rScalingFactors )
381  {
382  KRATOS_ERROR << "Calling the base class function (CalculateScalingFactors) in MPM FlowRule:: illegal operation!" << std::endl;
383  };
384 
385  virtual bool UpdateInternalVariables( RadialReturnVariables& rReturnMappingVariables, const Properties& rProp )
386  {
387  KRATOS_ERROR << "Calling the base class function (UpdateInternalVariables) in MPM FlowRule:: illegal operation!" << std::endl;
388 
389  return 0;
390  };
391 
392  virtual Matrix GetElasticLeftCauchyGreen( RadialReturnVariables& rReturnMappingVariables )
393  {
394  KRATOS_ERROR << "Calling the base class function (GetElasticLeftCauchyGreen) in MPM FlowRule:: illegal operation!" << std::endl;
395  };
396 
397  virtual unsigned int GetPlasticRegion()
398  {
399  KRATOS_ERROR << "Calling the base class function (GetPlasticRegion) in MPM FlowRule:: illegal operation!" << std::endl;
400  };
401 
402  virtual void CalculatePrincipalStressTrial(const RadialReturnVariables& rReturnMappingVariables, const Matrix& rNewElasticLeftCauchyGreen, Matrix& rStressMatrix, const Properties& rProp)
403  {
404  KRATOS_ERROR << "Calling the base class function (CalculatePrincipalStressTrial) in MPM FlowRule:: illegal operation!" << std::endl;
405  };
406 
407 
411 
412 
416 
417 
421 
422  // /// Turn back information as a string.
423  // virtual std::string Info() const;
424 
425  // /// Print information about this object.
426  // virtual void PrintInfo(std::ostream& rOStream) const;
427 
428  // /// Print object's data.
429  // virtual void PrintData(std::ostream& rOStream) const;
430 
431 
435 
436 
438 
439 protected:
442 
443 
447 
450 
452 
453  //HardeningLawPointer mpHardeningLaw;
454  //PropertiesPointer mpProperties;
455 
459 
460 
464 
465  virtual double& CalculateStressNorm ( Matrix & rStressMatrix, double& rStressNorm )
466  {
467  KRATOS_ERROR << "Calling the base class function (CalculateStressNorm) in MPM FlowRule:: illegal operation!" << std::endl;
468 
469  return rStressNorm;
470  };
471 
472 
476 
477 
481 
482 
486 
487 
489 
490 private:
493 
494 
498 
499 
503 
504 
508 
509 
513 
514 
518  friend class Serializer;
519 
520  // A private default constructor necessary for serialization
521 
522  virtual void save(Serializer& rSerializer) const
523  {
524  rSerializer.save("InternalVariables",mInternalVariables);
525  rSerializer.save("ThermalVariables",mThermalVariables);
526  rSerializer.save("ParticleYieldCriterion",mpYieldCriterion);
527  };
528 
529  virtual void load(Serializer& rSerializer)
530  {
531  rSerializer.load("InternalVariables",mInternalVariables);
532  rSerializer.load("ThermalVariables",mThermalVariables);
533  rSerializer.load("ParticleYieldCriterion",mpYieldCriterion);
534  };
535 
539 
540 
544 
545 
547 
548 }; // Class FlowRule
549 
551 
554 
555 
559 
560 
561 // /// input stream function
562 // inline std::istream& operator >> (std::istream& rIStream,
563 // FlowRule& rThis);
564 
565 // /// output stream function
566 // inline std::ostream& operator << (std::ostream& rOStream,
567 // const FlowRule& rThis)
568 // {
569 // rThis.PrintInfo(rOStream);
570 // rOStream << std::endl;
571 // rThis.PrintData(rOStream);
572 
573 // return rOStream;
574 // }
576 
578 
579 
580 
584 
586 
587 
588 } // namespace Kratos.
589 
590 #endif // KRATOS_MPM_FLOW_RULE_H_INCLUDED defined
591 
592 
Definition: flags.h:58
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
void clear()
Definition: amatrix_interface.h:284
Short class definition.
Definition: particle_flow_rule.hpp:61
ParticleFlowRule & operator=(ParticleFlowRule const &rOther)
Assignment operator.
Definition: particle_flow_rule.hpp:296
KRATOS_DEFINE_LOCAL_FLAG(PLASTIC_RATE_REGION)
virtual ParticleFlowRule::Pointer Clone() const
Definition: particle_flow_rule.hpp:320
virtual bool CalculateReturnMapping(RadialReturnVariables &rReturnMappingVariables, const Matrix &rIncrementalDeformationGradient, Matrix &rStressMatrix, Matrix &rNewElasticLeftCauchyGreen, const Properties &rProp)
Definition: particle_flow_rule.hpp:369
virtual void ComputeElastoPlasticTangentMatrix(const RadialReturnVariables &rReturnMappingVariables, const Matrix &rElasticLeftCauchyGreen, const double &rAlpha, Matrix &rElastoPlasticMatrix, const Properties &rProp)
Definition: particle_flow_rule.hpp:375
ParticleFlowRule()
Default constructor.
Definition: particle_flow_rule.hpp:274
virtual bool UpdateInternalVariables(RadialReturnVariables &rReturnMappingVariables, const Properties &rProp)
Definition: particle_flow_rule.hpp:385
KRATOS_DEFINE_LOCAL_FLAG(IMPLEX_ACTIVE)
virtual double & CalculateStressNorm(Matrix &rStressMatrix, double &rStressNorm)
Definition: particle_flow_rule.hpp:465
ParticleFlowRule(YieldCriterionPointer pYieldCriterion)
Initialization constructor.
Definition: particle_flow_rule.hpp:279
virtual void CalculatePrincipalStressTrial(const RadialReturnVariables &rReturnMappingVariables, const Matrix &rNewElasticLeftCauchyGreen, Matrix &rStressMatrix, const Properties &rProp)
Definition: particle_flow_rule.hpp:402
const InternalVariables & GetInternalVariables()
Definition: particle_flow_rule.hpp:353
YieldCriterionPointer mpYieldCriterion
Definition: particle_flow_rule.hpp:451
KRATOS_DEFINE_LOCAL_FLAG(RETURN_MAPPING_COMPUTED)
const ThermalVariables & GetThermalVariables()
Definition: particle_flow_rule.hpp:358
KRATOS_DEFINE_LOCAL_FLAG(PLASTIC_REGION)
ParticleFlowRule(ParticleFlowRule const &rOther)
Copy constructor.
Definition: particle_flow_rule.hpp:285
virtual bool CalculateReturnMapping(RadialReturnVariables &rReturnMappingVariables, Matrix &rIsoStressMatrix, const Properties &rProp)
Definition: particle_flow_rule.hpp:363
const Properties * PropertiesPointer
Definition: particle_flow_rule.hpp:70
KRATOS_CLASS_POINTER_DEFINITION(ParticleFlowRule)
Pointer definition of FlowRule.
ThermalVariables mThermalVariables
Definition: particle_flow_rule.hpp:449
ParticleYieldCriterion::Pointer YieldCriterionPointer
Definition: particle_flow_rule.hpp:66
virtual void CalculateScalingFactors(const RadialReturnVariables &rReturnMappingVariables, PlasticFactors &rScalingFactors)
Definition: particle_flow_rule.hpp:380
virtual void InitializeMaterial(YieldCriterionPointer &pYieldCriterion, HardeningLawPointer &pHardeningLaw, const Properties &rMaterialProperties)
Definition: particle_flow_rule.hpp:331
virtual ~ParticleFlowRule()
Destructor.
Definition: particle_flow_rule.hpp:308
ParticleHardeningLaw::Pointer HardeningLawPointer
Definition: particle_flow_rule.hpp:68
virtual Matrix GetElasticLeftCauchyGreen(RadialReturnVariables &rReturnMappingVariables)
Definition: particle_flow_rule.hpp:392
virtual void InitializeMaterial(const Properties &rMaterialProperties)
Definition: particle_flow_rule.hpp:343
InternalVariables mInternalVariables
Definition: particle_flow_rule.hpp:448
virtual unsigned int GetPlasticRegion()
Definition: particle_flow_rule.hpp:397
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_ERROR
Definition: exception.h:161
#define KRATOS_INFO(label)
Definition: logger.h:250
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
def load(f)
Definition: ode_solve.py:307
Definition: particle_flow_rule.hpp:192
double EquivalentPlasticStrainOld
Definition: particle_flow_rule.hpp:206
double Friction
Definition: particle_flow_rule.hpp:202
double BulkModulus
Definition: particle_flow_rule.hpp:204
double DeltaPlasticVolumetricStrain
Definition: particle_flow_rule.hpp:197
double LameMu_bar
Definition: particle_flow_rule.hpp:201
void print()
Definition: particle_flow_rule.hpp:226
double DeltaPlasticStrain
Definition: particle_flow_rule.hpp:194
double DeltaPlasticDeviatoricStrain
Definition: particle_flow_rule.hpp:198
double EquivalentPlasticStrain
Definition: particle_flow_rule.hpp:193
Matrix Normal
Definition: particle_flow_rule.hpp:199
double Dilatancy
Definition: particle_flow_rule.hpp:203
void clear()
Definition: particle_flow_rule.hpp:210
double AccumulatedPlasticDeviatoricStrain
Definition: particle_flow_rule.hpp:196
double AccumulatedPlasticVolumetricStrain
Definition: particle_flow_rule.hpp:195
Definition: particle_flow_rule.hpp:78
double Beta5
Definition: particle_flow_rule.hpp:84
Matrix Dev_Normal
Definition: particle_flow_rule.hpp:87
double Beta2
Definition: particle_flow_rule.hpp:81
double Beta1
Definition: particle_flow_rule.hpp:80
double Beta0
Definition: particle_flow_rule.hpp:79
Matrix Normal
Definition: particle_flow_rule.hpp:86
double Beta4
Definition: particle_flow_rule.hpp:83
double Beta3
Definition: particle_flow_rule.hpp:82
Definition: particle_flow_rule.hpp:130
void clear()
Definition: particle_flow_rule.hpp:162
double Temperature
Definition: particle_flow_rule.hpp:148
double CharacteristicSize
Definition: particle_flow_rule.hpp:150
double BulkModulus
Definition: particle_flow_rule.hpp:143
double LameMu_bar
Definition: particle_flow_rule.hpp:140
Flags Options
Definition: particle_flow_rule.hpp:131
double DeltaGamma
Definition: particle_flow_rule.hpp:137
double DeltaTime
Definition: particle_flow_rule.hpp:144
ThermalVariables Thermal
Definition: particle_flow_rule.hpp:158
double IncrementalPlasticShearStrain
Definition: particle_flow_rule.hpp:146
double Friction
Definition: particle_flow_rule.hpp:141
void initialize()
Definition: particle_flow_rule.hpp:179
double TrialStateFunction
Definition: particle_flow_rule.hpp:134
double Dilatancy
Definition: particle_flow_rule.hpp:142
double TraceStress
Definition: particle_flow_rule.hpp:135
double DeltaBeta
Definition: particle_flow_rule.hpp:138
double NormIsochoricStress
Definition: particle_flow_rule.hpp:133
Definition: particle_flow_rule.hpp:91
void print()
Definition: particle_flow_rule.hpp:103
double DeltaPlasticDissipation
Definition: particle_flow_rule.hpp:93
void clear()
Definition: particle_flow_rule.hpp:97
double PlasticDissipation
Definition: particle_flow_rule.hpp:92