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.
beam_element.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosSolidMechanicsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: August 2017 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_BEAM_ELEMENT_H_INCLUDED)
11 #define KRATOS_BEAM_ELEMENT_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
18 #include "includes/checks.h"
19 #include "includes/element.h"
21 #include "custom_utilities/element_utilities.hpp"
22 
23 namespace Kratos
24 {
39 
41 
42 class KRATOS_API(SOLID_MECHANICS_APPLICATION) BeamElement
43  :public Element
44 {
45 public:
46 
52  typedef ConstitutiveLawType::Pointer ConstitutiveLawPointerType;
63 
66 
68 
69 protected:
70 
74  KRATOS_DEFINE_LOCAL_FLAG( COMPUTE_RHS_VECTOR );
75  KRATOS_DEFINE_LOCAL_FLAG( COMPUTE_LHS_MATRIX );
76  KRATOS_DEFINE_LOCAL_FLAG( FINALIZED_STEP );
82  {
83  double Area; // Area or the beam section
84  double Inertia_z; // Moment of Inertia about the local z axis, Iz local
85  double Inertia_y; // Moment of Inertia about the local y axis, Iy local
86  double Polar_Inertia; // Polar Moment of Inertia, measures an object's ability to resist twisting, when acted upon by differences of torque along its length.
87  double Rotational_Inertia; // Moment of Inertia about the local x axis, measures an object's resistance to changes in its rotational velocity when acted by a net resultant torque
88  };
89 
94  {
95  //Current
96  std::vector<Vector> Current;
97  std::vector<Vector> CurrentDerivatives;
98 
99  //Initial
100  std::vector<Vector> Initial;
101  std::vector<Vector> InitialDerivatives;
102 
103  //Previous
104  std::vector<Vector> Previous;
105  std::vector<Vector> PreviousDerivatives;
106 
107 
108  //NODAL VARIABLES
109  std::vector<Matrix> InitialNode;
110  std::vector<Matrix> CurrentNode;
111  std::vector<Matrix> PreviousNode;
112 
113  std::vector<Matrix> CurrentNodeVelocities;
114  std::vector<Matrix> PreviousNodeVelocities;
115  };
116 
117 
122  struct ElementData
123  {
124  private:
125 
126  //variables including all integration points
128  const Matrix* pNcontainer;
129 
130  //directors variables
131  DirectorsVariables* Directors;
132 
133  public:
134 
135  //integration point
136  unsigned int PointNumber;
137 
138  //delta time
139  double DeltaTime;
140 
141  //element length
142  double Length;
143  double detJ;
144 
145  //equilibrium point
146  double Alpha;
147 
148  //general variables
152 
157 
158  //large displacement
161 
163 
166 
170 
171 
174 
177 
178 
179  //variables including all integration points
182 
183  //section properties
185 
190  {
191  pDN_De=&rDN_De;
192  };
193 
194  void SetShapeFunctions(const Matrix& rNcontainer)
195  {
196  pNcontainer=&rNcontainer;
197  };
198 
199 
201  {
202  Directors=&rDirectors;
203  };
204 
209  {
210  return *pDN_De;
211  };
212 
214  {
215  return *pNcontainer;
216  };
217 
219  {
220  return *Directors;
221  };
222 
223  void Initialize( const unsigned int& voigt_size,
224  const unsigned int& dimension,
225  const unsigned int& number_of_nodes )
226  {
227  //scalars
228  PointNumber = 0;
229  Length = 0;
230  detJ = 1;
231  Alpha = 1;
232  DeltaTime = 0;
233 
234  //vectors
235  StrainVector.resize(voigt_size,false);
236  StressVector.resize(voigt_size,false);
237  N.resize(number_of_nodes,false);
238  noalias(StrainVector) = ZeroVector(voigt_size);
239  noalias(StressVector) = ZeroVector(voigt_size);
240  noalias(N) = ZeroVector(number_of_nodes);
241  //matrices
242  B.resize(voigt_size, (dimension-1) * 3 * number_of_nodes,false);
243  DN_DX.resize(number_of_nodes, 1,false); //Local 1D
244  ConstitutiveMatrix.resize(voigt_size, voigt_size,false);
245  DeltaPosition.resize(number_of_nodes, dimension,false);
246 
247  noalias(DN_DX) = ZeroMatrix(number_of_nodes, 1);
248  noalias(ConstitutiveMatrix) = ZeroMatrix(voigt_size, voigt_size);
249  noalias(DeltaPosition) = ZeroMatrix(number_of_nodes, dimension);
250 
251  //large displacement
252  CurrentRotationMatrix.resize(dimension, dimension,false);
253  InitialAxisPositionDerivatives.resize(dimension,false);
254  CurrentAxisPositionDerivatives.resize(dimension,false);
255  PreviousAxisPositionDerivatives.resize(dimension,false);
256 
257  noalias(CurrentRotationMatrix) = ZeroMatrix(dimension, dimension);
258  noalias(InitialAxisPositionDerivatives) = ZeroVector(dimension);
259  noalias(CurrentAxisPositionDerivatives) = ZeroVector(dimension);
260  noalias(PreviousAxisPositionDerivatives) = ZeroVector(dimension);
261 
262  //others
263  J.resize(1,false);
264  j.resize(1,false);
265  J[0].resize(dimension,dimension,false);
266  j[0].resize(dimension,dimension,false);
269 
270  //pointers
271  pDN_De = NULL;
272  pNcontainer = NULL;
273  Directors = NULL;
274  }
275 
276  };
277 
278 
287  {
288  private:
289 
290  //for calculation local system with compacted LHS and RHS
291  MatrixType *mpLeftHandSideMatrix;
292  VectorType *mpRightHandSideVector;
293 
294  public:
295 
296  //calculation flags
298 
302  void SetLeftHandSideMatrix( MatrixType& rLeftHandSideMatrix ) { mpLeftHandSideMatrix = &rLeftHandSideMatrix; };
303 
304  void SetRightHandSideVector( VectorType& rRightHandSideVector ) { mpRightHandSideVector = &rRightHandSideVector; };
305 
306 
310  MatrixType& GetLeftHandSideMatrix() { return *mpLeftHandSideMatrix; };
311 
312  VectorType& GetRightHandSideVector() { return *mpRightHandSideVector; };
313 
314  };
315 
316 
317 public:
318 
321 
324 
326  BeamElement(IndexType NewId, GeometryType::Pointer pGeometry);
327 
328  BeamElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
329 
331  BeamElement(BeamElement const& rOther);
332 
334  ~BeamElement() override;
335 
336 
340 
341 
349  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const override;
350 
351 
352  //************* GETTING METHODS
353 
359  IntegrationMethod GetIntegrationMethod() const override;
360 
364  void GetDofList(DofsVectorType& rElementalDofList, const ProcessInfo& rCurrentProcessInfo) const override;
365 
369  void EquationIdVector(EquationIdVectorType& rResult, const ProcessInfo& rCurrentProcessInfo) const override;
370 
374  void GetValuesVector(Vector& rValues, int Step = 0) const override;
375 
379  void GetFirstDerivativesVector(Vector& rValues, int Step = 0) const override;
380 
384  void GetSecondDerivativesVector(Vector& rValues, int Step = 0) const override;
385 
386 
387  //************* STARTING - ENDING METHODS
388 
393  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
394 
398  void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
399 
403  void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
404 
408  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
409 
413  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
414 
415  //************* COMPUTING METHODS
416 
417 
426  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix, VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
427 
434  void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override;
435 
436 
443  void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix, const ProcessInfo& rCurrentProcessInfo) override;
444 
445 
453  void CalculateSecondDerivativesContributions(MatrixType& rLeftHandSideMatrix,
454  VectorType& rRightHandSideVector,
455  const ProcessInfo& rCurrentProcessInfo) override;
456 
463  void CalculateSecondDerivativesLHS(MatrixType& rLeftHandSideMatrix,
464  const ProcessInfo& rCurrentProcessInfo) override;
465 
466 
473  void CalculateSecondDerivativesRHS(VectorType& rRightHandSideVector,
474  const ProcessInfo& rCurrentProcessInfo) override;
475 
482  void CalculateMassMatrix(MatrixType& rMassMatrix, const ProcessInfo& rCurrentProcessInfo) override;
483 
484 
498  void AddExplicitContribution(const VectorType& rRHSVector, const Variable<VectorType>& rRHSVariable, const Variable<array_1d<double,3> >& rDestinationVariable, const ProcessInfo& rCurrentProcessInfo) override;
499 
500  //on integration points:
504  void CalculateOnIntegrationPoints(const Variable<double>& rVariable,
505  std::vector<double>& rOutput,
506  const ProcessInfo& rCurrentProcessInfo) override;
507 
508 
513  std::vector< array_1d<double, 3 > >& Output,
514  const ProcessInfo& rCurrentProcessInfo) override;
515 
516 
517  //************************************************************************************
518  //************************************************************************************
526  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
527 
531 
539  std::string Info() const override
540  {
541  std::stringstream buffer;
542  buffer << "Large Displacement Beam Element #" << Id();
543  return buffer.str();
544  }
545 
547  void PrintInfo(std::ostream& rOStream) const override
548  {
549  rOStream << "Large Displacement Beam Element #" << Id();
550  }
551 
553  void PrintData(std::ostream& rOStream) const override
554  {
555  GetGeometry().PrintData(rOStream);
556  }
561 
562 protected:
563 
569 
574 
579 
584 
585  //constexpr const std::size_t& Dimension() const {return GetGeometry().WorkingSpaceDimension();}
586 
590 
594  void IncreaseIntegrationMethod(IntegrationMethod& rThisIntegrationMethod,
595  unsigned int increment) const;
596 
597 
604  virtual void CalculateElementalSystem( LocalSystemComponents& rLocalSystem,
605  const ProcessInfo& rCurrentProcessInfo );
606 
607 
611  virtual void CalculateDynamicSystem( LocalSystemComponents& rLocalSystem,
612  const ProcessInfo& rCurrentProcessInfo );
613 
617  virtual unsigned int GetDofsSize() const;
618 
622  void InitializeSystemMatrices(MatrixType& rLeftHandSideMatrix,
623  VectorType& rRightHandSideVector,
624  Flags& rCalculationFlags);
625 
626 
630  Vector& MapToInitialLocalFrame(Vector& rVariable, unsigned int PointNumber = 0);
631 
635  virtual void MapLocalToGlobal(ElementDataType& rVariables, Matrix& rVariable);
636 
640  virtual void MapLocalToGlobal(ElementDataType& rVariables, VectorType& rVector);
641 
642 
646  Vector& GetLocalCurrentValue(const Variable<array_1d<double,3> >&rVariable,
647  Vector& rValue,
648  const Vector& rN);
649 
650 
654  Vector& GetLocalPreviousValue(const Variable<array_1d<double,3> >&rVariable,
655  Vector& rValue,
656  const Vector& rN);
657 
658 
662  Vector& GetNodalCurrentValue(const Variable<array_1d<double,3> >&rVariable,
663  Vector& rValue,
664  const unsigned int& rNode);
665 
669  Vector& GetNodalPreviousValue(const Variable<array_1d<double,3> >&rVariable,
670  Vector& rValue,
671  const unsigned int& rNode);
672 
676  virtual void InitializeElementData(ElementDataType & rVariables, const ProcessInfo& rCurrentProcessInfo);
677 
678 
682  void CalculateSectionProperties(SectionProperties & rSection);
683 
684 
688  virtual void CalculateKinematics(ElementDataType& rVariables,
689  const unsigned int& rPointNumber);
690 
694  virtual void CalculateConstitutiveMatrix(ElementDataType& rVariables);
695 
696 
700  void CalculateMaterialConstitutiveMatrix(Matrix& rConstitutiveMatrix, ElementDataType& rVariables);
701 
702 
706  virtual void CalculateStressResultants(ElementDataType& rVariables, const unsigned int& rPointNumber);
707 
711  virtual void CalculateAndAddLHS(LocalSystemComponents& rLocalSystem, ElementDataType& rVariables, double& rIntegrationWeight);
712 
716  virtual void CalculateAndAddRHS(LocalSystemComponents& rLocalSystem, ElementDataType& rVariables, Vector& VolumeForce, double& rIntegrationWeight);
717 
721  virtual double& CalculateIntegrationWeight(double& rIntegrationWeight);
722 
727  virtual void CalculateAndAddKuum(MatrixType& rLeftHandSideMatrix,
728  ElementDataType& rVariables,
729  double& rIntegrationWeight);
730 
731 
732 
736  virtual void CalculateAndAddKuug(MatrixType& rLeftHandSideMatrix,
737  ElementDataType& rVariables,
738  double& rIntegrationWeight);
739 
743  virtual void CalculateAndAddExternalForces(VectorType& rRightHandSideVector,
744  ElementDataType& rVariables,
745  Vector& rVolumeForce,
746  double& rIntegrationWeight);
747 
748 
752  virtual void CalculateAndAddInertiaLHS(MatrixType& rLeftHandSideMatrix,
753  ElementDataType& rVariables,
754  const ProcessInfo& rCurrentProcessInfo,
755  double& rIntegrationWeight);
756 
760  virtual void CalculateAndAddInertiaRHS(VectorType& rRightHandSideVector,
761  ElementDataType& rVariables,
762  const ProcessInfo& rCurrentProcessInfo,
763  double& rIntegrationWeight);
764 
768  virtual void CalculateAndAddInternalForces(VectorType& rRightHandSideVector,
769  ElementDataType & rVariables,
770  double& rIntegrationWeight);
771 
772 
776  void CalculateLocalAxesMatrix(Matrix& rRotationMatrix);
777 
778 
782  virtual Vector& CalculateVolumeForce(Vector& rVolumeForce, const Vector& rN);
783 
787  double& CalculateTotalMass( SectionProperties& Section, double& rTotalMass );
788 
792  void CalculateInertiaDyadic(SectionProperties& rSection, Matrix& rInertiaDyadic);
793 
794 
805 
806 private:
807 
826  friend class Serializer;
827 
828 
829  // A private default constructor necessary for serialization
830 
831 
832  void save(Serializer& rSerializer) const override;
833 
834  void load(Serializer& rSerializer) override;
835 
842 
843 
844 }; // Class BeamElement
845 
846 } // namespace Kratos.
847 #endif // KRATOS_BEAM_ELEMENT_H_INCLUDED defined
Beam Element for 2D and 3D space dimensions.
Definition: beam_element.hpp:44
BeamMathUtils< double > BeamMathUtilsType
Type definition for beam utilities.
Definition: beam_element.hpp:58
ConstitutiveLawType::Pointer ConstitutiveLawPointerType
Pointer type for constitutive laws.
Definition: beam_element.hpp:52
BeamElement()
Definition: beam_element.hpp:583
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: beam_element.hpp:547
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_LHS_MATRIX)
IntegrationMethod mThisIntegrationMethod
Definition: beam_element.hpp:573
Quaternion< double > QuaternionType
Type definition for quaternion.
Definition: beam_element.hpp:60
GeometryData::IntegrationMethod IntegrationMethod
Type definition for integration methods.
Definition: beam_element.hpp:56
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_RHS_VECTOR)
ElementData ElementDataType
Type for element variables.
Definition: beam_element.hpp:320
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(BeamElement)
Counted pointer of BeamElement.
ConstitutiveLawType::StressMeasure StressMeasureType
StressMeasure from constitutive laws.
Definition: beam_element.hpp:54
QuaternionType mInitialLocalQuaternion
Definition: beam_element.hpp:578
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: beam_element.hpp:553
std::string Info() const override
Turn back information as a string.
Definition: beam_element.hpp:539
KRATOS_DEFINE_LOCAL_FLAG(FINALIZED_STEP)
ConstitutiveLaw ConstitutiveLawType
Definition: beam_element.hpp:50
GeometryData::SizeType SizeType
Type for size.
Definition: beam_element.hpp:62
Definition: beam_math_utilities.hpp:31
Definition: constitutive_law.h:47
StressMeasure
Definition: constitutive_law.h:69
Base class for all Elements.
Definition: element.h:60
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
Definition: flags.h:58
std::size_t IndexType
Definition: flags.h:74
IntegrationMethod
Definition: geometry_data.h:76
std::size_t SizeType
Definition: geometry_data.h:173
Definition: amatrix_interface.h:41
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
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
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
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
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
def load(f)
Definition: ode_solve.py:307
def Alpha(n, j)
Definition: quadrature.py:93
int j
Definition: quadrature.py:648
J
Definition: sensitivityMatrix.py:58
N
Definition: sensitivityMatrix.py:29
B
Definition: sensitivityMatrix.py:76
Definition: beam_element.hpp:94
std::vector< Vector > InitialDerivatives
Definition: beam_element.hpp:101
std::vector< Vector > Current
Definition: beam_element.hpp:96
std::vector< Matrix > PreviousNode
Definition: beam_element.hpp:111
std::vector< Matrix > PreviousNodeVelocities
Definition: beam_element.hpp:114
std::vector< Vector > Initial
Definition: beam_element.hpp:100
std::vector< Vector > Previous
Definition: beam_element.hpp:104
std::vector< Matrix > CurrentNode
Definition: beam_element.hpp:110
std::vector< Vector > CurrentDerivatives
Definition: beam_element.hpp:97
std::vector< Matrix > CurrentNodeVelocities
Definition: beam_element.hpp:113
std::vector< Vector > PreviousDerivatives
Definition: beam_element.hpp:105
std::vector< Matrix > InitialNode
Definition: beam_element.hpp:109
Definition: beam_element.hpp:123
DirectorsVariables & GetDirectors()
Definition: beam_element.hpp:218
Vector StressVector
Definition: beam_element.hpp:150
double Alpha
Definition: beam_element.hpp:146
double DeltaTime
Definition: beam_element.hpp:139
double Length
Definition: beam_element.hpp:142
Vector PreviousStrainResultantsVector
Definition: beam_element.hpp:165
Matrix PreviousRotationMatrix
Definition: beam_element.hpp:176
Vector CurrentStepRotationVector
Definition: beam_element.hpp:162
Vector PreviousAxisPositionDerivatives
Definition: beam_element.hpp:169
Vector CurrentCurvatureVector
Definition: beam_element.hpp:159
Matrix DeltaPosition
Definition: beam_element.hpp:156
Matrix AlphaRotationMatrixAsterisk
Definition: beam_element.hpp:173
const GeometryType::ShapeFunctionsGradientsType & GetShapeFunctionsGradients()
Definition: beam_element.hpp:208
Vector CurrentStrainResultantsVector
Definition: beam_element.hpp:164
void SetShapeFunctions(const Matrix &rNcontainer)
Definition: beam_element.hpp:194
Vector StrainVector
Definition: beam_element.hpp:149
Matrix ConstitutiveMatrix
Definition: beam_element.hpp:155
GeometryType::JacobiansType j
Definition: beam_element.hpp:181
Vector N
Definition: beam_element.hpp:151
unsigned int PointNumber
Definition: beam_element.hpp:136
void SetShapeFunctionsGradients(const GeometryType::ShapeFunctionsGradientsType &rDN_De)
Definition: beam_element.hpp:189
Matrix AlphaRotationMatrix
Definition: beam_element.hpp:172
SectionProperties Section
Definition: beam_element.hpp:184
Vector CurrentAxisPositionDerivatives
Definition: beam_element.hpp:168
const Matrix & GetShapeFunctions()
Definition: beam_element.hpp:213
Matrix CurrentRotationMatrix
Definition: beam_element.hpp:175
Vector InitialAxisPositionDerivatives
Definition: beam_element.hpp:167
Vector PreviousCurvatureVector
Definition: beam_element.hpp:160
double detJ
Definition: beam_element.hpp:143
Matrix B
Definition: beam_element.hpp:153
void Initialize(const unsigned int &voigt_size, const unsigned int &dimension, const unsigned int &number_of_nodes)
Definition: beam_element.hpp:223
Matrix DN_DX
Definition: beam_element.hpp:154
void SetDirectors(DirectorsVariables &rDirectors)
Definition: beam_element.hpp:200
GeometryType::JacobiansType J
Definition: beam_element.hpp:180
Definition: beam_element.hpp:287
void SetLeftHandSideMatrix(MatrixType &rLeftHandSideMatrix)
Definition: beam_element.hpp:302
void SetRightHandSideVector(VectorType &rRightHandSideVector)
Definition: beam_element.hpp:304
Flags CalculationFlags
Definition: beam_element.hpp:297
VectorType & GetRightHandSideVector()
Definition: beam_element.hpp:312
MatrixType & GetLeftHandSideMatrix()
Definition: beam_element.hpp:310
Definition: beam_element.hpp:82
double Rotational_Inertia
Definition: beam_element.hpp:87
double Inertia_z
Definition: beam_element.hpp:84
double Area
Definition: beam_element.hpp:83
double Inertia_y
Definition: beam_element.hpp:85
double Polar_Inertia
Definition: beam_element.hpp:86