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.
thermal_modified_mohr_coulomb_yield_surface.h
Go to the documentation of this file.
1 // KRATOS ___ _ _ _ _ _ __ _
2 // / __\___ _ __ ___| |_(_) |_ _ _| |_(_)_ _____ / / __ ___ _____ /_\ _ __ _ __
3 // / / / _ \| '_ \/ __| __| | __| | | | __| \ \ / / _ \/ / / _` \ \ /\ / / __| //_\\| '_ \| '_ |
4 // / /__| (_) | | | \__ \ |_| | |_| |_| | |_| |\ V / __/ /__| (_| |\ V V /\__ \/ _ \ |_) | |_) |
5 // \____/\___/|_| |_|___/\__|_|\__|\__,_|\__|_| \_/ \___\____/\__,_| \_/\_/ |___/\_/ \_/ .__/| .__/
6 //
7 // License: BSD License
8 // license: structural_mechanics_application/license.txt
9 //
10 // Main authors: Alejandro Cornejo
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // Project includes
19 
20 namespace Kratos
21 {
24 
28 
32 
36 
40 
53 template <class TPlasticPotentialType>
55 {
56  public:
59 
61  using PlasticPotentialType = TPlasticPotentialType;
62 
64 
66  static constexpr SizeType Dimension = PlasticPotentialType::Dimension;
67 
69  static constexpr SizeType VoigtSize = PlasticPotentialType::VoigtSize;
70 
73 
75  static constexpr double tolerance = std::numeric_limits<double>::epsilon();
76 
79 
83 
86  {
87  }
88 
91  {
92  }
93 
96  {
97  return *this;
98  }
99 
102 
109 
118  const array_1d<double, VoigtSize>& rStressVector,
119  const Vector& rStrainVector,
120  double& rEquivalentStress,
122  )
123  {
124  const auto& r_material_properties = rValues.GetMaterialProperties();
125 
126  const bool has_symmetric_yield_stress = r_material_properties.Has(YIELD_STRESS);
127  const double yield_compression = has_symmetric_yield_stress ? r_material_properties[YIELD_STRESS] : r_material_properties[YIELD_STRESS_COMPRESSION];
128  const double yield_tension = has_symmetric_yield_stress ? r_material_properties[YIELD_STRESS] : r_material_properties[YIELD_STRESS_TENSION];
129  double friction_angle = AdvCLutils::GetMaterialPropertyThroughAccessor(FRICTION_ANGLE, rValues) * Globals::Pi / 180.0; // In radians!
130 
131  // Check input variables
132  if (friction_angle < tolerance) {
133  friction_angle = 32.0 * Globals::Pi / 180.0;
134  KRATOS_WARNING("ModifiedMohrCoulombYieldSurface") << "Friction Angle not defined, assumed equal to 32 deg " << std::endl;
135  }
136 
137  double theta;
138  const double R = std::abs(yield_compression / yield_tension); // we use the ref ones since the thermal effects acts equally in tension/compression
139  const double Rmorh = std::pow(std::tan((Globals::Pi / 4.0) + friction_angle / 2.0), 2);
140  const double alpha_r = R / Rmorh;
141  const double sin_phi = std::sin(friction_angle);
142 
143  double I1, J2, J3;
145  AdvCLutils::CalculateI1Invariant(rStressVector, I1);
146  AdvCLutils::CalculateJ2Invariant(rStressVector, I1, deviator, J2);
148 
149  const double K1 = 0.5 * (1.0 + alpha_r) - 0.5 * (1.0 - alpha_r) * sin_phi;
150  const double K2 = 0.5 * (1.0 + alpha_r) - 0.5 * (1.0 - alpha_r) / sin_phi;
151  const double K3 = 0.5 * (1.0 + alpha_r) * sin_phi - 0.5 * (1.0 - alpha_r);
152 
153  // Check Modified Mohr-Coulomb criterion
154  if (std::abs(I1) < tolerance) {
155  rEquivalentStress = 0.0;
156  } else {
158  rEquivalentStress = (2.0 * std::tan(Globals::Pi * 0.25 + friction_angle * 0.5) / std::cos(friction_angle)) * ((I1 * K3 / 3.0) + std::sqrt(J2) * (K1 * std::cos(theta) - K2 * std::sin(theta) * sin_phi / std::sqrt(3.0)));
159  }
160  }
161 
167  static void GetInitialUniaxialThreshold(ConstitutiveLaw::Parameters& rValues, double& rThreshold)
168  {
169  const auto& r_material_properties = rValues.GetMaterialProperties();
170 
171  double yield_compression;
172  if (rValues.IsSetShapeFunctionsValues()) { // This is needed since at Initialize level the N are not set yet...
173  yield_compression = r_material_properties.Has(YIELD_STRESS) ? AdvCLutils::GetMaterialPropertyThroughAccessor(YIELD_STRESS, rValues) : AdvCLutils::GetMaterialPropertyThroughAccessor(YIELD_STRESS_COMPRESSION, rValues);
174  } else {
175  const double ref_temperature = r_material_properties.Has(REFERENCE_TEMPERATURE) ? r_material_properties[REFERENCE_TEMPERATURE] : rValues.GetElementGeometry().GetValue(REFERENCE_TEMPERATURE);
176  yield_compression = r_material_properties.Has(YIELD_STRESS) ? AdvCLutils::GetPropertyFromTemperatureTable(YIELD_STRESS, rValues, ref_temperature) : AdvCLutils::GetPropertyFromTemperatureTable(YIELD_STRESS_COMPRESSION, rValues, ref_temperature);
177  }
178  rThreshold = std::abs(yield_compression);
179  }
180 
190  const array_1d<double, VoigtSize>& rStressVector,
191  const array_1d<double, VoigtSize>& rDeviator,
192  const double J2,
195  )
196  {
197  TPlasticPotentialType::CalculatePlasticPotentialDerivative(rStressVector, rDeviator, J2, GFlux, rValues);
198  }
199 
208  double& rAParameter,
209  const double CharacteristicLength
210  )
211  {
212  const Properties& r_material_properties = rValues.GetMaterialProperties();
213 
214  const auto &r_geom = rValues.GetElementGeometry();
215  const auto &r_N = rValues.GetShapeFunctionsValues();
216  const auto &r_process_info = rValues.GetProcessInfo();
217 
218  const double fracture_energy = r_material_properties.GetValue(FRACTURE_ENERGY, r_geom, r_N, r_process_info);
219  const double young_modulus = r_material_properties.GetValue(YOUNG_MODULUS, r_geom, r_N, r_process_info);
220  const bool has_symmetric_yield_stress = r_material_properties.Has(YIELD_STRESS);
221 
222  const double yield_compression = has_symmetric_yield_stress ? r_material_properties.GetValue(YIELD_STRESS, r_geom, r_N, r_process_info) : r_material_properties.GetValue(YIELD_STRESS_COMPRESSION, r_geom, r_N, r_process_info);
223  const double yield_tension = has_symmetric_yield_stress ? r_material_properties.GetValue(YIELD_STRESS, r_geom, r_N, r_process_info) : r_material_properties.GetValue(YIELD_STRESS_TENSION, r_geom, r_N, r_process_info);
224  const double n = yield_compression / yield_tension;
225 
226  if (r_material_properties[SOFTENING_TYPE] == static_cast<int>(SofteningType::Exponential)) {
227  rAParameter = 1.00 / (fracture_energy * n * n * young_modulus / (CharacteristicLength * std::pow(yield_compression, 2)) - 0.5);
228  KRATOS_ERROR_IF(rAParameter < 0.0) << "Fracture energy is too low, increase FRACTURE_ENERGY..." << std::endl;
229  } else if (r_material_properties[SOFTENING_TYPE] == static_cast<int>(SofteningType::Linear)) { // linear
230  rAParameter = -std::pow(yield_compression, 2) / (2.0 * young_modulus * fracture_energy * n * n / CharacteristicLength);
231  } else {
232  rAParameter = 0.0;
233  }
234  }
235 
248  const array_1d<double, VoigtSize>& rStressVector,
249  const array_1d<double, VoigtSize>& rDeviator,
250  const double J2,
253  {
254  const Properties& r_material_properties = rValues.GetMaterialProperties();
255 
256  array_1d<double, VoigtSize> first_vector, second_vector, third_vector;
257 
261 
262  double J3, lode_angle;
265 
266  const double checker = std::abs(lode_angle * 180.0 / Globals::Pi);
267 
268  double c1, c2, c3;
269  double friction_angle = AdvCLutils::GetMaterialPropertyThroughAccessor(FRICTION_ANGLE, rValues) * Globals::Pi / 180.0;
270 
271  // Check input variables
272  if (friction_angle < tolerance) {
273  friction_angle = 32.0 * Globals::Pi / 180.0;
274  KRATOS_WARNING("ModifiedMohrCoulombYieldSurface") << "Friction Angle not defined, assumed equal to 32 deg " << std::endl;
275  }
276 
277  const double sin_phi = std::sin(friction_angle);
278  const double cons_phi = std::cos(friction_angle);
279  const double sin_theta = std::sin(lode_angle);
280  const double cos_theta = std::cos(lode_angle);
281  const double cos_3theta = std::cos(3.0 * lode_angle);
282  const double tan_theta = std::tan(lode_angle);
283  const double tan_3theta = std::tan(3.0 * lode_angle);
284  const double Root3 = std::sqrt(3.0);
285 
286  const bool has_symmetric_yield_stress = r_material_properties.Has(YIELD_STRESS);
287  const double compr_yield = has_symmetric_yield_stress ? r_material_properties[YIELD_STRESS] : r_material_properties[YIELD_STRESS_COMPRESSION];
288  const double tens_yield = has_symmetric_yield_stress ? r_material_properties[YIELD_STRESS] : r_material_properties[YIELD_STRESS_TENSION];
289  // We use the ref ones since thermal effects are the same in tension and in compression
290  const double n = compr_yield / tens_yield;
291 
292  const double angle_phi = (Globals::Pi * 0.25) + friction_angle * 0.5;
293  const double alpha = n / (std::tan(angle_phi) * std::tan(angle_phi));
294 
295  const double CFL = 2.0 * std::tan(angle_phi) / cons_phi;
296 
297  const double K1 = 0.5 * (1.0 + alpha) - 0.5 * (1.0 - alpha) * sin_phi;
298  const double K2 = 0.5 * (1.0 + alpha) - 0.5 * (1.0 - alpha) / sin_phi;
299  const double K3 = 0.5 * (1.0 + alpha) * sin_phi - 0.5 * (1.0 - alpha);
300 
301  if (std::abs(sin_phi) > tolerance)
302  c1 = CFL * K3 / 3.0;
303  else
304  c1 = 0.0; // check
305 
306  if (std::abs(checker) < 29.0) { // Lode angle not greater than pi/6
307  c2 = cos_theta * CFL * (K1 * (1.0 + tan_theta * tan_3theta) + K2 * sin_phi * (tan_3theta - tan_theta) / Root3);
308  c3 = CFL * (K1 * Root3 * sin_theta + K2 * sin_phi * cos_theta) / (2.0 * J2 * cos_3theta);
309  } else {
310  c3 = 0.0;
311  double aux = 1.0;
312  if (lode_angle > tolerance)
313  aux = -1.0;
314  c2 = 0.5 * CFL * (K1 * Root3 + aux * K2 * sin_phi / Root3);
315  }
316  noalias(rFFlux) = c1 * first_vector + c2 * second_vector + c3 * third_vector;
317  }
318 
323  static int Check(const Properties& rMaterialProperties)
324  {
325  return BaseType::Check(rMaterialProperties);
326  }
327 
333  {
335  }
336 
342  static double GetScaleFactorTension(const Properties& rMaterialProperties)
343  {
344  return BaseType::GetScaleFactorTension(rMaterialProperties);
345  }
346 
350 
354 
358 
362 
364 
365  protected:
368 
372 
376 
380 
384 
388 
392 
394  private:
397 
401 
405 
409 
413 
417 
421 
423 
424 }; // Class ModifiedMohrCoulombYieldSurface
425 
427 
430 
434 
436 
437 } // 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 CalculateSecondVector(const BoundedVectorType &rDeviator, const double J2, BoundedVectorType &rSecondVector)
This method computes the first vector to be used in the derivative of the yield surface.
Definition: advanced_constitutive_law_utilities.cpp:100
static void CalculateFirstVector(BoundedVectorType &rFirstVector)
This method computes the first vector to be used in the derivative of the yield surface.
Definition: advanced_constitutive_law_utilities.cpp:80
static double GetPropertyFromTemperatureTable(const Variable< double > &rVariable, ConstitutiveLaw::Parameters &rValues, const double Temperature)
This retrieves a double type variable from a table if exists, assumes TEMPERATURE to be the independe...
Definition: advanced_constitutive_law_utilities.cpp:833
static void CalculateThirdVector(const BoundedVectorType &rDeviator, const double J2, BoundedVectorType &rThirdVector)
This method computes the third vector to be used in the derivative of the yield surface.
Definition: advanced_constitutive_law_utilities.cpp:131
static double GetMaterialPropertyThroughAccessor(const Variable< double > &rVariable, ConstitutiveLaw::Parameters &rValues)
This retrieves a double type variable checking the accessor.
Definition: advanced_constitutive_law_utilities.cpp:818
static void CalculateLodeAngle(const double J2, const double J3, double &rLodeAngle)
This method computes the lode angle.
Definition: advanced_constitutive_law_utilities.cpp:158
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
static void CalculateJ3Invariant(const BoundedVectorType &rDeviator, double &rJ3)
This method computes the third invariant of J.
Definition: advanced_constitutive_law_utilities.cpp:62
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometry.h:627
This class defines a yield surface according to Modified Mohr-Coulumb theory.
Definition: modified_mohr_coulomb_yield_surface.h:58
static bool IsWorkingWithTensionThreshold()
This method returns true if the yield surfacecompares with the tension tield stress.
Definition: modified_mohr_coulomb_yield_surface.h:335
static double GetScaleFactorTension(const Properties &rMaterialProperties)
This method returns the scaling factor of the yield surface surfacecompares with the tension tield st...
Definition: modified_mohr_coulomb_yield_surface.h:345
static int Check(const Properties &rMaterialProperties)
This method defines the check to be performed in the yield surface.
Definition: modified_mohr_coulomb_yield_surface.h:308
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
TVariableType::Type & GetValue(const TVariableType &rVariable)
Definition: properties.h:228
bool Has(TVariableType const &rThisVariable) const
Definition: properties.h:578
This class defines a yield surface according to Modified Mohr-Coulumb theory.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:55
static void CalculateEquivalentStress(const array_1d< double, VoigtSize > &rStressVector, const Vector &rStrainVector, double &rEquivalentStress, ConstitutiveLaw::Parameters &rValues)
This method the uniaxial equivalent stress.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:117
static bool IsWorkingWithTensionThreshold()
This method returns true if the yield surfacecompares with the tension tield stress.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:332
static constexpr SizeType VoigtSize
The Plastic potential already defines the Voigt size.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:69
virtual ~ThermalModifiedMohrCoulombYieldSurface()
Destructor.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:101
TPlasticPotentialType PlasticPotentialType
The type of potential plasticity.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:61
KRATOS_CLASS_POINTER_DEFINITION(ThermalModifiedMohrCoulombYieldSurface)
Counted pointer of ThermalModifiedMohrCoulombYieldSurface.
static void GetInitialUniaxialThreshold(ConstitutiveLaw::Parameters &rValues, double &rThreshold)
This method returns the initial uniaxial stress threshold.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:167
static void CalculateDamageParameter(ConstitutiveLaw::Parameters &rValues, double &rAParameter, const double CharacteristicLength)
This method returns the damage parameter needed in the exp/linear expressions of damage.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:206
ThermalModifiedMohrCoulombYieldSurface()
Initialization constructor.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:85
static int Check(const Properties &rMaterialProperties)
This method defines the check to be performed in the yield surface.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:323
static void CalculatePlasticPotentialDerivative(const array_1d< double, VoigtSize > &rStressVector, const array_1d< double, VoigtSize > &rDeviator, const double J2, array_1d< double, VoigtSize > &GFlux, ConstitutiveLaw::Parameters &rValues)
This method calculates the derivative of the plastic potential DG/DS.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:189
static constexpr double tolerance
The machine precision zero tolerance.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:75
ThermalModifiedMohrCoulombYieldSurface & operator=(ThermalModifiedMohrCoulombYieldSurface const &rOther)
Assignment operator.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:95
static double GetScaleFactorTension(const Properties &rMaterialProperties)
This method returns the scaling factor of the yield surface surfacecompares with the tension tield st...
Definition: thermal_modified_mohr_coulomb_yield_surface.h:342
static void CalculateYieldSurfaceDerivative(const array_1d< double, VoigtSize > &rStressVector, const array_1d< double, VoigtSize > &rDeviator, const double J2, array_1d< double, VoigtSize > &rFFlux, ConstitutiveLaw::Parameters &rValues)
This script calculates the derivatives of the Yield Surf according to NAYAK-ZIENKIEWICZ paper Interna...
Definition: thermal_modified_mohr_coulomb_yield_surface.h:247
static constexpr SizeType Dimension
The Plastic potential already defines the working simension size.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:66
ThermalModifiedMohrCoulombYieldSurface(ThermalModifiedMohrCoulombYieldSurface const &rOther)
Copy constructor.
Definition: thermal_modified_mohr_coulomb_yield_surface.h:90
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_WARNING(label)
Definition: logger.h:265
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
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
float J2
Definition: isotropic_damage_automatic_differentiation.py:133
float K2
Definition: isotropic_damage_automatic_differentiation.py:178
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
R
Definition: isotropic_damage_automatic_differentiation.py:172
CFL
Definition: isotropic_damage_automatic_differentiation.py:156
def J3
Definition: isotropic_damage_automatic_differentiation.py:176
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
Definition: constitutive_law.h:189
const GeometryType & GetElementGeometry()
Definition: constitutive_law.h:462
const Vector & GetShapeFunctionsValues()
Definition: constitutive_law.h:419
bool IsSetShapeFunctionsValues()
Definition: constitutive_law.h:483
const ProcessInfo & GetProcessInfo()
Definition: constitutive_law.h:452
const Properties & GetMaterialProperties()
Definition: constitutive_law.h:457