14 #if !defined(KRATOS_CONSTITUTIVE_LAW_UTILITIES)
15 #define KRATOS_CONSTITUTIVE_LAW_UTILITIES
61 template <SizeType TVoigtSize = 6>
72 static constexpr
SizeType Dimension = TVoigtSize == 6 ? 3 : 2;
75 static constexpr
SizeType VoigtSize = TVoigtSize;
96 static constexpr
double tolerance = std::numeric_limits<double>::epsilon();
113 static void CalculateElasticMatrix(
114 Matrix &rConstitutiveMatrix,
124 static void CalculateDeviatoricStrainVector(
125 const Vector &rStrainVector,
126 const Vector &rVolumetricStrainVector,
127 Vector &rDeviatoricStrainVector);
134 static void CalculateVolumetricStrainVector(
135 const Vector &rStrainVector,
136 Vector &rVolumetricStrainVector);
147 if (rIdentityVector.
size() != VoigtSize) {
148 rIdentityVector.
resize(VoigtSize);
153 rIdentityVector[
i] = 1.0;
160 static double CalculateBulkModulus(
161 const double YoungModulus,
162 const double PoissonRatio);
168 static double CalculateShearModulus(
169 const double YoungModulus,
170 const double PoissonRatio);
177 static void CalculateI1Invariant(
178 const BoundedVectorType& rStressVector,
265 static void CalculateLodeAngle(
290 static void CalculatePrincipalStressesWithCardano(
303 const Vector& rStrainVector,
304 double& rEquivalentStress,
311 rEquivalentStress = std::sqrt(3.0 *
J2);
322 const Vector& rStrainVector,
323 double& rEquivalentStress,
327 const double yield_compression = r_material_properties[YIELD_STRESS_C];
328 const double yield_tension = r_material_properties[YIELD_STRESS_T];
329 double friction_angle = r_material_properties[INTERNAL_FRICTION_ANGLE] *
Globals::Pi / 180.0;
332 if (friction_angle < tolerance) {
334 KRATOS_WARNING(
"ModifiedMohrCoulombYieldSurface") <<
"Friction Angle not defined, assumed equal to 32 deg " << std::endl;
338 const double R = std::abs(yield_compression / yield_tension);
339 const double Rmorh = std::pow(std::tan((
Globals::Pi / 4.0) + friction_angle / 2.0), 2);
341 const double sin_phi = std::sin(friction_angle);
354 if (std::abs(
I1) < tolerance) {
355 rEquivalentStress = 0.0;
358 rEquivalentStress = (2.0 * std::tan(
Globals::Pi * 0.25 + friction_angle * 0.5) / std::cos(friction_angle)) * ((
I1 *
K3 / 3.0) +
359 std::sqrt(
J2) * (
K1 * std::cos(theta) -
K2 * std::sin(theta) *
sin_phi / std::sqrt(3.0)));
371 const Vector& rStrainVector,
372 double& rEquivalentStress,
375 double I1,
J2,
J3, lode_angle;
384 const double friction_angle = r_material_properties[INTERNAL_FRICTION_ANGLE] *
Globals::Pi / 180.0;
386 rEquivalentStress = (std::cos(lode_angle) - std::sin(lode_angle) * std::sin(friction_angle) / std::sqrt(3.0)) * std::sqrt(
J2) +
387 I1 * std::sin(friction_angle) / 3.0;
398 const Vector& rStrainVector,
399 double& rEquivalentStress,
406 rEquivalentStress =
std::max(
std::max(principal_stress_vector[0], principal_stress_vector[1]), principal_stress_vector[2]);
408 rEquivalentStress =
std::max(principal_stress_vector[0], principal_stress_vector[1]);
419 const Vector& rStrainVector,
420 double& rEquivalentStress,
423 double I1,
J2,
J3, lode_angle;
429 rEquivalentStress = 2.0 * std::cos(lode_angle) * std::sqrt(
J2);
440 const Vector& rStrainVector,
441 double& rEquivalentStress,
448 const double yield_compression = r_material_properties[YIELD_STRESS_C];
449 const double yield_tension = r_material_properties[YIELD_STRESS_T];
450 const double n = std::abs(yield_compression / yield_tension);
452 double sum_a = 0.0, sum_b = 0.0, sum_c = 0.0, ere0, ere1;
453 for (std::size_t cont = 0; cont < 2; ++cont) {
454 sum_a += std::abs(principal_stress_vector[cont]);
455 sum_b += 0.5 * (principal_stress_vector[cont] + std::abs(principal_stress_vector[cont]));
456 sum_c += 0.5 * (-principal_stress_vector[cont] + std::abs(principal_stress_vector[cont]));
458 ere0 = sum_b / sum_a;
459 ere1 = sum_c / sum_a;
462 for (std::size_t cont = 0; cont < VoigtSize; ++cont) {
463 auxf += rStrainVector[cont] * rPredictiveStressVector[cont];
465 rEquivalentStress = std::sqrt(auxf);
466 rEquivalentStress *= (ere0 *
n + ere1);
477 const Vector& rStrainVector,
478 double& rEquivalentStress,
483 double friction_angle = r_material_properties[INTERNAL_FRICTION_ANGLE] *
Globals::Pi / 180.0;
484 const double sin_phi = std::sin(friction_angle);
485 const double root_3 = std::sqrt(3.0);
488 if (friction_angle < tolerance) {
490 KRATOS_WARNING(
"DruckerPragerYieldSurface") <<
"Friction Angle not defined, assumed equal to 32 " << std::endl;
498 if (std::abs(
I1) < tolerance) {
499 rEquivalentStress = 0.0;
503 rEquivalentStress = std::abs(
CFL *
TEN0);
518 const double yield_tension = r_material_properties[YIELD_STRESS_T];
519 rThreshold = std::abs(yield_tension);
533 const double yield_compression = r_material_properties[YIELD_STRESS_C];
534 rThreshold = std::abs(yield_compression);
548 const double cohesion = r_material_properties[COHESION_MC];
549 const double friction_angle = r_material_properties[INTERNAL_FRICTION_ANGLE] *
Globals::Pi / 180.0;
550 rThreshold = cohesion * std::cos(friction_angle);
563 GetInitialUniaxialThresholdHuberVonMises(rValues, rThreshold);
576 GetInitialUniaxialThresholdHuberVonMises(rValues, rThreshold);
590 const double yield_compression = r_material_properties[YIELD_STRESS_C];
591 rThreshold = std::abs(yield_compression / std::sqrt(r_material_properties[YOUNG_MODULUS]));
605 const double yield_tension = r_material_properties[YIELD_STRESS_T];
606 const double friction_angle = r_material_properties[INTERNAL_FRICTION_ANGLE] *
Globals::Pi / 180.0;
607 const double sin_phi = std::sin(friction_angle);
608 rThreshold = std::abs(yield_tension * (3.0 +
sin_phi) / (3.0 *
sin_phi - 3.0));
620 const double CharacteristicLength)
623 const double fracture_energy = r_material_properties[FRAC_ENERGY_T];
624 const double young_modulus = r_material_properties[YOUNG_MODULUS];
625 const double yield_tension = r_material_properties[YIELD_STRESS_T];
626 rAParameter = 1.00 / (fracture_energy * young_modulus / (CharacteristicLength * std::pow(yield_tension, 2)) - 0.5);
627 KRATOS_ERROR_IF(rAParameter < 0.0) <<
"Fracture energy is too low, increase FRACTURE_ENERGY..." << std::endl;
639 const double CharacteristicLength)
642 const double fracture_energy = r_material_properties[FRAC_ENERGY_T];
643 const double young_modulus = r_material_properties[YOUNG_MODULUS];
644 const double yield_compression = r_material_properties[YIELD_STRESS_C];
645 const double yield_tension = r_material_properties[YIELD_STRESS_T];
646 const double n = yield_compression / yield_tension;
647 rAParameter = 1.00 / (fracture_energy *
n *
n * young_modulus / (CharacteristicLength * std::pow(yield_compression, 2)) - 0.5);
648 KRATOS_ERROR_IF(rAParameter < 0.0) <<
"Fracture energy is too low, increase FRACTURE_ENERGY..." << std::endl;
660 const double CharacteristicLength)
663 const double fracture_energy = r_material_properties[FRAC_ENERGY_T];
664 const double young_modulus = r_material_properties[YOUNG_MODULUS];
665 const double cohesion = r_material_properties[COHESION_MC];
666 rAParameter = 1.00 / (fracture_energy * young_modulus / (CharacteristicLength * std::pow(cohesion, 2)) - 0.5);
667 KRATOS_ERROR_IF(rAParameter < 0.0) <<
"Fracture energy is too low, increase FRACTURE_ENERGY..." << std::endl;
679 const double CharacteristicLength)
681 CalculateDamageParameterHuberVonMises(rValues, rAParameter, CharacteristicLength);
693 const double CharacteristicLength)
695 CalculateDamageParameterHuberVonMises(rValues, rAParameter, CharacteristicLength);
707 const double CharacteristicLength)
710 const double fracture_energy = r_material_properties[FRAC_ENERGY_T];
711 const double yield_compression = r_material_properties[YIELD_STRESS_C];
712 const double yield_tension = r_material_properties[YIELD_STRESS_T];
713 const double n = yield_compression / yield_tension;
714 rAParameter = 1.0 / (fracture_energy *
n *
n / (CharacteristicLength * std::pow(yield_compression, 2)) - 0.5);
715 KRATOS_ERROR_IF(rAParameter < 0.0) <<
"Fracture energy is too low, increase FRACTURE_ENERGY..." << std::endl;
727 const double CharacteristicLength)
729 CalculateDamageParameterModifiedMohrCoulomb(rValues, rAParameter, CharacteristicLength);
740 if (aux < rValues[
i]) aux = rValues[
i];
756 if (std::abs(rArrayValues[
i]) > aux) {
757 aux = std::abs(rArrayValues[
i]);
774 if (std::abs(rArrayValues[
i]) < aux) {
775 aux = std::abs(rArrayValues[
i]);
801 for (
int i = 0;
i <
n;
i++) {
802 for (
int j = 0;
j <
n - 1;
j++) {
803 if (
V[
j] >
V[
j + 1]) {
810 rMaxValues[0] =
V[2];
811 rMaxValues[1] =
V[1];
820 static void CalculateHenckyStrain(
830 static void CalculateBiotStrain(
840 static void CalculateAlmansiStrain(
850 static void CalculateGreenLagrangianStrain(
This class includes several utilities necessaries for the computation of the constitutive law.
Definition: constitutive_law_utilities.h:63
static void CalculateDamageParameterHuberVonMises(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: constitutive_law_utilities.h:617
Geometry< NodeType > GeometryType
Geometry definitions.
Definition: constitutive_law_utilities.h:93
static void CalculateDamageParameterMohrCoulomb(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: constitutive_law_utilities.h:657
static void CalculateDamageParameterSimoJu(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: constitutive_law_utilities.h:704
static void CalculateEquivalentStressModifiedMohrCoulomb(const BoundedVectorType &rPredictiveStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress of ModifiedMohrCoulomb.
Definition: constitutive_law_utilities.h:320
static void Get2MaxValues(Vector &rMaxValues, const double a, const double b, const double c)
This method returns the 2 max values of a vector.
Definition: constitutive_law_utilities.h:786
Vector VectorType
the vector type definition
Definition: constitutive_law_utilities.h:81
static void CalculateFirstVector(BoundedVectorType &rFirstVector)
This method computes the first vector.
static void GetInitialUniaxialThresholdMohrCoulomb(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold for MohrCoulomb.
Definition: constitutive_law_utilities.h:543
static void CalculateEquivalentStressMohrCoulomb(const BoundedVectorType &rPredictiveStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress of MohrCoulomb.
Definition: constitutive_law_utilities.h:369
static void CalculateEquivalentStressSimoJu(const BoundedVectorType &rPredictiveStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress of SimoJu.
Definition: constitutive_law_utilities.h:438
static void CalculateEquivalentStressHuberVonMises(const BoundedVectorType &rPredictiveStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress of Huber-VonMises.
Definition: constitutive_law_utilities.h:301
Matrix MatrixType
The matrix type definition.
Definition: constitutive_law_utilities.h:78
static void GetInitialUniaxialThresholdRankine(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold for Rankine.
Definition: constitutive_law_utilities.h:559
static void CalculateDamageParameterDruckerPrager(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: constitutive_law_utilities.h:724
static void GetInitialUniaxialThresholdDruckerPrager(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold for SimoJu.
Definition: constitutive_law_utilities.h:600
static void GetInitialUniaxialThresholdModifiedMohrCoulomb(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold for ModifiedMohrCoulomb.
Definition: constitutive_law_utilities.h:528
static void CalculateJ2Invariant(const BoundedVectorType &rStressVector, const double I1, BoundedVectorType &rDeviator, double &rJ2)
This method computes the second invariant of J.
static void CalculateLodeAngle(const double J2, const double J3, double &rLodeAngle)
This method computes the lode angle.
Definition: constitutive_law_utilities.cpp:389
static double GetMaxValue(const Vector &rValues)
This method returns max value over a vector.
Definition: constitutive_law_utilities.h:736
std::size_t IndexType
The index type definition.
Definition: constitutive_law_utilities.h:69
static double GetMinAbsValue(const Vector &rArrayValues)
This method returns min abs value over a vector.
Definition: constitutive_law_utilities.h:768
static void CalculateI3Invariant(const BoundedVectorType &rStressVector, double &rI3)
This method computes the third invariant from a given stress vector.
static double GetMaxAbsValue(const Vector &rArrayValues)
This method returns max abs value over a vector.
Definition: constitutive_law_utilities.h:749
static void CalculateDamageParameterModifiedMohrCoulomb(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: constitutive_law_utilities.h:636
array_1d< double, VoigtSize > BoundedVectorType
The definition of the bounded vector type.
Definition: constitutive_law_utilities.h:84
static void GetInitialUniaxialThresholdHuberVonMises(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold for VonMises.
Definition: constitutive_law_utilities.h:513
Node NodeType
Node type definition.
Definition: constitutive_law_utilities.h:90
static void CalculateEquivalentStressDruckerPrager(const BoundedVectorType &rPredictiveStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress of Drucker-Prager.
Definition: constitutive_law_utilities.h:475
static void CalculateI2Invariant(const BoundedVectorType &rStressVector, double &rI2)
This method computes the second invariant from a given stress vector.
static void CalculateJ3Invariant(const BoundedVectorType &rDeviator, double &rJ3)
This method computes the third invariant of J.
static void GetInitialUniaxialThresholdTresca(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold for Tresca.
Definition: constitutive_law_utilities.h:572
static void CalculateIdentityVector(BoundedVectorType &rIdentityVector)
This method creates an identity vector.
Definition: constitutive_law_utilities.h:143
static void CalculateThirdVector(const BoundedVectorType &rDeviator, const double J2, BoundedVectorType &rThirdVector)
This method computes the third vector.
static void CalculateSecondVector(const BoundedVectorType &rDeviator, const double J2, BoundedVectorType &rSecondVector)
This method computes the second vector.
static void CalculateEquivalentStressTresca(const BoundedVectorType &rPredictiveStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress of Tresca.
Definition: constitutive_law_utilities.h:417
static void CalculateI1Invariant(const BoundedVectorType &rStressVector, double &rI1)
This method computes the first invariant from a given stress vector.
Definition: constitutive_law_utilities.cpp:148
static void CalculateDamageParameterRankine(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: constitutive_law_utilities.h:676
BoundedMatrix< double, Dimension, Dimension > BoundedMatrixType
The definition of the bounded matrix type.
Definition: constitutive_law_utilities.h:87
static void CalculateEquivalentStressRankine(const BoundedVectorType &rPredictiveStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress of Rankine.
Definition: constitutive_law_utilities.h:396
static void CalculatePrincipalStresses(array_1d< double, Dimension > &rPrincipalStressVector, const BoundedVectorType &rStressVector)
This method computes the principal stresses vector.
static void CalculateDamageParameterTresca(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: constitutive_law_utilities.h:690
static void GetInitialUniaxialThresholdSimoJu(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold for SimoJu.
Definition: constitutive_law_utilities.h:585
Geometry base class.
Definition: geometry.h:71
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class defines the node.
Definition: node.h:65
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
BOOST_UBLAS_INLINE void resize(size_type array_size, bool preserve=true)
Definition: array_1d.h:242
BOOST_UBLAS_INLINE size_type size() const
Definition: array_1d.h:370
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_WARNING(label)
Definition: logger.h:265
static double max(double a, double b)
Definition: GeometryFunctions.h:79
constexpr double Pi
Definition: global_variables.h:25
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
V
Definition: generate_droplet_dynamics.py:256
E
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:26
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
float J2
Definition: isotropic_damage_automatic_differentiation.py:133
float K2
Definition: isotropic_damage_automatic_differentiation.py:178
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
float K3
Definition: isotropic_damage_automatic_differentiation.py:179
I1
Definition: isotropic_damage_automatic_differentiation.py:230
tuple alpha_r
Definition: isotropic_damage_automatic_differentiation.py:174
nu
Definition: isotropic_damage_automatic_differentiation.py:135
R
Definition: isotropic_damage_automatic_differentiation.py:172
CFL
Definition: isotropic_damage_automatic_differentiation.py:156
root_3
Definition: isotropic_damage_automatic_differentiation.py:155
def J3
Definition: isotropic_damage_automatic_differentiation.py:176
float TEN0
Definition: isotropic_damage_automatic_differentiation.py:157
sin_phi
Definition: isotropic_damage_automatic_differentiation.py:153
float K1
Definition: isotropic_damage_automatic_differentiation.py:177
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int j
Definition: quadrature.py:648
int counter
Definition: script_THERMAL_CORRECT.py:218
integer i
Definition: TensorModule.f:17
Definition: constitutive_law.h:189
const Properties & GetMaterialProperties()
Definition: constitutive_law.h:457