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.
mortar_contact_condition.h
Go to the documentation of this file.
1 // KRATOS ______ __ __ _____ __ __ __
2 // / ____/___ ____ / /_____ ______/ /_/ ___// /________ _______/ /___ ___________ _/ /
3 // / / / __ \/ __ \/ __/ __ `/ ___/ __/\__ \/ __/ ___/ / / / ___/ __/ / / / ___/ __ `/ /
4 // / /___/ /_/ / / / / /_/ /_/ / /__/ /_ ___/ / /_/ / / /_/ / /__/ /_/ /_/ / / / /_/ / /
5 // \____/\____/_/ /_/\__/\__,_/\___/\__//____/\__/_/ \__,_/\___/\__/\__,_/_/ \__,_/_/ MECHANICS
6 //
7 // License: BSD License
8 // license: ContactStructuralMechanicsApplication/license.txt
9 //
10 // Main authors: Vicente Mataix Ferrandiz
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // External includes
18 
19 // Project includes
22 #include "utilities/math_utils.h"
23 #include "includes/kratos_flags.h"
24 #include "includes/checks.h"
26 
27 /* Utilities */
30 // #include "custom_utilities/logging_settings.hpp"
31 
32 /* Geometries */
33 #include "geometries/line_2d_2.h"
35 
36 namespace Kratos
37 {
38 
41 
45 
47  using SizeType = std::size_t;
48 
52 
56 
60 
75 template< const SizeType TDim, const SizeType TNumNodes, const FrictionalCase TFrictional, const bool TNormalVariation, const SizeType TNumNodesMaster = TNumNodes>
76 class KRATOS_API(CONTACT_STRUCTURAL_MECHANICS_APPLICATION) MortarContactCondition
77  : public PairedCondition
78 {
79 public:
82 
85 
88 
90  using VectorType = typename BaseType::VectorType;
91 
93  using MatrixType = typename BaseType::MatrixType;
94 
96  using IndexType = typename BaseType::IndexType;
97 
99  using GeometryPointerType = typename BaseType::GeometryType::Pointer;
100 
103 
105  using PropertiesPointerType = typename BaseType::PropertiesType::Pointer;
106 
108  using PointType = Point;
109 
112 
113  // Type definition for integration methods
115 
118 
121 
124 
127 
129  using ConditionArrayListType = typename std::vector<ConditionArrayType>;
130 
133 
136 
139 
141  using DerivativeDataType = typename std::conditional<TFrictional == FrictionalCase::FRICTIONAL || TFrictional == FrictionalCase::FRICTIONAL_PENALTY, DerivativeDataFrictional<TDim, TNumNodes, TNumNodesMaster>, DerivativeData<TDim, TNumNodes, TNumNodesMaster> >::type;
142 
144  static constexpr IndexType MatrixSize = (TFrictional == FrictionalCase::FRICTIONLESS) ? TDim * (TNumNodesMaster + TNumNodes) + TNumNodes : (TFrictional == FrictionalCase::FRICTIONLESS_COMPONENTS || TFrictional == FrictionalCase::FRICTIONAL) ? TDim * (TNumNodesMaster + TNumNodes + TNumNodes) : TDim * (TNumNodesMaster + TNumNodes);
145 
147  static constexpr bool IsFrictional = (TFrictional == FrictionalCase::FRICTIONAL || TFrictional == FrictionalCase::FRICTIONAL_PENALTY) ? true: false;
148 
151 
154 
157 
160 
163 
164  // The threshold coefficient considered for checking
165  static constexpr double CheckThresholdCoefficient = 1.0e-12;
166 
170 
173  : PairedCondition()
174  {}
175 
176  // Constructor 1
178  IndexType NewId,
179  GeometryType::Pointer pGeometry
180  ) :PairedCondition(NewId, pGeometry)
181  {}
182 
183  // Constructor 2
185  IndexType NewId,
186  GeometryType::Pointer pGeometry,
187  PropertiesType::Pointer pProperties
188  ) :PairedCondition( NewId, pGeometry, pProperties )
189  {}
190 
191  // Constructor 3
193  IndexType NewId,
194  GeometryType::Pointer pGeometry,
195  PropertiesType::Pointer pProperties,
196  GeometryType::Pointer pMasterGeometry
197  )
198  :PairedCondition( NewId, pGeometry, pProperties, pMasterGeometry)
199  {}
200 
203 
206 
210 
211 
215 
220  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
221 
226  void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
227 
232  void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
233 
238  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
239 
244  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
245 
251  void CalculateMassMatrix(
252  MatrixType& rMassMatrix,
253  const ProcessInfo& rCurrentProcessInfo
254  ) override;
255 
261  void CalculateDampingMatrix(
262  MatrixType& rDampingMatrix,
263  const ProcessInfo& rCurrentProcessInfo
264  ) override;
265 
273  Condition::Pointer Create(
274  IndexType NewId,
275  NodesArrayType const& rThisNodes,
276  PropertiesType::Pointer pProperties
277  ) const override;
278 
286  Condition::Pointer Create(
287  IndexType NewId,
288  GeometryType::Pointer pGeom,
289  PropertiesType::Pointer pProperties
290  ) const override;
291 
300  Condition::Pointer Create(
301  IndexType NewId,
302  GeometryType::Pointer pGeom,
303  PropertiesType::Pointer pProperties,
304  GeometryType::Pointer pMasterGeom
305  ) const override;
306 
312  void AddExplicitContribution(const ProcessInfo& rCurrentProcessInfo) override;
313 
322  void AddExplicitContribution(
323  const VectorType& rRHSVector,
324  const Variable<VectorType>& rRHSVariable,
325  const Variable<double >& rDestinationVariable,
326  const ProcessInfo& rCurrentProcessInfo
327  ) override;
328 
338  void AddExplicitContribution(const VectorType& rRHSVector,
339  const Variable<VectorType>& rRHSVariable,
340  const Variable<array_1d<double, 3> >& rDestinationVariable,
341  const ProcessInfo& rCurrentProcessInfo
342  ) override;
343 
344  /******************************************************************/
345  /********** AUXILLIARY METHODS FOR GENERAL CALCULATIONS ***********/
346  /******************************************************************/
347 
353  void EquationIdVector(
354  EquationIdVectorType& rResult,
355  const ProcessInfo& rCurrentProcessInfo
356  ) const override;
357 
363  void GetDofList(
364  DofsVectorType& rConditionalDofList,
365  const ProcessInfo& rCurrentProcessInfo
366  ) const override;
367 
375  const Variable<double>& rVariable,
376  std::vector<double>& rOutput,
377  const ProcessInfo& rCurrentProcessInfo
378  ) override;
379 
387  const Variable<array_1d<double, 3 > >& rVariable,
388  std::vector< array_1d<double, 3 > >& rOutput,
389  const ProcessInfo& rCurrentProcessInfo
390  ) override;
391 
399  const Variable<Vector>& rVariable,
400  std::vector<Vector>& rOutput,
401  const ProcessInfo& rCurrentProcessInfo
402  ) override;
403 
411  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
412 
416 
420 
424 
426  std::string Info() const override
427  {
428  std::stringstream buffer;
429  buffer << "MortarContactCondition #" << this->Id();
430  return buffer.str();
431  }
432 
434  void PrintInfo(std::ostream& rOStream) const override
435  {
436  rOStream << "MortarContactCondition #" << this->Id();
437  }
438 
440  void PrintData(std::ostream& rOStream) const override
441  {
442  PrintInfo(rOStream);
443  this->GetParentGeometry().PrintData(rOStream);
444  this->GetPairedGeometry().PrintData(rOStream);
445  }
446 
450 
452 
453 protected:
456 
460 
464 
468 
469  /******************************************************************/
470  /*********************** COMPUTING METHODS ***********************/
471  /******************************************************************/
472 
481  void CalculateLocalSystem(
482  MatrixType& rLeftHandSideMatrix,
483  VectorType& rRightHandSideVector,
484  const ProcessInfo& rCurrentProcessInfo
485  ) override;
486 
493  void CalculateRightHandSide(
494  VectorType& rRightHandSideVector,
495  const ProcessInfo& rCurrentProcessInfo
496  ) override;
497 
504  void CalculateLeftHandSide(
505  MatrixType& rLeftHandSideMatrix,
506  const ProcessInfo& rCurrentProcessInfo
507  ) override;
508 
512  void CalculateConditionSystem(
513  MatrixType& rLeftHandSideMatrix,
514  VectorType& rRightHandSideVector,
515  const ProcessInfo& CurrentProcessInfo,
516  const bool ComputeLHS = true,
517  const bool ComputeRHS = true
518  );
519 
520  /********************************************************************************/
521  /**************** METHODS TO CALCULATE MORTAR CONDITION MATRICES ****************/
522  /********************************************************************************/
523 
531  virtual void CalculateLocalLHS(
532  Matrix& rLocalLHS,
533  const MortarConditionMatrices& rMortarConditionMatrices,
534  const DerivativeDataType& rDerivativeData,
535  const IndexType rActiveInactive,
536  const ProcessInfo& rCurrentProcessInfo
537  );
538 
546  virtual void CalculateLocalRHS(
547  Vector& rLocalRHS,
548  const MortarConditionMatrices& rMortarConditionMatrices,
549  const DerivativeDataType& rDerivativeData,
550  const IndexType rActiveInactive,
551  const ProcessInfo& rCurrentProcessInfo
552  );
553 
554  /******************************************************************/
555  /********** AUXILLIARY METHODS FOR GENERAL CALCULATIONS ***********/
556  /******************************************************************/
557 
563  virtual IndexType GetActiveInactiveValue(const GeometryType& CurrentGeometry) const
564  {
565  KRATOS_ERROR << "You are calling to the base class method GetActiveInactiveValue, you are evil, and your seed must be eradicated from the face of the earth" << std::endl;
566 
567  return 0;
568  }
569 
575  bool CheckIsolatedElement(
576  const double DeltaTime,
577  const bool HalfJump = true
578  );
579 
584  {
585  // Setting the auxiliary integration points
586  const IndexType integration_order = GetProperties().Has(INTEGRATION_ORDER_CONTACT) ? GetProperties().GetValue(INTEGRATION_ORDER_CONTACT) : 2;
587  switch (integration_order) {
588  case 1:
590  case 2:
592  case 3:
594  case 4:
596  case 5:
598  default:
600  }
601  }
602 
607  virtual bool IsAxisymmetric() const;
608 
613  virtual double GetAxisymmetricCoefficient(const GeneralVariables& rVariables) const;
614 
619  virtual void ResizeLHS(MatrixType& rLeftHandSideMatrix);
620 
625  virtual void ResizeRHS(VectorType& rRightHandSideVector);
626 
631  virtual void ZeroLHS(MatrixType& rLeftHandSideMatrix);
632 
637  virtual void ZeroRHS(VectorType& rRightHandSideVector);
638 
642 
646 
650 
652 private:
655 
659 
663 
667 
671 
675 
679 
680  // Serialization
681 
682  friend class Serializer;
683 
684  void save(Serializer& rSerializer) const override
685  {
687  }
688 
689  void load(Serializer& rSerializer) override
690  {
692  }
693 
695 
696 }; // Class MortarContactCondition
697 
699 
702 
706 
708 
709 }// namespace Kratos.
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
This data will be used to compute the derivatives.
Definition: mortar_classes.h:638
This utilities are used in order to compute the directional derivatives during mortar contact.
Definition: derivatives_utilities.h:63
This is the definition dual lagrange multiplier operators including the derivatives.
Definition: mortar_classes.h:1718
This utility calculates the exact integration necessary for the Mortar Conditions.
Definition: exact_mortar_segmentation_utility.h:89
This defines the geometrical object, base definition of the element and condition entities.
Definition: geometrical_object.h:58
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
std::vector< IntegrationPointType > IntegrationPointsArrayType
Definition: geometry.h:161
An two node 2D line geometry with linear shape functions.
Definition: line_2d_2.h:65
MortarContactCondition.
Definition: mortar_contact_condition.h:78
typename GeometryType::IntegrationPointsArrayType IntegrationPointsType
Definition: mortar_contact_condition.h:114
typename BaseType::PropertiesType::Pointer PropertiesPointerType
Properties pointer definition.
Definition: mortar_contact_condition.h:105
typename std::vector< ConditionArrayType > ConditionArrayListType
Type definition for a list of arrays of points with belonging.
Definition: mortar_contact_condition.h:129
typename std::conditional< TDim==2, LineType, TriangleType >::type DecompositionType
The decomposition type.
Definition: mortar_contact_condition.h:138
typename std::conditional< TFrictional==FrictionalCase::FRICTIONAL||TFrictional==FrictionalCase::FRICTIONAL_PENALTY, DerivativeDataFrictional< TDim, TNumNodes, TNumNodesMaster >, DerivativeData< TDim, TNumNodes, TNumNodesMaster > >::type DerivativeDataType
The derivative data type.
Definition: mortar_contact_condition.h:141
virtual IndexType GetActiveInactiveValue(const GeometryType &CurrentGeometry) const
Returns a value depending of the active/inactive set.
Definition: mortar_contact_condition.h:563
typename BaseType::GeometryType::Pointer GeometryPointerType
Geometry pointer definition.
Definition: mortar_contact_condition.h:99
MortarContactCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Definition: mortar_contact_condition.h:177
typename std::conditional< TNumNodes==2, PointBelongsLine2D2N, typename std::conditional< TNumNodes==3, typename std::conditional< TNumNodesMaster==3, PointBelongsTriangle3D3N, PointBelongsTriangle3D3NQuadrilateral3D4N >::type, typename std::conditional< TNumNodesMaster==3, PointBelongsQuadrilateral3D4NTriangle3D3N, PointBelongsQuadrilateral3D4N >::type >::type >::type BelongType
The type of points belongs to be considered.
Definition: mortar_contact_condition.h:117
~MortarContactCondition() override
Destructor.
MortarContactCondition(MortarContactCondition const &rOther)
Copy constructor.
Definition: mortar_contact_condition.h:202
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MortarContactCondition)
Counted pointer of MortarContactCondition.
MortarContactCondition()
Default constructor.
Definition: mortar_contact_condition.h:172
std::string Info() const override
Turn back information as a string.
Definition: mortar_contact_condition.h:426
MortarContactCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: mortar_contact_condition.h:184
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: mortar_contact_condition.h:434
typename BaseType::IndexType IndexType
Index type definition.
Definition: mortar_contact_condition.h:96
IntegrationMethod GetIntegrationMethod() const override
It returns theintegration method considered.
Definition: mortar_contact_condition.h:583
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: mortar_contact_condition.h:440
MortarContactCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties, GeometryType::Pointer pMasterGeometry)
Definition: mortar_contact_condition.h:192
MortarKinematicVariablesWithDerivatives.
Definition: mortar_classes.h:490
This class derives from the MortarOperator class and it includes the derived operators.
Definition: mortar_classes.h:1273
This is a base class for the conditions paired.
Definition: paired_condition.h:53
Custom Point container to be used by the mapper.
Definition: mortar_classes.h:1952
Point class.
Definition: point.h:59
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
A three node 3D triangle geometry with linear shape functions.
Definition: triangle_3d_3.h:77
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
Short class definition.
Definition: array_1d.h:61
#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
Definition: exception.h:161
double GetAxisymmetricCoefficient(const PairedCondition *pCondition, const Vector &rNSlave)
This functions computes the integration weight to consider.
Definition: mortar_explicit_contribution_utilities.cpp:662
std::size_t IndexType
Definition: binary_expression.cpp:25
Vector VectorType
Definition: geometrical_transformation_utilities.h:56
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
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
@ FRICTIONLESS_COMPONENTS
Frictionless contact with components.
@ FRICTIONLESS
Frictionless contact.
@ FRICTIONAL_PENALTY
Frictional contact with penalty method.
@ FRICTIONAL
Frictional contact.
type
Definition: generate_gid_list_file.py:35
def load(f)
Definition: ode_solve.py:307