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_5p_element.h
Go to the documentation of this file.
1 #if !defined(KRATOS_SHELL_5P_ELEMENT_H_INCLUDED )
2 #define KRATOS_SHELL_5P_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 
24 class Shell5pElement final
25  : public Element
26 {
27 protected:
28 
31  {
32  // covariant metric
36 
37  //base vectors current and reference
42 
45  //director
47  //array_1d<double, 3> t;
48 
49  //director derivatives wrt physical space
52 
53  //differential area
54  double dA;
55 
56  void setZero()
57  {
59  curvature = ZeroVector(3);
61 
62  a1 = ZeroVector(3);
63  a2 = ZeroVector(3);
64  A1 = ZeroVector(3);
65  A2 = ZeroVector(3);
66  t = ZeroVector(3);
67  dtd1 = ZeroVector(3);
68  dtd2 = ZeroVector(3);
69  dud1 = ZeroVector(3);
70  dud2 = ZeroVector(3);
71 
72  dA = 0;
73  }
74  };
75 
80  {
84 
89  {
90  StrainVector = ZeroVector(StrainSize);
91  StressVector = ZeroVector(StrainSize);
92  ConstitutiveMatrix = ZeroMatrix(StrainSize, StrainSize);
93  }
94  };
95 
100 
105  {
114  };
115 
116 public:
119 
122 
124  typedef std::size_t SizeType;
125  typedef std::size_t IndexType;
126 
127  // GometryType
128  typedef Node NodeType;
130 
131 
135 
138  IndexType NewId,
139  GeometryType::Pointer pGeometry)
140  : Element(NewId, pGeometry)
141  {};
142 
145  IndexType NewId,
146  GeometryType::Pointer pGeometry,
147  PropertiesType::Pointer pProperties)
148  : Element(NewId, pGeometry, pProperties)
149  {};
150 
153  : Element()
154  {};
155 
157  virtual ~Shell5pElement() final
158  {};
159 
163 
165  Element::Pointer Create(
166  IndexType NewId,
167  GeometryType::Pointer pGeom,
168  PropertiesType::Pointer pProperties
169  ) const final
170  {
171  return Kratos::make_intrusive<Shell5pElement>(
172  NewId, pGeom, pProperties);
173  };
174 
176  Element::Pointer Create(
177  IndexType NewId,
178  NodesArrayType const& ThisNodes,
179  PropertiesType::Pointer pProperties
180  ) const final
181  {
182  return Kratos::make_intrusive< Shell5pElement >(
183  NewId, GetGeometry().Create(ThisNodes), pProperties);
184  };
185 
189 
197  VectorType& rRightHandSideVector,
198  const ProcessInfo& rCurrentProcessInfo) final
199  {
200  const SizeType number_of_nodes = GetGeometry().size();
201  const SizeType mat_size = number_of_nodes * 5;
202 
203  if (rRightHandSideVector.size() != mat_size)
204  rRightHandSideVector.resize(mat_size);
205  noalias(rRightHandSideVector) = ZeroVector(mat_size);
206 
207  MatrixType left_hand_side_matrix;
208 
209  CalculateAll(left_hand_side_matrix, rRightHandSideVector,
210  rCurrentProcessInfo, false, true);
211  }
212 
220  MatrixType& rLeftHandSideMatrix,
221  const ProcessInfo& rCurrentProcessInfo) final
222  {
223  const SizeType number_of_nodes = GetGeometry().size();
224  const SizeType mat_size = number_of_nodes * 5;
225 
226  VectorType right_hand_side_vector;
227 
228  if (rLeftHandSideMatrix.size1() != mat_size)
229  rLeftHandSideMatrix.resize(mat_size, mat_size);
230  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
231 
232  CalculateAll(rLeftHandSideMatrix, right_hand_side_vector,
233  rCurrentProcessInfo, true, false);
234  }
235 
245  MatrixType& rLeftHandSideMatrix,
246  VectorType& rRightHandSideVector,
247  const ProcessInfo& rCurrentProcessInfo) final
248  {
249  const SizeType number_of_nodes = GetGeometry().size();
250  const SizeType mat_size = number_of_nodes * 5;
251 
252  if (rRightHandSideVector.size() != mat_size)
253  rRightHandSideVector.resize(mat_size);
254  noalias(rRightHandSideVector) = ZeroVector(mat_size);
255 
256  if (rLeftHandSideMatrix.size1() != mat_size || rLeftHandSideMatrix.size2() != mat_size)
257  rLeftHandSideMatrix.resize(mat_size, mat_size);
258  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
259 
260  CalculateAll(rLeftHandSideMatrix, rRightHandSideVector,
261  rCurrentProcessInfo, true, true);
262  }
263 
269  void EquationIdVector(
270  EquationIdVectorType& rResult,
271  const ProcessInfo& rCurrentProcessInfo
272  ) const final;
273 
279  void GetDofList(
280  DofsVectorType& rElementalDofList,
281  const ProcessInfo& rCurrentProcessInfo
282  ) const final;
283 
287 
288  void Initialize(const ProcessInfo& rCurrentProcessInfo) final;
289 
290  void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) final;
291 
292  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) final;
293 
294  void GetValuesVector(
295  Vector& rValues,
296  int Step) const final;
297 
299  Vector& rValues,
300  int Step) const final;
301 
303  Vector& rValues,
304  int Step) const final;
305 
309 
317  int Check(const ProcessInfo& rCurrentProcessInfo) const final {
318  auto& r_geometry = GetGeometry();
319  for (IndexType i = 0; i < r_geometry.size(); ++i) {
320  KRATOS_ERROR_IF_NOT(r_geometry[i].Has(DIRECTOR))
321  << "DIRECTOR not provided at node #" << r_geometry[i].Id() << std::endl;
322  }
323 
324  return 0;
325  }
326 
330 
332  std::string Info() const final
333  {
334  std::stringstream buffer;
335  buffer << "RMElement #" << Id();
336  return buffer.str();
337  }
338 
340  void PrintInfo(std::ostream& rOStream) const final
341  {
342  rOStream << "RMElement #" << Id();
343  }
344 
346  void PrintData(std::ostream& rOStream) const final {
347  pGetGeometry()->PrintData(rOStream);
348  }
349 
351 
352 private:
355 
356  // Components of the metric coefficient tensor on the contravariant basis
357  //std::vector<array_1d<double, 3>> m_A_ab_covariant_vector;
358  // Components of the curvature coefficient tensor on the contravariant basis
359  std::vector<array_1d<double, 3>> reference_Curvature;
360  // Components of the shear coefficient tensor on the contravariant basis
361  std::vector<array_1d<double, 2>> reference_TransShear;
362 
363  // Determinant of the geometrical Jacobian.
364  Vector m_dA_vector;
365 
366  Kratos::Variable<Vector>::Type const& (NodeType::*m_GetValueFunctor)(const Kratos::Variable<Vector >&) const = &NodeType::GetValue;
367  Kratos::Variable<array_1d<double, 3>>::Type const& (NodeType::*m_FastGetSolutionStepValueFunctor)(const Kratos::Variable<array_1d<double,3> >&) const = &NodeType::FastGetSolutionStepValue;
368  NodeType::PointType::CoordinatesArrayType const& (NodeType::* m_GetCoordinatesFunctor)() const = &NodeType::Coordinates;
369  NodeType::PointType const& (NodeType::* m_GetInitialPositionFunctor)() const = &NodeType::GetInitialPosition;
370 
371  // Transformed curvilinear derivatives into cartesian derivatives/
372  std::vector<Matrix> m_cart_deriv;
373 
374  //The St. Venant Kirchhoff 5P Material Tangent
376 
380 
382  void CalculateAll(
383  MatrixType& rLeftHandSideMatrix,
384  VectorType& rRightHandSideVector,
385  const ProcessInfo& rCurrentProcessInfo,
386  const bool CalculateStiffnessMatrixFlag,
387  const bool CalculateResidualVectorFlag
388  );
389 
390  std::pair< Shell5pElement::KinematicVariables, Shell5pElement::VariationVariables>
391  CalculateKinematics(const IndexType IntegrationPointIndex) const;
392 
393  // Computes the cartesian derivatives from curvilinear ones
394  Matrix CalculateCartesianDerivatives(
395  const IndexType IntegrationPointIndex);
396 
397  Matrix CalculateStrainDisplacementOperator(
398  const IndexType IntegrationPointIndex,
399  const KinematicVariables& rActualKinematic,
400  const VariationVariables& rVariations) const ;
401 
402  Matrix CalculateGeometricStiffness(
403  const IndexType IntegrationPointIndex,
404  const KinematicVariables& rActKin,
405  const VariationVariables& ractVar,
406  const ConstitutiveVariables& rThisConstitutiveVariables) const;
407 
415  void CalculateConstitutiveVariables(
416  const IndexType IntegrationPointIndex,
417  const KinematicVariables& rActualMetric,
418  ConstitutiveVariables& rThisConstitutiveVariables,
420  const ConstitutiveLaw::StressMeasure ThisStressMeasure
421  );
422 
424  void CalculateSVKMaterialTangent();
425 
426  template< typename ContainerType, typename NodeFunctor, typename ...Args>
427  BoundedVector<double, 3> InterpolateNodalVariable(const ContainerType& vec, const NodeFunctor& funct, const Args&... args) const;
428 
429  public:
431  private:
435 
436  friend class Serializer;
437 
438  void save(Serializer& rSerializer) const final
439  {
441  rSerializer.save("reference_Curvature", reference_Curvature);
442  rSerializer.save("reference_TransShear", reference_TransShear);
443  rSerializer.save("dA_vector", m_dA_vector);
444  rSerializer.save("cart_deriv", m_cart_deriv);
445  }
446 
447  void load(Serializer& rSerializer) final
448  {
450  rSerializer.load("curvature", reference_Curvature);
451  rSerializer.load("reference_TransShear", reference_TransShear);
452  rSerializer.load("dA_vector", m_dA_vector);
453  rSerializer.save("cart_deriv", m_cart_deriv);
454  }
455 
457 
458 }; // Class Shell5pElement
460 
461 } // namespace Kratos.
462 
463 #endif // KRATOS_MESHLESS_SHELL_5P_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
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
bool Has(const Variable< TDataType > &rThisVariable) const
Definition: geometrical_object.h:230
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
IndexType Id() const
Definition: indexed_object.h:107
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: node.h:466
const PointType & GetInitialPosition() const
Definition: node.h:559
Point class.
Definition: point.h:59
CoordinatesArrayType const & Coordinates() const
Definition: point.h:215
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
Definition: shell_5p_element.h:26
Shell5pElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using an array of nodes with properties.
Definition: shell_5p_element.h:144
static BoundedMatrix< double, 3, 2 > TangentSpaceFromStereographicProjection(const array_1d< double, 3 > &director)
Definition: shell_5p_element.cpp:512
std::string Info() const final
Turn back information as a string.
Definition: shell_5p_element.h:332
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) final
This is called during the assembling process in order to calculate the condition right hand side matr...
Definition: shell_5p_element.h:196
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) final
This is called during the assembling process in order to calculate the condition left hand side matri...
Definition: shell_5p_element.h:219
std::size_t IndexType
Definition: shell_5p_element.h:125
void FinalizeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo) final
Definition: shell_5p_element.cpp:541
void GetValuesVector(Vector &rValues, int Step) const final
Definition: shell_5p_element.cpp:372
void GetFirstDerivativesVector(Vector &rValues, int Step) const final
Definition: shell_5p_element.cpp:393
Shell5pElement(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using an array of nodes.
Definition: shell_5p_element.h:137
void InitializeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo) final
Definition: shell_5p_element.cpp:535
Geometry< NodeType > GeometryType
Definition: shell_5p_element.h:129
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const final
Sets on rResult the ID's of the element degrees of freedom.
Definition: shell_5p_element.cpp:433
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const final
Sets on rConditionDofList the degrees of freedom of the considered element geometry.
Definition: shell_5p_element.cpp:457
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const final
Create with Id, pointer to geometry and pointer to property.
Definition: shell_5p_element.h:165
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const final
Create with Id, pointer to geometry and pointer to property.
Definition: shell_5p_element.h:176
void PrintData(std::ostream &rOStream) const final
Print object's data.
Definition: shell_5p_element.h:346
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(Shell5pElement)
Counted pointer of Shell5pElement.
void GetSecondDerivativesVector(Vector &rValues, int Step) const final
Definition: shell_5p_element.cpp:413
void PrintInfo(std::ostream &rOStream) const final
Print information about this object.
Definition: shell_5p_element.h:340
std::size_t SizeType
Size types.
Definition: shell_5p_element.h:124
Node NodeType
Definition: shell_5p_element.h:128
void Initialize(const ProcessInfo &rCurrentProcessInfo) final
Definition: shell_5p_element.cpp:25
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) final
This function provides a more general interface to the element.
Definition: shell_5p_element.h:244
Shell5pElement()
Default constructor necessary for serialization.
Definition: shell_5p_element.h:152
int Check(const ProcessInfo &rCurrentProcessInfo) const final
Definition: shell_5p_element.h:317
virtual ~Shell5pElement() final
Destructor.
Definition: shell_5p_element.h:157
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#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
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
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
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
args
Definition: generate_gid_list_file.py:37
def load(f)
Definition: ode_solve.py:307
tuple const
Definition: ode_solve.py:403
integer i
Definition: TensorModule.f:17
Definition: constitutive_law.h:189
Definition: shell_5p_element.h:80
Vector StrainVector
Definition: shell_5p_element.h:81
Matrix ConstitutiveMatrix
Definition: shell_5p_element.h:83
ConstitutiveVariables(SizeType StrainSize)
Definition: shell_5p_element.h:88
Vector StressVector
Definition: shell_5p_element.h:82
Internal variables used for metric transformation.
Definition: shell_5p_element.h:31
BoundedVector< double, 3 > a2
Definition: shell_5p_element.h:39
void setZero()
Definition: shell_5p_element.h:56
BoundedVector< double, 3 > dud1
Definition: shell_5p_element.h:43
BoundedVector< double, 3 > t
Definition: shell_5p_element.h:46
array_1d< double, 3 > dtd2
Definition: shell_5p_element.h:51
double dA
Definition: shell_5p_element.h:54
array_1d< double, 3 > metricChange
Definition: shell_5p_element.h:33
BoundedVector< double, 3 > dud2
Definition: shell_5p_element.h:44
array_1d< double, 3 > curvature
Definition: shell_5p_element.h:34
BoundedVector< double, 3 > A1
Definition: shell_5p_element.h:40
BoundedVector< double, 3 > A2
Definition: shell_5p_element.h:41
BoundedVector< double, 3 > a1
Definition: shell_5p_element.h:38
array_1d< double, 3 > dtd1
Definition: shell_5p_element.h:50
array_1d< double, 2 > transShear
Definition: shell_5p_element.h:35
Definition: shell_5p_element.h:105
Matrix3d Q1
Definition: shell_5p_element.h:107
Matrix3d S2
Definition: shell_5p_element.h:110
Matrix3d Chi12Chi21
Definition: shell_5p_element.h:112
Matrix3d Chi11
Definition: shell_5p_element.h:111
Matrix3d Q2
Definition: shell_5p_element.h:108
Matrix3d Chi22
Definition: shell_5p_element.h:113
Matrix3d S1
Definition: shell_5p_element.h:109
Matrix3d P
Definition: shell_5p_element.h:106
Configure::ContainerType ContainerType
Definition: transfer_utility.h:247