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.
support_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 
11 #if !defined(KRATOS_SUPPORT_PENALTY_CONDITION_H_INCLUDED )
12 #define KRATOS_SUPPORT_PENALTY_CONDITION_H_INCLUDED
13 
14 
15 // System includes
16 #include "includes/define.h"
17 #include "includes/condition.h"
18 
19 // External includes
20 
21 // Project includes
23 
24 namespace Kratos
25 {
28  : public Condition
29  {
30  public:
33 
36 
38  typedef std::size_t SizeType;
39  typedef std::size_t IndexType;
40 
44 
47  IndexType NewId,
48  GeometryType::Pointer pGeometry)
49  : Condition(NewId, pGeometry)
50  {};
51 
54  IndexType NewId,
55  GeometryType::Pointer pGeometry,
56  PropertiesType::Pointer pProperties)
57  : Condition(NewId, pGeometry, pProperties)
58  {};
59 
62  {};
63 
65  virtual ~SupportPenaltyCondition() override
66  {};
67 
71 
73  Condition::Pointer Create(
74  IndexType NewId,
75  GeometryType::Pointer pGeom,
76  PropertiesType::Pointer pProperties
77  ) const override
78  {
79  return Kratos::make_intrusive<SupportPenaltyCondition>(
80  NewId, pGeom, pProperties);
81  };
82 
84  Condition::Pointer Create(
85  IndexType NewId,
86  NodesArrayType const& ThisNodes,
87  PropertiesType::Pointer pProperties
88  ) const override
89  {
90  return Kratos::make_intrusive<SupportPenaltyCondition>(
91  NewId, GetGeometry().Create(ThisNodes), pProperties);
92  };
93 
97 
105  VectorType& rRightHandSideVector,
106  const ProcessInfo& rCurrentProcessInfo) override
107  {
108  const SizeType mat_size = GetGeometry().size() * 3;
109 
110  if (rRightHandSideVector.size() != mat_size)
111  rRightHandSideVector.resize(mat_size);
112  noalias(rRightHandSideVector) = ZeroVector(mat_size);
113 
114  MatrixType left_hand_side_matrix;
115 
116  CalculateAll(left_hand_side_matrix, rRightHandSideVector,
117  rCurrentProcessInfo, false, true);
118  }
119 
127  MatrixType& rLeftHandSideMatrix,
128  const ProcessInfo& rCurrentProcessInfo) override
129  {
130  const SizeType mat_size = GetGeometry().size() * 3;
131 
132  VectorType right_hand_side_vector;
133 
134  if (rLeftHandSideMatrix.size1() != mat_size && rLeftHandSideMatrix.size2())
135  rLeftHandSideMatrix.resize(mat_size, mat_size);
136  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
137 
138  CalculateAll(rLeftHandSideMatrix, right_hand_side_vector,
139  rCurrentProcessInfo, true, false);
140  }
141 
151  MatrixType& rLeftHandSideMatrix,
152  VectorType& rRightHandSideVector,
153  const ProcessInfo& rCurrentProcessInfo) override
154  {
155  const SizeType mat_size = GetGeometry().size() * 3;
156 
157  if (rRightHandSideVector.size() != mat_size)
158  rRightHandSideVector.resize(mat_size);
159  noalias(rRightHandSideVector) = ZeroVector(mat_size);
160 
161  if (rLeftHandSideMatrix.size1() != mat_size)
162  rLeftHandSideMatrix.resize(mat_size, mat_size);
163  noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size);
164 
165  CalculateAll(rLeftHandSideMatrix, rRightHandSideVector,
166  rCurrentProcessInfo, true, true);
167  }
168 
174  void EquationIdVector(
175  EquationIdVectorType& rResult,
176  const ProcessInfo& rCurrentProcessInfo
177  ) const override;
178 
184  void GetDofList(
185  DofsVectorType& rElementalDofList,
186  const ProcessInfo& rCurrentProcessInfo
187  ) const override;
188 
190  void CalculateAll(
191  MatrixType& rLeftHandSideMatrix,
192  VectorType& rRightHandSideVector,
193  const ProcessInfo& rCurrentProcessInfo,
194  const bool CalculateStiffnessMatrixFlag,
195  const bool CalculateResidualVectorFlag
196  );
197 
199  const GeometryType& rGeometry,
200  Vector& rDeterminantOfJacobian);
201 
205 
207  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
208 
212 
214  std::string Info() const override
215  {
216  std::stringstream buffer;
217  buffer << "\"SupportPenaltyCondition\" #" << Id();
218  return buffer.str();
219  }
220 
222  void PrintInfo(std::ostream& rOStream) const override
223  {
224  rOStream << "\"SupportPenaltyCondition\" #" << Id();
225  }
226 
228  void PrintData(std::ostream& rOStream) const override
229  {
230  pGetGeometry()->PrintData(rOStream);
231  }
232 
234 
235  private:
238 
239  friend class Serializer;
240 
241  virtual void save(Serializer& rSerializer) const override
242  {
244  }
245 
246  virtual void load(Serializer& rSerializer) override
247  {
249  }
250 
252 
253  }; // Class SupportPenaltyCondition
254 
255 } // namespace Kratos.
256 
257 #endif // KRATOS_SUPPORT_PENALTY_CONDITION_H_INCLUDED defined
Base class for all Conditions.
Definition: condition.h:59
std::size_t SizeType
Definition: condition.h:94
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
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
SizeType size() const
Definition: geometry.h:518
IndexType Id() const
Definition: indexed_object.h:107
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
Condition for penalty support condition.
Definition: support_penalty_condition.h:29
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(SupportPenaltyCondition)
Counted pointer definition of SupportPenaltyCondition.
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
This function provides a more general interface to the element.
Definition: support_penalty_condition.h:150
Condition::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: support_penalty_condition.h:73
std::size_t SizeType
Size types.
Definition: support_penalty_condition.h:38
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: support_penalty_condition.h:228
SupportPenaltyCondition()
Default constructor.
Definition: support_penalty_condition.h:61
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: support_penalty_condition.h:104
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: support_penalty_condition.cpp:23
SupportPenaltyCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor with Id, geometry and property.
Definition: support_penalty_condition.h:53
virtual ~SupportPenaltyCondition() override
Destructor.
Definition: support_penalty_condition.h:65
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Performs check if Penalty factor is provided.
Definition: support_penalty_condition.cpp:133
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: support_penalty_condition.h:126
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: support_penalty_condition.h:222
SupportPenaltyCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor with Id and geometry.
Definition: support_penalty_condition.h:46
std::size_t IndexType
Definition: support_penalty_condition.h:39
std::string Info() const override
Turn back information as a string.
Definition: support_penalty_condition.h:214
Condition::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create with Id, pointer to geometry and pointer to property.
Definition: support_penalty_condition.h:84
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rResult the ID's of the element degrees of freedom.
Definition: support_penalty_condition.cpp:140
void DeterminantOfJacobianInitial(const GeometryType &rGeometry, Vector &rDeterminantOfJacobian)
Definition: support_penalty_condition.cpp:95
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Sets on rConditionDofList the degrees of freedom of the considered element geometry.
Definition: support_penalty_condition.cpp:160
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
def load(f)
Definition: ode_solve.py:307