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.
solid_element.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosDamApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: July 2013 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_SOLID_ELEMENT_H_INCLUDED)
11 #define KRATOS_SOLID_ELEMENT_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
18 #include "includes/kratos_flags.h"
19 #include "includes/checks.h"
20 #include "includes/element.h"
21 #include "custom_utilities/element_utilities.hpp"
22 
23 
24 namespace Kratos
25 {
40 
42 
48 class KRATOS_API(DAM_APPLICATION) SolidElement : public Element
49 {
50  public:
51 
57  typedef ConstitutiveLawType::Pointer ConstitutiveLawPointerType;
64 
67 
68  protected:
69 
74  KRATOS_DEFINE_LOCAL_FLAG( COMPUTE_RHS_VECTOR );
75  KRATOS_DEFINE_LOCAL_FLAG( COMPUTE_LHS_MATRIX );
76  KRATOS_DEFINE_LOCAL_FLAG( FINALIZED_STEP );
77 
82  struct ElementData
83  {
84  private:
85 
86  //variables including all integration points
88  const Matrix* pNcontainer;
89  const ProcessInfo* pProcessInfo;
90 
91  public:
92 
94 
95  double Tau;
97 
98  //for axisymmetric use only
99  double CurrentRadius;
101 
102  //general variables for large displacement use
103  double detF;
104  double detF0;
105  double detH; //Wildcard ( detF(0 to n+1) )
106  double detJ;
111  Matrix H; //Wildcard ( Displacement Gradient, F(0 to n+1), B-bar, Velocity Gradient...)
112  Matrix F; //Incremental Deformation Gradient (n to n+1)
113  Matrix F0; //Historical Deformation Gradient (0 to n)
116 
117  //variables including all integration points
121 
122 
127  {
128  pDN_De=&rDN_De;
129  };
130 
131  void SetShapeFunctions(const Matrix& rNcontainer)
132  {
133  pNcontainer=&rNcontainer;
134  };
135 
136  void SetProcessInfo(const ProcessInfo& rProcessInfo)
137  {
138  pProcessInfo=&rProcessInfo;
139  };
140 
141 
142 
147  {
148  return *pDN_De;
149  };
150 
152  {
153  return *pNcontainer;
154  };
155 
157  {
158  return *pProcessInfo;
159  };
160 
161  void Initialize(const unsigned int& voigt_size,
162  const unsigned int& dimension,
163  const unsigned int& number_of_nodes)
164  {
165  StressMeasure = ConstitutiveLaw::StressMeasure_PK2;
166 
167  //stabilization
168  Tau = 0;
169 
170  //time step
171  IntegrationWeight = 1;
172 
173  //radius
174  CurrentRadius = 0;
175  ReferenceRadius = 0;
176 
177  //jacobians
178  detF = 1;
179  detF0 = 1;
180  detH = 1;
181  detJ = 1;
182 
183  //vectors
184  StrainVector.resize(voigt_size,false);
185  StressVector.resize(voigt_size,false);
186  N.resize(number_of_nodes,false);
187  noalias(StrainVector) = ZeroVector(voigt_size);
188  noalias(StressVector) = ZeroVector(voigt_size);
189  noalias(N) = ZeroVector(number_of_nodes);
190 
191  //matrices
192  B.resize(voigt_size, dimension*number_of_nodes,false);
193  H.resize(dimension,dimension,false);
194  F.resize(dimension,dimension,false);
195  F0.resize(dimension,dimension,false);
196  DN_DX.resize(number_of_nodes, dimension,false);
197  ConstitutiveMatrix.resize(voigt_size, voigt_size,false);
198  DeltaPosition.resize(number_of_nodes, dimension,false);
199 
200  noalias(B) = ZeroMatrix(voigt_size, dimension*number_of_nodes);
204  noalias(DN_DX) = ZeroMatrix(number_of_nodes, dimension);
205  noalias(ConstitutiveMatrix) = ZeroMatrix(voigt_size, voigt_size);
206  noalias(DeltaPosition) = ZeroMatrix(number_of_nodes, dimension);
207 
208  //others
209  J.resize(1,false);
210  j.resize(1,false);
211  J[0].resize(dimension,dimension,false);
212  j[0].resize(dimension,dimension,false);
215 
216  //pointers
217  pDN_De = NULL;
218  pNcontainer = NULL;
219  pProcessInfo = NULL;
220  }
221 
222  };
223 
224 
233  {
234  private:
235 
236  //for calculation local system with compacted LHS and RHS
237  MatrixType *mpLeftHandSideMatrix;
238  VectorType *mpRightHandSideVector;
239 
240  public:
241 
242  //calculation flags
244 
249  void SetLeftHandSideMatrix( MatrixType& rLeftHandSideMatrix ) { mpLeftHandSideMatrix = &rLeftHandSideMatrix; };
250 
251  void SetRightHandSideVector( VectorType& rRightHandSideVector ) { mpRightHandSideVector = &rRightHandSideVector; };
252 
253 
258  MatrixType& GetLeftHandSideMatrix() { return *mpLeftHandSideMatrix; };
259 
260  VectorType& GetRightHandSideVector() { return *mpRightHandSideVector; };
261 
262  };
263 
264 
265  public:
266 
267 
270 
274 
276  SolidElement();
277 
279  SolidElement(IndexType NewId, GeometryType::Pointer pGeometry);
280 
281  SolidElement(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties);
282 
284  SolidElement(SolidElement const& rOther);
285 
287  ~SolidElement() override;
288 
292 
294  SolidElement& operator=(SolidElement const& rOther);
295 
299 
308  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, PropertiesType::Pointer pProperties) const override;
309 
317  Element::Pointer Clone(IndexType NewId, NodesArrayType const& ThisNodes) const override;
318 
319 
320  //************* GETTING METHODS
321 
326  IntegrationMethod GetIntegrationMethod() const override;
327 
331  void GetDofList(DofsVectorType& rElementalDofList, const ProcessInfo& rCurrentProcessInfo) const override;
332 
336  void EquationIdVector(EquationIdVectorType& rResult, const ProcessInfo& rCurrentProcessInfo) const override;
337 
341  void GetValuesVector(Vector& rValues, int Step = 0) const override;
342 
346  void GetFirstDerivativesVector(Vector& rValues, int Step = 0) const override;
347 
351  void GetSecondDerivativesVector(Vector& rValues, int Step = 0) const override;
352 
353 
354 
355  //on integration points:
366  //SET
370  void SetValuesOnIntegrationPoints(const Variable<double>& rVariable, const std::vector<double>& rValues, const ProcessInfo& rCurrentProcessInfo) override;
371 
375  void SetValuesOnIntegrationPoints(const Variable<Vector>& rVariable, const std::vector<Vector>& rValues, const ProcessInfo& rCurrentProcessInfo) override;
376 
380  void SetValuesOnIntegrationPoints(const Variable<Matrix>& rVariable, const std::vector<Matrix>& rValues, const ProcessInfo& rCurrentProcessInfo) override;
381 
386  const std::vector<ConstitutiveLaw::Pointer>& rValues,
387  const ProcessInfo& rCurrentProcessInfo ) override;
388 
389 
390  //************* STARTING - ENDING METHODS
391 
396  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
397 
401  void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
402 
406  void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
407 
411  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
412 
416  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
417 
418 
419  //************* COMPUTING METHODS
420 
421 
431  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
432  VectorType& rRightHandSideVector,
433  const ProcessInfo& rCurrentProcessInfo) override;
434 
435 
442  void CalculateRightHandSide(VectorType& rRightHandSideVector,
443  const ProcessInfo& rCurrentProcessInfo) override;
444 
445 
452  void CalculateLeftHandSide (MatrixType& rLeftHandSideMatrix,
453  const ProcessInfo& rCurrentProcessInfo) override;
454 
462  void CalculateFirstDerivativesContributions(MatrixType& rLeftHandSideMatrix,
463  VectorType& rRightHandSideVector,
464  const ProcessInfo& rCurrentProcessInfo) override;
465 
473  void CalculateSecondDerivativesContributions(MatrixType& rLeftHandSideMatrix,
474  VectorType& rRightHandSideVector,
475  const ProcessInfo& rCurrentProcessInfo) override;
476 
483  void CalculateSecondDerivativesLHS(MatrixType& rLeftHandSideMatrix,
484  const ProcessInfo& rCurrentProcessInfo) override;
485 
486 
493  void CalculateSecondDerivativesRHS(VectorType& rRightHandSideVector,
494  const ProcessInfo& rCurrentProcessInfo) override;
495 
502  void CalculateMassMatrix(MatrixType& rMassMatrix,
503  const ProcessInfo& rCurrentProcessInfo) override;
504 
511  void CalculateDampingMatrix(MatrixType& rDampingMatrix,
512  const ProcessInfo& rCurrentProcessInfo) override;
513 
514 
524  void AddExplicitContribution(const VectorType& rRHSVector,
525  const Variable<VectorType>& rRHSVariable,
526  const Variable<array_1d<double,3> >& rDestinationVariable,
527  const ProcessInfo& rCurrentProcessInfo) override;
528 
529  //on integration points:
533  void CalculateOnIntegrationPoints(const Variable<double>& rVariable,
534  std::vector<double>& rOutput,
535  const ProcessInfo& rCurrentProcessInfo) override;
536 
540  void CalculateOnIntegrationPoints(const Variable<Vector>& rVariable,
541  std::vector<Vector>& rOutput,
542  const ProcessInfo& rCurrentProcessInfo) override;
543 
547  void CalculateOnIntegrationPoints(const Variable<Matrix >& rVariable,
548  std::vector< Matrix >& rOutput,
549  const ProcessInfo& rCurrentProcessInfo) override;
550 
551 
552  //************************************************************************************
553  //************************************************************************************
561  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
562 
566 
574 
575  std::string Info() const override
576  {
577  std::stringstream buffer;
578  buffer << "Large Displacement Element #" << Id();
579  return buffer.str();
580  }
581 
583  void PrintInfo(std::ostream& rOStream) const override
584  {
585  rOStream << "Large Displacement Element #" << Id();
586  }
587 
589  void PrintData(std::ostream& rOStream) const override
590  {
591  GetGeometry().PrintData(rOStream);
592  }
597 
598  protected:
599 
605 
610 
614  std::vector<ConstitutiveLaw::Pointer> mConstitutiveLawVector;
615 
616 
620 
621  //constexpr const std::size_t& Dimension() const {return GetGeometry().WorkingSpaceDimension();}
622 
626 
630  void IncreaseIntegrationMethod(IntegrationMethod& rThisIntegrationMethod,
631  unsigned int increment) const;
632 
636  virtual void CalculateElementalSystem(LocalSystemComponents& rLocalSystem,
637  const ProcessInfo& rCurrentProcessInfo);
638 
642  virtual void CalculateDynamicSystem(LocalSystemComponents& rLocalSystem,
643  const ProcessInfo& rCurrentProcessInfo);
644 
648  void PrintElementCalculation(LocalSystemComponents& rLocalSystem, ElementDataType& rVariables);
649 
650 
654  void CalculatePerturbedLeftHandSide (MatrixType& rLeftHandSideMatrix,
655  const ProcessInfo& rCurrentProcessInfo);
656 
660  virtual void CalculateAndAddLHS(LocalSystemComponents& rLocalSystem,
661  ElementDataType& rVariables,
662  double& rIntegrationWeight);
663 
667  virtual void CalculateAndAddRHS(LocalSystemComponents& rLocalSystem,
668  ElementDataType& rVariables,
669  Vector& rVolumeForce,
670  double& rIntegrationWeight);
671 
675  virtual void CalculateAndAddDynamicLHS(MatrixType& rLeftHandSideMatrix,
676  ElementDataType& rVariables,
677  const ProcessInfo& rCurrentProcessInfo,
678  double& rIntegrationWeight);
679 
683  virtual void CalculateAndAddDynamicRHS(VectorType& rRightHandSideVector,
684  ElementDataType& rVariables,
685  const ProcessInfo& rCurrentProcessInfo,
686  double& rIntegrationWeight);
687 
691  virtual void CalculateAndAddKuum(MatrixType& rLeftHandSideMatrix,
692  ElementDataType& rVariables,
693  double& rIntegrationWeight);
694 
698  virtual void CalculateAndAddKuug(MatrixType& rLeftHandSideMatrix,
699  ElementDataType& rVariables,
700  double& rIntegrationWeight);
701 
705  virtual void CalculateAndAddExternalForces(VectorType& rRightHandSideVector,
706  ElementDataType& rVariables,
707  Vector& rVolumeForce,
708  double& rIntegrationWeight);
709 
713  virtual void CalculateAndAddInternalForces(VectorType& rRightHandSideVector,
714  ElementDataType & rVariables,
715  double& rIntegrationWeight);
716 
717 
721  virtual void SetElementData(ElementDataType& rVariables,
723  const int & rPointNumber);
724 
728  virtual void CalculateMaterialResponse(ElementDataType& rVariables,
730  const int & rPointNumber);
734  virtual SizeType GetDofsSize() const;
735 
739  bool IsSliver()
740  {
741  if( this->IsDefined(SELECTED) )
742  return this->Is(SELECTED);
743  else
744  return false;
745  }
746 
750  virtual void InitializeSystemMatrices(MatrixType& rLeftHandSideMatrix,
751  VectorType& rRightHandSideVector,
752  Flags& rCalculationFlags);
753 
757  void InitializeConstitutiveLaw();
758 
762  void ResetConstitutiveLaw() override;
763 
767  void InitializeExplicitContributions();
768 
772  virtual void CalculateKinematics(ElementDataType& rVariables,
773  const double& rPointNumber);
774 
778  virtual void CalculateKinetics(ElementDataType& rVariables,
779  const double& rPointNumber);
780 
784  virtual void InitializeElementData(ElementDataType & rVariables,
785  const ProcessInfo& rCurrentProcessInfo);
786 
790  virtual void TransformElementData(ElementDataType & rVariables,
791  const double& rPointNumber);
792 
796  virtual void FinalizeStepVariables(ElementDataType & rVariables,
797  const double& rPointNumber);
798 
802  virtual double& CalculateIntegrationWeight(double& rIntegrationWeight);
803 
807  virtual double& CalculateTotalMass(double& rTotalMass, const ProcessInfo& rCurrentProcessInfo);
808 
812  virtual Matrix& CalculateDeltaPosition(Matrix & rDeltaPosition);
813 
817  virtual Matrix& CalculateTotalDeltaPosition(Matrix & rDeltaPosition);
818 
822  virtual double& CalculateVolumeChange(double& rVolumeChange, ElementDataType& rVariables);
823 
827  virtual Vector& CalculateVolumeForce(Vector& rVolumeForce, ElementDataType& rVariables);
828 
839 
840  private:
841 
847 
848 
852 
853 
857 
858 
863 
867  friend class Serializer;
868 
869  // A private default constructor necessary for serialization
870 
871  void save(Serializer& rSerializer) const override;
872 
873  void load(Serializer& rSerializer) override;
874 
875 
882 
883 }; // Class SolidElement
884 
892 
893 } // namespace Kratos.
894 #endif // KRATOS_SOLID_ELEMENT_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: constitutive_law.h:47
StressMeasure
Definition: constitutive_law.h:69
@ StressMeasure_PK2
Definition: constitutive_law.h:71
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
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
Large Displacement Lagrangian Element for 3D and 2D geometries. (base class)
Definition: solid_element.hpp:49
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_LHS_MATRIX)
ElementData ElementDataType
Type for element variables.
Definition: solid_element.hpp:269
KRATOS_DEFINE_LOCAL_FLAG(COMPUTE_RHS_VECTOR)
std::string Info() const override
Turn back information as a string.
Definition: solid_element.hpp:575
KRATOS_DEFINE_LOCAL_FLAG(FINALIZED_STEP)
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: solid_element.hpp:589
bool IsSliver()
Definition: solid_element.hpp:739
ConstitutiveLaw ConstitutiveLawType
Definition: solid_element.hpp:55
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: solid_element.hpp:583
GeometryData::SizeType SizeType
Type for size.
Definition: solid_element.hpp:63
GeometryData::IntegrationMethod IntegrationMethod
Type definition for integration methods.
Definition: solid_element.hpp:61
ConstitutiveLawType::Pointer ConstitutiveLawPointerType
Pointer type for constitutive laws.
Definition: solid_element.hpp:57
std::vector< ConstitutiveLaw::Pointer > mConstitutiveLawVector
Definition: solid_element.hpp:614
IntegrationMethod mThisIntegrationMethod
Definition: solid_element.hpp:609
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(SolidElement)
Counted pointer of SolidElement.
ConstitutiveLawType::StressMeasure StressMeasureType
StressMeasure from constitutive laws.
Definition: solid_element.hpp:59
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
void SetValuesOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const std::vector< TDataType > &values, const ProcessInfo &rCurrentProcessInfo)
Definition: add_mesh_to_python.cpp:185
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
AMatrix::IdentityMatrix< double > IdentityMatrix
Definition: amatrix_interface.h:564
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
H
Definition: generate_droplet_dynamics.py:257
F
Definition: hinsberg_optimization.py:144
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
def load(f)
Definition: ode_solve.py:307
int j
Definition: quadrature.py:648
J
Definition: sensitivityMatrix.py:58
N
Definition: sensitivityMatrix.py:29
B
Definition: sensitivityMatrix.py:76
Definition: constitutive_law.h:189
Definition: solid_element.hpp:83
void SetShapeFunctionsGradients(const GeometryType::ShapeFunctionsGradientsType &rDN_De)
Definition: solid_element.hpp:126
void SetShapeFunctions(const Matrix &rNcontainer)
Definition: solid_element.hpp:131
double ReferenceRadius
Definition: solid_element.hpp:100
Matrix DN_DX
Definition: solid_element.hpp:114
double detH
Definition: solid_element.hpp:105
double Tau
Definition: solid_element.hpp:95
Vector StrainVector
Definition: solid_element.hpp:107
GeometryType::JacobiansType j
Definition: solid_element.hpp:119
const GeometryType::ShapeFunctionsGradientsType & GetShapeFunctionsGradients()
Definition: solid_element.hpp:146
double detJ
Definition: solid_element.hpp:106
Matrix DeltaPosition
Definition: solid_element.hpp:120
Matrix ConstitutiveMatrix
Definition: solid_element.hpp:115
double detF
Definition: solid_element.hpp:103
Matrix F0
Definition: solid_element.hpp:113
const ProcessInfo & GetProcessInfo()
Definition: solid_element.hpp:156
void SetProcessInfo(const ProcessInfo &rProcessInfo)
Definition: solid_element.hpp:136
double IntegrationWeight
Definition: solid_element.hpp:96
Matrix F
Definition: solid_element.hpp:112
Matrix H
Definition: solid_element.hpp:111
Matrix B
Definition: solid_element.hpp:110
const Matrix & GetShapeFunctions()
Definition: solid_element.hpp:151
void Initialize(const unsigned int &voigt_size, const unsigned int &dimension, const unsigned int &number_of_nodes)
Definition: solid_element.hpp:161
double CurrentRadius
Definition: solid_element.hpp:99
double detF0
Definition: solid_element.hpp:104
Vector N
Definition: solid_element.hpp:109
StressMeasureType StressMeasure
Definition: solid_element.hpp:93
GeometryType::JacobiansType J
Definition: solid_element.hpp:118
Vector StressVector
Definition: solid_element.hpp:108
Definition: solid_element.hpp:233
void SetRightHandSideVector(VectorType &rRightHandSideVector)
Definition: solid_element.hpp:251
Flags CalculationFlags
Definition: solid_element.hpp:243
MatrixType & GetLeftHandSideMatrix()
Definition: solid_element.hpp:258
VectorType & GetRightHandSideVector()
Definition: solid_element.hpp:260
void SetLeftHandSideMatrix(MatrixType &rLeftHandSideMatrix)
Definition: solid_element.hpp:249