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.
mesh_tying_mortar_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
23 
24 /* Utilities */
25 #include "utilities/math_utils.h"
28 
29 namespace Kratos
30 {
33 
37 
39  using SizeType = std::size_t;
40 
44 
48 
52 
65 template< const SizeType TDim, const SizeType TNumNodes, const SizeType TNumNodesMaster = TNumNodes>
66 class KRATOS_API(CONTACT_STRUCTURAL_MECHANICS_APPLICATION) MeshTyingMortarCondition
67  : public PairedCondition
68 {
69 public:
72 
75 
78 
80  using VectorType = typename BaseType::VectorType;
81 
83  using MatrixType = typename BaseType::MatrixType;
84 
86  using IndexType = typename BaseType::IndexType;
87 
89  using GeometryPointerType = typename BaseType::GeometryType::Pointer;
90 
93 
95  using PropertiesPointerType = typename BaseType::PropertiesType::Pointer;
96 
98  using PointType = Point;
99 
102 
105 
107  using ConditionArrayListType = typename std::vector<array_1d<PointType, TDim>>;
108 
111 
114 
117 
120 
123 
126 
129 
132 
133  // The threshold coefficient considered for checking
134  static constexpr double CheckThresholdCoefficient = 1.0e-12;
135 
139 
142  : PairedCondition()
143  {}
144 
145  // Constructor 1
147  IndexType NewId,
148  GeometryType::Pointer pGeometry
149  ) :PairedCondition(NewId, pGeometry)
150  {}
151 
152  // Constructor 2
154  IndexType NewId,
155  GeometryType::Pointer pGeometry,
156  PropertiesType::Pointer pProperties
157  ) :PairedCondition( NewId, pGeometry, pProperties )
158  {}
159 
160  // Constructor 3
162  IndexType NewId,
163  GeometryType::Pointer pGeometry,
164  PropertiesType::Pointer pProperties,
165  GeometryType::Pointer pMasterGeometry
166  )
167  :PairedCondition( NewId, pGeometry, pProperties, pMasterGeometry)
168  {}
169 
172 
175 
179 
180 
184 
188  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
189 
194  void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
195 
200  void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
201 
206  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
207 
212  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
213 
219  void CalculateMassMatrix(
220  MatrixType& rMassMatrix,
221  const ProcessInfo& rCurrentProcessInfo
222  ) override;
223 
229  void CalculateDampingMatrix(
230  MatrixType& rDampingMatrix,
231  const ProcessInfo& rCurrentProcessInfo
232  ) override;
233 
241  Condition::Pointer Create(
242  IndexType NewId,
243  NodesArrayType const& rThisNodes,
244  PropertiesType::Pointer pProperties
245  ) const override;
246 
254  Condition::Pointer Create(
255  IndexType NewId,
256  GeometryType::Pointer pGeom,
257  PropertiesType::Pointer pProperties
258  ) const override;
259 
268  Condition::Pointer Create(
269  IndexType NewId,
270  GeometryType::Pointer pGeom,
271  PropertiesType::Pointer pProperties,
272  GeometryType::Pointer pMasterGeom
273  ) const override;
274 
275  /******************************************************************/
276  /********** AUXILLIARY METHODS FOR GENERAL CALCULATIONS ***********/
277  /******************************************************************/
278 
284  void EquationIdVector(
285  EquationIdVectorType& rResult,
286  const ProcessInfo& rCurrentProcessInfo
287  ) const override;
288 
294  void GetDofList(
295  DofsVectorType& rConditionalDofList,
296  const ProcessInfo& rCurrentProcessInfo
297  ) const override;
298 
306  const Variable<double>& rVariable,
307  std::vector<double>& rOutput,
308  const ProcessInfo& rCurrentProcessInfo
309  ) override;
310 
318  const Variable<array_1d<double, 3>>& rVariable,
319  std::vector< array_1d<double, 3>>& rOutput,
320  const ProcessInfo& rCurrentProcessInfo
321  ) override;
322 
330  const Variable<Vector>& rVariable,
331  std::vector<Vector>& rOutput,
332  const ProcessInfo& rCurrentProcessInfo
333  ) override;
334 
340  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
341 
345 
349 
353 
355  std::string Info() const override
356  {
357  std::stringstream buffer;
358  buffer << "MeshTyingMortarCondition #" << this->Id();
359  return buffer.str();
360  }
361 
363  void PrintInfo(std::ostream& rOStream) const override
364  {
365  rOStream << "MeshTyingMortarCondition #" << this->Id();
366  }
367 
369  void PrintData(std::ostream& rOStream) const override
370  {
371  PrintInfo(rOStream);
372  this->GetParentGeometry().PrintData(rOStream);
373  this->GetPairedGeometry().PrintData(rOStream);
374  }
375 
379 
381 
382 protected:
385 
389  struct DofData
390  {
391  public:
392 
393  // Auxiliary types
396 
397  // The DoF
400 
405  DofData(const std::size_t Dimension = TDim)
406  {
407  // Resizing as needed (for scalar cases)
408  if (Dimension != TDim) {
409  LagrangeMultipliers.resize(TNumNodes, Dimension, false);
410  u1.resize(TNumNodes, Dimension, false);
411  u2.resize(TNumNodesMaster, Dimension, false);
412  }
413 
414  // Clearing the values
415  this->Clear();
416  }
417 
418  // Default destructor
419  ~DofData()= default;
420 
424  void Clear()
425  {
426  // Clearing the values
427  u1.clear();
428  u2.clear();
429  LagrangeMultipliers.clear();
430  }
431 
438  const GeometryType& rGeometryInput,
439  std::vector<const Variable<double>*>& rpDoFVariables
440  )
441  {
442  // Fill master information
443  for (IndexType i_node = 0; i_node < TNumNodesMaster; ++i_node) {
444  const auto& r_node = rGeometryInput[i_node];
445  for (IndexType i_dof = 0; i_dof < rpDoFVariables.size(); ++i_dof) {
446  u2(i_node, i_dof) = r_node.FastGetSolutionStepValue(*rpDoFVariables[i_dof]);
447  }
448  }
449  }
450 
451  };
452 
456 
458 
459  std::vector<const Variable<double>*> mpDoFVariables;
460 
461  std::vector<const Variable<double>*> mpLMVariables;
462 
466 
470 
471  /******************************************************************/
472  /*********************** COMPUTING METHODS ***********************/
473  /******************************************************************/
474 
481  void CalculateLocalSystem(
482  MatrixType& rLeftHandSideMatrix,
483  VectorType& rRightHandSideVector,
484  const ProcessInfo& rCurrentProcessInfo
485  ) override;
486 
492  void CalculateRightHandSide(
493  VectorType& rRightHandSideVector,
494  const ProcessInfo& rCurrentProcessInfo
495  ) override;
496 
502  void CalculateLeftHandSide(
503  MatrixType& rLeftHandSideMatrix,
504  const ProcessInfo& rCurrentProcessInfo
505  ) override;
506 
515  void CalculateConditionSystem(
516  MatrixType& rLeftHandSideMatrix,
517  VectorType& rRightHandSideVector,
518  const ProcessInfo& rCurrentProcessInfo,
519  const bool ComputeLHS = true,
520  const bool ComputeRHS = true
521  );
522 
528  void InitializeDofData(DofData& rDofData)
529  {
530  // The slave geometry
531  auto& r_slave_geometry = this->GetParentGeometry();
532 
533  // Retrieve values
534  for (IndexType i_node = 0; i_node < TNumNodes; i_node++) {
535  const auto& r_node = r_slave_geometry[i_node];
536  for (IndexType i_dof = 0; i_dof < mpDoFVariables.size(); ++i_dof) {
537  rDofData.u1(i_node, i_dof) = r_node.FastGetSolutionStepValue(*mpDoFVariables[i_dof]);
538  rDofData.LagrangeMultipliers(i_node, i_dof) = r_node.FastGetSolutionStepValue(*mpLMVariables[i_dof]);
539  }
540  }
541  }
542 
551  bool CalculateAe(
552  const array_1d<double, 3>& rNormalMaster,
553  MatrixDualLM& rAe,
554  GeneralVariables& rVariables,
555  const ConditionArrayListType& rConditionsPointsSlave,
556  const IntegrationMethod ThisIntegrationMethod
557  );
558 
569  void CalculateKinematics(
570  GeneralVariables& rVariables,
571  const MatrixDualLM& rAe,
572  const array_1d<double, 3>& rNormalMaster,
573  const PointType& rLocalPointDecomp,
574  const PointType& rLocalPointParent,
575  const GeometryPointType& rGeometryDecomp,
576  const bool DualLM = false
577  );
578 
579  /********************************************************************************/
580  /**************** METHODS TO CALCULATE MORTAR CONDITION MATRICES ****************/
581  /********************************************************************************/
582 
590  void CalculateLocalLHS(
591  Matrix& rLocalLHS,
592  const MortarConditionMatrices& rMortarConditionMatrices,
593  const DofData& rDofData,
594  const ProcessInfo& rCurrentProcessInfo
595  );
596 
604  void CalculateLocalRHS(
605  Vector& rLocalRHS,
606  const MortarConditionMatrices& rMortarConditionMatrices,
607  const DofData& rDofData,
608  const ProcessInfo& rCurrentProcessInfo
609  );
610 
611  /***********************************************************************************/
612  /**************** AUXILLIARY METHODS FOR CONDITION LHS CONTRIBUTION ****************/
613  /***********************************************************************************/
614 
621  void MasterShapeFunctionValue(
622  GeneralVariables& rVariables,
623  const array_1d<double, 3>& rNormalMaster,
624  const PointType& rLocalPoint
625  );
626 
627  /******************************************************************/
628  /********** AUXILLIARY METHODS FOR GENERAL CALCULATIONS ***********/
629  /******************************************************************/
630 
636  {
637  // Setting the auxiliary integration points
638  const IndexType integration_order = GetProperties().Has(INTEGRATION_ORDER_CONTACT) ? GetProperties().GetValue(INTEGRATION_ORDER_CONTACT) : 2;
639  switch (integration_order) {
646  }
647  }
648 
652 
656 
660 
662 private:
665 
669 
673 
677 
681 
685 
689 
690  // Serialization
691  friend class Serializer;
692 
697  void save(Serializer& rSerializer) const override;
698 
703  void load(Serializer& rSerializer) override;
704 
706 
707 }; // Class MeshTyingMortarCondition
708 
710 
713 
717 
719 
720 }// namespace Kratos.
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
This is the definition dual lagrange multiplier operators according to the work of Alexander Popp: ht...
Definition: mortar_classes.h:1513
std::size_t IndexType
Definition: flags.h:74
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
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
void clear()
Definition: amatrix_interface.h:284
An two node 2D line geometry with linear shape functions.
Definition: line_2d_2.h:65
MeshTyingMortarCondition.
Definition: mesh_tying_mortar_condition.h:68
MortarConditionMatrices mMortarConditionMatrices
Definition: mesh_tying_mortar_condition.h:457
~MeshTyingMortarCondition() override
Destructor.
MeshTyingMortarCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties, GeometryType::Pointer pMasterGeometry)
Definition: mesh_tying_mortar_condition.h:161
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MeshTyingMortarCondition)
Counted pointer of MeshTyingMortarCondition.
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: mesh_tying_mortar_condition.h:363
typename std::conditional< TDim==2, LineType, TriangleType >::type DecompositionType
Type definition for the decomposition based on dimension.
Definition: mesh_tying_mortar_condition.h:116
IntegrationMethod GetIntegrationMethod() const override
It returns theintegration method considered.
Definition: mesh_tying_mortar_condition.h:635
MeshTyingMortarCondition()
Default constructor.
Definition: mesh_tying_mortar_condition.h:141
void CalculateOnIntegrationPoints(const Variable< array_1d< double, 3 >> &rVariable, std::vector< array_1d< double, 3 >> &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Calculate a array_1d Variable.
MeshTyingMortarCondition(MeshTyingMortarCondition const &rOther)
Copy constructor.
Definition: mesh_tying_mortar_condition.h:171
std::vector< const Variable< double > * > mpDoFVariables
The mortar operators.
Definition: mesh_tying_mortar_condition.h:459
typename BaseType::PropertiesType::Pointer PropertiesPointerType
Type definition for the pointer to the properties used in the condition.
Definition: mesh_tying_mortar_condition.h:95
std::vector< const Variable< double > * > mpLMVariables
The list of DoF variables.
Definition: mesh_tying_mortar_condition.h:461
std::string Info() const override
Turn back information as a string.
Definition: mesh_tying_mortar_condition.h:355
void InitializeDofData(DofData &rDofData)
Initializes the DofData object.
Definition: mesh_tying_mortar_condition.h:528
typename std::vector< array_1d< PointType, TDim > > ConditionArrayListType
Type definition for the array list of conditions with points.
Definition: mesh_tying_mortar_condition.h:107
MeshTyingMortarCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: mesh_tying_mortar_condition.h:153
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: mesh_tying_mortar_condition.h:369
typename BaseType::GeometryType::Pointer GeometryPointerType
Type definition for the pointer to the geometry used in the condition.
Definition: mesh_tying_mortar_condition.h:89
MeshTyingMortarCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Definition: mesh_tying_mortar_condition.h:146
typename GeometryType::IntegrationPointsArrayType IntegrationPointsType
Type definition for the integration points in the geometry.
Definition: mesh_tying_mortar_condition.h:104
This is a base class for the conditions paired.
Definition: paired_condition.h:53
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
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
u2
Definition: generate_frictional_mortar_condition.py:76
u1
Definition: generate_frictional_mortar_condition.py:75
type
Definition: generate_gid_list_file.py:35
def load(f)
Definition: ode_solve.py:307
Definition: mesh_tying_mortar_condition.h:390
void Clear()
Clearing the values.
Definition: mesh_tying_mortar_condition.h:424
MatrixUnknownMaster u2
Definition: mesh_tying_mortar_condition.h:399
MatrixUnknownSlave LagrangeMultipliers
Definition: mesh_tying_mortar_condition.h:398
void UpdateMasterPair(const GeometryType &rGeometryInput, std::vector< const Variable< double > * > &rpDoFVariables)
Updating the Master pair.
Definition: mesh_tying_mortar_condition.h:437
DofData(const std::size_t Dimension=TDim)
Default constructor.
Definition: mesh_tying_mortar_condition.h:405
MatrixUnknownSlave u1
Definition: mesh_tying_mortar_condition.h:398