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.
penalty_frictional_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 
23 namespace Kratos
24 {
25 
28 
32 
33  using PointType = Point;
34  using GeometryType = Geometry<Node>;
35  using GeometryPointType = Geometry<PointType>;
38 
42 
46 
50 
65 template< std::size_t TDim, std::size_t TNumNodes, bool TNormalVariation, std::size_t TNumNodesMaster = TNumNodes>
66 class KRATOS_API(CONTACT_STRUCTURAL_MECHANICS_APPLICATION) PenaltyMethodFrictionalMortarContactCondition
67  : public MortarContactCondition<TDim, TNumNodes, FrictionalCase::FRICTIONAL_PENALTY, TNormalVariation, TNumNodesMaster>
68 {
69 public:
72 
75 
78 
81 
84 
86  using MortarConditionMatrices = typename BaseType::MortarConditionMatrices;
87 
89  using GeneralVariables = typename BaseType::GeneralVariables;
90 
92  using IntegrationUtility = typename BaseType::IntegrationUtility;
93 
95  using DerivativesUtilitiesType = typename BaseType::DerivativesUtilitiesType;
96 
98  using BelongType = typename BaseType::BelongType;
99 
101  using ConditionArrayListType = typename BaseType::ConditionArrayListType;
102 
105 
108 
111 
114 
116  using GeometryPointerType = typename ConditionBaseType::GeometryType::Pointer;
117 
120 
123 
125  using PropertiesPointerType = typename ConditionBaseType::PropertiesType::Pointer;
126 
129 
132 
135 
138 
141 
144 
146  static constexpr IndexType MatrixSize = TDim * (TNumNodes + TNumNodesMaster);
147 
149  static constexpr IndexType StepSlip = TNormalVariation ? 0 : 1;
150 
154 
157  : BaseType()
158  {
159  }
160 
161  // Constructor 1
163  IndexType NewId,
164  GeometryPointerType pGeometry
165  ):BaseType(NewId, pGeometry)
166  {
167  }
168 
169  // Constructor 2
171  IndexType NewId,
172  GeometryPointerType pGeometry,
173  PropertiesPointerType pProperties
174  ):BaseType( NewId, pGeometry, pProperties )
175  {
176  }
177 
178  // Constructor 3
180  IndexType NewId,
181  GeometryPointerType pGeometry,
182  PropertiesPointerType pProperties,
183  GeometryType::Pointer pMasterGeometry
184  ):BaseType( NewId, pGeometry, pProperties, pMasterGeometry )
185  {
186  }
187 
190  {
191  }
192 
195 
199 
200 
204 
208  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
209 
214  void InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
215 
220  void FinalizeSolutionStep(const ProcessInfo& rCurrentProcessInfo) override;
221 
229  Condition::Pointer Create(
230  IndexType NewId,
231  NodesArrayType const& rThisNodes,
232  PropertiesPointerType pProperties
233  ) const override;
234 
242  Condition::Pointer Create(
243  IndexType NewId,
244  GeometryPointerType pGeom,
245  PropertiesPointerType pProperties
246  ) const override;
247 
256  Condition::Pointer Create(
257  IndexType NewId,
258  GeometryPointerType pGeom,
259  PropertiesPointerType pProperties,
260  GeometryPointerType pMasterGeom
261  ) const override;
262 
273  void AddExplicitContribution(const ProcessInfo& rCurrentProcessInfo) override;
274 
284  void AddExplicitContribution(
285  const VectorType& rRHSVector,
286  const Variable<VectorType>& rRHSVariable,
287  const Variable<double >& rDestinationVariable,
288  const ProcessInfo& rCurrentProcessInfo
289  ) override;
290 
300  void AddExplicitContribution(const VectorType& rRHSVector,
301  const Variable<VectorType>& rRHSVariable,
302  const Variable<array_1d<double, 3> >& rDestinationVariable,
303  const ProcessInfo& rCurrentProcessInfo
304  ) override;
305 
306  /********************************************************************************/
307  /**************** METHODS TO CALCULATE MORTAR CONDITION MATRICES ****************/
308  /********************************************************************************/
309 
321  PairedCondition* pCondition,
322  const MortarBaseConditionMatrices& rPreviousMortarOperators,
324  Vector& rLocalRHS,
325  const MortarConditionMatrices& rMortarConditionMatrices,
326  const DerivativeDataType& rDerivativeData,
327  const IndexType rActiveInactive,
328  const ProcessInfo& rCurrentProcessInfo
329  );
330 
331  /******************************************************************/
332  /********** AUXILLIARY METHODS FOR GENERAL CALCULATIONS ***********/
333  /******************************************************************/
334 
340  void EquationIdVector(
341  EquationIdVectorType& rResult,
342  const ProcessInfo& rCurrentProcessInfo
343  ) const override;
344 
350  void GetDofList(
351  DofsVectorType& rConditionalDofList,
352  const ProcessInfo& rCurrentProcessInfo
353  ) const override;
354 
362  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
363 
367 
371 
375 
377  std::string Info() const override
378  {
379  std::stringstream buffer;
380  buffer << "PenaltyMethodFrictionalMortarContactCondition #" << this->Id();
381  return buffer.str();
382  }
383 
385  void PrintInfo(std::ostream& rOStream) const override
386  {
387  rOStream << "PenaltyMethodFrictionalMortarContactCondition #" << this->Id();
388  }
389 
391  void PrintData(std::ostream& rOStream) const override
392  {
393  PrintInfo(rOStream);
394  this->GetParentGeometry().PrintData(rOStream);
395  this->GetPairedGeometry().PrintData(rOStream);
396  }
397 
401 
403 
404 protected:
407 
411 
412  bool mPreviousMortarOperatorsInitialized = false;
413 
415 
416  // TODO: Define the "CL" or friction law to compute this. Or do it nodally
417 
421 
425 
426  /********************************************************************************/
427  /**************** METHODS TO CALCULATE MORTAR CONDITION MATRICES ****************/
428  /********************************************************************************/
429 
439  Matrix& rLocalLHS,
440  const MortarConditionMatrices& rMortarConditionMatrices,
441  const DerivativeDataType& rDerivativeData,
442  const IndexType rActiveInactive,
443  const ProcessInfo& rCurrentProcessInfo
444  ) override;
445 
454  void CalculateLocalRHS(
455  Vector& rLocalRHS,
456  const MortarConditionMatrices& rMortarConditionMatrices,
457  const DerivativeDataType& rDerivativeData,
458  const IndexType rActiveInactive,
459  const ProcessInfo& rCurrentProcessInfo
460  ) override;
461 
462  /******************************************************************/
463  /********** AUXILLIARY METHODS FOR GENERAL CALCULATIONS ***********/
464  /******************************************************************/
465 
471  IndexType GetActiveInactiveValue(const GeometryType& rCurrentGeometry) const override
472  {
473  IndexType value = 0;
474  for (IndexType i_node = 0; i_node < TNumNodes; ++i_node) {
475  if (rCurrentGeometry[i_node].Is(ACTIVE) == true) {
476  if (rCurrentGeometry[i_node].Is(SLIP) == true)
477  value += std::pow(3, i_node);
478  else
479  value += 2 * std::pow(3, i_node);
480  }
481  }
482 
483  return value;
484  }
485 
491  {
492  // The friction coefficient
493  array_1d<double, TNumNodes> friction_coeffient_vector;
494  auto& r_geometry = this->GetParentGeometry();
495 
496  for (std::size_t i_node = 0; i_node < TNumNodes; ++i_node) {
497  friction_coeffient_vector[i_node] = r_geometry[i_node].GetValue(FRICTION_COEFFICIENT);
498  }
499 
500  // TODO: Define the "CL" or friction law to compute this
501 
502  return friction_coeffient_vector;
503  }
504 
508 
512 
516 
518 private:
521 
525 
529 
533 
538  void ComputePreviousMortarOperators(const ProcessInfo& rCurrentProcessInfo);
539 
545  static inline BoundedMatrix<double, TNumNodes, TDim> ComputeTangentMatrixSlip(const GeometryType& rGeometry)
546  {
547  return MortarUtilities::ComputeTangentMatrix<TDim, TNumNodes>(rGeometry);
548 // return ContactUtilities::ComputeTangentMatrixSlip<TDim, TNumNodes>(rGeometry, StepSlip);
549  }
550 
554 
558 
562 
563  // Serialization
564 
565  friend class Serializer;
566 
567  void save(Serializer& rSerializer) const override
568  {
570  rSerializer.save("PreviousMortarOperators", mPreviousMortarOperators);
571  rSerializer.save("PreviousMortarOperatorsInitialized", mPreviousMortarOperatorsInitialized);
572  }
573 
574  void load(Serializer& rSerializer) override
575  {
576  KRATOS_SERIALIZE_LOAD_BASE_CLASS( rSerializer, BaseType );
577  rSerializer.load("PreviousMortarOperators", mPreviousMortarOperators);
578  rSerializer.load("PreviousMortarOperatorsInitialized", mPreviousMortarOperatorsInitialized);
579  }
580 
582 
583 }; // Class PenaltyMethodFrictionalMortarContactCondition
584 
586 
589 
593 
595 
596 }// namespace Kratos.
Base class for all Conditions.
Definition: condition.h:59
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
This class is a derived class of DerivativeData.
Definition: mortar_classes.h:934
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
An two node 2D line geometry with linear shape functions.
Definition: line_2d_2.h:65
MortarContactCondition.
Definition: mortar_contact_condition.h:78
This is a base class for the conditions paired.
Definition: paired_condition.h:53
BaseType::GeometryType::Pointer GeometryPointerType
Geometry pointer type definition.
Definition: paired_condition.h:83
BaseType::PropertiesType::Pointer PropertiesPointerType
Properties pointer type definition.
Definition: paired_condition.h:89
PenaltyMethodFrictionalMortarContactCondition.
Definition: penalty_frictional_mortar_contact_condition.h:68
typename ConditionBaseType::IndexType IndexType
Index type definition.
Definition: penalty_frictional_mortar_contact_condition.h:113
typename BaseType::GeneralVariables GeneralVariables
Type definition for general variables.
Definition: penalty_frictional_mortar_contact_condition.h:89
MortarBaseConditionMatrices mPreviousMortarOperators
In order to know iw we need to initialize the previous operators.
Definition: penalty_frictional_mortar_contact_condition.h:414
array_1d< double, TNumNodes > GetFrictionCoefficient()
This method returns a vector containing the friction coefficients.
Definition: penalty_frictional_mortar_contact_condition.h:490
Condition::Pointer Create(IndexType NewId, GeometryPointerType pGeom, PropertiesPointerType pProperties, GeometryPointerType pMasterGeom) const override
Creates a new element pointer from an existing geometry.
typename BaseType::BelongType BelongType
Type definition for belong type.
Definition: penalty_frictional_mortar_contact_condition.h:98
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: penalty_frictional_mortar_contact_condition.h:391
PenaltyMethodFrictionalMortarContactCondition(PenaltyMethodFrictionalMortarContactCondition const &rOther)
Copy constructor.
Definition: penalty_frictional_mortar_contact_condition.h:189
typename BaseType::IntegrationUtility IntegrationUtility
Type definition for integration utility.
Definition: penalty_frictional_mortar_contact_condition.h:92
void CalculateLocalLHS(Matrix &rLocalLHS, const MortarConditionMatrices &rMortarConditionMatrices, const DerivativeDataType &rDerivativeData, const IndexType rActiveInactive, const ProcessInfo &rCurrentProcessInfo) override
Calculates the local contibution of the LHS.
IndexType GetActiveInactiveValue(const GeometryType &rCurrentGeometry) const override
Returns a value depending of the active/inactive set.
Definition: penalty_frictional_mortar_contact_condition.h:471
void AddExplicitContribution(const VectorType &rRHSVector, const Variable< VectorType > &rRHSVariable, const Variable< array_1d< double, 3 > > &rDestinationVariable, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to make the element to assemble an rRHS vector identified by a variable rRH...
PenaltyMethodFrictionalMortarContactCondition(IndexType NewId, GeometryPointerType pGeometry)
Definition: penalty_frictional_mortar_contact_condition.h:162
typename std::conditional< TDim==2, LineType, TriangleType >::type DecompositionType
Decomposition type definition.
Definition: penalty_frictional_mortar_contact_condition.h:140
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: penalty_frictional_mortar_contact_condition.h:385
typename BaseType::MortarConditionMatrices MortarConditionMatrices
Type definition for mortar condition matrices.
Definition: penalty_frictional_mortar_contact_condition.h:86
typename BaseType::DerivativesUtilitiesType DerivativesUtilitiesType
Type definition for derivatives utilities.
Definition: penalty_frictional_mortar_contact_condition.h:95
std::string Info() const override
Turn back information as a string.
Definition: penalty_frictional_mortar_contact_condition.h:377
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(PenaltyMethodFrictionalMortarContactCondition)
Counted pointer of PenaltyMethodFrictionalMortarContactCondition.
static void StaticCalculateLocalRHS(PairedCondition *pCondition, const MortarBaseConditionMatrices &rPreviousMortarOperators, const array_1d< double, TNumNodes > &mu, Vector &rLocalRHS, const MortarConditionMatrices &rMortarConditionMatrices, const DerivativeDataType &rDerivativeData, const IndexType rActiveInactive, const ProcessInfo &rCurrentProcessInfo)
Calculates the local contibution of the RHS.
PenaltyMethodFrictionalMortarContactCondition()
Default constructor.
Definition: penalty_frictional_mortar_contact_condition.h:156
~PenaltyMethodFrictionalMortarContactCondition() override
Destructor.
PenaltyMethodFrictionalMortarContactCondition(IndexType NewId, GeometryPointerType pGeometry, PropertiesPointerType pProperties, GeometryType::Pointer pMasterGeometry)
Definition: penalty_frictional_mortar_contact_condition.h:179
PenaltyMethodFrictionalMortarContactCondition(IndexType NewId, GeometryPointerType pGeometry, PropertiesPointerType pProperties)
Definition: penalty_frictional_mortar_contact_condition.h:170
typename BaseType::ConditionArrayListType ConditionArrayListType
Type definition for an array list of conditions.
Definition: penalty_frictional_mortar_contact_condition.h:101
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
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
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
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
#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
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
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
Properties PropertiesType
Definition: regenerate_pfem_pressure_conditions_process.h:26
GeometryData::IntegrationMethod IntegrationMethod
Type definition for integration methods.
Definition: exact_mortar_segmentation_utility.h:57
Geometry< PointType > GeometryPointType
Definition: exact_mortar_segmentation_utility.h:54
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
mu
Definition: generate_frictional_mortar_condition.py:127
type
Definition: generate_gid_list_file.py:35
def load(f)
Definition: ode_solve.py:307
Configure::PointType PointType
Definition: transfer_utility.h:245