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.
hardening_rule.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosConstitutiveModelApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: July 2017 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_HARDENING_RULE_H_INCLUDED )
11 #define KRATOS_HARDENING_RULE_H_INCLUDED
12 
13 // System includes
14 #include <string>
15 #include <iostream>
16 
17 // External includes
18 
19 // Project includes
20 #include "includes/define.h"
21 #include "includes/properties.h"
22 
24 
26 
27 namespace Kratos
28 {
31 
34 
38 
42 
46 
50 
52 
55  {
56  protected:
57 
58  //warning::this variable is going to be shadowed by they derived classes
59  //if any problem is detected an alternative method must be used instead
60  constexpr static std::size_t VarSize = 1;
61 
62  public:
63 
66 
71 
72  template<std::size_t TVarSize>
74  {
75  //internal variables
77 
78  //default constructor (to initialize Variables)
80 
82 
83  unsigned int size() {return TVarSize;}
84 
85  private:
86 
87  friend class Serializer;
88 
89  void save(Serializer& rSerializer) const
90  {
91  rSerializer.save("Variables",Variables);
92  };
93 
94  void load(Serializer& rSerializer)
95  {
96  rSerializer.load("Variables",Variables);
97  };
98 
99  };
100 
101 
102  template<std::size_t TVarSize>
104  {
105  private:
106 
107  Flags* mpState;
108  const ModelDataType* mpModelData;
109 
110  public:
111 
112  //flow rule internal variables
114  double StressNorm;
115 
116  //hardening rule internal variables
117  double RateFactor;
118 
119  //internal variables
122 
123  //strain matrix
124  MatrixType StrainMatrix; //wildcard strain (cauchy green tensors or infinitessimal tensor)
125 
126  //Set Data Pointers
127  void SetState (Flags& rState) {mpState = &rState;};
128  void SetModelData (const ModelDataType& rModelData) {mpModelData = &rModelData;};
129 
130  //Get Data Pointers
131  const ModelDataType& GetModelData () const {return *mpModelData;};
132  const MaterialDataType& GetMaterialParameters () const {return mpModelData->GetMaterialParameters();};
133 
134  //Get non const Data
135  Flags& State () {return *mpState;};
136 
137  //Get const Data
138  const Flags& GetState () const {return *mpState;};
139  const double& GetTrialStateFunction () const {return TrialStateFunction;};
140  const double& GetStressNorm () const {return StressNorm;};
141  const double& GetRateFactor () const {return RateFactor;};
142 
145 
146  const MatrixType& GetStrainMatrix () const {return StrainMatrix;};
147 
148  const array_1d<double,TVarSize>& GetInternalVariables () const {return Internal.Variables;};
150 
151  };
152 
155 
158 
162 
165 
167  HardeningRule(HardeningRule const& rOther) {}
168 
171  {
172  return *this;
173  }
174 
176  virtual HardeningRule::Pointer Clone() const
177  {
178  return Kratos::make_shared<HardeningRule>(*this);
179  }
180 
182  virtual ~HardeningRule() {}
183 
187 
188 
192 
197  virtual double& CalculateHardening(const PlasticDataType& rVariables, double& rHardening)
198  {
199  KRATOS_TRY
200 
201  KRATOS_ERROR << "calling the HardeningRule base class ... illegal operation" << std::endl;
202 
203  return rHardening;
204 
205  KRATOS_CATCH(" ")
206  }
207 
208 
213  virtual double& CalculateDeltaHardening(const PlasticDataType& rVariables, double& rDeltaHardening)
214  {
215  KRATOS_TRY
216 
217  KRATOS_ERROR << "calling the HardeningRule base class ... illegal operation" << std::endl;
218 
219  return rDeltaHardening;
220 
221  KRATOS_CATCH(" ")
222  }
223 
224  virtual double& CalculateDeltaHardening(const PlasticDataType& rVariables, double& rDeltaHardening, const MatrixType & rPlasticPotentialDerivative)
225  {
226  KRATOS_TRY
227 
228  KRATOS_ERROR << "calling the HardeningRule base class ... illegal operation" << std::endl;
229 
230  return rDeltaHardening;
231 
232  KRATOS_CATCH(" ")
233  }
234 
235  virtual double& CalculateDeltaThermalHardening(const PlasticDataType& rVariables, double& rDeltaThermalHardening)
236  {
237  KRATOS_TRY
238 
239  KRATOS_ERROR << "calling the HardeningRule base class ... illegal operation" << std::endl;
240 
241  return rDeltaThermalHardening;
242 
243  KRATOS_CATCH(" ")
244  }
245 
246 
250 
251 
255 
256 
260 
262  virtual std::string Info() const
263  {
264  std::stringstream buffer;
265  buffer << "HardeningRule" ;
266  return buffer.str();
267  }
268 
270  virtual void PrintInfo(std::ostream& rOStream) const
271  {
272  rOStream << "HardeningRule";
273  }
274 
276  virtual void PrintData(std::ostream& rOStream) const
277  {
278  rOStream << "HardeningRule Data";
279  }
280 
284 
285 
287 
288  protected:
291 
292 
296 
297 
301 
302 
306 
307 
311 
312 
316 
317 
321 
322 
324 
325  private:
328 
329 
333 
334 
338 
339 
343 
344 
348 
349 
353  friend class Serializer;
354 
355 
356  virtual void save(Serializer& rSerializer) const
357  {
358  }
359 
360  virtual void load(Serializer& rSerializer)
361  {
362  }
363 
367 
368 
372 
374 
375  }; // Class HardeningRule
376 
378 
381 
382 
386 
387 
389 
391 
392 } // namespace Kratos.
393 
394 #endif // KRATOS_HARDENING_RULE_H_INCLUDED defined
Definition: flags.h:58
Short class definition.
Definition: hardening_rule.hpp:55
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: hardening_rule.hpp:276
virtual std::string Info() const
Turn back information as a string.
Definition: hardening_rule.hpp:262
virtual double & CalculateDeltaThermalHardening(const PlasticDataType &rVariables, double &rDeltaThermalHardening)
Definition: hardening_rule.hpp:235
ConstitutiveModelData::MaterialData MaterialDataType
Definition: hardening_rule.hpp:70
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: hardening_rule.hpp:270
InternalVariables< VarSize > InternalVariablesType
Definition: hardening_rule.hpp:153
constexpr static std::size_t VarSize
Definition: hardening_rule.hpp:60
virtual double & CalculateDeltaHardening(const PlasticDataType &rVariables, double &rDeltaHardening)
Definition: hardening_rule.hpp:213
virtual double & CalculateHardening(const PlasticDataType &rVariables, double &rHardening)
Definition: hardening_rule.hpp:197
ConstitutiveModelData::ModelData ModelDataType
Definition: hardening_rule.hpp:69
HardeningRule()
Default constructor.
Definition: hardening_rule.hpp:164
ConstitutiveModelData::MatrixType MatrixType
Definition: hardening_rule.hpp:67
virtual double & CalculateDeltaHardening(const PlasticDataType &rVariables, double &rDeltaHardening, const MatrixType &rPlasticPotentialDerivative)
Definition: hardening_rule.hpp:224
ConstitutiveModelData::VectorType VectorType
Definition: hardening_rule.hpp:68
HardeningRule(HardeningRule const &rOther)
Copy constructor.
Definition: hardening_rule.hpp:167
virtual HardeningRule::Pointer Clone() const
Clone.
Definition: hardening_rule.hpp:176
PlasticModelData< VarSize > PlasticDataType
Definition: hardening_rule.hpp:154
KRATOS_CLASS_POINTER_DEFINITION(HardeningRule)
Pointer definition of HardeningRule.
virtual ~HardeningRule()
Destructor.
Definition: hardening_rule.hpp:182
HardeningRule & operator=(HardeningRule const &rOther)
Assignment operator.
Definition: hardening_rule.hpp:170
Definition: amatrix_interface.h:41
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
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#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:92
Definition: constitutive_model_data.hpp:383
const MaterialData & GetMaterialParameters() const
Definition: constitutive_model_data.hpp:462
Definition: hardening_rule.hpp:74
InternalVariables()
Definition: hardening_rule.hpp:79
unsigned int size()
Definition: hardening_rule.hpp:83
const array_1d< double, TVarSize > & GetVariables()
Definition: hardening_rule.hpp:81
array_1d< double, TVarSize > Variables
Definition: hardening_rule.hpp:76
Definition: hardening_rule.hpp:104
double RateFactor
Definition: hardening_rule.hpp:117
double TrialStateFunction
Definition: hardening_rule.hpp:113
const InternalVariables< TVarSize > & GetInternal() const
Definition: hardening_rule.hpp:143
void SetState(Flags &rState)
Definition: hardening_rule.hpp:127
const double & GetRateFactor() const
Definition: hardening_rule.hpp:141
InternalVariables< TVarSize > Internal
Definition: hardening_rule.hpp:120
const MaterialDataType & GetMaterialParameters() const
Definition: hardening_rule.hpp:132
Flags & State()
Definition: hardening_rule.hpp:135
const array_1d< double, TVarSize > & GetInternalVariables() const
Definition: hardening_rule.hpp:148
const double & GetTrialStateFunction() const
Definition: hardening_rule.hpp:139
double StressNorm
Definition: hardening_rule.hpp:114
InternalVariables< TVarSize > DeltaInternal
Definition: hardening_rule.hpp:121
const InternalVariables< TVarSize > & GetDeltaInternal() const
Definition: hardening_rule.hpp:144
const double & GetStressNorm() const
Definition: hardening_rule.hpp:140
const Flags & GetState() const
Definition: hardening_rule.hpp:138
const array_1d< double, TVarSize > & GetDeltaInternalVariables() const
Definition: hardening_rule.hpp:149
MatrixType StrainMatrix
Definition: hardening_rule.hpp:124
void SetModelData(const ModelDataType &rModelData)
Definition: hardening_rule.hpp:128
const MatrixType & GetStrainMatrix() const
Definition: hardening_rule.hpp:146
const ModelDataType & GetModelData() const
Definition: hardening_rule.hpp:131