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.
total_lagrangian_mixed_volumetric_strain_element.h
Go to the documentation of this file.
1 // KRATOS ___| | | |
2 // \___ \ __| __| | | __| __| | | __| _` | |
3 // | | | | | ( | | | | ( | |
4 // _____/ \__|_| \__,_|\___|\__|\__,_|_| \__,_|_| MECHANICS
5 //
6 // License: BSD License
7 // license: StructuralMechanicsApplication/license.txt
8 //
9 // Main authors: Ruben Zorrilla
10 // Riccardo Rossi
11 // Guglielmo Scovazzi
12 //
13 
14 #pragma once
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/define.h"
22 #include "includes/element.h"
24 
25 // Application includes
27 
28 namespace Kratos
29 {
30 
33 
37 
41 
45 
49 
65 template<std::size_t TDim>
66 class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) TotalLagrangianMixedVolumetricStrainElement
67  : public Element
68 {
69 
70  static constexpr std::size_t NumNodes = TDim + 1;
71  static constexpr std::size_t StrainSize = TDim == 2 ? 3 : 6;
72  static constexpr std::size_t BlockSize = TDim +1;
73  static constexpr std::size_t LocalSize = NumNodes*BlockSize;
74 
75 protected:
76 
81  {
82  double detF;
84  double detJ0;
92 
94  {
95  detF = 1.0;
96  detJ0 = 1.0;
97  F = IdentityMatrix(TDim);
98  J0 = ZeroMatrix(TDim, TDim);
99  InvJ0 = ZeroMatrix(TDim, TDim);
100  N = ZeroVector(NumNodes);
101  DN_DX = ZeroMatrix(NumNodes, TDim);
102  Displacements = ZeroMatrix(NumNodes, TDim);
103  JacobianDeterminant = ZeroVector(NumNodes);
104  EquivalentStrain = ZeroVector(StrainSize);
105  }
106  };
107 
112  {
116 
121  {
122  StrainVector = ZeroVector(StrainSize);
123  StressVector = ZeroVector(StrainSize);
124  ConstitutiveMatrix = ZeroMatrix(StrainSize, StrainSize);
125  }
126  };
127 
128 public:
129 
132 
135 
137  typedef ConstitutiveLawType::Pointer ConstitutiveLawPointerType;
138 
141 
144 
146  typedef Node NodeType;
147 
149  typedef Element BaseType;
150 
153 
156 
159 
162 
163  // Counted pointer of TotalLagrangianMixedVolumetricStrainElement
165 
169 
170  // Constructor void
172  {};
173 
174  // Constructor using an array of nodes
176  IndexType NewId,
177  GeometryType::Pointer pGeometry)
178  : Element(NewId, pGeometry)
179  {};
180 
181  // Constructor using an array of nodes with properties
183  IndexType NewId,
184  GeometryType::Pointer pGeometry,
185  PropertiesType::Pointer pProperties)
186  : Element(NewId, pGeometry, pProperties)
187  {};
188 
189  // Copy constructor
191  : BaseType(rOther)
192  , mThisIntegrationMethod(rOther.mThisIntegrationMethod)
193  , mConstitutiveLawVector(rOther.mConstitutiveLawVector)
194  {};
195 
196  // Destructor
198  {};
199 
203 
207 
212  void Initialize(const ProcessInfo &rCurrentProcessInfo) override;
213 
218  void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
219 
224  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
225 
233  Element::Pointer Create(
234  IndexType NewId,
235  NodesArrayType const& ThisNodes,
236  PropertiesType::Pointer pProperties) const override;
237 
245  Element::Pointer Create(
246  IndexType NewId,
247  GeometryType::Pointer pGeom,
248  PropertiesType::Pointer pProperties) const override;
249 
257  Element::Pointer Clone(
258  IndexType NewId,
259  NodesArrayType const& rThisNodes) const override;
260 
267  EquationIdVectorType& rResult,
268  const ProcessInfo& rCurrentProcessInfo) const override;
269 
276  DofsVectorType& rElementalDofList,
277  const ProcessInfo& rCurrentProcessInfo) const override;
278 
284  {
285  return mThisIntegrationMethod;
286  }
287 
296  MatrixType& rLeftHandSideMatrix,
297  VectorType& rRightHandSideVector,
298  const ProcessInfo& rCurrentProcessInfo) override;
299 
306  MatrixType& rLeftHandSideMatrix,
307  const ProcessInfo& rCurrentProcessInfo) override;
308 
315  VectorType& rRightHandSideVector,
316  const ProcessInfo& rCurrentProcessInfo) override;
317 
325  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
326 
334  const Variable<double>& rVariable,
335  std::vector<double>& rOutput,
336  const ProcessInfo& rCurrentProcessInfo) override;
337 
345  const Variable<Vector>& rVariable,
346  std::vector<Vector>& rOutput,
347  const ProcessInfo& rCurrentProcessInfo) override;
348 
352 
353 
357 
358 
362 
363  const Parameters GetSpecifications() const override;
364 
366  std::string Info() const override
367  {
368  std::stringstream buffer;
369  buffer << "Small Displacement Mixed Strain Element #" << Id() << "\nConstitutive law: " << mConstitutiveLawVector[0]->Info();
370  return buffer.str();
371  }
372 
374  void PrintInfo(std::ostream& rOStream) const override
375  {
376  rOStream << "Small Displacement Mixed Strain Element #" << Id() << "\nConstitutive law: " << mConstitutiveLawVector[0]->Info();
377  }
378 
380  void PrintData(std::ostream& rOStream) const override
381  {
382  pGetGeometry()->PrintData(rOStream);
383  }
384 
388 
389 protected:
390 
393 
397 
401 
405 
409 
413 
417 
418 private:
421 
425 
426  Vector mMinShearModulusVector;
427 
428  IntegrationMethod mThisIntegrationMethod;
429 
430  std::vector<ConstitutiveLaw::Pointer> mConstitutiveLawVector;
431 
435 
439 
444  void SetIntegrationMethod(const IntegrationMethod& ThisIntegrationMethod)
445  {
446  mThisIntegrationMethod = ThisIntegrationMethod;
447  }
448 
453  void SetConstitutiveLawVector(const std::vector<ConstitutiveLaw::Pointer>& ThisConstitutiveLawVector)
454  {
455  mConstitutiveLawVector = ThisConstitutiveLawVector;
456  }
457 
461  virtual void InitializeMaterial();
462 
466  virtual bool UseElementProvidedStrain() const;
467 
476  virtual void SetConstitutiveVariables(
477  KinematicVariables& rThisKinematicVariables,
478  ConstitutiveVariables& rThisConstitutiveVariables,
479  ConstitutiveLaw::Parameters& rValues,
480  const IndexType PointNumber,
481  const GeometryType::IntegrationPointsArrayType& IntegrationPoints) const;
482 
492  virtual void CalculateConstitutiveVariables(
493  KinematicVariables& rThisKinematicVariables,
494  ConstitutiveVariables& rThisConstitutiveVariables,
495  ConstitutiveLaw::Parameters& rValues,
496  const IndexType PointNumber,
497  const GeometryType::IntegrationPointsArrayType& IntegrationPoints,
499 
507  void CalculateKinematicVariables(
508  KinematicVariables& rThisKinematicVariables,
509  const IndexType PointNumber,
510  const GeometryType::IntegrationMethod& rIntegrationMethod) const;
511 
521  void CalculateEquivalentStrain(KinematicVariables& rThisKinematicVariables) const;
522 
531  void CalculateEquivalentF(KinematicVariables& rThisKinematicVariables) const;
532 
540  double CalculateShearModulus(const Matrix &rC) const;
541 
548  double CalculateBulkModulus(const Matrix &rC) const;
549 
557  template<class TType>
558  void GetValueOnConstitutiveLaw(
559  const Variable<TType>& rVariable,
560  std::vector<TType>& rOutput)
561  {
562  const auto& r_geometry = GetGeometry();
563  const SizeType n_gauss = r_geometry.IntegrationPointsNumber(GetIntegrationMethod());
564 
565  for (IndexType i_gauss = 0; i_gauss < n_gauss; ++i_gauss) {
566  mConstitutiveLawVector[i_gauss]->GetValue(rVariable, rOutput[i_gauss]);
567  }
568  }
569 
578  template<class TType>
579  void CalculateOnConstitutiveLaw(
580  const Variable<TType>& rVariable,
581  std::vector<TType>& rOutput,
582  const ProcessInfo& rCurrentProcessInfo)
583  {
584  const auto& r_geometry = GetGeometry();
585  const SizeType n_nodes = r_geometry.size();
586  const SizeType dim = r_geometry.WorkingSpaceDimension();
587  const SizeType n_gauss = r_geometry.IntegrationPointsNumber(GetIntegrationMethod());
588  const auto& r_integration_points = r_geometry.IntegrationPoints(GetIntegrationMethod());
589 
590  // Create the kinematics container and fill the nodal data
591  KinematicVariables kinematic_variables;
592  for (IndexType i_node = 0; i_node < n_nodes; ++i_node) {
593  const auto& r_disp = r_geometry[i_node].FastGetSolutionStepValue(DISPLACEMENT);
594  for (IndexType d = 0; d < dim; ++d) {
595  kinematic_variables.Displacements(i_node, d) = r_disp[d];
596  }
597  kinematic_variables.JacobianDeterminant[i_node] = r_geometry[i_node].FastGetSolutionStepValue(VOLUMETRIC_STRAIN);
598  }
599 
600  // Create the constitutive variables and values containers
601  ConstitutiveVariables constitutive_variables;
602  ConstitutiveLaw::Parameters cons_law_values(r_geometry, GetProperties(), rCurrentProcessInfo);
603  auto& r_cons_law_options = cons_law_values.GetOptions();
604  r_cons_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true);
605  r_cons_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, true);
606  r_cons_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false);
607 
608  // Call the initialize material response
609  for (IndexType i_gauss = 0; i_gauss < n_gauss; ++i_gauss) {
610  // Recompute the kinematics
611  CalculateKinematicVariables(kinematic_variables, i_gauss, GetIntegrationMethod());
612 
613  // Set the constitutive variables
614  SetConstitutiveVariables(kinematic_variables, constitutive_variables, cons_law_values, i_gauss, r_integration_points);
615 
616  // Calculate the output value
617  rOutput[i_gauss] = mConstitutiveLawVector[i_gauss]->CalculateValue(cons_law_values, rVariable, rOutput[i_gauss] );
618  }
619  }
620 
624 
628 
632 
633  friend class Serializer;
634 
635  void save( Serializer& rSerializer ) const override;
636 
637  void load( Serializer& rSerializer ) override;
638 
639 }; // class TotalLagrangianMixedVolumetricStrainElement.
640 
644 
645 
649 
650 } // namespace Kratos.
Definition: constitutive_law.h:47
StressMeasure
Definition: constitutive_law.h:69
@ StressMeasure_PK2
Definition: constitutive_law.h:71
Base class for all Elements.
Definition: element.h:60
std::size_t SizeType
Definition: element.h:94
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
std::size_t IndexType
Definition: flags.h:74
This defines the geometrical object, base definition of the element and condition entities.
Definition: geometrical_object.h:58
IntegrationMethod
Definition: geometry_data.h:76
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
GeometryData::IntegrationMethod IntegrationMethod
Definition: geometry.h:122
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.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
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Total Lagrangian mixed displacement volumetric strain formulation element.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:68
ConstitutiveLawType::Pointer ConstitutiveLawPointerType
Pointer type for constitutive laws.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:137
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rElementalDofList the degrees of freedom of the considered element geometry.
GeometryData::IntegrationMethod IntegrationMethod
Type definition for integration methods.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:143
TotalLagrangianMixedVolumetricStrainElement(IndexType NewId, GeometryType::Pointer pGeometry)
Definition: total_lagrangian_mixed_volumetric_strain_element.h:175
Element BaseType
The base element type.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:149
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the elemental right hand side vect...
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the elemental left hand side matri...
ConstitutiveLawType::StressMeasure StressMeasureType
StressMeasure from constitutive laws.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:140
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rResult the ID's of the element degrees of freedom.
IntegrationMethod GetIntegrationMethod() const override
Returns the used integration method.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:283
std::string Info() const override
Turn back information as a string.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:366
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This function provides a more general interface to the element.
TotalLagrangianMixedVolumetricStrainElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: total_lagrangian_mixed_volumetric_strain_element.h:182
TotalLagrangianMixedVolumetricStrainElement(TotalLagrangianMixedVolumetricStrainElement const &rOther)
Definition: total_lagrangian_mixed_volumetric_strain_element.h:190
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:380
ConstitutiveLaw ConstitutiveLawType
Reference type definition for constitutive laws.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:134
~TotalLagrangianMixedVolumetricStrainElement() override
Definition: total_lagrangian_mixed_volumetric_strain_element.h:197
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:374
Node NodeType
This is the definition of the node.
Definition: total_lagrangian_mixed_volumetric_strain_element.h:146
TotalLagrangianMixedVolumetricStrainElement()
Definition: total_lagrangian_mixed_volumetric_strain_element.h:171
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(TotalLagrangianMixedVolumetricStrainElement)
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
std::size_t IndexType
Definition: binary_expression.cpp:25
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
std::size_t SizeType
Definition: nurbs_utilities.h:41
pybind11::list CalculateOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const ProcessInfo &rProcessInfo)
Definition: add_mesh_to_python.cpp:142
void InitializeSolutionStep(ConstructionUtility &rThisUtil, std::string ThermalSubModelPartName, std::string MechanicalSubModelPartName, std::string HeatFluxSubModelPartName, std::string HydraulicPressureSubModelPartName, bool thermal_conditions, bool mechanical_conditions, int phase)
Definition: add_custom_utilities_to_python.cpp:45
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
Properties PropertiesType
Definition: regenerate_pfem_pressure_conditions_process.h:26
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
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
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
int n_nodes
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:15
F
Definition: hinsberg_optimization.py:144
def load(f)
Definition: ode_solve.py:307
int d
Definition: ode_solve.py:397
N
Definition: sensitivityMatrix.py:29
int dim
Definition: sensitivityMatrix.py:25
Definition: total_lagrangian_mixed_volumetric_strain_element.h:112
Vector StressVector
Definition: total_lagrangian_mixed_volumetric_strain_element.h:114
Matrix ConstitutiveMatrix
Definition: total_lagrangian_mixed_volumetric_strain_element.h:115
ConstitutiveVariables()
Definition: total_lagrangian_mixed_volumetric_strain_element.h:120
Vector StrainVector
Definition: total_lagrangian_mixed_volumetric_strain_element.h:113
Definition: total_lagrangian_mixed_volumetric_strain_element.h:81
Matrix J0
Definition: total_lagrangian_mixed_volumetric_strain_element.h:85
Matrix DN_DX
Definition: total_lagrangian_mixed_volumetric_strain_element.h:88
Matrix F
Definition: total_lagrangian_mixed_volumetric_strain_element.h:83
Vector N
Definition: total_lagrangian_mixed_volumetric_strain_element.h:87
double detF
Definition: total_lagrangian_mixed_volumetric_strain_element.h:82
Vector EquivalentStrain
Definition: total_lagrangian_mixed_volumetric_strain_element.h:91
Matrix InvJ0
Definition: total_lagrangian_mixed_volumetric_strain_element.h:86
BoundedVector< double, NumNodes > JacobianDeterminant
Definition: total_lagrangian_mixed_volumetric_strain_element.h:90
KinematicVariables()
Definition: total_lagrangian_mixed_volumetric_strain_element.h:93
BoundedMatrix< double, NumNodes, TDim > Displacements
Definition: total_lagrangian_mixed_volumetric_strain_element.h:89
double detJ0
Definition: total_lagrangian_mixed_volumetric_strain_element.h:84