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.
non_linear_rate_dependent_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_NON_LINEAR_RATE_DEPENDENT_PLASTICITY_MODEL_H_INCLUDED )
11 #define KRATOS_NON_LINEAR_RATE_DEPENDENT_PLASTICITY_MODEL_H_INCLUDED
12 
13 
14 // System includes
15 
16 // External includes
17 
18 // Project includes
20 
21 namespace Kratos
22 {
25 
28 
32 
36 
40 
44 
46 
48  template<class TElasticityModel, class TYieldSurface>
49  class KRATOS_API(CONSTITUTIVE_MODELS_APPLICATION) NonLinearRateDependentPlasticityModel : public NonLinearAssociativePlasticityModel<TElasticityModel,TYieldSurface>
50  {
51  public:
52 
55 
56  //elasticity model
57  typedef TElasticityModel ElasticityModelType;
58  typedef typename ElasticityModelType::Pointer ElasticityModelPointer;
59 
60  //yield surface
61  typedef TYieldSurface YieldSurfaceType;
62  typedef typename YieldSurfaceType::Pointer YieldSurfacePointer;
63 
64  //derived type
66 
67  //base type
69 
70  //common types
71  typedef typename BaseType::Pointer BaseTypePointer;
72  typedef typename BaseType::SizeType SizeType;
74  typedef typename BaseType::MatrixType MatrixType;
79 
82 
86 
89 
91  NonLinearRateDependentPlasticityModel(ElasticityModelPointer pElasticityModel, YieldSurfacePointer pYieldSurface) : DerivedType(pElasticityModel, pYieldSurface) {}
92 
95 
98  {
99  DerivedType::operator=(rOther);
100  return *this;
101  }
102 
104  ConstitutiveModel::Pointer Clone() const override
105  {
106  return Kratos::make_shared<NonLinearRateDependentPlasticityModel>(*this);
107  }
108 
111 
112 
116 
117 
121 
122 
126 
127 
131 
132 
136 
138  std::string Info() const override
139  {
140  std::stringstream buffer;
141  buffer << "NonLinearRateDependentPlasticityModel" ;
142  return buffer.str();
143  }
144 
146  void PrintInfo(std::ostream& rOStream) const override
147  {
148  rOStream << "NonLinearRateDependentPlasticityModel";
149  }
150 
152  void PrintData(std::ostream& rOStream) const override
153  {
154  rOStream << "NonLinearRateDependentPlasticityModel Data";
155  }
156 
160 
161 
163 
164  protected:
167 
171 
175 
176 
180 
181 
182  // calculate return mapping
183  bool CalculateReturnMapping(PlasticDataType& rVariables, MatrixType& rStressMatrix) override
184  {
185  KRATOS_TRY
186 
187  bool converged = false;
188 
189  //Start 1rst Newton Raphson iteration
190  rVariables.State().Set(ConstitutiveModelData::PLASTIC_RATE_REGION,true);
191  rVariables.RateFactor=1; //plastic rate region on
192  converged = CalculateRateDependentReturnMapping(rVariables,rStressMatrix);
193 
194  // if(!converged)
195  // std::cout<<" ConstitutiveLaw did not converge on the rate dependent return mapping"<<std::endl;
196 
197  const ModelDataType& rModelData = rVariables.GetModelData();
198  const double& rDeltaTime = rModelData.GetProcessInfo()[DELTA_TIME];
199 
200  const Properties& rProperties = rModelData.GetProperties();
201  const double& rPlasticStrainRate = rProperties[PLASTIC_STRAIN_RATE];
202 
203 
204  double MaterialDeltaPlasticStrain = rPlasticStrainRate * rDeltaTime;
205 
206  //std::cout<<" DeltaPlasticStrain: "<<rPlasticVariables.DeltaPlasticStrain<<" MaterialDeltaPlasticStrain: "<<MaterialDeltaPlasticStrain<<std::endl;
207 
208  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
209 
210  if( sqrt(2.0/3.0) * rDeltaGamma < MaterialDeltaPlasticStrain ){
211 
212  //std::cout<<" DeltaPlasticStrain: "<<rPlasticVariables.DeltaPlasticStrain<<" MaterialDeltaPlasticStrain: "<<MaterialDeltaPlasticStrain<<std::endl;
213 
214  //Start 2nd Newton Raphson iteration
215  rVariables.State().Set(ConstitutiveModelData::PLASTIC_RATE_REGION,false);
216  rVariables.RateFactor=0; //plastic rate region on
217 
218  converged = CalculateRateIndependentReturnMapping(rVariables,rStressMatrix);
219 
220  // if(!converged)
221  // std::cout<<" ConstitutiveLaw did not converge on the rate independent return mapping"<<std::endl;
222 
223  }
224 
225  return converged;
226 
227  KRATOS_CATCH(" ")
228  }
229 
230 
232  {
233  KRATOS_TRY
234 
235  //Set convergence parameters
236  unsigned int iter = 0;
237  double Tolerance = 1e-5;
238  double MaxIterations = 50;
239 
240  //start
241  double DeltaDeltaGamma = 0;
242  double DeltaStateFunction = 0;
243  double DeltaPlasticStrain = 0;
244 
245  double& rEquivalentPlasticStrainOld = this->mPreviousInternal.Variables[0];
246  double& rEquivalentPlasticStrain = rVariables.Internal.Variables[0];
247  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
248 
249 
250  const ModelDataType& rModelData = rVariables.GetModelData();
251  const double& rDeltaTime = rModelData.GetProcessInfo()[DELTA_TIME];
252 
253  const Properties& rProperties = rModelData.GetProperties();
254  const double& rPlasticStrainRate = rProperties[PLASTIC_STRAIN_RATE];
255 
256 
257  rEquivalentPlasticStrain = 0;
258  rDeltaGamma = sqrt(3.0*0.5) * rPlasticStrainRate * rDeltaTime;
259 
260  DeltaPlasticStrain = sqrt(2.0/3.0) * rDeltaGamma;
261  rEquivalentPlasticStrain = rEquivalentPlasticStrainOld + DeltaPlasticStrain;
262 
263  double StateFunction = this->mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
264 
265  double alpha = 1;
266  while ( fabs(StateFunction)>=Tolerance && iter<=MaxIterations)
267  {
268  //Calculate Delta State Function:
269  DeltaStateFunction = this->mYieldSurface.CalculateDeltaStateFunction( rVariables, DeltaStateFunction );
270 
271  //Calculate DeltaGamma:
272  DeltaDeltaGamma = StateFunction/DeltaStateFunction;
273  rDeltaGamma += DeltaDeltaGamma;
274 
275  //Update Equivalent Plastic Strain:
276  DeltaPlasticStrain = sqrt(2.0/3.0) * rDeltaGamma;
277 
278  //alpha = CalculateLineSearch( rVariables, alpha );
279 
280  rEquivalentPlasticStrain = rEquivalentPlasticStrainOld + alpha * DeltaPlasticStrain;
281 
282  //Calculate State Function:
283  StateFunction = this->mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
284 
285  iter++;
286  }
287 
288 
289  if(iter>MaxIterations)
290  return false;
291 
292 
293  return true;
294 
295  KRATOS_CATCH(" ")
296  }
297 
298 
300  {
301  KRATOS_TRY
302 
303  //Set convergence parameters
304  unsigned int iter = 0;
305  double Tolerance = 1e-5;
306  double MaxIterations = 50;
307 
308  //start
309  double DeltaDeltaGamma = 0;
310  double DeltaStateFunction = 0;
311  double DeltaPlasticStrain = 0;
312 
313  double& rEquivalentPlasticStrainOld = this->mPreviousInternal.Variables[0];
314  double& rEquivalentPlasticStrain = rVariables.Internal.Variables[0];
315  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
316 
317  rEquivalentPlasticStrain = 0;
318  rDeltaGamma = 1e-40; //this can not be zero (zig-zag in the iterative loop if is zero)
319 
320  DeltaPlasticStrain = sqrt(2.0/3.0) * rDeltaGamma;
321  rEquivalentPlasticStrain = rEquivalentPlasticStrainOld + DeltaPlasticStrain;
322 
323  double StateFunction = rVariables.TrialStateFunction;
324 
325  double alpha = 1;
326  while ( fabs(StateFunction)>=Tolerance && iter<=MaxIterations)
327  {
328  //Calculate Delta State Function:
329  DeltaStateFunction = this->mYieldSurface.CalculateDeltaStateFunction( rVariables, DeltaStateFunction );
330 
331  //Calculate DeltaGamma:
332  DeltaDeltaGamma = StateFunction/DeltaStateFunction;
333  rDeltaGamma += DeltaDeltaGamma;
334 
335  //Update Equivalent Plastic Strain:
336  DeltaPlasticStrain = sqrt(2.0/3.0) * rDeltaGamma;
337 
338  //alpha = CalculateLineSearch( rVariables, alpha );
339 
340  rEquivalentPlasticStrain = rEquivalentPlasticStrainOld + alpha * DeltaPlasticStrain;
341 
342  //Calculate State Function:
343  StateFunction = this->mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
344 
345  iter++;
346  }
347 
348 
349  if(iter>MaxIterations)
350  return false;
351 
352 
353  return true;
354 
355  KRATOS_CATCH(" ")
356  }
357 
358 
359  // implex protected methods
360  void CalculateImplexReturnMapping(PlasticDataType& rVariables, MatrixType& rStressMatrix) override
361  {
362  KRATOS_TRY
363 
364  const ModelDataType& rModelData = rVariables.GetModelData();
365 
366  const double& rEquivalentPlasticStrain = rVariables.GetInternalVariables()[0];
367  const double& rEquivalentPlasticStrainOld = this->mPreviousInternal.Variables[0];
368 
369  double& rDeltaGamma = rVariables.Internal.Variables[0];
370  const double& rDeltaTime = rModelData.GetProcessInfo()[DELTA_TIME];
371 
372 
373  //1.-Computation of the plastic Multiplier
374  rDeltaGamma = sqrt(3.0*0.5) * ( rEquivalentPlasticStrain - rEquivalentPlasticStrainOld );
375 
376  //2.- Update back stress, plastic strain and stress
377  this->UpdateStressConfiguration(rVariables,rStressMatrix);
378 
379  //3.- Calculate thermal dissipation and delta thermal dissipation
380  if( rDeltaGamma > 0 ){
381 
382  const Properties& rProperties = rModelData.GetProperties();
383 
384  const double& rPlasticStrainRate =rProperties[PLASTIC_STRAIN_RATE];
385 
386  double MaterialDeltaPlasticStrain = rPlasticStrainRate * rDeltaTime;
387 
388  //plastic rate region on
389  rVariables.State().Set(ConstitutiveModelData::PLASTIC_RATE_REGION,true);
390  rVariables.RateFactor=1;
391 
392  if( sqrt(2.0/3.0) * rDeltaGamma < MaterialDeltaPlasticStrain ){
393  //plastic rate region off
394 
395  rVariables.State().Set(ConstitutiveModelData::PLASTIC_RATE_REGION,false);
396  rVariables.RateFactor=0;
397  }
398 
399  this->CalculateImplexThermalDissipation( rVariables );
400 
401  rVariables.State().Set(ConstitutiveModelData::PLASTIC_REGION,true);
402 
403  }
404  else{
405 
406  this->mThermalVariables.PlasticDissipation = 0;
407  this->mThermalVariables.DeltaPlasticDissipation = 0;
408  }
409 
410  KRATOS_CATCH(" ")
411  }
412 
413 
414  double& CalculateLineSearch(PlasticDataType& rVariables, double& rAlpha)
415  {
416  KRATOS_TRY
417 
418  //Set convergence parameters
419  unsigned int iter = 0;
420  double MaxIterations = 10;
421 
422  //start preserve initial variables
423  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
424  double DeltaGamma = sqrt(2.0/3.0) * rDeltaGamma;
425 
426  double StateFunction = this->mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
427  double R0 = sqrt(2.0/3.0) * rDeltaGamma * StateFunction;
428 
429  //double Residual0 = StateFunction;
430 
431  double& rEquivalentPlasticStrain = rVariables.GetInternalVariables()[0];
432  const double& rEquivalentPlasticStrainOld = this->mPreviousInternal.Variables[0];
433 
434  rEquivalentPlasticStrain = rEquivalentPlasticStrainOld + sqrt(2.0/3.0) * rDeltaGamma;
435  StateFunction = this->mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
436 
437  double R1 = sqrt(2.0/3.0) * rDeltaGamma * StateFunction;
438 
439  rAlpha = 1;
440 
441  if(R0*R1<0){
442 
443  double R2 = R1;
444 
445  if(fabs(R1)<fabs(R0))
446  R2=R0;
447  double R0start = R0;
448 
449 
450  double nabla = 0;
451  double delta = 1;
452 
453  //if( Residual0 < StateFunction ){
454 
455  while ( fabs(R2/R0start)>0.3 && iter<MaxIterations && (R1*R0)<0 && fabs(R1)>1e-7 && fabs(R0)>1e-7 )
456  {
457 
458  rAlpha = 0.5*(nabla+delta);
459 
460  rDeltaGamma *= rAlpha;
461 
462  rEquivalentPlasticStrain = rEquivalentPlasticStrainOld + sqrt(2.0/3.0) * rDeltaGamma;
463 
464  StateFunction = this->mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
465 
466  R2 = sqrt(2.0/3.0) * rDeltaGamma * StateFunction;
467 
468  rDeltaGamma /= rAlpha;
469 
470 
471  if(R2*R1<0){
472  nabla = rAlpha;
473  R0 = R2;
474  }
475  else if(R2*R0<0){
476  delta = rAlpha;
477  R1 = R2;
478  }
479  else{
480  break;
481  }
482 
483  iter++;
484  }
485  //}
486 
487  }
488 
489  rDeltaGamma = DeltaGamma;
490 
491  if( rAlpha != 1)
492  std::cout<<" [ LINE SEARCH: (Iterations: "<<iter<<", rAlpha: "<<rAlpha<<") ] "<<std::endl;
493 
494 
495  if(rAlpha>1 || rAlpha<=0)
496  rAlpha=1;
497 
498  return rAlpha;
499 
500  KRATOS_CATCH(" ")
501  }
502 
506 
507 
511 
512 
516 
517 
519 
520  private:
523 
524 
528 
529 
533 
534 
538 
539 
543 
544 
548  friend class Serializer;
549 
550  void save(Serializer& rSerializer) const override
551  {
553  }
554 
555  void load(Serializer& rSerializer) override
556  {
557  KRATOS_SERIALIZE_LOAD_BASE_CLASS( rSerializer, DerivedType )
558  }
559 
563 
564 
568 
570 
571  }; // Class NonLinearRateDependentPlasticityModel
572 
574 
577 
581 
583 
585 
586 } // namespace Kratos.
587 
588 #endif // KRATOS_NON_LINEAR_RATE_DEPENDENT_PLASTICITY_MODEL_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: amatrix_interface.h:41
Short class definition.
Definition: non_linear_associative_plasticity_model.hpp:50
BaseType::PlasticDataType PlasticDataType
Definition: non_linear_associative_plasticity_model.hpp:72
Short class definition.
Definition: non_linear_rate_dependent_plasticity_model.hpp:50
BaseType::SizeType SizeType
Definition: non_linear_rate_dependent_plasticity_model.hpp:72
BaseType::MatrixType MatrixType
Definition: non_linear_rate_dependent_plasticity_model.hpp:74
~NonLinearRateDependentPlasticityModel() override
Destructor.
Definition: non_linear_rate_dependent_plasticity_model.hpp:110
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: non_linear_rate_dependent_plasticity_model.hpp:152
bool CalculateReturnMapping(PlasticDataType &rVariables, MatrixType &rStressMatrix) override
Definition: non_linear_rate_dependent_plasticity_model.hpp:183
BaseType::ModelDataType ModelDataType
Definition: non_linear_rate_dependent_plasticity_model.hpp:75
NonLinearAssociativePlasticityModel< ElasticityModelType, YieldSurfaceType > DerivedType
Definition: non_linear_rate_dependent_plasticity_model.hpp:65
ConstitutiveModel::Pointer Clone() const override
Clone.
Definition: non_linear_rate_dependent_plasticity_model.hpp:104
BaseType::PlasticDataType PlasticDataType
Definition: non_linear_rate_dependent_plasticity_model.hpp:77
bool CalculateRateDependentReturnMapping(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_rate_dependent_plasticity_model.hpp:231
NonLinearRateDependentPlasticityModel(ElasticityModelPointer pElasticityModel, YieldSurfacePointer pYieldSurface)
Constructor.
Definition: non_linear_rate_dependent_plasticity_model.hpp:91
NonLinearRateDependentPlasticityModel & operator=(NonLinearRateDependentPlasticityModel const &rOther)
Assignment operator.
Definition: non_linear_rate_dependent_plasticity_model.hpp:97
NonLinearRateDependentPlasticityModel()
Default constructor.
Definition: non_linear_rate_dependent_plasticity_model.hpp:88
NonLinearRateDependentPlasticityModel(NonLinearRateDependentPlasticityModel const &rOther)
Copy constructor.
Definition: non_linear_rate_dependent_plasticity_model.hpp:94
TElasticityModel ElasticityModelType
Definition: non_linear_rate_dependent_plasticity_model.hpp:57
YieldSurfaceType::Pointer YieldSurfacePointer
Definition: non_linear_rate_dependent_plasticity_model.hpp:62
bool CalculateRateIndependentReturnMapping(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_rate_dependent_plasticity_model.hpp:299
BaseType::Pointer BaseTypePointer
Definition: non_linear_rate_dependent_plasticity_model.hpp:71
PlasticityModel< ElasticityModelType, YieldSurfaceType > BaseType
Definition: non_linear_rate_dependent_plasticity_model.hpp:68
std::string Info() const override
Turn back information as a string.
Definition: non_linear_rate_dependent_plasticity_model.hpp:138
double & CalculateLineSearch(PlasticDataType &rVariables, double &rAlpha)
Definition: non_linear_rate_dependent_plasticity_model.hpp:414
KRATOS_CLASS_POINTER_DEFINITION(NonLinearRateDependentPlasticityModel)
Pointer definition of NonLinearRateDependentPlasticityModel.
BaseType::InternalVariablesType InternalVariablesType
Definition: non_linear_rate_dependent_plasticity_model.hpp:78
void CalculateImplexReturnMapping(PlasticDataType &rVariables, MatrixType &rStressMatrix) override
Definition: non_linear_rate_dependent_plasticity_model.hpp:360
TYieldSurface YieldSurfaceType
Definition: non_linear_rate_dependent_plasticity_model.hpp:61
BaseType::MaterialDataType MaterialDataType
Definition: non_linear_rate_dependent_plasticity_model.hpp:76
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: non_linear_rate_dependent_plasticity_model.hpp:146
ElasticityModelType::Pointer ElasticityModelPointer
Definition: non_linear_rate_dependent_plasticity_model.hpp:58
BaseType::VoigtIndexType VoigtIndexType
Definition: non_linear_rate_dependent_plasticity_model.hpp:73
Short class definition.
Definition: plasticity_model.hpp:50
TYieldSurface::InternalVariablesType InternalVariablesType
Definition: plasticity_model.hpp:69
ConstitutiveModelData::SizeType SizeType
Definition: plasticity_model.hpp:63
ConstitutiveModelData::VoigtIndexType VoigtIndexType
Definition: plasticity_model.hpp:64
TYieldSurface::PlasticDataType PlasticDataType
Definition: plasticity_model.hpp:68
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
#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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
def load(f)
Definition: ode_solve.py:307
double precision, dimension(3, 3), public delta
Definition: TensorModule.f:16
e
Definition: run_cpp_mpi_tests.py:31
Definition: constitutive_model_data.hpp:92
Definition: constitutive_model_data.hpp:383
const Properties & GetProperties() const
Definition: constitutive_model_data.hpp:431
const ProcessInfo & GetProcessInfo() const
Definition: constitutive_model_data.hpp:435