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_yield_criterion.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: Bodhinanda Chandra
11 //
12 // References: This class is adapted from applications/SolidMechanicsApplication/custom_constitutive/custom_yield_criteria/yield_criterion.hpp
13 
14 
15 #if !defined(KRATOS_MPM_YIELD_CRITERION_H_INCLUDED)
16 #define KRATOS_MPM_YIELD_CRITERION_H_INCLUDED
17 
18 // System includes
19 
20 // External includes
21 
22 // Project includes
23 #include "includes/serializer.h"
25 
26 namespace Kratos
27 {
30 
33 
37 
41 
45 
49 
51 
53 class KRATOS_API(PARTICLE_MECHANICS_APPLICATION) ParticleYieldCriterion
54 {
55  public:
56  struct Parameters
57  {
58  private:
59 
60  const double* mpStressNorm;
61  ParticleHardeningLaw::Parameters HardeningParameters;
62 
63  public:
64  //Set Parameters
65  void SetStressNorm (const double& rStressNorm) { mpStressNorm = &rStressNorm; };
66 
67  //Get Parameters
68  const double& GetStressNorm () const { return *mpStressNorm; };
69  const ParticleHardeningLaw::Parameters& GetHardeningParameters () const { return HardeningParameters; };
70 
71  //Set Hardening Parameters
72  void SetRateFactor (double rRateFactor) { HardeningParameters.SetRateFactor(rRateFactor); };
73  void SetDeltaTime (const double& rDeltaTime) { HardeningParameters.SetDeltaTime(rDeltaTime); };
74 
75  //Get Hardening Parameters
76  const double& GetRateFactor () const { return HardeningParameters.GetRateFactor(); };
77  const double& GetDeltaTime () const { return HardeningParameters.GetDeltaTime(); };
78 
79  };
80 
83  typedef ParticleHardeningLaw::Pointer HardeningLawPointer;
84 
87 
91 
94  {
95  };
96 
99  :mpHardeningLaw(pHardeningLaw)
100  {
101  };
102 
105  :mpHardeningLaw(rOther.mpHardeningLaw)
106  {
107 
108  };
109 
112  {
113  mpHardeningLaw = rOther.mpHardeningLaw;
114  return *this;
115  }
116 
119 
120 
124 
129  virtual ParticleYieldCriterion::Pointer Clone() const
130  {
131  return Kratos::make_shared<ParticleYieldCriterion>(*this);
132  }
133 
134 
138  void InitializeMaterial (HardeningLawPointer& pHardeningLaw, const Properties& rMaterialProperties)
139  {
140  mpHardeningLaw = pHardeningLaw;
141  }
142 
143 
145  {
146  mpHardeningLaw = (HardeningLawPointer) (&rHardeningLaw);
147  }
148 
150  {
151  mpHardeningLaw = pHardeningLaw;
152  }
153 
155  {
156  return *mpHardeningLaw;
157  }
158 
160  {
161  return mpHardeningLaw;
162  }
163 
164 
165  /*
166  * @brief This function return the yield criterion at the given principal stress condition
167  * @param[in/out] rStateFunction Computed yield criterion
168  * @param[in] rVariables Parameter of yields
169  * @param[in] rPrincipalStress Current principal stress
170  * @param[in] rAlpha Used parameters
171  * @param[in] rBeta Used parameters
172  * @return Yield criterion
173  */
174  virtual double& CalculateYieldCondition(double & rStateFunction, const Parameters& rVariables, const Properties& rProp)
175  {
176  KRATOS_ERROR << "Calling the base class function in ParticleYieldCriterion ... illegal operation!!" << std::endl;
177  return rStateFunction;
178  };
179 
180  virtual double& CalculateYieldCondition(double& rStateFunction, const Vector& rPrincipalStress, const double& rAlpha, const Properties& rProp)
181  {
182  KRATOS_ERROR << "Calling the base class function in ParticleYieldCriterion ... illegal operation!!" << std::endl;
183  };
184 
185  virtual double& CalculateYieldCondition(double& rStateFunction, const Vector& rPrincipalStress, const double& rAlpha, const double& rBeta, const Properties& rProp)
186  {
187  KRATOS_ERROR << "Calling the base class function in ParticleYieldCriterion ... illegal operation!!" << std::endl;
188  };
189 
190 
191  /*
192  * @brief This function return the first derivative of yield criterion at the given principal stress condition
193  * @param[in] rPrincipalStress Principal stresses
194  * @param[in/out] rFirstDerivative First stress derivative value of yield function
195  * @param[in] rAlpha Used parameters
196  * @param[in] rBeta Used parameters
197  */
198  virtual void CalculateYieldFunctionDerivative(const Vector& rPrincipalStress, Vector& rFirstDerivative, const Properties& rProp)
199  {
200  KRATOS_ERROR << "Calling the base class function in ParticleYieldCriterion ... illegal operation!!" << std::endl;
201 
202  };
203 
204  virtual void CalculateYieldFunctionDerivative(const Vector& rPrincipalStress, Vector& rFirstDerivative, const double& rAlpha, const Properties& rProp)
205  {
206  KRATOS_ERROR << "Calling the base class function in ParticleYieldCriterion ... illegal operation!!" << std::endl;
207  };
208 
209  virtual void CalculateYieldFunctionDerivative(const Vector& rPrincipalStress, Vector& rFirstDerivative, const double& rAlpha, const double& rBeta, const Properties& rProp)
210  {
211  KRATOS_ERROR << "Calling the base class function in ParticleYieldCriterion ... illegal operation!!" << std::endl;
212  };
213 
214 
215  /*
216  * @brief This function return the second derivative of yield criterion at the given principal stress condition
217  * @param[in] rStressVector Principal stresses
218  * @param[in/out] rSecondDerivative Second stress derivative value of yield function
219  */
220  virtual void CalculateYieldFunctionSecondDerivative(const Vector& rPrincipalStress, Vector& rSecondDerivative, const Properties& rProp)
221  {
222  KRATOS_ERROR << "Calling the base class function in ParticleYieldCriterion ... illegal operation!!" << std::endl;
223  };
224 
225 
229 
230 
234 
235 
239 
243 
244 
246 
247  protected:
250 
251 
255 
257 
261 
262 
266 
267 
271 
272 
276 
277 
281 
282 
284 
285  private:
288 
289 
293 
294 
298 
299 
303 
304 
308 
309 
313  friend class Serializer;
314 
315  // A private default constructor necessary for serialization
316 
317  virtual void save(Serializer& rSerializer) const
318  {
319  rSerializer.save("mpHardeningLaw",mpHardeningLaw);
320  };
321 
322  virtual void load(Serializer& rSerializer)
323  {
324  rSerializer.load("mpHardeningLaw",mpHardeningLaw);
325  };
326 
330 
331 
335 
337 
338  }; // Class ParticleYieldCriterion
339 
341 
344 
345 
349 
350 
351  // /// input stream function
352  // inline std::istream& operator >> (std::istream& rIStream,
353  // ParticleYieldCriterion& rThis);
354 
355  // /// output stream function
356  // inline std::ostream& operator << (std::ostream& rOStream,
357  // const ParticleYieldCriterion& rThis)
358  // {
359  // rThis.PrintInfo(rOStream);
360  // rOStream << std::endl;
361  // rThis.PrintData(rOStream);
362 
363  // return rOStream;
364  // }
366 
368 
369 } // namespace Kratos.
370 
371 #endif // KRATOS_MPM_YIELD_CRITERION_H_INCLUDED defined
Short class definition.
Definition: particle_hardening_law.hpp:58
Short class definition.
Definition: particle_yield_criterion.hpp:54
ParticleYieldCriterion & operator=(ParticleYieldCriterion const &rOther)
Assignment operator.
Definition: particle_yield_criterion.hpp:111
virtual double & CalculateYieldCondition(double &rStateFunction, const Vector &rPrincipalStress, const double &rAlpha, const double &rBeta, const Properties &rProp)
Definition: particle_yield_criterion.hpp:185
void SetHardeningLaw(ParticleHardeningLaw &rHardeningLaw)
Definition: particle_yield_criterion.hpp:144
virtual double & CalculateYieldCondition(double &rStateFunction, const Parameters &rVariables, const Properties &rProp)
Definition: particle_yield_criterion.hpp:174
HardeningLawPointer mpHardeningLaw
Definition: particle_yield_criterion.hpp:256
virtual void CalculateYieldFunctionSecondDerivative(const Vector &rPrincipalStress, Vector &rSecondDerivative, const Properties &rProp)
Definition: particle_yield_criterion.hpp:220
virtual void CalculateYieldFunctionDerivative(const Vector &rPrincipalStress, Vector &rFirstDerivative, const Properties &rProp)
Definition: particle_yield_criterion.hpp:198
ParticleYieldCriterion(ParticleYieldCriterion const &rOther)
Copy constructor.
Definition: particle_yield_criterion.hpp:104
ParticleHardeningLaw::Pointer HardeningLawPointer
Definition: particle_yield_criterion.hpp:83
KRATOS_CLASS_POINTER_DEFINITION(ParticleYieldCriterion)
Pointer definition of ParticleYieldCriterion.
void pSetHardeningLaw(HardeningLawPointer &pHardeningLaw)
Definition: particle_yield_criterion.hpp:149
virtual void CalculateYieldFunctionDerivative(const Vector &rPrincipalStress, Vector &rFirstDerivative, const double &rAlpha, const Properties &rProp)
Definition: particle_yield_criterion.hpp:204
ParticleYieldCriterion(HardeningLawPointer pHardeningLaw)
Initialization constructor.
Definition: particle_yield_criterion.hpp:98
virtual void CalculateYieldFunctionDerivative(const Vector &rPrincipalStress, Vector &rFirstDerivative, const double &rAlpha, const double &rBeta, const Properties &rProp)
Definition: particle_yield_criterion.hpp:209
void InitializeMaterial(HardeningLawPointer &pHardeningLaw, const Properties &rMaterialProperties)
Definition: particle_yield_criterion.hpp:138
virtual ParticleYieldCriterion::Pointer Clone() const
Definition: particle_yield_criterion.hpp:129
ParticleYieldCriterion()
Default constructor.
Definition: particle_yield_criterion.hpp:93
ParticleHardeningLaw & GetHardeningLaw()
Definition: particle_yield_criterion.hpp:154
virtual double & CalculateYieldCondition(double &rStateFunction, const Vector &rPrincipalStress, const double &rAlpha, const Properties &rProp)
Definition: particle_yield_criterion.hpp:180
virtual ~ParticleYieldCriterion()
Destructor.
Definition: particle_yield_criterion.hpp:118
HardeningLawPointer pGetHardeningLaw()
Definition: particle_yield_criterion.hpp:159
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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
def load(f)
Definition: ode_solve.py:307
Definition: particle_hardening_law.hpp:62
void SetRateFactor(double rRateFactor)
Definition: particle_hardening_law.hpp:72
void SetDeltaTime(const double &rDeltaTime)
Definition: particle_hardening_law.hpp:73
const double & GetDeltaTime() const
Definition: particle_hardening_law.hpp:77
const double & GetRateFactor() const
Definition: particle_hardening_law.hpp:76
Definition: particle_yield_criterion.hpp:57
const double & GetStressNorm() const
Definition: particle_yield_criterion.hpp:68
void SetDeltaTime(const double &rDeltaTime)
Definition: particle_yield_criterion.hpp:73
void SetStressNorm(const double &rStressNorm)
Definition: particle_yield_criterion.hpp:65
const double & GetDeltaTime() const
Definition: particle_yield_criterion.hpp:77
const double & GetRateFactor() const
Definition: particle_yield_criterion.hpp:76
const ParticleHardeningLaw::Parameters & GetHardeningParameters() const
Definition: particle_yield_criterion.hpp:69
void SetRateFactor(double rRateFactor)
Definition: particle_yield_criterion.hpp:72