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.
advanced_constitutive_law_utilities.h
Go to the documentation of this file.
1 // KRATOS ___ _ _ _ _ _ __ _
2 // / __\___ _ __ ___| |_(_) |_ _ _| |_(_)_ _____ / / __ ___ _____ /_\ _ __ _ __
3 // / / / _ \| '_ \/ __| __| | __| | | | __| \ \ / / _ \/ / / _` \ \ /\ / / __| //_\\| '_ \| '_ |
4 // / /__| (_) | | | \__ \ |_| | |_| |_| | |_| |\ V / __/ /__| (_| |\ V V /\__ \/ _ \ |_) | |_) |
5 // \____/\___/|_| |_|___/\__|_|\__|\__,_|\__|_| \_/ \___\____/\__,_| \_/\_/ |___/\_/ \_/ .__/| .__/
6 // |_| |_|
7 //
8 // License: BSD License
9 // license: structural_mechanics_application/license.txt
10 //
11 // Main authors: Alejandro Cornejo
12 //
13 
14 #pragma once
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
22 #include "includes/node.h"
24 #include "geometries/geometry.h"
25 
26 namespace Kratos
27 {
30 
34 
36  using SizeType = std::size_t;
37 
41 
45 
49 
57 template <SizeType TVoigtSize = 6>
58 class KRATOS_API(CONSTITUTIVE_LAWS_APPLICATION) AdvancedConstitutiveLawUtilities
59 {
60  public:
63 
65  using IndexType = std::size_t;
66 
68  static constexpr SizeType Dimension = TVoigtSize == 6 ? 3 : 2;
69 
71  static constexpr SizeType VoigtSize = TVoigtSize;
72 
74  using MatrixType = Matrix;
75 
77  using VectorType = Vector;
78 
81 
84 
87 
89  using NodeType = Node;
90 
93 
95  static constexpr double tolerance = std::numeric_limits<double>::epsilon();
96 
100 
104 
108 
115  template<class TVector>
116  static void CalculateI1Invariant(
117  const TVector& rStressVector,
118  double& rI1
119  )
120  {
121  rI1 = rStressVector[0];
122  for (IndexType i = 1; i < Dimension; ++i)
123  rI1 += rStressVector[i];
124  }
125 
132  static void CalculateI2Invariant(
133  const BoundedVectorType& rStressVector,
134  double& rI2
135  );
136 
143  static void CalculateI3Invariant(
144  const BoundedVectorType& rStressVector,
145  double& rI3
146  );
147 
156  template<class TVector>
157  static void CalculateJ2Invariant(
158  const TVector& rStressVector,
159  const double I1,
160  BoundedVectorType& rDeviator,
161  double& rJ2
162  )
163  {
164  noalias(rDeviator) = rStressVector;
165  const double p_mean = I1 / 3.0;
166  if constexpr (Dimension == 3) {
167  for (IndexType i = 0; i < Dimension; ++i)
168  rDeviator[i] -= p_mean;
169  rJ2 = 0.0;
170  for (IndexType i = 0; i < Dimension; ++i)
171  rJ2 += 0.5 * std::pow(rDeviator[i], 2);
172  for (IndexType i = Dimension; i < 6; ++i)
173  rJ2 += std::pow(rDeviator[i], 2);
174  } else {
175  for (IndexType i = 0; i < Dimension; ++i)
176  rDeviator[i] -= p_mean;
177  rJ2 = 0.5 * (std::pow(rDeviator[0], 2.0) + std::pow(rDeviator[1], 2.0) + std::pow(p_mean, 2.0)) + std::pow(rDeviator[2], 2.0);
178  }
179  }
180 
186  static void CalculateJ3Invariant(
187  const BoundedVectorType& rDeviator,
188  double& rJ3
189  );
190 
197  static void CalculateFirstVector(BoundedVectorType& rFirstVector);
198 
207  static void CalculateSecondVector(
208  const BoundedVectorType& rDeviator,
209  const double J2,
210  BoundedVectorType& rSecondVector
211  );
212 
222  static void CalculateThirdVector(
223  const BoundedVectorType& rDeviator,
224  const double J2,
225  BoundedVectorType& rThirdVector
226  );
227 
234  static void CalculateLodeAngle(
235  const double J2,
236  const double J3,
237  double& rLodeAngle
238  );
239 
245  static double CalculateCharacteristicLength(const GeometryType& rGeometry);
246 
252  static double CalculateCharacteristicLengthOnReferenceConfiguration(const GeometryType& rGeometry);
253 
258  static Matrix ComputeEquivalentSmallDeformationDeformationGradient(const Vector& rStrainVector);
259 
266  static void CalculateAlmansiStrain(
267  const MatrixType& rLeftCauchyTensor,
268  VectorType& rStrainVector
269  );
270 
277  static void CalculateHenckyStrain(
278  const MatrixType& rCauchyTensor,
279  VectorType& rStrainVector
280  );
281 
288  static void CalculateBiotStrain(
289  const MatrixType& rCauchyTensor,
290  VectorType& rStrainVector
291  );
292 
301  array_1d<double, Dimension>& rPrincipalStressVector,
302  const BoundedVectorType& rStressVector
303  );
304 
312  static void CalculatePrincipalStressesWithCardano(
313  array_1d<double, Dimension>& rPrincipalStressVector,
314  const BoundedVectorType& rStressVector
315  );
316 
328  static void SpectralDecomposition(
329  const BoundedVectorType& rStressVector,
330  BoundedVectorType& rStressVectorTension,
331  BoundedVectorType& rStressVectorCompression
332  );
333 
340  static Matrix CalculateElasticDeformationGradient(
341  const MatrixType& rF,
342  const MatrixType& rFp
343  );
344 
350  static MatrixType CalculateLinearPlasticDeformationGradientIncrement(
351  const BoundedVectorType& rPlasticPotentialDerivative,
352  const double PlasticConsistencyFactorIncrement
353  );
354 
360  static Matrix CalculatePlasticDeformationGradientFromElastic(
361  const MatrixType& rF,
362  const MatrixType& rFp
363  );
364 
373  static MatrixType CalculateExponentialElasticDeformationGradient(
374  const MatrixType& rTrialFe,
375  const BoundedVectorType& rPlasticPotentialDerivative,
376  const double PlasticConsistencyFactorIncrement,
377  const MatrixType& rRe
378  );
379 
385  static void CalculatePlasticStrainFromFp(
386  const MatrixType& rFp,
387  Vector& rPlasticStrainVector
388  );
389 
397  static MatrixType CalculateDirectElasticDeformationGradient(
398  const MatrixType& rElasticTrial,
399  const BoundedVectorType& rPlasticPotentialDerivative,
400  const double PlasticConsistencyFactorIncrement,
401  const MatrixType& rRe
402  );
403 
411  static MatrixType CalculateExponentialPlasticDeformationGradientIncrement(
412  const BoundedVectorType& rPlasticPotentialDerivative,
413  const double PlasticConsistencyFactorIncrement,
414  const MatrixType& rRe
415  );
416 
424  static MatrixType CalculateDirectPlasticDeformationGradientIncrement(
425  const BoundedVectorType& rPlasticPotentialDerivative,
426  const double PlasticConsistencyFactorIncrement,
427  const MatrixType& rRe
428  );
429 
434  static void CalculateRotationOperatorEuler1(
435  const double EulerAngle1,
436  BoundedMatrix<double, 3, 3>& rRotationOperator
437  );
438 
443  static void CalculateRotationOperatorEuler2(
444  const double EulerAngle2,
445  BoundedMatrix<double, 3, 3>& rRotationOperator
446  );
447 
452  static void CalculateRotationOperatorEuler3(
453  const double EulerAngle3,
454  BoundedMatrix<double, 3, 3>& rRotationOperator
455  );
456 
467  static void CalculateRotationOperator(
468  const double EulerAngle1, // phi
469  const double EulerAngle2, // theta
470  const double EulerAngle3, // hi
471  BoundedMatrix<double, 3, 3>& rRotationOperator
472  );
473 
477  static double MacaullyBrackets(const double Number);
478 
482  static void SubstractThermalStrain(
483  ConstitutiveLaw::StrainVectorType &rStrainVector,
484  const double ReferenceTemperature,
485  ConstitutiveLaw::Parameters &rParameters,
486  const bool IsPlaneStrain = false
487  );
488 
492  static double CalculateInGaussPoint(
493  const Variable<double> &rVariableInput,
494  ConstitutiveLaw::Parameters &rParameters,
495  unsigned int step = 0
496  );
497 
501  static double GetMaterialPropertyThroughAccessor(
502  const Variable<double>& rVariable,
504  );
505 
509  static double GetPropertyFromTemperatureTable(
510  const Variable<double>& rVariable,
512  const double Temperature
513  );
514 
515 }; // class AdvancedConstitutiveLawUtilities
516 } // namespace Kratos
This class includes several utilities necessaries for the computation of the constitutive law.
Definition: advanced_constitutive_law_utilities.h:59
static void CalculateJ2Invariant(const TVector &rStressVector, const double I1, BoundedVectorType &rDeviator, double &rJ2)
This method computes the second invariant of J.
Definition: advanced_constitutive_law_utilities.h:157
static void CalculatePrincipalStresses(array_1d< double, Dimension > &rPrincipalStressVector, const BoundedVectorType &rStressVector)
This method computes the principal stresses vector.
static void CalculateI1Invariant(const TVector &rStressVector, double &rI1)
This method computes the first invariant from a given stress vector.
Definition: advanced_constitutive_law_utilities.h:116
std::size_t IndexType
The index type definition.
Definition: advanced_constitutive_law_utilities.h:65
Geometry base class.
Definition: geometry.h:71
This class defines the node.
Definition: node.h:65
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
int step
Definition: face_heat.py:88
float J2
Definition: isotropic_damage_automatic_differentiation.py:133
I1
Definition: isotropic_damage_automatic_differentiation.py:230
def J3
Definition: isotropic_damage_automatic_differentiation.py:176
integer i
Definition: TensorModule.f:17
Definition: constitutive_law.h:189