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.
small_displacement_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 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // External includes
18 
19 // Project includes
20 #include "includes/define.h"
21 #include "includes/element.h"
23 
24 // Application includes
26 
27 namespace Kratos
28 {
29 
32 
36 
38  typedef std::size_t IndexType;
39 
41  typedef std::size_t SizeType;
42 
46 
50 
54 
63 class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SmallDisplacementMixedVolumetricStrainElement
64  : public Element
65 {
66 
67 protected:
68 
73  {
76  double detF;
78  double detJ0;
85 
93  const SizeType StrainSize,
94  const SizeType Dimension,
95  const SizeType NumberOfNodes
96  )
97  {
98  detF = 1.0;
99  detJ0 = 1.0;
100  N = ZeroVector(NumberOfNodes);
101  B = ZeroMatrix(StrainSize, Dimension * NumberOfNodes);
102  F = IdentityMatrix(Dimension);
103  DN_DX = ZeroMatrix(NumberOfNodes, Dimension);
104  J0 = ZeroMatrix(Dimension, Dimension);
105  InvJ0 = ZeroMatrix(Dimension, Dimension);
106  Displacements = ZeroVector(Dimension * NumberOfNodes);
107  VolumetricNodalStrains = ZeroVector(NumberOfNodes);
108  EquivalentStrain = ZeroVector(StrainSize);
109  }
110  };
111 
116  {
120 
125  ConstitutiveVariables(const SizeType StrainSize)
126  {
127  StrainVector = ZeroVector(StrainSize);
128  StressVector = ZeroVector(StrainSize);
129  D = ZeroMatrix(StrainSize, StrainSize);
130  }
131  };
132 
133 public:
134 
137 
140 
142  typedef ConstitutiveLawType::Pointer ConstitutiveLawPointerType;
143 
146 
149 
151  typedef Node NodeType;
152 
154  typedef Element BaseType;
155 
156  // Counted pointer of SmallDisplacementMixedVolumetricStrainElement
158 
162 
163  // Constructor void
165  {};
166 
167  // Constructor using an array of nodes
169  IndexType NewId,
170  GeometryType::Pointer pGeometry
171  ) : Element(
172  NewId,
173  pGeometry)
174  {};
175 
176  // Constructor using an array of nodes with properties
178  IndexType NewId,
179  GeometryType::Pointer pGeometry,
180  PropertiesType::Pointer pProperties
181  ) : Element(
182  NewId,
183  pGeometry,
184  pProperties)
185  {};
186 
187  // Copy constructor
189  : BaseType(rOther),
190  mThisIntegrationMethod(rOther.mThisIntegrationMethod),
191  mConstitutiveLawVector(rOther.mConstitutiveLawVector)
192  {};
193 
194  // Destructor
196  {};
197 
201 
205 
210  void Initialize(const ProcessInfo &rCurrentProcessInfo) override;
211 
216  void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
217 
222  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
223 
231  Element::Pointer Create(
232  IndexType NewId,
233  NodesArrayType const& ThisNodes,
234  PropertiesType::Pointer pProperties) const override;
235 
243  Element::Pointer Create(
244  IndexType NewId,
245  GeometryType::Pointer pGeom,
246  PropertiesType::Pointer pProperties) const override;
247 
255  Element::Pointer Clone(
256  IndexType NewId,
257  NodesArrayType const& rThisNodes) const override;
258 
264  void EquationIdVector(
265  EquationIdVectorType& rResult,
266  const ProcessInfo& rCurrentProcessInfo) const override;
267 
273  void GetDofList(
274  DofsVectorType& rElementalDofList,
275  const ProcessInfo& rCurrentProcessInfo) const override;
276 
282  {
283  return mThisIntegrationMethod;
284  }
285 
293  void CalculateLocalSystem(
294  MatrixType& rLeftHandSideMatrix,
295  VectorType& rRightHandSideVector,
296  const ProcessInfo& rCurrentProcessInfo) override;
297 
303  void CalculateLeftHandSide(
304  MatrixType& rLeftHandSideMatrix,
305  const ProcessInfo& rCurrentProcessInfo) override;
306 
312  void CalculateRightHandSide(
313  VectorType& rRightHandSideVector,
314  const ProcessInfo& rCurrentProcessInfo) override;
315 
323  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
324 
332  const Variable<double>& rVariable,
333  std::vector<double>& rOutput,
334  const ProcessInfo& rCurrentProcessInfo) override;
335 
343  const Variable<Vector>& rVariable,
344  std::vector<Vector>& rOutput,
345  const ProcessInfo& rCurrentProcessInfo) override;
346 
347 
351 
352 
356 
357 
361 
362  const Parameters GetSpecifications() const override;
363 
365  std::string Info() const override
366  {
367  std::stringstream buffer;
368  buffer << "Small Displacement Mixed Strain Element #" << Id() << "\nConstitutive law: " << mConstitutiveLawVector[0]->Info();
369  return buffer.str();
370  }
371 
373  void PrintInfo(std::ostream& rOStream) const override
374  {
375  rOStream << "Small Displacement Mixed Strain Element #" << Id() << "\nConstitutive law: " << mConstitutiveLawVector[0]->Info();
376  }
377 
379  void PrintData(std::ostream& rOStream) const override
380  {
381  pGetGeometry()->PrintData(rOStream);
382  }
383 
387 
388 protected:
389 
392 
396 
398 
399  std::vector<ConstitutiveLaw::Pointer> mConstitutiveLawVector;
400 
404 
408 
413  void SetIntegrationMethod(const IntegrationMethod& ThisIntegrationMethod)
414  {
415  mThisIntegrationMethod = ThisIntegrationMethod;
416  }
417 
422  void SetConstitutiveLawVector(const std::vector<ConstitutiveLaw::Pointer>& ThisConstitutiveLawVector)
423  {
424  mConstitutiveLawVector = ThisConstitutiveLawVector;
425  }
426 
430  virtual void InitializeMaterial();
431 
435  virtual bool UseElementProvidedStrain() const;
436 
445  virtual void SetConstitutiveVariables(
446  KinematicVariables& rThisKinematicVariables,
447  ConstitutiveVariables& rThisConstitutiveVariables,
449  const IndexType PointNumber,
450  const GeometryType::IntegrationPointsArrayType& IntegrationPoints
451  ) const;
452 
462  virtual void CalculateConstitutiveVariables(
463  KinematicVariables& rThisKinematicVariables,
464  ConstitutiveVariables& rThisConstitutiveVariables,
466  const IndexType PointNumber,
467  const GeometryType::IntegrationPointsArrayType& IntegrationPoints,
469  ) const;
470 
477  virtual Vector GetBodyForce(
478  const GeometryType::IntegrationPointsArrayType& rIntegrationPoints,
479  const IndexType PointNumber) const;
480 
484 
488 
492 
493 private:
496 
500 
501  Matrix mAnisotropyTensor;
502  Matrix mInverseAnisotropyTensor;
503 
507 
511 
519  void CalculateKinematicVariables(
520  KinematicVariables& rThisKinematicVariables,
521  const IndexType PointNumber,
522  const GeometryType::IntegrationMethod& rIntegrationMethod
523  ) const;
524 
532  void CalculateB(
533  Matrix& rB,
534  const Matrix& rDN_DX
535  ) const;
536 
545  void CalculateEquivalentStrain(KinematicVariables& rThisKinematicVariables) const;
546 
551  void CalculateAnisotropyTensor(const ProcessInfo &rCurrentProcessInfo);
552 
558  void CalculateInverseAnisotropyTensor();
559 
566  double CalculateBulkModulus(const Matrix &rC) const;
567 
574  double CalculateShearModulus(const Matrix &rC) const;
575 
581  void ComputeEquivalentF(
582  Matrix& rF,
583  const Vector& rStrainTensor
584  ) const;
585 
593  template<class TType>
594  void GetValueOnConstitutiveLaw(
595  const Variable<TType>& rVariable,
596  std::vector<TType>& rOutput)
597  {
598  const auto& r_geometry = GetGeometry();
599  const SizeType n_gauss = r_geometry.IntegrationPointsNumber(GetIntegrationMethod());
600 
601  for (IndexType i_gauss = 0; i_gauss < n_gauss; ++i_gauss) {
602  mConstitutiveLawVector[i_gauss]->GetValue(rVariable, rOutput[i_gauss]);
603  }
604  }
605 
614  template<class TType>
615  void CalculateOnConstitutiveLaw(
616  const Variable<TType>& rVariable,
617  std::vector<TType>& rOutput,
618  const ProcessInfo& rCurrentProcessInfo)
619  {
620  const auto& r_geometry = GetGeometry();
621  const SizeType n_nodes = r_geometry.size();
622  const SizeType dim = r_geometry.WorkingSpaceDimension();
623  const SizeType strain_size = mConstitutiveLawVector[0]->GetStrainSize();
624  const SizeType n_gauss = r_geometry.IntegrationPointsNumber(GetIntegrationMethod());
625  const auto& r_integration_points = r_geometry.IntegrationPoints(GetIntegrationMethod());
626 
627  // Create the kinematics container and fill the nodal data
628  KinematicVariables kinematic_variables(strain_size, dim, n_nodes);
629  for (IndexType i_node = 0; i_node < n_nodes; ++i_node) {
630  const auto& r_disp = r_geometry[i_node].FastGetSolutionStepValue(DISPLACEMENT);
631  for (IndexType d = 0; d < dim; ++d) {
632  kinematic_variables.Displacements(i_node * dim + d) = r_disp[d];
633  }
634  kinematic_variables.VolumetricNodalStrains[i_node] = r_geometry[i_node].FastGetSolutionStepValue(VOLUMETRIC_STRAIN);
635  }
636 
637  // Create the constitutive variables and values containers
638  ConstitutiveVariables constitutive_variables(strain_size);
639  ConstitutiveLaw::Parameters cons_law_values(r_geometry, GetProperties(), rCurrentProcessInfo);
640  auto& r_cons_law_options = cons_law_values.GetOptions();
641  r_cons_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true);
642  r_cons_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, true);
643  r_cons_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false);
644 
645  // Call the initialize material response
646  for (IndexType i_gauss = 0; i_gauss < n_gauss; ++i_gauss) {
647  // Recompute the kinematics
648  CalculateKinematicVariables(kinematic_variables, i_gauss, GetIntegrationMethod());
649 
650  // Set the constitutive variables
651  SetConstitutiveVariables(kinematic_variables, constitutive_variables, cons_law_values, i_gauss, r_integration_points);
652 
653  // Calculate the output value
654  rOutput[i_gauss] = mConstitutiveLawVector[i_gauss]->CalculateValue(cons_law_values, rVariable, rOutput[i_gauss] );
655  }
656  }
657 
661 
665 
669 
670  friend class Serializer;
671 
672  void save( Serializer& rSerializer ) const override;
673 
674  void load( Serializer& rSerializer ) override;
675 
676 }; // class SmallDisplacementMixedVolumetricStrainElement.
677 
681 
682 
686 
687 } // namespace Kratos.
688 
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::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
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
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Small displacement with strain based mixed formulation element.
Definition: small_displacement_mixed_volumetric_strain_element.h:65
SmallDisplacementMixedVolumetricStrainElement(SmallDisplacementMixedVolumetricStrainElement const &rOther)
Definition: small_displacement_mixed_volumetric_strain_element.h:188
SmallDisplacementMixedVolumetricStrainElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: small_displacement_mixed_volumetric_strain_element.h:177
void SetIntegrationMethod(const IntegrationMethod &ThisIntegrationMethod)
Sets the used integration method.
Definition: small_displacement_mixed_volumetric_strain_element.h:413
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: small_displacement_mixed_volumetric_strain_element.h:379
ConstitutiveLawType::Pointer ConstitutiveLawPointerType
Pointer type for constitutive laws.
Definition: small_displacement_mixed_volumetric_strain_element.h:142
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: small_displacement_mixed_volumetric_strain_element.h:373
std::string Info() const override
Turn back information as a string.
Definition: small_displacement_mixed_volumetric_strain_element.h:365
IntegrationMethod mThisIntegrationMethod
Definition: small_displacement_mixed_volumetric_strain_element.h:397
Element BaseType
The base element type.
Definition: small_displacement_mixed_volumetric_strain_element.h:154
GeometryData::IntegrationMethod IntegrationMethod
Type definition for integration methods.
Definition: small_displacement_mixed_volumetric_strain_element.h:148
~SmallDisplacementMixedVolumetricStrainElement() override
Definition: small_displacement_mixed_volumetric_strain_element.h:195
std::vector< ConstitutiveLaw::Pointer > mConstitutiveLawVector
Currently selected integration methods.
Definition: small_displacement_mixed_volumetric_strain_element.h:399
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(SmallDisplacementMixedVolumetricStrainElement)
Node NodeType
This is the definition of the node.
Definition: small_displacement_mixed_volumetric_strain_element.h:151
void SetConstitutiveLawVector(const std::vector< ConstitutiveLaw::Pointer > &ThisConstitutiveLawVector)
Sets the used constitutive laws.
Definition: small_displacement_mixed_volumetric_strain_element.h:422
SmallDisplacementMixedVolumetricStrainElement()
Definition: small_displacement_mixed_volumetric_strain_element.h:164
ConstitutiveLaw ConstitutiveLawType
Reference type definition for constitutive laws.
Definition: small_displacement_mixed_volumetric_strain_element.h:139
ConstitutiveLawType::StressMeasure StressMeasureType
StressMeasure from constitutive laws.
Definition: small_displacement_mixed_volumetric_strain_element.h:145
IntegrationMethod GetIntegrationMethod() const override
Returns the used integration method.
Definition: small_displacement_mixed_volumetric_strain_element.h:281
SmallDisplacementMixedVolumetricStrainElement(IndexType NewId, GeometryType::Pointer pGeometry)
Definition: small_displacement_mixed_volumetric_strain_element.h:168
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
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
void ComputeEquivalentF(const Element &rElement, const TVectorType &rStrainTensor, TMatrixType &rF)
This method computes the deformation gradient F (for small deformation solid elements)
Definition: structural_mechanics_element_utilities.h:69
void CalculateB(const GeometricalObject &rElement, const TMatrixType1 &rDN_DX, TMatrixType2 &rB)
This method computes the deformation tensor B (for small deformation solid elements)
Definition: structural_mechanics_element_utilities.h:105
array_1d< double, 3 > GetBodyForce(const Element &rElement, const GeometryType::IntegrationPointsArrayType &rIntegrationPoints, const IndexType PointNumber)
This method returns the computed the computed body force.
Definition: structural_mechanics_element_utilities.cpp:71
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
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
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 strain_size
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:16
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
B
Definition: sensitivityMatrix.py:76
Definition: constitutive_law.h:189
Definition: small_displacement_mixed_volumetric_strain_element.h:116
Vector StressVector
Definition: small_displacement_mixed_volumetric_strain_element.h:118
Vector StrainVector
Definition: small_displacement_mixed_volumetric_strain_element.h:117
Matrix D
Definition: small_displacement_mixed_volumetric_strain_element.h:119
ConstitutiveVariables(const SizeType StrainSize)
Definition: small_displacement_mixed_volumetric_strain_element.h:125
Definition: small_displacement_mixed_volumetric_strain_element.h:73
Matrix InvJ0
Definition: small_displacement_mixed_volumetric_strain_element.h:80
Matrix B
Definition: small_displacement_mixed_volumetric_strain_element.h:75
Matrix J0
Definition: small_displacement_mixed_volumetric_strain_element.h:79
double detF
Definition: small_displacement_mixed_volumetric_strain_element.h:76
double detJ0
Definition: small_displacement_mixed_volumetric_strain_element.h:78
Vector VolumetricNodalStrains
Definition: small_displacement_mixed_volumetric_strain_element.h:83
Vector EquivalentStrain
Definition: small_displacement_mixed_volumetric_strain_element.h:84
Matrix DN_DX
Definition: small_displacement_mixed_volumetric_strain_element.h:81
Vector N
Definition: small_displacement_mixed_volumetric_strain_element.h:74
Matrix F
Definition: small_displacement_mixed_volumetric_strain_element.h:77
Vector Displacements
Definition: small_displacement_mixed_volumetric_strain_element.h:82
KinematicVariables(const SizeType StrainSize, const SizeType Dimension, const SizeType NumberOfNodes)
Definition: small_displacement_mixed_volumetric_strain_element.h:92