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.
coupling_penalty_condition.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Tobias Tescheamacher
11 // Michael Breitenberger
12 // Riccardo Rossi
13 //
14 
15 #if !defined(KRATOS_COUPLING_PENALTY_CONDITION_H_INCLUDED )
16 #define KRATOS_COUPLING_PENALTY_CONDITION_H_INCLUDED
17 
18 // System includes
19 #include "includes/define.h"
20 #include "includes/condition.h"
21 
22 // External includes
23 
24 // Project includes
27 
29 
30 namespace Kratos
31 {
32 
34 
47  : public Condition
48 {
49 public:
52 
55 
57  typedef std::size_t SizeType;
58  typedef std::size_t IndexType;
59 
63 
66  IndexType NewId,
67  GeometryType::Pointer pGeometry)
68  : Condition(NewId, pGeometry)
69  {};
70 
73  IndexType NewId,
74  GeometryType::Pointer pGeometry,
75  PropertiesType::Pointer pProperties)
76  : Condition(NewId, pGeometry, pProperties)
77  {};
78 
81  : Condition()
82  {};
83 
85  virtual ~CouplingPenaltyCondition() = default;
86 
90 
92  Condition::Pointer Create(
93  IndexType NewId,
94  GeometryType::Pointer pGeom,
95  PropertiesType::Pointer pProperties
96  ) const override
97  {
98  return Kratos::make_intrusive<CouplingPenaltyCondition>(
99  NewId, pGeom, pProperties);
100  };
101 
103  Condition::Pointer Create(
104  IndexType NewId,
105  NodesArrayType const& ThisNodes,
106  PropertiesType::Pointer pProperties
107  ) const override
108  {
109  return Kratos::make_intrusive< CouplingPenaltyCondition >(
110  NewId, GetGeometry().Create(ThisNodes), pProperties);
111  };
112 
116 
124  VectorType& rRightHandSideVector,
125  const ProcessInfo& rCurrentProcessInfo) override
126  {
127  MatrixType left_hand_side_matrix = Matrix(0, 0);
128 
129  CalculateAll(left_hand_side_matrix, rRightHandSideVector,
130  rCurrentProcessInfo, false, true);
131  }
132 
140  MatrixType& rLeftHandSideMatrix,
141  const ProcessInfo& rCurrentProcessInfo) override
142  {
143  VectorType right_hand_side_vector = Vector(0);
144 
145  CalculateAll(rLeftHandSideMatrix, right_hand_side_vector,
146  rCurrentProcessInfo, true, false);
147  }
148 
158  MatrixType& rLeftHandSideMatrix,
159  VectorType& rRightHandSideVector,
160  const ProcessInfo& rCurrentProcessInfo) override
161  {
162  CalculateAll(rLeftHandSideMatrix, rRightHandSideVector,
163  rCurrentProcessInfo, true, true);
164  }
165 
171  void EquationIdVector(
172  EquationIdVectorType& rResult,
173  const ProcessInfo& rCurrentProcessInfo
174  ) const override;
175 
181  void GetDofList(
182  DofsVectorType& rElementalDofList,
183  const ProcessInfo& rCurrentProcessInfo
184  ) const override;
185 
187  void CalculateAll(
188  MatrixType& rLeftHandSideMatrix,
189  VectorType& rRightHandSideVector,
190  const ProcessInfo& rCurrentProcessInfo,
191  const bool CalculateStiffnessMatrixFlag,
192  const bool CalculateResidualVectorFlag
193  );
194 
196  const GeometryType& rGeometry,
197  Vector& rDeterminantOfJacobian);
198 
202 
204  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
205 
209 
211  std::string Info() const override
212  {
213  std::stringstream buffer;
214  buffer << "\"CouplingPenaltyCondition\" #" << Id();
215  return buffer.str();
216  }
217 
219  void PrintInfo(std::ostream& rOStream) const override
220  {
221  rOStream << "\"CouplingPenaltyCondition\" #" << Id();
222  }
223 
225  void PrintData(std::ostream& rOStream) const override {
226  pGetGeometry()->PrintData(rOStream);
227  }
228 
230 
231 private:
232  // Compute rotational shape functions
233  void CalculateRotationalShapeFunctions(
234  IndexType IntegrationPointIndex,
235  Vector& phi_r,
236  Matrix& phi_rs,
237  array_1d<double, 2>& diff_phi);
238 
239  // Compute rotation
240  void CalculateRotation(
241  IndexType IntegrationPointIndex,
242  const Matrix &rShapeFunctionGradientValues,
243  Vector &phi_r,
244  Matrix &phi_rs,
246  array_1d<double, 3> &trim_tangent,
247  const Vector &local_tangent,
248  const bool master);
249 
252 
253  friend class Serializer;
254 
255  virtual void save(Serializer& rSerializer) const override
256  {
258  }
259 
260  virtual void load(Serializer& rSerializer) override
261  {
263  }
264 
266 
267 }; // Class CouplingPenaltyCondition
268 
269 } // namespace Kratos.
270 
271 #endif // KRATOS_COUPLING_PENALTY_CONDITION_H_INCLUDED defined
Base class for all Conditions.
Definition: condition.h:59
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
Matrix MatrixType
Definition: condition.h:90
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
Penalty factor based coupling condition.
Definition: coupling_penalty_condition.h:48
void CalculateAll(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo, const bool CalculateStiffnessMatrixFlag, const bool CalculateResidualVectorFlag)
Calculates left (K) and right (u) hand sides, according to the flags.
Definition: coupling_penalty_condition.cpp:24
CouplingPenaltyCondition()
Default constructor.
Definition: coupling_penalty_condition.h:80
std::size_t IndexType
Definition: coupling_penalty_condition.h:58
KRATOS_CLASS_POINTER_DEFINITION(CouplingPenaltyCondition)
Counted pointer of CouplingPenaltyCondition.
Condition::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: coupling_penalty_condition.h:103
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rResult the ID's of the element degrees of freedom.
Definition: coupling_penalty_condition.cpp:488
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: coupling_penalty_condition.h:219
std::size_t SizeType
Size types.
Definition: coupling_penalty_condition.h:57
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This function provides a more general interface to the element.
Definition: coupling_penalty_condition.h:157
CouplingPenaltyCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor with Id, geometry and property.
Definition: coupling_penalty_condition.h:72
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: coupling_penalty_condition.h:225
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the condition right hand side matr...
Definition: coupling_penalty_condition.h:123
void DeterminantOfJacobianInitial(const GeometryType &rGeometry, Vector &rDeterminantOfJacobian)
Definition: coupling_penalty_condition.cpp:162
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
This is called during the assembling process in order to calculate the condition left hand side matri...
Definition: coupling_penalty_condition.h:139
std::string Info() const override
Turn back information as a string.
Definition: coupling_penalty_condition.h:211
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rElementalDofList the degrees of freedom of the considered element geometry.
Definition: coupling_penalty_condition.cpp:522
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Performs check if Penalty factor is provided.
Definition: coupling_penalty_condition.cpp:481
Condition::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: coupling_penalty_condition.h:92
virtual ~CouplingPenaltyCondition()=default
Destructor.
CouplingPenaltyCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor with Id and geometry.
Definition: coupling_penalty_condition.h:65
std::size_t IndexType
Definition: flags.h:74
GeometryType::Pointer pGetGeometry()
Returns the pointer to the geometry.
Definition: geometrical_object.h:140
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
IndexType Id() const
Definition: indexed_object.h:107
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
#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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
phi
Definition: isotropic_damage_automatic_differentiation.py:168
def load(f)
Definition: ode_solve.py:307