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.
iga_membrane_element.h
Go to the documentation of this file.
1 #if !defined(KRATOS_IGA_MEMBRANE_ELEMENT_H_INCLUDED )
2 #define KRATOS_IGA_MEMBRANE_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 KRATOS_API(IGA_APPLICATION) IgaMembraneElement
25  : public Element
26 {
27 protected:
28 
31  {
32  // covariant metric
34 
35  //base vector 1
37  //base vector 2
39  //base vector 3 normalized
41  //not-normalized base vector 3
43 
44  //differential area
45  double dA;
46 
52  {
53  noalias(a_ab_covariant) = ZeroVector(Dimension);
54 
55  noalias(a1) = ZeroVector(Dimension);
56  noalias(a2) = ZeroVector(Dimension);
57  noalias(a3) = ZeroVector(Dimension);
58 
59  noalias(a3_tilde) = ZeroVector(Dimension);
60 
61  dA = 1.0;
62  }
63  };
64 
69  {
73 
78  {
79  StrainVector = ZeroVector(StrainSize);
80  StressVector = ZeroVector(StrainSize);
81  ConstitutiveMatrix = ZeroMatrix(StrainSize, StrainSize);
82  }
83  };
84 
89  {
93 
99  {
100  B11 = ZeroMatrix(mat_size, mat_size);
101  B22 = ZeroMatrix(mat_size, mat_size);
102  B12 = ZeroMatrix(mat_size, mat_size);
103  }
104  };
105 
107  enum class ConfigurationType {
108  Current,
109  Reference
110  };
111 
112 public:
115 
118 
120  typedef std::size_t SizeType;
121  typedef std::size_t IndexType;
122 
123  // GometryType
125 
129 
132  IndexType NewId,
133  GeometryType::Pointer pGeometry)
134  : Element(NewId, pGeometry)
135  {};
136 
139  IndexType NewId,
140  GeometryType::Pointer pGeometry,
141  PropertiesType::Pointer pProperties)
142  : Element(NewId, pGeometry, pProperties)
143  {};
144 
147  : Element()
148  {};
149 
151  virtual ~IgaMembraneElement() = default;
152 
156 
158  Element::Pointer Create(
159  IndexType NewId,
160  GeometryType::Pointer pGeom,
161  PropertiesType::Pointer pProperties
162  ) const override
163  {
164  return Kratos::make_intrusive<IgaMembraneElement>(
165  NewId, pGeom, pProperties);
166  };
167 
169  Element::Pointer Create(
170  IndexType NewId,
171  NodesArrayType const& ThisNodes,
172  PropertiesType::Pointer pProperties
173  ) const override
174  {
175  return Kratos::make_intrusive< IgaMembraneElement >(
176  NewId, GetGeometry().Create(ThisNodes), pProperties);
177  };
178 
182 
190  VectorType& rRightHandSideVector,
191  const ProcessInfo& rCurrentProcessInfo) override
192  {
193  const SizeType number_of_nodes = GetGeometry().size();
194  const SizeType mat_size = number_of_nodes * 3;
195 
196  if (rRightHandSideVector.size() != mat_size)
197  rRightHandSideVector.resize(mat_size);
198  noalias(rRightHandSideVector) = ZeroVector(mat_size);
199 
200  MatrixType left_hand_side_matrix;
201 
202  CalculateAll(left_hand_side_matrix, rRightHandSideVector,
203  rCurrentProcessInfo, false, true);
204  }
205 
213  MatrixType& rLeftHandSideMatrix,
214  const ProcessInfo& rCurrentProcessInfo) override
215  {
216  const SizeType number_of_nodes = GetGeometry().size();
217  const SizeType mat_size = number_of_nodes * 3;
218 
219  VectorType right_hand_side_vector;
220 
221  if (rLeftHandSideMatrix.size1() != mat_size)
222  rLeftHandSideMatrix.resize(mat_size, mat_size);
223  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
224 
225  CalculateAll(rLeftHandSideMatrix, right_hand_side_vector,
226  rCurrentProcessInfo, true, false);
227  }
228 
238  MatrixType& rLeftHandSideMatrix,
239  VectorType& rRightHandSideVector,
240  const ProcessInfo& rCurrentProcessInfo) override
241  {
242  const SizeType number_of_nodes = GetGeometry().size();
243  const SizeType mat_size = number_of_nodes * 3;
244 
245  if (rRightHandSideVector.size() != mat_size)
246  rRightHandSideVector.resize(mat_size);
247  noalias(rRightHandSideVector) = ZeroVector(mat_size);
248 
249  if (rLeftHandSideMatrix.size1() != mat_size)
250  rLeftHandSideMatrix.resize(mat_size, mat_size);
251  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
252 
253  CalculateAll(rLeftHandSideMatrix, rRightHandSideVector,
254  rCurrentProcessInfo, true, true);
255  }
256 
262  void CalculateMassMatrix(
263  MatrixType& rMassMatrix,
264  const ProcessInfo& rCurrentProcessInfo
265  ) override;
266 
272  void CalculateDampingMatrix(
273  MatrixType& rDampingMatrix,
274  const ProcessInfo& rCurrentProcessInfo
275  ) override;
276 
277  void Calculate(const Variable<Matrix>& rVariable,
278  Matrix& rOutput, const ProcessInfo& rCurrentProcessInfo) override;
279 
287  const Variable<double>& rVariable,
288  std::vector<double>& rValues,
289  const ProcessInfo& rCurrentProcessInfo
290  ) override;
291 
299  const Variable<Vector>& rVariable,
300  std::vector<Vector>& rValues,
301  const ProcessInfo& rCurrentProcessInfo
302  ) override;
303 
309  void EquationIdVector(
310  EquationIdVectorType& rResult,
311  const ProcessInfo& rCurrentProcessInfo
312  ) const override;
313 
319  void GetDofList(
320  DofsVectorType& rElementalDofList,
321  const ProcessInfo& rCurrentProcessInfo
322  ) const override;
323 
327 
328  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
329 
330  void GetValuesVector(
331  Vector& rValues,
332  int Step = 0) const override;
333 
334  void GetFirstDerivativesVector(
335  Vector& rValues,
336  int Step = 0) const override;
337 
338  void GetSecondDerivativesVector(
339  Vector& rValues,
340  int Step = 0) const override;
341 
342 
346 
354  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
355 
359 
361  std::string Info() const override
362  {
363  std::stringstream buffer;
364  buffer << "IgaMembraneElement #" << Id();
365  return buffer.str();
366  }
367 
369  void PrintInfo(std::ostream& rOStream) const override
370  {
371  rOStream << "IgaMembraneElement #" << Id();
372  }
373 
375  void PrintData(std::ostream& rOStream) const override
376  {
377  pGetGeometry()->PrintData(rOStream);
378  }
379 
381 
382 private:
385 
386  // Components of the metric coefficient tensor on the contravariant basis
387  std::vector<array_1d<double, 3>> m_A_ab_covariant_vector;
388 
389  // Determinant of the geometrical Jacobian.
390  Vector m_dA_vector;
391 
392  /* Transformation the strain tensor from the curvilinear system
393  * to the local cartesian in voigt notation including a 2 in the
394  * shear part. */
395  std::vector<Matrix> m_T_vector;
396 
397  /* Transformation the stress tensor from the local cartesian
398  * to the curvilinear system in voigt notation. */
399  std::vector<Matrix> m_T_hat_vector;
400 
401  // Contravatiant at reference configuration.
402  std::vector<array_1d< array_1d<double, 3>,2>> m_reference_contravariant_base;
403 
405  std::vector<ConstitutiveLaw::Pointer> mConstitutiveLawVector;
406 
410 
412  void CalculateAll(
413  MatrixType& rLeftHandSideMatrix,
414  VectorType& rRightHandSideVector,
415  const ProcessInfo& rCurrentProcessInfo,
416  const bool CalculateStiffnessMatrixFlag,
417  const bool CalculateResidualVectorFlag
418  );
419 
421  void InitializeMaterial();
422 
423  void CalculateKinematics(
424  IndexType IntegrationPointIndex,
425  KinematicVariables& rKinematicVariables,
426  const Matrix& rShapeFunctionGradientValues, const ConfigurationType& rConfiguration);
427 
428  // Computes transformation
429  void CalculateTransformation(
430  const KinematicVariables& rKinematicVariables,
431  Matrix& rT, Matrix& rT_hat, array_1d<array_1d<double, 3>,2>& rReferenceContraVariantBase);
432 
433  void CalculateBMembrane(
434  IndexType IntegrationPointIndex,
435  Matrix& rB,
436  const KinematicVariables& rActualKinematic);
437 
438  void CalculateSecondVariationStrain(
439  IndexType IntegrationPointIndex,
440  SecondVariations& rSecondVariationsStrain,
441  const KinematicVariables& rActualKinematic);
442 
450  void CalculateConstitutiveVariables(
451  IndexType IntegrationPointIndex,
452  KinematicVariables& rActualMetric,
453  ConstitutiveVariables& rThisConstitutiveVariablesMembrane,
455  const ConstitutiveLaw::StressMeasure ThisStressMeasure
456  );
457 
463  void CalculateTransformationPrestress(
464  Matrix& rTransformationPrestress,
465  const KinematicVariables& rActualKinematic
466  );
467 
468  inline void CalculateAndAddKm(
469  MatrixType& rLeftHandSideMatrix,
470  const Matrix& B,
471  const Matrix& D,
472  const double IntegrationWeight);
473 
474  inline void CalculateAndAddNonlinearKm(
475  Matrix& rLeftHandSideMatrix,
476  const SecondVariations& rSecondVariationsStrain,
477  const Vector& rSD,
478  const double IntegrationWeight);
479 
480  void CalculatePK2Stresses(
481  IndexType IntegrationPointIndex,
482  array_1d<double, 3>& rPK2Stresses,
483  KinematicVariables& rKinematicVariables,
484  const Matrix& rShapeFunctionGradientValues,
485  const ProcessInfo& rCurrentProcessInfo);
486 
487  void CalculateCauchyStresses(
488  IndexType IntegrationPointIndex,
489  array_1d<double, 3>& rCauchyStresses,
490  KinematicVariables& rKinematicVariables,
491  const Matrix& rShapeFunctionGradientValues,
492  const ProcessInfo& rCurrentProcessInfo);
493 
497 
498  friend class Serializer;
499 
500  void save(Serializer& rSerializer) const override
501  {
503  rSerializer.save("A_ab_covariant_vector", m_A_ab_covariant_vector);
504  rSerializer.save("dA_vector", m_dA_vector);
505  rSerializer.save("T_vector", m_T_vector);
506  rSerializer.save("T_hat_vector", m_T_hat_vector);
507  rSerializer.save("reference_contravariant_base", m_reference_contravariant_base);
508  rSerializer.save("constitutive_law_vector", mConstitutiveLawVector);
509  }
510 
511  void load(Serializer& rSerializer) override
512  {
514  rSerializer.load("A_ab_covariant_vector", m_A_ab_covariant_vector);
515  rSerializer.load("dA_vector", m_dA_vector);
516  rSerializer.load("T_vector", m_T_vector);
517  rSerializer.load("T_hat_vector", m_T_hat_vector);
518  rSerializer.load("reference_contravariant_base", m_reference_contravariant_base);
519  rSerializer.load("constitutive_law_vector", mConstitutiveLawVector);
520  }
521 
523 
524 }; // Class IgaMembraneElement
526 
527 } // namespace Kratos.
528 
529 #endif // KRATOS_IGA_MEMBRANE_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::size_t IndexType
Definition: flags.h:74
Geometry base class.
Definition: geometry.h:71
Definition: iga_membrane_element.h:26
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: iga_membrane_element.h:169
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: iga_membrane_element.h:375
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(IgaMembraneElement)
Counted pointer of IgaMembraneElement.
IgaMembraneElement(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using an array of nodes.
Definition: iga_membrane_element.h:131
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: iga_membrane_element.h:189
IgaMembraneElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using an array of nodes with properties.
Definition: iga_membrane_element.h:138
std::string Info() const override
Turn back information as a string.
Definition: iga_membrane_element.h:361
ConfigurationType
Internal flags used for calculate reference or current kinematic.
Definition: iga_membrane_element.h:107
std::size_t IndexType
Definition: iga_membrane_element.h:121
IgaMembraneElement()
Default constructor necessary for serialization.
Definition: iga_membrane_element.h:146
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: iga_membrane_element.h:158
virtual ~IgaMembraneElement()=default
Destructor.
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This function provides a more general interface to the element.
Definition: iga_membrane_element.h:237
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: iga_membrane_element.h:369
Geometry< Node > GeometryType
Definition: iga_membrane_element.h:124
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: iga_membrane_element.h:212
std::size_t SizeType
Size types.
Definition: iga_membrane_element.h:120
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
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
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
TDataType Calculate(GeometryType &dummy, const Variable< TDataType > &rVariable)
Definition: add_geometries_to_python.cpp:103
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
@ Current
Definition: structural_mechanics_math_utilities.hpp:30
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
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: iga_membrane_element.h:69
ConstitutiveVariables(SizeType StrainSize)
Definition: iga_membrane_element.h:77
Vector StrainVector
Definition: iga_membrane_element.h:70
Vector StressVector
Definition: iga_membrane_element.h:71
Matrix ConstitutiveMatrix
Definition: iga_membrane_element.h:72
Internal variables used for metric transformation.
Definition: iga_membrane_element.h:31
double dA
Definition: iga_membrane_element.h:45
array_1d< double, 3 > a2
Definition: iga_membrane_element.h:38
array_1d< double, 3 > a3
Definition: iga_membrane_element.h:40
array_1d< double, 3 > a_ab_covariant
Definition: iga_membrane_element.h:33
array_1d< double, 3 > a1
Definition: iga_membrane_element.h:36
array_1d< double, 3 > a3_tilde
Definition: iga_membrane_element.h:42
KinematicVariables(SizeType Dimension)
Definition: iga_membrane_element.h:51
Definition: iga_membrane_element.h:89
Matrix B11
Definition: iga_membrane_element.h:90
Matrix B22
Definition: iga_membrane_element.h:91
SecondVariations(SizeType mat_size)
Definition: iga_membrane_element.h:98
Matrix B12
Definition: iga_membrane_element.h:92