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.
shell_3p_element.h
Go to the documentation of this file.
1 #if !defined(KRATOS_SHELL_3P_ELEMENT_H_INCLUDED )
2 #define KRATOS_SHELL_3P_ELEMENT_H_INCLUDED
3 
4 
5 // System includes
6 
7 // External includes
8 
9 // Project includes
10 #include "includes/define.h"
11 #include "includes/element.h"
12 #include "utilities/math_utils.h"
13 
14 // Application includes
16 
17 namespace Kratos
18 {
22 
25  : public Element
26 {
27 protected:
28 
31  {
32  // covariant metric
35 
36  //base vector 1
38  //base vector 2
40  //base vector 3 normalized
42  //not-normalized base vector 3
44 
45  //differential area
46  double dA;
47 
53  {
54  noalias(a_ab_covariant) = ZeroVector(Dimension);
55  noalias(b_ab_covariant) = ZeroVector(Dimension);
56 
57  noalias(a1) = ZeroVector(Dimension);
58  noalias(a2) = ZeroVector(Dimension);
59  noalias(a3) = ZeroVector(Dimension);
60 
61  noalias(a3_tilde) = ZeroVector(Dimension);
62 
63  dA = 1.0;
64  }
65  };
66 
71  {
75 
80  {
81  StrainVector = ZeroVector(StrainSize);
82  StressVector = ZeroVector(StrainSize);
83  ConstitutiveMatrix = ZeroMatrix(StrainSize, StrainSize);
84  }
85  };
86 
91  {
95 
100  SecondVariations(const int& mat_size)
101  {
102  B11 = ZeroMatrix(mat_size, mat_size);
103  B22 = ZeroMatrix(mat_size, mat_size);
104  B12 = ZeroMatrix(mat_size, mat_size);
105  }
106  };
107 
108 public:
111 
114 
116  typedef std::size_t SizeType;
117  typedef std::size_t IndexType;
118 
119  // GometryType
121 
125 
128  IndexType NewId,
129  GeometryType::Pointer pGeometry)
130  : Element(NewId, pGeometry)
131  {};
132 
135  IndexType NewId,
136  GeometryType::Pointer pGeometry,
137  PropertiesType::Pointer pProperties)
138  : Element(NewId, pGeometry, pProperties)
139  {};
140 
143  : Element()
144  {};
145 
147  virtual ~Shell3pElement() = default;
148 
152 
154  Element::Pointer Create(
155  IndexType NewId,
156  GeometryType::Pointer pGeom,
157  PropertiesType::Pointer pProperties
158  ) const override
159  {
160  return Kratos::make_intrusive<Shell3pElement>(
161  NewId, pGeom, pProperties);
162  };
163 
165  Element::Pointer Create(
166  IndexType NewId,
167  NodesArrayType const& ThisNodes,
168  PropertiesType::Pointer pProperties
169  ) const override
170  {
171  return Kratos::make_intrusive< Shell3pElement >(
172  NewId, GetGeometry().Create(ThisNodes), pProperties);
173  };
174 
178 
186  VectorType& rRightHandSideVector,
187  const ProcessInfo& rCurrentProcessInfo) override
188  {
189  const SizeType number_of_nodes = GetGeometry().size();
190  const SizeType mat_size = number_of_nodes * 3;
191 
192  if (rRightHandSideVector.size() != mat_size)
193  rRightHandSideVector.resize(mat_size);
194  noalias(rRightHandSideVector) = ZeroVector(mat_size);
195 
196  MatrixType left_hand_side_matrix;
197 
198  CalculateAll(left_hand_side_matrix, rRightHandSideVector,
199  rCurrentProcessInfo, false, true);
200  }
201 
209  MatrixType& rLeftHandSideMatrix,
210  const ProcessInfo& rCurrentProcessInfo) override
211  {
212  const SizeType number_of_nodes = GetGeometry().size();
213  const SizeType mat_size = number_of_nodes * 3;
214 
215  VectorType right_hand_side_vector;
216 
217  if (rLeftHandSideMatrix.size1() != mat_size)
218  rLeftHandSideMatrix.resize(mat_size, mat_size);
219  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
220 
221  CalculateAll(rLeftHandSideMatrix, right_hand_side_vector,
222  rCurrentProcessInfo, true, false);
223  }
224 
234  MatrixType& rLeftHandSideMatrix,
235  VectorType& rRightHandSideVector,
236  const ProcessInfo& rCurrentProcessInfo) override
237  {
238  const SizeType number_of_nodes = GetGeometry().size();
239  const SizeType mat_size = number_of_nodes * 3;
240 
241  if (rRightHandSideVector.size() != mat_size)
242  rRightHandSideVector.resize(mat_size);
243  noalias(rRightHandSideVector) = ZeroVector(mat_size);
244 
245  if (rLeftHandSideMatrix.size1() != mat_size)
246  rLeftHandSideMatrix.resize(mat_size, mat_size);
247  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
248 
249  CalculateAll(rLeftHandSideMatrix, rRightHandSideVector,
250  rCurrentProcessInfo, true, true);
251  }
252 
258  void CalculateMassMatrix(
259  MatrixType& rMassMatrix,
260  const ProcessInfo& rCurrentProcessInfo
261  ) override;
262 
269  MatrixType& rDampingMatrix,
270  const ProcessInfo& rCurrentProcessInfo
271  ) override;
272 
273  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
274 
280  void EquationIdVector(
281  EquationIdVectorType& rResult,
282  const ProcessInfo& rCurrentProcessInfo
283  ) const override;
284 
290  void GetDofList(
291  DofsVectorType& rElementalDofList,
292  const ProcessInfo& rCurrentProcessInfo
293  ) const override;
294 
298 
299  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
300 
301  void GetValuesVector(
302  Vector& rValues,
303  int Step) const override;
304 
306  Vector& rValues,
307  int Step) const override;
308 
310  Vector& rValues,
311  int Step) const override;
312 
320  const Variable<double>& rVariable,
321  std::vector<double>& rOutput,
322  const ProcessInfo& rCurrentProcessInfo
323  ) override;
324 
332  const Variable<array_1d<double, 3>>& rVariable,
333  std::vector<array_1d<double, 3>>& rOutput,
334  const ProcessInfo& rCurrentProcessInfo
335  ) override;
336 
340 
348  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
349 
353 
355  std::string Info() const override
356  {
357  std::stringstream buffer;
358  buffer << "Kirchhoff-Love Shell3pElement #" << Id();
359  return buffer.str();
360  }
361 
363  void PrintInfo(std::ostream& rOStream) const override
364  {
365  rOStream << "Kirchhoff-Love Shell3pElement #" << Id();
366  }
367 
369  void PrintData(std::ostream& rOStream) const override
370  {
371  pGetGeometry()->PrintData(rOStream);
372  }
373 
375 
376 private:
379 
380  // Components of the metric coefficient tensor on the contravariant basis
381  std::vector<array_1d<double, 3>> m_A_ab_covariant_vector;
382  // Components of the curvature coefficient tensor on the contravariant basis
383  std::vector<array_1d<double, 3>> m_B_ab_covariant_vector;
384 
385  // Determinant of the geometrical Jacobian.
386  Vector m_dA_vector;
387 
388  /* Transformation the strain tensor from the curvilinear system
389  * to the local cartesian in voigt notation including a 2 in the
390  * shear part. */
391  std::vector<Matrix> m_T_vector;
392 
394  std::vector<ConstitutiveLaw::Pointer> mConstitutiveLawVector;
395 
399 
401  void CalculateAll(
402  MatrixType& rLeftHandSideMatrix,
403  VectorType& rRightHandSideVector,
404  const ProcessInfo& rCurrentProcessInfo,
405  const bool CalculateStiffnessMatrixFlag,
406  const bool CalculateResidualVectorFlag
407  ) const;
408 
410  void InitializeMaterial();
411 
412  void CalculateKinematics(
413  const IndexType IntegrationPointIndex,
414  KinematicVariables& rKinematicVariables) const;
415 
416  // Computes transformation
417  void CalculateTransformation(
418  const KinematicVariables& rKinematicVariables,
419  Matrix& rT) const;
420 
421  // Computes transformation for the stress tensor
422  void CalculateTransformationFromCovariantToCartesian(
423  const KinematicVariables& rKinematicVariables,
424  Matrix& rTCovToCar) const;
425 
426  void CalculateBMembrane(
427  const IndexType IntegrationPointIndex,
428  Matrix& rB,
429  const KinematicVariables& rActualKinematic) const;
430 
431  void CalculateBCurvature(
432  const IndexType IntegrationPointIndex,
433  Matrix& rB,
434  const KinematicVariables& rActualKinematic) const;
435 
436  void CalculateSecondVariationStrainCurvature(
437  const IndexType IntegrationPointIndex,
438  SecondVariations& rSecondVariationsStrain,
439  SecondVariations& rSecondVariationsCurvature,
440  const KinematicVariables& rActualKinematic) const;
441 
449  void CalculateConstitutiveVariables(
450  const IndexType IntegrationPointIndex,
451  KinematicVariables& rActualMetric,
452  ConstitutiveVariables& rThisConstitutiveVariablesMembrane,
453  ConstitutiveVariables& rThisConstitutiveVariablesCurvature,
455  const ConstitutiveLaw::StressMeasure ThisStressMeasure
456  ) const;
457 
458  inline void CalculateAndAddKm(
459  MatrixType& rLeftHandSideMatrix,
460  const Matrix& B,
461  const Matrix& D,
462  const double IntegrationWeight) const;
463 
464  inline void CalculateAndAddNonlinearKm(
465  Matrix& rLeftHandSideMatrix,
466  const SecondVariations& rSecondVariationsStrain,
467  const Vector& rSD,
468  const double IntegrationWeight) const;
469 
470  // Calculation of the PK2 stress
471  void CalculatePK2Stress(
472  const IndexType IntegrationPointIndex,
473  array_1d<double, 3>& rPK2MembraneStressCartesian,
474  array_1d<double, 3>& rPK2BendingStressCartesian,
475  const ProcessInfo& rCurrentProcessInfo) const;
476 
477  // Calculation of the Cauchy stress by transforming the PK2 stress
478  void CalculateCauchyStress(
479  const IndexType IntegrationPointIndex,
480  array_1d<double, 3>& rCauchyMembraneStressesCartesian,
481  array_1d<double, 3>& rCauchyBendingStressesCartesian,
482  const ProcessInfo& rCurrentProcessInfo) const;
483 
484  // Calculation of the shear force, shear force = derivative of moment
485  void CalculateShearForce(
486  const IndexType IntegrationPointIndex,
487  array_1d<double, 2>& rq,
488  const ProcessInfo& rCurrentProcessInfo) const;
489 
490  void CalculateDerivativeOfCurvatureInitial(
491  const IndexType IntegrationPointIndex,
492  array_1d<double, 3>& rDCurvature_D1,
493  array_1d<double, 3>& rDCurvature_D2,
494  const Matrix& rHessian) const;
495 
496  void CalculateDerivativeOfCurvatureActual(
497  const IndexType IntegrationPointIndex,
498  array_1d<double, 3>& rDCurvature_D1,
499  array_1d<double, 3>& rDCurvature_D2,
500  const Matrix& rHessian,
501  const KinematicVariables& rKinematicVariables) const;
502 
503  void CalculateDerivativeTransformationMatrices(
504  const IndexType IntegrationPointIndex,
505  std::vector<Matrix>& rDQ_Dalpha_init,
506  std::vector<Matrix>& rDTransCartToCov_Dalpha_init,
507  const Matrix& rHessian) const;
508 
516  template<class TType>
517  void GetValueOnConstitutiveLaw(
518  const Variable<TType>& rVariable,
519  std::vector<TType>& rOutput
520  )
521  {
523 
524  for (IndexType point_number = 0; point_number < integration_points.size(); ++point_number) {
525  mConstitutiveLawVector[point_number]->GetValue(rVariable, rOutput[point_number]);
526  }
527  }
528 
532 
533  void CalculateHessian(
534  Matrix& Hessian,
535  const Matrix& rDDN_DDe) const;
536 
537  void CalculateSecondDerivativesOfBaseVectors(
538  const Matrix& rDDDN_DDDe,
539  array_1d<double, 3>& rDDa1_DD11,
540  array_1d<double, 3>& rDDa1_DD12,
541  array_1d<double, 3>& rDDa2_DD21,
542  array_1d<double, 3>& rDDa2_DD22) const;
543 
547 
548  friend class Serializer;
549 
550  void save(Serializer& rSerializer) const override
551  {
553  rSerializer.save("A_ab_covariant_vector", m_A_ab_covariant_vector);
554  rSerializer.save("B_ab_covariant_vector", m_B_ab_covariant_vector);
555  rSerializer.save("dA_vector", m_dA_vector);
556  rSerializer.save("T_vector", m_T_vector);
557  rSerializer.save("constitutive_law_vector", mConstitutiveLawVector);
558  }
559 
560  void load(Serializer& rSerializer) override
561  {
563  rSerializer.load("A_ab_covariant_vector", m_A_ab_covariant_vector);
564  rSerializer.load("B_ab_covariant_vector", m_B_ab_covariant_vector);
565  rSerializer.load("dA_vector", m_dA_vector);
566  rSerializer.load("T_vector", m_T_vector);
567  rSerializer.load("constitutive_law_vector", mConstitutiveLawVector);
568  }
569 
571 
572 }; // Class Shell3pElement
574 
575 } // namespace Kratos.
576 
577 #endif // KRATOS_MESHLESS_SHELL_3P_ELEMENT_H_INCLUDED defined
StressMeasure
Definition: constitutive_law.h:69
Base class for all Elements.
Definition: element.h:60
std::size_t SizeType
Definition: element.h:94
virtual IntegrationMethod GetIntegrationMethod() const
Definition: element.h:285
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
Matrix MatrixType
Definition: element.h:90
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
std::size_t IndexType
Definition: flags.h:74
GeometryType::Pointer pGetGeometry()
Returns the pointer to the geometry.
Definition: geometrical_object.h:140
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
const IntegrationPointsArrayType & IntegrationPoints() const
Definition: geometry.h:2284
IndexType Id() const
Definition: indexed_object.h:107
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
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
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
Definition: shell_3p_element.h:26
void Initialize(const ProcessInfo &rCurrentProcessInfo) override
Definition: shell_3p_element.cpp:28
Shell3pElement()
Default constructor necessary for serialization.
Definition: shell_3p_element.h:142
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: shell_3p_element.h:363
Shell3pElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using an array of nodes with properties.
Definition: shell_3p_element.h:134
void FinalizeSolutionStep(const ProcessInfo &rCurrentProcessInfo) override
Definition: shell_3p_element.cpp:90
std::size_t IndexType
Definition: shell_3p_element.h:117
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the condition right hand side matr...
Definition: shell_3p_element.h:185
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rConditionDofList the degrees of freedom of the considered element geometry.
Definition: shell_3p_element.cpp:1535
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rResult the ID's of the element degrees of freedom.
Definition: shell_3p_element.cpp:1511
void GetFirstDerivativesVector(Vector &rValues, int Step) const override
Definition: shell_3p_element.cpp:1471
std::size_t SizeType
Size types.
Definition: shell_3p_element.h:116
Shell3pElement(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using an array of nodes.
Definition: shell_3p_element.h:127
void GetValuesVector(Vector &rValues, int Step) const override
Definition: shell_3p_element.cpp:1450
void CalculateDampingMatrix(MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the elemental damping matrix.
Definition: shell_3p_element.cpp:415
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: shell_3p_element.h:154
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(Shell3pElement)
Counted pointer of Shell3pElement.
virtual ~Shell3pElement()=default
Destructor.
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This function provides a more general interface to the element.
Definition: shell_3p_element.h:233
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: shell_3p_element.h:369
void GetSecondDerivativesVector(Vector &rValues, int Step) const override
Definition: shell_3p_element.cpp:1491
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the condition left hand side matri...
Definition: shell_3p_element.h:208
Geometry< Node > GeometryType
Definition: shell_3p_element.h:120
void CalculateOnIntegrationPoints(const Variable< double > &rVariable, std::vector< double > &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Calculate a double Variable on the Element Constitutive Law.
Definition: shell_3p_element.cpp:105
std::string Info() const override
Turn back information as a string.
Definition: shell_3p_element.h:355
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Definition: shell_3p_element.cpp:1560
void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the elemental mass matrix.
Definition: shell_3p_element.cpp:466
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: shell_3p_element.h:165
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
def load(f)
Definition: ode_solve.py:307
B
Definition: sensitivityMatrix.py:76
Definition: constitutive_law.h:189
Definition: shell_3p_element.h:71
ConstitutiveVariables(SizeType StrainSize)
Definition: shell_3p_element.h:79
Vector StressVector
Definition: shell_3p_element.h:73
Matrix ConstitutiveMatrix
Definition: shell_3p_element.h:74
Vector StrainVector
Definition: shell_3p_element.h:72
Internal variables used for metric transformation.
Definition: shell_3p_element.h:31
KinematicVariables(SizeType Dimension)
Definition: shell_3p_element.h:52
array_1d< double, 3 > a3_tilde
Definition: shell_3p_element.h:43
double dA
Definition: shell_3p_element.h:46
array_1d< double, 3 > a_ab_covariant
Definition: shell_3p_element.h:33
array_1d< double, 3 > a1
Definition: shell_3p_element.h:37
array_1d< double, 3 > a3
Definition: shell_3p_element.h:41
array_1d< double, 3 > a2
Definition: shell_3p_element.h:39
array_1d< double, 3 > b_ab_covariant
Definition: shell_3p_element.h:34
Definition: shell_3p_element.h:91
SecondVariations(const int &mat_size)
Definition: shell_3p_element.h:100
Matrix B12
Definition: shell_3p_element.h:94
Matrix B22
Definition: shell_3p_element.h:93
Matrix B11
Definition: shell_3p_element.h:92