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.
generic_total_lagrangian_mixtures_femdem_element.hpp
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ \.
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics FemDem Application
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Alejandro Cornejo
11 //
12 //
13 
14 #pragma once
15 
16 // System includes
17 
18 // External include
19 
20 // Project includes
21 
23 #include "custom_utilities/constitutive_law_utilities.h"
24 
25 namespace Kratos
26 {
30 
34 
37 
41 
45 
53 template<unsigned int TDim, unsigned int TyieldSurf>
54 class KRATOS_API(FEM_TO_DEM_APPLICATION) GenericTotalLagrangianMixturesFemDemElement
55  : public GenericTotalLagrangianFemDemElement<TDim,TyieldSurf>
56 {
57 public:
58 
63 
66 
69 
71  typedef Node NodeType;
72 
78 
81 
84 
85  typedef Vector VectorType;
86 
87  typedef Matrix MatrixType;
88 
89  typedef std::size_t IndexType;
90 
91  typedef std::size_t SizeType;
92 
93  typedef std::vector<std::size_t> EquationIdVectorType;
94 
95  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
96 
98 
100 
102  static constexpr SizeType VoigtSize = (TDim == 3) ? 6 : 3;
103 
105  static constexpr SizeType NumberOfEdges = (TDim == 3) ? 6 : 3;
106 
108  typedef ConstitutiveLawType::Pointer ConstitutiveLawPointerType;
109 
111  static constexpr double tolerance = std::numeric_limits<double>::epsilon();
112 
115 
118 
122 
124  GenericTotalLagrangianMixturesFemDemElement(IndexType NewId, GeometryType::Pointer pGeometry);
125  GenericTotalLagrangianMixturesFemDemElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
126 
128  // GenericTotalLagrangianMixturesFemDemElement(GenericTotalLagrangianMixturesFemDemElement const &rOther);
129 
132 
135  : BaseType(rOther)
136  {};
137 
145  Element::Pointer Create(
146  IndexType NewId,
147  GeometryType::Pointer pGeom,
148  PropertiesType::Pointer pProperties
149  ) const override;
150 
158  Element::Pointer Create(
159  IndexType NewId,
160  NodesArrayType const& ThisNodes,
161  PropertiesType::Pointer pProperties
162  ) const override;
163 
171  Element::Pointer Clone(
172  IndexType NewId,
173  NodesArrayType const& rThisNodes
174  ) const override;
175 
177  {
178  }
179 
180 protected:
181 
185  Vector IntegrateSmoothedConstitutiveLaw(const std::string &rYieldSurface, ConstitutiveLaw::Parameters &rValues,
186  const BaseSolidElement::ConstitutiveVariables &rThisConstVars, const BaseSolidElement::KinematicVariables &rKinVariables,
187  Vector &rStrainVector, double &rDamageElement, bool &rIsDamaging, const double CharacteristicLength,
188  const bool SaveIntVars) override;
189 
193  Vector IntegrateStressPlasticity(ConstitutiveLaw::Parameters &rValues,
194  const Vector &rStrainVector,
195  Vector& rPlasticStrainVector,
196  double &rAcumulatedPlasticStrain,
197  double &rThreshold,
198  double& rUniaxialStress,
199  bool &rIsPlastifying);
204  void ComputePlasticMultiplier(const double UniaxialStress,
205  const double Threshold,
206  double &rPlasticMultiplier,
207  ConstitutiveLaw::Parameters &rValues);
211  void ComputePlasticThreshold(const double AcumulatedPlasticStrain,
212  double &rThreshold,
213  ConstitutiveLaw::Parameters &rValues);
214 
218  void IntegratePerturbedStrain(Vector &rPerturbedStressVector,
219  const Vector &rPerturbedStrainVector,
220  const Matrix &rElasticMatrix,
221  ConstitutiveLaw::Parameters &rValues) override;
222 
224  const Variable<double> &rVariable,
225  std::vector<double> &rOutput,
226  const ProcessInfo &rCurrentProcessInfo) override;
227 
229  const Variable<Vector>& rVariable,
230  std::vector<Vector>& rOutput,
231  const ProcessInfo& rCurrentProcessInfo) override;
232 
234  const Variable<Matrix>& rVariable,
235  std::vector<Matrix>& rOutput,
236  const ProcessInfo& rCurrentProcessInfo) override;
237 
238  Vector CalculateAveragePlasticStrain()
239  {
240  Vector average_plastic_strain(VoigtSize);
241  noalias(average_plastic_strain) = ZeroVector(VoigtSize);
242  for (IndexType i = 0; i < NumberOfEdges; ++i)
243  average_plastic_strain += mPlasticStrains[i];
244  return average_plastic_strain / NumberOfEdges;
245  }
246 
247  double CalculateAverageAcumulatedPlasticStrain()
248  {
249  double acumulated_strain = 0.0;
250  for (IndexType i = 0; i < NumberOfEdges; ++i)
251  acumulated_strain += mAcumulatedPlasticStrains[i];
252  return acumulated_strain / NumberOfEdges;
253  }
254 
255 
256  void CheckIfEraseElement(
257  const ProcessInfo &rCurrentProcessInfo,
258  const Properties& rProperties
259  ) override
260  {
261  if (this->mDamage >= 0.98 && this->CalculateAverageAcumulatedPlasticStrain() >= rProperties[MAX_PLASTIC_STRAIN]) {
262  this->Set(ACTIVE, false);
263  this->mDamage = 0.98;
264  // We set a "flag" to generate the DEM
265  // rCurrentProcessInfo[GENERATE_DEM] = true;
266  this->SetValue(GENERATE_DEM, true);
267  }
268  }
269 
270  void CalculateAll(
271  MatrixType &rLeftHandSideMatrix,
272  VectorType &rRightHandSideVector,
273  const ProcessInfo &rCurrentProcessInfo,
274  const bool CalculateStiffnessMatrixFlag,
275  const bool CalculateResidualVectorFlag) override;
276 
277  Vector mAcumulatedPlasticStrains;
278  Vector mPlasticityThresholds;
279  std::vector<Vector> mPlasticStrains;
280  double mUniaxialStress = 0.0;
281 
284 
288 
292 
296 
301 
305 }; // Class GenericTotalLagrangianMixturesFemDemElement
306 
307 template<unsigned int TDim, unsigned int TyieldSurf> constexpr SizeType GenericTotalLagrangianMixturesFemDemElement<TDim, TyieldSurf>::VoigtSize;
308 template<unsigned int TDim, unsigned int TyieldSurf> constexpr SizeType GenericTotalLagrangianMixturesFemDemElement<TDim, TyieldSurf>::NumberOfEdges;
309 
317 
318 } // namespace Kratos.
Definition: constitutive_law.h:47
Base class for all Elements.
Definition: element.h:60
std::size_t IndexType
Definition: flags.h:74
Total Lagrangian element for 2D and 3D geometries.
Definition: generic_total_lagrangian_femdem_element.h:60
Total Lagrangian element taking into account a Classical Rule Of Mixtures and j2-plasticity for the f...
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:56
Geometry< NodeType >::PointsArrayType NodesArrayType
definition of nodes container type, redefined from GeometryType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:83
static constexpr SizeType NumberOfEdges
We define the number of edges.
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:105
Node NodeType
definition of node type (default is: Node)
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:71
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:97
Properties PropertiesType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:77
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:80
static constexpr SizeType VoigtSize
We define the dimension.
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:102
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:95
Matrix MatrixType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:87
std::size_t SizeType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:91
GenericTotalLagrangianMixturesFemDemElement(GenericTotalLagrangianMixturesFemDemElement const &rOther)
Assignment operator.
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:134
GenericTotalLagrangianFemDemElement< TDim, TyieldSurf > BaseType
base type: an GeometricalObject that automatically has a unique number
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:68
array_1d< double, VoigtSize > BoundedVectorType
The definition of the bounded vector type.
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:114
std::vector< std::size_t > EquationIdVectorType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:93
std::size_t IndexType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:89
ConstitutiveLaw ConstitutiveLawType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:62
Vector VectorType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:85
Element ElementType
definition of element type
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:65
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(GenericTotalLagrangianMixturesFemDemElement)
Counted pointer of GenericTotalLagrangianMixturesFemDemElement.
GenericTotalLagrangianMixturesFemDemElement()
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:176
ConstitutiveLawType::Pointer ConstitutiveLawPointerType
Pointer type for constitutive laws.
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:108
GeometryData GeometryDataType
Definition: generic_total_lagrangian_mixtures_femdem_element.hpp:99
This defines the geometrical object, base definition of the element and condition entities.
Definition: geometrical_object.h:58
Definition: geometry_data.h:60
Geometry base class.
Definition: geometry.h:71
This object defines an indexed object.
Definition: indexed_object.h:54
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
pybind11::list CalculateOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const ProcessInfo &rProcessInfo)
Definition: add_mesh_to_python.cpp:142
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
array_1d< double, 3 > VectorType
Definition: solid_mechanics_application_variables.cpp:19
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
def SetValue(entity, variable, value)
Definition: coupling_interface_data.py:256
integer i
Definition: TensorModule.f:17
Definition: base_solid_element.h:112
Definition: base_solid_element.h:73
Definition: constitutive_law.h:189