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.
structural_mechanics_element_utilities.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: Philipp Bucher
10 // Vicente Mataix Ferrandiz
11 // Riccardo Rossi
12 // Ruben Zorrilla
13 //
14 
15 #pragma once
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/element.h"
23 
24 namespace Kratos {
34 namespace StructuralMechanicsElementUtilities {
35 
37 typedef std::size_t SizeType;
38 
40 typedef std::size_t IndexType;
41 
43 typedef Node NodeType;
44 
47 
55  const Element& rElement,
56  const ProcessInfo& rCurrentProcessInfo,
57  const std::vector<ConstitutiveLaw::Pointer>& rConstitutiveLaws
58  );
59 
68 template<class TVectorType, class TMatrixType>
70  const Element& rElement,
71  const TVectorType& rStrainTensor,
72  TMatrixType& rF
73  )
74 {
75  const auto& r_geometry = rElement.GetGeometry();
76  const SizeType dimension = r_geometry.WorkingSpaceDimension();
77 
78  if(dimension == 2) {
79  rF(0,0) = 1.0+rStrainTensor(0);
80  rF(0,1) = 0.5*rStrainTensor(2);
81  rF(1,0) = 0.5*rStrainTensor(2);
82  rF(1,1) = 1.0+rStrainTensor(1);
83  } else {
84  rF(0,0) = 1.0+rStrainTensor(0);
85  rF(0,1) = 0.5*rStrainTensor(3);
86  rF(0,2) = 0.5*rStrainTensor(5);
87  rF(1,0) = 0.5*rStrainTensor(3);
88  rF(1,1) = 1.0+rStrainTensor(1);
89  rF(1,2) = 0.5*rStrainTensor(4);
90  rF(2,0) = 0.5*rStrainTensor(5);
91  rF(2,1) = 0.5*rStrainTensor(4);
92  rF(2,2) = 1.0+rStrainTensor(2);
93  }
94 }
95 
104 template<class TMatrixType1, class TMatrixType2>
106  const GeometricalObject& rElement,
107  const TMatrixType1& rDN_DX,
108  TMatrixType2& rB
109  )
110 {
111  const auto& r_geometry = rElement.GetGeometry();
112  const SizeType number_of_nodes = r_geometry.PointsNumber();
113  const SizeType dimension = rDN_DX.size2();
114 
115  rB.clear();
116 
117  if(dimension == 2) {
118  for ( IndexType i = 0; i < number_of_nodes; ++i ) {
119  const IndexType initial_index = i*2;
120  rB(0, initial_index ) = rDN_DX(i, 0);
121  rB(1, initial_index + 1) = rDN_DX(i, 1);
122  rB(2, initial_index ) = rDN_DX(i, 1);
123  rB(2, initial_index + 1) = rDN_DX(i, 0);
124  }
125  } else if(dimension == 3) {
126  for ( IndexType i = 0; i < number_of_nodes; ++i ) {
127  const IndexType initial_index = i*3;
128  rB(0, initial_index ) = rDN_DX(i, 0);
129  rB(1, initial_index + 1) = rDN_DX(i, 1);
130  rB(2, initial_index + 2) = rDN_DX(i, 2);
131  rB(3, initial_index ) = rDN_DX(i, 1);
132  rB(3, initial_index + 1) = rDN_DX(i, 0);
133  rB(4, initial_index + 1) = rDN_DX(i, 2);
134  rB(4, initial_index + 2) = rDN_DX(i, 1);
135  rB(5, initial_index ) = rDN_DX(i, 2);
136  rB(5, initial_index + 2) = rDN_DX(i, 0);
137  }
138  }
139 }
140 
148  const Element& rElement,
149  const GeometryType::IntegrationPointsArrayType& rIntegrationPoints,
150  const IndexType PointNumber
151  );
152 
160  const Properties& rProperties,
161  const ProcessInfo& rCurrentProcessInfo);
162 
169 bool HasRayleighDamping(
170  const Properties& rProperties,
171  const ProcessInfo& rCurrentProcessInfo);
172 
179 double GetRayleighAlpha(
180  const Properties& rProperties,
181  const ProcessInfo& rCurrentProcessInfo);
182 
189 double GetRayleighBeta(
190  const Properties& rProperties,
191  const ProcessInfo& rCurrentProcessInfo);
192 
198 double GetDensityForMassMatrixComputation(const Element& rElement);
199 
207 void KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) CalculateRayleighDampingMatrix(
208  Element& rElement,
209  Element::MatrixType& rDampingMatrix,
210  const ProcessInfo& rCurrentProcessInfo,
211  const std::size_t MatrixSize);
212 
218 double KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) CalculateReferenceLength2D2N(const Element& rElement);
219 
225 double KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) CalculateCurrentLength2D2N(const Element& rElement);
226 
232 double KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) CalculateReferenceLength3D2N(const Element& rElement);
233 
239 double KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) CalculateCurrentLength3D2N(const Element& rElement);
240 
246  const array_1d<double, 3>& rv1,
247  const array_1d<double, 3>& rv2,
248  const array_1d<double, 3>& rv3,
249  const double Tolerance = 1.0e4*std::numeric_limits<double>::epsilon());
250 
256  BoundedMatrix<double, 3, 3>& rRotationMatrix,
257  const array_1d<double, 3>& rv1,
258  const array_1d<double, 3>& rv2,
259  const array_1d<double, 3>& rv3);
260 
261 } // namespace StructuralMechanicsElementUtilities.
262 } // namespace Kratos.
Base class for all Elements.
Definition: element.h:60
This defines the geometrical object, base definition of the element and condition entities.
Definition: geometrical_object.h:58
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
This class defines the node.
Definition: node.h:65
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
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
void InitialCheckLocalAxes(const array_1d< double, 3 > &rv1, const array_1d< double, 3 > &rv2, const array_1d< double, 3 > &rv3, const double Tolerance)
This function checks the norm of the vectors.
Definition: structural_mechanics_element_utilities.cpp:315
int SolidElementCheck(const Element &rElement, const ProcessInfo &rCurrentProcessInfo, const std::vector< ConstitutiveLaw::Pointer > &rConstitutiveLaws)
This method performs commons checks on the solid elements.
Definition: structural_mechanics_element_utilities.cpp:28
double CalculateCurrentLength2D2N(const Element &rElement)
This function calculates the current length for 2D2N elements.
Definition: structural_mechanics_element_utilities.cpp:252
Node NodeType
Node type definition.
Definition: structural_mechanics_element_utilities.h:43
void CalculateRayleighDampingMatrix(Element &rElement, Element::MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo, const std::size_t MatrixSize)
Method to calculate the rayleigh damping-matrix.
Definition: structural_mechanics_element_utilities.cpp:193
std::size_t IndexType
The index type definition.
Definition: structural_mechanics_element_utilities.h:40
double CalculateReferenceLength2D2N(const Element &rElement)
This function calculates the reference length for 2D2N elements.
Definition: structural_mechanics_element_utilities.cpp:235
bool HasRayleighDamping(const Properties &rProperties, const ProcessInfo &rCurrentProcessInfo)
Method to specify if rayligh-damping is specified.
Definition: structural_mechanics_element_utilities.cpp:125
void BuildRotationMatrix(BoundedMatrix< double, 3, 3 > &rRotationMatrix, const array_1d< double, 3 > &rv1, const array_1d< double, 3 > &rv2, const array_1d< double, 3 > &rv3)
This function fills a rotation matrix from a set of vectors.
Definition: structural_mechanics_element_utilities.cpp:332
double CalculateCurrentLength3D2N(const Element &rElement)
This function calculates the current length for 3D2N elements.
Definition: structural_mechanics_element_utilities.cpp:292
double GetRayleighAlpha(const Properties &rProperties, const ProcessInfo &rCurrentProcessInfo)
Method to get the rayleigh-alpha parameter.
Definition: structural_mechanics_element_utilities.cpp:136
double GetDensityForMassMatrixComputation(const Element &rElement)
Method to returns the density to be consider for the mass-matrix computation.
Definition: structural_mechanics_element_utilities.cpp:172
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
double GetRayleighBeta(const Properties &rProperties, const ProcessInfo &rCurrentProcessInfo)
Method to get the rayleigh-beta parameter.
Definition: structural_mechanics_element_utilities.cpp:154
double CalculateReferenceLength3D2N(const Element &rElement)
This function calculates the reference length for 3D2N elements.
Definition: structural_mechanics_element_utilities.cpp:276
bool ComputeLumpedMassMatrix(const Properties &rProperties, const ProcessInfo &rCurrentProcessInfo)
Method to specify if the lumped or the consistent mass-matrix should be computed.
Definition: structural_mechanics_element_utilities.cpp:103
std::size_t SizeType
The size type definition.
Definition: structural_mechanics_element_utilities.h:37
Geometry< NodeType > GeometryType
Geometry definitions.
Definition: structural_mechanics_element_utilities.h:46
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
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
integer i
Definition: TensorModule.f:17