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_associative_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_ASSOCIATIVE_PLASTICITY_MODEL_H_INCLUDED )
11 #define KRATOS_NON_LINEAR_ASSOCIATIVE_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) NonLinearAssociativePlasticityModel : public PlasticityModel<TElasticityModel,TYieldSurface>
50  {
51  public:
52 
55 
56  //elasticity model
57  typedef TElasticityModel ElasticityModelType;
58 
59  //yield surface
60  typedef TYieldSurface YieldSurfaceType;
61 
62  //base type
64 
65  //common types
66  typedef typename BaseType::Pointer BaseTypePointer;
67  typedef typename BaseType::SizeType SizeType;
69  typedef typename BaseType::MatrixType MatrixType;
74 
77 
78 
79  protected:
80 
82  {
83  public:
86 
87  private:
88 
89  friend class Serializer;
90 
91  void save(Serializer& rSerializer) const
92  {
93  rSerializer.save("PlasticDissipation",PlasticDissipation);
94  rSerializer.save("DeltaPlasticDissipation",DeltaPlasticDissipation);
95  };
96 
97  void load(Serializer& rSerializer)
98  {
99  rSerializer.load("PlasticDissipation",PlasticDissipation);
100  rSerializer.load("DeltaPlasticDissipation",DeltaPlasticDissipation);
101  };
102 
103  };
104 
105 
107  {
108  double Beta0;
109  double Beta1;
110  double Beta2;
111  double Beta3;
112  double Beta4;
113 
116  };
117 
118 
119  public:
120 
121 
124 
128 
131 
133  NonLinearAssociativePlasticityModel(NonLinearAssociativePlasticityModel const& rOther) :BaseType(rOther), mInternal(rOther.mInternal), mPreviousInternal(rOther.mPreviousInternal), mThermalVariables(rOther.mThermalVariables) {}
134 
137  {
138  BaseType::operator=(rOther);
139  mInternal = rOther.mInternal;
140  mPreviousInternal = rOther.mPreviousInternal;
141  mThermalVariables = rOther.mThermalVariables;
142  return *this;
143  }
144 
146  ConstitutiveModel::Pointer Clone() const override
147  {
148  return Kratos::make_shared<NonLinearAssociativePlasticityModel>(*this);
149  }
150 
153 
154 
158 
159 
163 
168  void CalculateStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override
169  {
170  KRATOS_TRY
171 
172  // calculate volumetric stress
173  MatrixType VolumetricStressMatrix;
174  noalias(VolumetricStressMatrix) = ZeroMatrix(3,3);
175  this->mElasticityModel.CalculateVolumetricStressTensor(rValues,VolumetricStressMatrix);
176 
177  // calculate isochoric stress
178  this->CalculateIsochoricStressTensor(rValues,rStressMatrix);
179 
180  rStressMatrix += VolumetricStressMatrix;
181 
182  KRATOS_CATCH(" ")
183  }
184 
185  void CalculateIsochoricStressTensor(ModelDataType& rValues, MatrixType& rStressMatrix) override
186  {
187  KRATOS_TRY
188 
189  PlasticDataType Variables;
190  this->InitializeVariables(rValues,Variables);
191 
192  // calculate elastic isochoric stress
193  this->mElasticityModel.CalculateIsochoricStressTensor(rValues,rStressMatrix);
194 
195  rValues.StressMatrix = rStressMatrix; //store trial isochoric stress to ModelData StressMatrix
196 
197  // calculate plastic isochoric stress
198  this->CalculateAndAddIsochoricStressTensor(Variables,rStressMatrix);
199 
200  if( rValues.State.Is(ConstitutiveModelData::UPDATE_INTERNAL_VARIABLES ) )
201  this->UpdateInternalVariables(rValues, Variables, rStressMatrix);
202 
203 
204  KRATOS_CATCH(" ")
205  }
206 
210  void CalculateConstitutiveTensor(ModelDataType& rValues, Matrix& rConstitutiveMatrix) override
211  {
212  KRATOS_TRY
213 
214  //Initialize ConstitutiveMatrix
215  rConstitutiveMatrix.clear();
216 
217  PlasticDataType Variables;
218  this->InitializeVariables(rValues,Variables);
219 
220  // calculate isochoric stress (radial return is needed)
221 
222  //MatrixType StoredStressMatrix = rValues.StressMatrix; //store to recover later
223 
224  MatrixType StressMatrix;
225  //1.-Elastic Isochoric Stress Matrix
226  this->mElasticityModel.CalculateIsochoricStressTensor(rValues,StressMatrix);
227 
228  rValues.StressMatrix = StressMatrix; //store trial isochoric stress to ModelData StressMatrix
229 
230  //2.-Calculate and Add Plastic Isochoric Stress Matrix
231  this->CalculateAndAddIsochoricStressTensor(Variables,StressMatrix);
232 
233  //Calculate Constitutive Matrix
234 
235  // calculate elastic constitutive tensor
236  this->mElasticityModel.CalculateConstitutiveTensor(rValues,rConstitutiveMatrix);
237 
238  // calculate plastic constitutive tensor
239  if( Variables.State().Is(ConstitutiveModelData::PLASTIC_REGION) )
240  this->CalculateAndAddPlasticConstitutiveTensor(Variables,rConstitutiveMatrix);
241 
242  Variables.State().Set(ConstitutiveModelData::CONSTITUTIVE_MATRIX_COMPUTED,true);
243 
244  //rValues.StressMatrix = StoredStressMatrix; //recovered (commented because it is the same)
245 
246  KRATOS_CATCH(" ")
247  }
248 
252  void CalculateStressAndConstitutiveTensors(ModelDataType& rValues, MatrixType& rStressMatrix, Matrix& rConstitutiveMatrix) override
253  {
254  KRATOS_TRY
255 
256  PlasticDataType Variables;
257  this->InitializeVariables(rValues,Variables);
258 
259  //Calculate Stress Matrix
260 
261  // calculate volumetric stress
262  MatrixType VolumetricStressMatrix;
263  noalias(VolumetricStressMatrix) = ZeroMatrix(3,3);
264  this->mElasticityModel.CalculateVolumetricStressTensor(rValues,VolumetricStressMatrix);
265 
266  // calculate isochoric stress
267 
268  // calculate elastic isochoric stress
269  this->mElasticityModel.CalculateIsochoricStressTensor(rValues,rStressMatrix);
270 
271  rValues.StressMatrix = rStressMatrix; //store trial isochoric stress to ModelData StressMatrix
272 
273  // calculate plastic isochoric stress
274  this->CalculateAndAddIsochoricStressTensor(Variables,rStressMatrix);
275 
276 
277  //Calculate Constitutive Matrix
278 
279  // calculate elastic constitutive tensor
280  this->mElasticityModel.CalculateConstitutiveTensor(rValues,rConstitutiveMatrix);
281 
282  // calculate plastic constitutive tensor
283  if( Variables.State().Is(ConstitutiveModelData::PLASTIC_REGION) ){
284  this->CalculateAndAddPlasticConstitutiveTensor(Variables,rConstitutiveMatrix);
285  }
286 
287  Variables.State().Set(ConstitutiveModelData::CONSTITUTIVE_MATRIX_COMPUTED,true);
288 
289  rStressMatrix += VolumetricStressMatrix;
290 
291 
292  if( rValues.State.Is(ConstitutiveModelData::UPDATE_INTERNAL_VARIABLES ) )
293  this->UpdateInternalVariables(rValues, Variables, rStressMatrix);
294 
295 
296  KRATOS_CATCH(" ")
297  }
298 
302 
306  bool Has(const Variable<double>& rThisVariable) override {return false;}
307 
311  void SetValue(const Variable<double>& rVariable,
312  const double& rValue,
313  const ProcessInfo& rCurrentProcessInfo) override {}
317  double& GetValue(const Variable<double>& rThisVariable, double& rValue) override { rValue=0; return rValue;}
318 
319 
323 
324 
328 
330  std::string Info() const override
331  {
332  std::stringstream buffer;
333  buffer << "NonLinearAssociativePlasticityModel" ;
334  return buffer.str();
335  }
336 
338  void PrintInfo(std::ostream& rOStream) const override
339  {
340  rOStream << "NonLinearAssociativePlasticityModel";
341  }
342 
344  void PrintData(std::ostream& rOStream) const override
345  {
346  rOStream << "NonLinearAssociativePlasticityModel Data";
347  }
348 
352 
353 
355 
356  protected:
359 
360 
364 
365  // internal variables:
368 
370 
374 
375 
379 
383  virtual void SetWorkingMeasures(PlasticDataType& rVariables, MatrixType& rStressMatrix)
384  {
385  KRATOS_TRY
386 
387  const ModelDataType& rModelData = rVariables.GetModelData();
388 
389  //working stress is Kirchhoff by default : transform stresses is working stress is PK2
390  const StressMeasureType& rStressMeasure = rModelData.GetStressMeasure();
391  const StrainMeasureType& rStrainMeasure = rModelData.GetStrainMeasure();
392 
394 
395  const MatrixType& rTotalDeformationMatrix = rModelData.GetTotalDeformationMatrix();
396  MatrixType StressMatrixPart;
397  noalias( StressMatrixPart ) = prod( rTotalDeformationMatrix, rStressMatrix );
398  noalias( rStressMatrix ) = prod( StressMatrixPart, trans(rTotalDeformationMatrix) );
399 
401  double I3 = 0;
402  ConstitutiveModelUtilities::InvertMatrix3( rModelData.GetStrainMatrix(), rVariables.StrainMatrix, I3 );
403  }
404  else{
405  KRATOS_ERROR << "calling initialize PlasticityModel .. StrainMeasure provided is inconsistent" << std::endl;
406  }
407 
408  }
410 
412  rVariables.StrainMatrix = IdentityMatrix(3);
413  }
414  else{
415  KRATOS_ERROR << "calling initialize PlasticityModel .. StrainMeasure provided is inconsistent" << std::endl;
416  }
417 
418  }
419  else{
420  KRATOS_ERROR << "calling initialize PlasticityModel .. StressMeasure provided is inconsistent" << std::endl;
421  }
422 
423  //initialize thermal variables
424  mThermalVariables.PlasticDissipation = 0;
425  mThermalVariables.DeltaPlasticDissipation = 0;
426 
427  KRATOS_CATCH(" ")
428  }
429 
430 
434  virtual void GetWorkingMeasures(PlasticDataType& rVariables, MatrixType& rStressMatrix)
435  {
436  KRATOS_TRY
437 
438  const ModelDataType& rModelData = rVariables.GetModelData();
439 
440  //working stress is Kirchhoff by default : transform stresses if working stress is PK2
441  const StressMeasureType& rStressMeasure = rModelData.GetStressMeasure();
442 
444 
445  const MatrixType& rTotalDeformationMatrix = rModelData.GetTotalDeformationMatrix();
446  MatrixType StressMatrixPart;
447 
448  MatrixType InverseTotalDeformationMatrix;
449  InverseTotalDeformationMatrix.clear();
450  double TotalDeformationDet;
451  ConstitutiveModelUtilities::InvertMatrix3( rTotalDeformationMatrix, InverseTotalDeformationMatrix, TotalDeformationDet);
452  noalias( StressMatrixPart ) = prod( InverseTotalDeformationMatrix, rStressMatrix );
453  noalias( rStressMatrix ) = prod( StressMatrixPart, trans(InverseTotalDeformationMatrix) );
454 
455  }
456 
457  KRATOS_CATCH(" ")
458  }
459 
460 
464  virtual void CalculateAndAddIsochoricStressTensor(PlasticDataType& rVariables, MatrixType& rStressMatrix)
465  {
466  KRATOS_TRY
467 
468  //0.-Check working stress
469  this->SetWorkingMeasures(rVariables,rStressMatrix);
470 
471  //1.-Isochoric stress norm (rStressMatrix := Elastic Isochoric Stress Matrix)
472  rVariables.StressNorm = ConstitutiveModelUtilities::CalculateStressNorm(rStressMatrix, rVariables.StressNorm);
473 
474  //2.-Check yield condition
475  rVariables.TrialStateFunction = this->mYieldSurface.CalculateYieldCondition(rVariables, rVariables.TrialStateFunction);
476 
477  if( rVariables.State().Is(ConstitutiveModelData::IMPLEX_ACTIVE) )
478  {
479  //3.- Calculate the implex radial return
480  this->CalculateImplexReturnMapping(rVariables,rStressMatrix);
481  }
482  else{
483 
484  if( rVariables.TrialStateFunction <= 0 )
485  {
486  rVariables.State().Set(ConstitutiveModelData::PLASTIC_REGION,false);
487  }
488  else
489  {
490  //3.- Calculate the return mapping
491  bool converged = this->CalculateReturnMapping(rVariables,rStressMatrix);
492 
493  //4.- Update back stress, plastic strain and stress
494  this->UpdateStressConfiguration(rVariables,rStressMatrix);
495 
496  if( !converged )
497  KRATOS_WARNING("NON-LINEAR PLASTICITY")<<"Not converged"<<std::endl;
498 
499  //5.- Calculate thermal dissipation and delta thermal dissipation
500  this->CalculateThermalDissipation(rVariables);
501 
502  rVariables.State().Set(ConstitutiveModelData::PLASTIC_REGION,true);
503  }
504 
505  }
506 
507  //6.- Recover working stress
508  this->GetWorkingMeasures(rVariables,rStressMatrix);
509 
510  rVariables.State().Set(ConstitutiveModelData::RETURN_MAPPING_COMPUTED,true);
511 
512  KRATOS_CATCH(" ")
513  }
514 
518  virtual void CalculateAndAddPlasticConstitutiveTensor(PlasticDataType& rVariables, Matrix& rConstitutiveMatrix)
519  {
520  KRATOS_TRY
521 
522  //Compute radial return
523  if( rVariables.State().IsNot(ConstitutiveModelData::RETURN_MAPPING_COMPUTED) )
524  KRATOS_ERROR << "ReturnMapping has to be computed to perform the calculation" << std::endl;
525 
526  //Algorithmic moduli factors
527  PlasticFactors Factors;
528  this->CalculateScalingFactors(rVariables,Factors);
529 
530  //Calculate HyperElastic ConstitutiveMatrix
531  const ModelDataType& rModelData = rVariables.GetModelData();
532  const SizeType& rVoigtSize = rModelData.GetVoigtSize();
533  const VoigtIndexType& rIndexVoigtTensor = rModelData.GetVoigtIndexTensor();
534 
535 
536  for(SizeType i=0; i<rVoigtSize; i++)
537  {
538  for(SizeType j=0; j<rVoigtSize; j++)
539  {
540 
541  rConstitutiveMatrix(i,j) = this->AddPlasticConstitutiveComponent(rVariables,Factors,rConstitutiveMatrix(i,j),
542  rIndexVoigtTensor[i][0],rIndexVoigtTensor[i][1],
543  rIndexVoigtTensor[j][0],rIndexVoigtTensor[j][1]);
544  }
545 
546  }
547 
548 
549  rVariables.State().Set(ConstitutiveModelData::CONSTITUTIVE_MATRIX_COMPUTED,true);
550 
551  KRATOS_CATCH(" ")
552  }
553 
558  PlasticFactors& rFactors, double& rCabcd,
559  const unsigned int& a, const unsigned int& b,
560  const unsigned int& c, const unsigned int& d)
561  {
562  KRATOS_TRY
563 
564  const ModelDataType& rModelData = rVariables.GetModelData();
565  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
566 
567  const MatrixType& rIsochoricStressMatrix = rModelData.GetStressMatrix(); //isochoric stress stored as StressMatrix
568  const MatrixType& rStrainMatrix = rVariables.GetStrainMatrix(); // C^-1 or Id
569 
570  //TODO: this constitutive part must be revised, depending on the working strain/stress measure C^-1 or I must be supplied
571 
572 
573  double Cabcd = 0;
574 
575  Cabcd = (1.0/3.0) * ( rStrainMatrix(a,b) * rStrainMatrix(c,d) );
576 
577  Cabcd -= (0.5 * ( rStrainMatrix(a,c) * rStrainMatrix(b,d) + rStrainMatrix(a,d) * rStrainMatrix(b,c) ) );
578 
579  Cabcd *= 3.0 * rMaterial.GetLameMuBar();
580 
581  Cabcd += ( rStrainMatrix(c,d) * rIsochoricStressMatrix(a,b) + rIsochoricStressMatrix(c,d) * rStrainMatrix(a,b) );
582 
583  Cabcd *= (-2.0/3.0) * ( (-1) * rFactors.Beta1 );
584 
585  Cabcd -= rFactors.Beta3 * 2.0 * rMaterial.GetLameMuBar() * ( rFactors.Normal(a,b) * rFactors.Normal(c,d) );
586 
587  Cabcd -= rFactors.Beta4 * 2.0 * rMaterial.GetLameMuBar() * ( rFactors.Normal(a,b) * rFactors.Dev_Normal(c,d) );
588 
589 
590  rCabcd += Cabcd;
591 
592  return rCabcd;
593 
594  KRATOS_CATCH(" ")
595  }
596 
597 
598  // calculate return mapping
599 
600  virtual bool CalculateReturnMapping(PlasticDataType& rVariables, MatrixType& rStressMatrix)
601  {
602  KRATOS_TRY
603 
604  //Set convergence parameters
605  unsigned int iter = 0;
606  double Tolerance = 1e-5;
607  double MaxIterations = 50;
608 
609  //start
610  double DeltaDeltaGamma = 0;
611  double DeltaStateFunction = 0;
612  double DeltaPlasticStrain = 0;
613 
614  double& rEquivalentPlasticStrainOld = mPreviousInternal.Variables[0];
615  double& rEquivalentPlasticStrain = rVariables.Internal.Variables[0];
616  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
617 
618  double StateFunction = rVariables.TrialStateFunction;
619 
620  rEquivalentPlasticStrain = 0;
621  rDeltaGamma = 0;
622 
623  while(fabs(StateFunction)>=Tolerance && iter<=MaxIterations)
624  {
625  //Calculate Delta State Function:
626  DeltaStateFunction = this->mYieldSurface.CalculateDeltaStateFunction( rVariables, DeltaStateFunction );
627 
628  //Calculate DeltaGamma:
629  DeltaDeltaGamma = StateFunction/DeltaStateFunction;
630  rDeltaGamma += DeltaDeltaGamma;
631 
632  //Update Equivalent Plastic Strain:
633  DeltaPlasticStrain = sqrt(2.0/3.0) * rDeltaGamma;
634  rEquivalentPlasticStrain = rEquivalentPlasticStrainOld + DeltaPlasticStrain;
635 
636  //Calculate State Function:
637  StateFunction = this->mYieldSurface.CalculateStateFunction( rVariables, StateFunction );
638 
639  iter++;
640  }
641 
642  if(iter>MaxIterations){
643  std::cout<<" ConstitutiveLaw did not converge [Stress: "<<rStressMatrix<<" DeltaGamma: "<<rDeltaGamma<<" StateFunction: "<<StateFunction<<" DeltaDeltaGamma: "<<DeltaDeltaGamma<<"]"<<std::endl;
644  return false;
645  }
646 
647  return true;
648 
649  KRATOS_CATCH(" ")
650  }
651 
652  // implex protected methods
653  virtual void CalculateImplexReturnMapping(PlasticDataType& rVariables, MatrixType& rStressMatrix)
654  {
655  KRATOS_TRY
656 
657  double& rEquivalentPlasticStrainOld = mPreviousInternal.Variables[0];
658  double& rEquivalentPlasticStrain = rVariables.Internal.Variables[0];
659  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
660 
661  //1.-Computation of the plastic Multiplier
662  rDeltaGamma = sqrt(3.0*0.5) * ( rEquivalentPlasticStrain - rEquivalentPlasticStrainOld );
663 
664  //2.- Update back stress, plastic strain and stress
665  this->UpdateStressConfiguration(rVariables,rStressMatrix);
666 
667  //3.- Calculate thermal dissipation and delta thermal dissipation
668  if( rDeltaGamma > 0 ){
669 
670  this->CalculateImplexThermalDissipation( rVariables );
671  rVariables.State().Set(ConstitutiveModelData::PLASTIC_REGION,true);
672 
673  }
674  else{
675 
676  mThermalVariables.PlasticDissipation = 0;
677  mThermalVariables.DeltaPlasticDissipation = 0;
678  }
679 
680  KRATOS_CATCH(" ")
681  }
682 
683  // auxiliar methods
684 
685  virtual void InitializeVariables(ModelDataType& rValues, PlasticDataType& rVariables)
686  {
687  KRATOS_TRY
688 
689  //set model data pointer
690  rVariables.SetModelData(rValues);
691 
692  rValues.State.Set(ConstitutiveModelData::PLASTIC_REGION,false);
693 
694  rValues.State.Set(ConstitutiveModelData::IMPLEX_ACTIVE,false);
695  if( rValues.GetProcessInfo()[IMPLEX] == 1 )
696  rValues.State.Set(ConstitutiveModelData::IMPLEX_ACTIVE,true);
697 
698  rVariables.SetState(rValues.State);
699 
700  // RateFactor
701  rVariables.RateFactor = 0;
702 
703  // EquivalentPlasticStrain
704  rVariables.Internal = mInternal;
705 
706  // DeltaGamma / DeltaPlasticStrain (associative plasticity)
707  rVariables.DeltaInternal.Variables.clear();
708 
709  // Flow Rule local variables
710  rVariables.TrialStateFunction = 0;
711  rVariables.StressNorm = 0;
712 
713  KRATOS_CATCH(" ")
714  }
715 
716  virtual void UpdateStressConfiguration(PlasticDataType& rVariables, MatrixType& rStressMatrix)
717  {
718  KRATOS_TRY
719 
720  //Plastic Strain and Back Stress update
721  if( rVariables.StressNorm > 0 ){
722 
723  double& DeltaGamma = rVariables.DeltaInternal.Variables[0];
724  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
725 
726  //Stress Update:
727  rStressMatrix -= ( rStressMatrix * ( ( 2.0 * rMaterial.GetLameMuBar() * DeltaGamma ) / rVariables.StressNorm ) );
728 
729  }
730 
731  KRATOS_CATCH(" ")
732  }
733 
734  virtual void UpdateInternalVariables(ModelDataType& rValues, PlasticDataType& rVariables, const MatrixType& rStressMatrix)
735  {
736  KRATOS_TRY
737 
738  double& rEquivalentPlasticStrainOld = mPreviousInternal.Variables[0];
739  double& rEquivalentPlasticStrain = mInternal.Variables[0];
740  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
741 
742  //update mechanical variables
743  rEquivalentPlasticStrainOld = rEquivalentPlasticStrain;
744  rEquivalentPlasticStrain += sqrt(2.0/3.0) * rDeltaGamma;
745 
746 
747  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
748 
749  //update total strain measure
750  double VolumetricPart = (rValues.StrainMatrix(0,0)+rValues.StrainMatrix(1,1)+rValues.StrainMatrix(2,2)) / (3.0);
751 
752  rValues.StrainMatrix = rStressMatrix;
753  rValues.StrainMatrix *= ( 1.0 / rMaterial.GetLameMu() * pow(rValues.GetTotalDeformationDet(),(2.0/3.0)) );
754 
755  rValues.StrainMatrix(0,0) += VolumetricPart;
756  rValues.StrainMatrix(1,1) += VolumetricPart;
757  rValues.StrainMatrix(2,2) += VolumetricPart;
758 
759 
760  KRATOS_CATCH(" ")
761  }
762 
763  virtual void CalculateScalingFactors(PlasticDataType& rVariables, PlasticFactors& rFactors)
764  {
765  KRATOS_TRY
766 
767  //0.-Get needed parameters
768  const ModelDataType& rModelData = rVariables.GetModelData();
769  const MaterialDataType& rMaterial = rVariables.GetMaterialParameters();
770 
771  double& rDeltaGamma = rVariables.DeltaInternal.Variables[0];
772  const MatrixType& rIsochoricStressMatrix = rModelData.GetStressMatrix(); //isochoric stress stored as StressMatrix
773 
774  //1.-Identity build
775  MatrixType Identity = IdentityMatrix(3);
776 
777  //2.-Auxiliar matrices
778  rFactors.Normal = rIsochoricStressMatrix * ( 1.0 / rVariables.StressNorm );
779 
780  MatrixType Norm_Normal = prod( rFactors.Normal, trans(rFactors.Normal) );
781 
782  double Trace_Norm_Normal = Norm_Normal( 0, 0 ) + Norm_Normal( 1, 1 ) + Norm_Normal( 2, 2 );
783 
784  rFactors.Dev_Normal = Norm_Normal;
785 
786  rFactors.Dev_Normal -= (1.0/3.0) * Trace_Norm_Normal * Identity;
787 
788  //3.-Auxiliar constants
789  if( rVariables.State().Is(ConstitutiveModelData::IMPLEX_ACTIVE) )
790  {
791 
792  rFactors.Beta0 = 0;
793 
794  rFactors.Beta1 = 2.0 * rMaterial.GetLameMuBar() * rDeltaGamma / rVariables.StressNorm;
795 
796  rFactors.Beta2 = (2.0/3.0) * rVariables.StressNorm * rDeltaGamma / ( rMaterial.GetLameMuBar() );
797 
798  rFactors.Beta3 = ( -rFactors.Beta1 + rFactors.Beta2 );
799 
800  rFactors.Beta4 = ( -rFactors.Beta1 ) * rVariables.StressNorm / ( rMaterial.GetLameMuBar() );
801 
802  }
803  else
804  {
805 
806  if( rVariables.State().Is(ConstitutiveModelData::PLASTIC_RATE_REGION) )
807  rVariables.RateFactor = 1;
808  else if ( rVariables.State().IsNot(ConstitutiveModelData::PLASTIC_RATE_REGION) )
809  rVariables.RateFactor = 0;
810 
811  double DeltaHardening = this->mYieldSurface.GetHardeningRule().CalculateDeltaHardening( rVariables, DeltaHardening );
812 
813  rFactors.Beta0 = 1.0 + DeltaHardening/(3.0 * rMaterial.GetLameMuBar());
814 
815  rFactors.Beta1 = 2.0 * rMaterial.GetLameMuBar() * rDeltaGamma / rVariables.StressNorm;
816 
817  rFactors.Beta2 = ( ( 1.0 - ( 1.0 / rFactors.Beta0 ) ) * (2.0/3.0) * rVariables.StressNorm * rDeltaGamma )/( rMaterial.GetLameMuBar() );
818 
819  rFactors.Beta3 = ( ( 1.0 / rFactors.Beta0 ) - rFactors.Beta1 + rFactors.Beta2 );
820 
821  rFactors.Beta4 = ( ( 1.0 / rFactors.Beta0 ) - rFactors.Beta1 ) * rVariables.StressNorm / ( rMaterial.GetLameMuBar() );
822 
823  }
824 
825  // std::cout<<"FACTORS:: Beta0 "<<rFactors.Beta0<<" Beta 1 "<<rFactors.Beta1<<" Beta2 "<<rFactors.Beta2<<" Beta3 "<<rFactors.Beta3<<" Beta4 "<<rFactors.Beta4<<std::endl;
826 
827  // std::cout<<" Normal "<<rFactors.Normal<<std::endl;
828  // std::cout<<" Dev_Normal "<<rFactors.Dev_Normal<<std::endl;
829 
830  KRATOS_CATCH(" ")
831 
832  }
833 
834 
835  // energy calculation methods
836 
838  {
839  KRATOS_TRY
840 
841 
842  //1.- Thermal Dissipation:
843  mThermalVariables.PlasticDissipation = this->mYieldSurface.CalculatePlasticDissipation( rVariables, mThermalVariables.PlasticDissipation );
844 
845 
846  //std::cout<<" PlasticDissipation "<<mThermalVariables.PlasticDissipation<<std::endl;
847 
848  //2.- Thermal Dissipation Increment:
849  mThermalVariables.DeltaPlasticDissipation = this->mYieldSurface.CalculateDeltaPlasticDissipation( rVariables, mThermalVariables.DeltaPlasticDissipation );
850 
851  //std::cout<<" DeltaPlasticDissipation "<<mThermalVariables.DeltaPlasticDissipation<<std::endl;
852 
853  KRATOS_CATCH(" ")
854  }
855 
856  // implex protected methods
858  {
859  KRATOS_TRY
860 
861  //1.- Thermal Dissipation:
862  mThermalVariables.PlasticDissipation = this->mYieldSurface.CalculateImplexPlasticDissipation( rVariables, mThermalVariables.PlasticDissipation );
863 
864  //2.- Thermal Dissipation Increment:
865  mThermalVariables.DeltaPlasticDissipation = this->mYieldSurface.CalculateImplexDeltaPlasticDissipation( rVariables, mThermalVariables.DeltaPlasticDissipation );
866 
867  KRATOS_CATCH(" ")
868  }
869 
873 
874 
878 
879 
883 
884 
886 
887  private:
890 
891 
895 
896 
900 
901 
905 
906 
910 
911 
915  friend class Serializer;
916 
917  void save(Serializer& rSerializer) const override
918  {
920  rSerializer.save("InternalVariables",mInternal);
921  rSerializer.save("PreviousInternalVariables",mPreviousInternal);
922  rSerializer.save("ThermalVariables",mThermalVariables);
923  }
924 
925  void load(Serializer& rSerializer) override
926  {
927  KRATOS_SERIALIZE_LOAD_BASE_CLASS( rSerializer, BaseType )
928  rSerializer.load("InternalVariables",mInternal);
929  rSerializer.load("PreviousInternalVariables",mPreviousInternal);
930  rSerializer.load("ThermalVariables",mThermalVariables);
931  }
932 
936 
937 
941 
943 
944  }; // Class NonLinearAssociativePlasticityModel
945 
947 
950 
954 
956 
958 
959 } // namespace Kratos.
960 
961 #endif // KRATOS_NON_LINEAR_ASSOCIATIVE_PLASTICITY_MODEL_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
StressMeasureType
Definition: constitutive_model_data.hpp:83
StrainMeasureType
Definition: constitutive_model_data.hpp:75
const unsigned int(*)[2] VoigtIndexType
Definition: constitutive_model.hpp:55
ConstitutiveModelData::SizeType SizeType
Definition: constitutive_model.hpp:66
static double & CalculateStressNorm(const MatrixType &rStressMatrix, double &rStressNorm)
Definition: constitutive_model_utilities.hpp:881
static void InvertMatrix3(const MatrixType &InputMatrix, MatrixType &InvertedMatrix, double &InputMatrixDet)
Definition: constitutive_model_utilities.hpp:1043
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool Is(Flags const &rOther) const
Definition: flags.h:274
Definition: amatrix_interface.h:41
void clear()
Definition: amatrix_interface.h:284
Short class definition.
Definition: non_linear_associative_plasticity_model.hpp:50
ConstitutiveModelData::StressMeasureType StressMeasureType
Definition: non_linear_associative_plasticity_model.hpp:76
ConstitutiveModelData::StrainMeasureType StrainMeasureType
Definition: non_linear_associative_plasticity_model.hpp:75
BaseType::ModelDataType ModelDataType
Definition: non_linear_associative_plasticity_model.hpp:70
BaseType::SizeType SizeType
Definition: non_linear_associative_plasticity_model.hpp:67
std::string Info() const override
Turn back information as a string.
Definition: non_linear_associative_plasticity_model.hpp:330
TYieldSurface YieldSurfaceType
Definition: non_linear_associative_plasticity_model.hpp:60
virtual void SetWorkingMeasures(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_associative_plasticity_model.hpp:383
void CalculateImplexThermalDissipation(PlasticDataType &rVariables)
Definition: non_linear_associative_plasticity_model.hpp:857
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: non_linear_associative_plasticity_model.hpp:338
PlasticityModel< ElasticityModelType, YieldSurfaceType > BaseType
Definition: non_linear_associative_plasticity_model.hpp:63
BaseType::PlasticDataType PlasticDataType
Definition: non_linear_associative_plasticity_model.hpp:72
virtual void CalculateAndAddIsochoricStressTensor(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_associative_plasticity_model.hpp:464
virtual double & AddPlasticConstitutiveComponent(PlasticDataType &rVariables, PlasticFactors &rFactors, double &rCabcd, const unsigned int &a, const unsigned int &b, const unsigned int &c, const unsigned int &d)
Definition: non_linear_associative_plasticity_model.hpp:557
BaseType::MaterialDataType MaterialDataType
Definition: non_linear_associative_plasticity_model.hpp:71
virtual void GetWorkingMeasures(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_associative_plasticity_model.hpp:434
virtual bool CalculateReturnMapping(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_associative_plasticity_model.hpp:600
void CalculateIsochoricStressTensor(ModelDataType &rValues, MatrixType &rStressMatrix) override
Definition: non_linear_associative_plasticity_model.hpp:185
BaseType::Pointer BaseTypePointer
Definition: non_linear_associative_plasticity_model.hpp:66
ConstitutiveModel::Pointer Clone() const override
Clone.
Definition: non_linear_associative_plasticity_model.hpp:146
ThermalVariables mThermalVariables
Definition: non_linear_associative_plasticity_model.hpp:369
BaseType::MatrixType MatrixType
Definition: non_linear_associative_plasticity_model.hpp:69
~NonLinearAssociativePlasticityModel() override
Destructor.
Definition: non_linear_associative_plasticity_model.hpp:152
double & GetValue(const Variable< double > &rThisVariable, double &rValue) override
Definition: non_linear_associative_plasticity_model.hpp:317
void CalculateStressAndConstitutiveTensors(ModelDataType &rValues, MatrixType &rStressMatrix, Matrix &rConstitutiveMatrix) override
Definition: non_linear_associative_plasticity_model.hpp:252
virtual void CalculateAndAddPlasticConstitutiveTensor(PlasticDataType &rVariables, Matrix &rConstitutiveMatrix)
Definition: non_linear_associative_plasticity_model.hpp:518
NonLinearAssociativePlasticityModel()
Default constructor.
Definition: non_linear_associative_plasticity_model.hpp:130
BaseType::InternalVariablesType InternalVariablesType
Definition: non_linear_associative_plasticity_model.hpp:73
void CalculateStressTensor(ModelDataType &rValues, MatrixType &rStressMatrix) override
Definition: non_linear_associative_plasticity_model.hpp:168
KRATOS_CLASS_POINTER_DEFINITION(NonLinearAssociativePlasticityModel)
Pointer definition of NonLinearAssociativePlasticityModel.
TElasticityModel ElasticityModelType
Definition: non_linear_associative_plasticity_model.hpp:57
virtual void CalculateScalingFactors(PlasticDataType &rVariables, PlasticFactors &rFactors)
Definition: non_linear_associative_plasticity_model.hpp:763
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: non_linear_associative_plasticity_model.hpp:344
virtual void InitializeVariables(ModelDataType &rValues, PlasticDataType &rVariables)
Definition: non_linear_associative_plasticity_model.hpp:685
void CalculateThermalDissipation(PlasticDataType &rVariables)
Definition: non_linear_associative_plasticity_model.hpp:837
virtual void UpdateInternalVariables(ModelDataType &rValues, PlasticDataType &rVariables, const MatrixType &rStressMatrix)
Definition: non_linear_associative_plasticity_model.hpp:734
BaseType::VoigtIndexType VoigtIndexType
Definition: non_linear_associative_plasticity_model.hpp:68
InternalVariablesType mInternal
Definition: non_linear_associative_plasticity_model.hpp:366
NonLinearAssociativePlasticityModel(NonLinearAssociativePlasticityModel const &rOther)
Copy constructor.
Definition: non_linear_associative_plasticity_model.hpp:133
InternalVariablesType mPreviousInternal
Definition: non_linear_associative_plasticity_model.hpp:367
virtual void UpdateStressConfiguration(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_associative_plasticity_model.hpp:716
bool Has(const Variable< double > &rThisVariable) override
Definition: non_linear_associative_plasticity_model.hpp:306
NonLinearAssociativePlasticityModel & operator=(NonLinearAssociativePlasticityModel const &rOther)
Assignment operator.
Definition: non_linear_associative_plasticity_model.hpp:136
void SetValue(const Variable< double > &rVariable, const double &rValue, const ProcessInfo &rCurrentProcessInfo) override
Definition: non_linear_associative_plasticity_model.hpp:311
virtual void CalculateImplexReturnMapping(PlasticDataType &rVariables, MatrixType &rStressMatrix)
Definition: non_linear_associative_plasticity_model.hpp:653
void CalculateConstitutiveTensor(ModelDataType &rValues, Matrix &rConstitutiveMatrix) override
Definition: non_linear_associative_plasticity_model.hpp:210
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
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
#define KRATOS_WARNING(label)
Definition: logger.h:265
void InitializeVariables(TContainerType &rContainer, const Variable< TDataType > &rOutputVariable, const Variable< TDataType > &rReferenceVariable)
Definition: temporal_method_utilities.h:36
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
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
tuple I3
Definition: isotropic_damage_automatic_differentiation.py:232
def load(f)
Definition: ode_solve.py:307
int d
Definition: ode_solve.py:397
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31
Definition: constitutive_model_data.hpp:92
const double & GetLameMu() const
Definition: constitutive_model_data.hpp:111
const double & GetLameMuBar() const
Definition: constitutive_model_data.hpp:112
Definition: constitutive_model_data.hpp:383
const ProcessInfo & GetProcessInfo() const
Definition: constitutive_model_data.hpp:435
const StressMeasureType & GetStressMeasure() const
Definition: constitutive_model_data.hpp:452
const SizeType & GetVoigtSize() const
Definition: constitutive_model_data.hpp:436
const double & GetTotalDeformationDet() const
Definition: constitutive_model_data.hpp:449
MatrixType StressMatrix
Definition: constitutive_model_data.hpp:401
const VoigtIndexType & GetVoigtIndexTensor() const
Definition: constitutive_model_data.hpp:437
Flags State
Definition: constitutive_model_data.hpp:399
MatrixType StrainMatrix
Definition: constitutive_model_data.hpp:402
Definition: non_linear_associative_plasticity_model.hpp:107
double Beta2
Definition: non_linear_associative_plasticity_model.hpp:110
double Beta3
Definition: non_linear_associative_plasticity_model.hpp:111
MatrixType Normal
Definition: non_linear_associative_plasticity_model.hpp:114
double Beta1
Definition: non_linear_associative_plasticity_model.hpp:109
MatrixType Dev_Normal
Definition: non_linear_associative_plasticity_model.hpp:115
double Beta0
Definition: non_linear_associative_plasticity_model.hpp:108
double Beta4
Definition: non_linear_associative_plasticity_model.hpp:112
Definition: non_linear_associative_plasticity_model.hpp:82
double PlasticDissipation
Definition: non_linear_associative_plasticity_model.hpp:84
double DeltaPlasticDissipation
Definition: non_linear_associative_plasticity_model.hpp:85