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.
potential_wall_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: Inigo Lopez and Riccardo Rossi
11 //
12 
13 #ifndef KRATOS_POTENTIAL_WALL_CONDITION_H
14 #define KRATOS_POTENTIAL_WALL_CONDITION_H
15 
16 // System includes
17 #include <string>
18 #include <iostream>
19 
20 #include "includes/kratos_flags.h"
22 
23 // External includes
24 
25 // Project includes
26 #include "includes/define.h"
27 #include "includes/serializer.h"
28 #include "includes/condition.h"
29 #include "includes/process_info.h"
30 #include "includes/cfd_variables.h"
31 
32 // Application includes
34 
35 namespace Kratos
36 {
39 
42 
46 
50 
54 
58 
60 template <unsigned int TDim, unsigned int TNumNodes = TDim>
61 class KRATOS_API(COMPRESSIBLE_POTENTIAL_FLOW_APPLICATION) PotentialWallCondition : public Condition
62 {
63 public:
66 
69 
70  static constexpr int NumNodes = TNumNodes;
71  static constexpr int Dim = TDim;
72 
73  typedef Node NodeType;
74 
76 
78 
80 
81  typedef Vector VectorType;
82 
83  typedef Matrix MatrixType;
84 
85  typedef std::size_t IndexType;
86 
87  typedef std::size_t SizeType;
88 
89  typedef std::vector<std::size_t> EquationIdVectorType;
90 
91  typedef std::vector<Dof<double>::Pointer> DofsVectorType;
92 
94 
95  typedef Element::WeakPointer ElementWeakPointerType;
96 
97  typedef Element::Pointer ElementPointerType;
98 
102 
104 
107  explicit PotentialWallCondition(IndexType NewId = 0) : Condition(NewId)
108  {
109  }
110 
112 
117  : Condition(NewId, ThisNodes)
118  {
119  }
120 
122 
126  PotentialWallCondition(IndexType NewId, GeometryType::Pointer pGeometry)
127  : Condition(NewId, pGeometry)
128  {
129  }
130 
132 
138  GeometryType::Pointer pGeometry,
139  PropertiesType::Pointer pProperties)
140  : Condition(NewId, pGeometry, pProperties)
141  {
142  }
143 
146 
149 
152  {
153  }
154 
158 
161  {
162  Condition::operator=(rOther);
163  return *this;
164  }
165 
168  {
169  Condition::operator=(rOther);
170  return *this;
171  }
172 
176 
177  Condition::Pointer Create(IndexType NewId,
178  NodesArrayType const& ThisNodes,
179  PropertiesType::Pointer pProperties) const override;
180 
181  Condition::Pointer Create(IndexType NewId,
182  Condition::GeometryType::Pointer pGeom,
183  PropertiesType::Pointer pProperties) const override;
184 
185  Condition::Pointer Clone(IndexType NewId, NodesArrayType const& rThisNodes) const override;
186 
187  // Find the condition's parent element.
188  void Initialize(const ProcessInfo& rCurrentProcessInfo) override;
189 
190  void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix,
191  const ProcessInfo& rCurrentProcessInfo) override;
192 
193  void CalculateRightHandSide(VectorType& rRightHandSideVector,
194  const ProcessInfo& rCurrentProcessInfo) override;
195 
196  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
197  VectorType& rRightHandSideVector,
198  const ProcessInfo& rCurrentProcessInfo) override;
199 
200  void EquationIdVector(EquationIdVectorType& rResult,
201  const ProcessInfo& rCurrentProcessInfo) const override;
202 
203  void GetDofList(DofsVectorType& ConditionDofList, const ProcessInfo& CurrentProcessInfo) const override;
204 
205  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override;
206 
210 
214 
215  int Check(const ProcessInfo& rCurrentProcessInfo) const override;
216 
220 
222  std::string Info() const override;
223 
225  void PrintInfo(std::ostream& rOStream) const override;
226 
228  void PrintData(std::ostream& rOStream) const override;
229 
233 
235 
236 protected:
239 
243 
247 
251 
255 
259 
263 
265 
266 private:
269 
273 
274  bool mInitializeWasPerformed = false;
275 
276  GlobalPointer<Element> mpElement;
277 
278  void CalculateNormal2D(array_1d<double, 3>& An) const;
279 
280  void CalculateNormal3D(array_1d<double, 3>& An) const;
281 
285 
286  friend class Serializer;
287 
288  void save(Serializer& rSerializer) const override;
289 
290  void load(Serializer& rSerializer) override;
291 
295 
296  inline GlobalPointer<Element> pGetElement() const;
297 
298  void GetElementCandidates(GlobalPointersVector<Element>& ElementCandidates,
299  const GeometryType& rGeom) const;
300 
301  void GetSortedIds(std::vector<IndexType>& Ids, const GeometryType& rGeom) const;
302 
303  void FindParentElement(std::vector<IndexType>& NodeIds,
304  std::vector<IndexType>& ElementNodeIds,
305  GlobalPointersVector<Element> ElementCandidates);
306 
310 
314 
318 
322 
324 
325 }; // Class PotentialWallCondition
326 
328 
331 
335 
337 template <unsigned int TDim, unsigned int TNumNodes>
338 inline std::istream& operator>>(std::istream& rIStream,
340 {
341  return rIStream;
342 }
343 
345 template <unsigned int TDim, unsigned int TNumNodes>
346 inline std::ostream& operator<<(std::ostream& rOStream,
348 {
349  rThis.PrintInfo(rOStream);
350  rOStream << std::endl;
351  rThis.PrintData(rOStream);
352 
353  return rOStream;
354 }
355 
357 
359 
360 } // namespace Kratos.
361 
362 #endif // KRATOS_POTENTIAL_WALL_CONDITION_H
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Base class for all Conditions.
Definition: condition.h:59
Condition & operator=(Condition const &rOther)
Assignment operator.
Definition: condition.h:181
std::size_t IndexType
Definition: flags.h:74
Geometry base class.
Definition: geometry.h:71
This class is a wrapper for a pointer to a data that is located in a different rank.
Definition: global_pointer.h:44
This object defines an indexed object.
Definition: indexed_object.h:54
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
Implements a wall condition for the potential flow formulation.
Definition: potential_wall_condition.h:62
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: potential_wall_condition.h:79
PotentialWallCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using Geometry.
Definition: potential_wall_condition.h:126
~PotentialWallCondition() override
Destructor.
Definition: potential_wall_condition.h:151
Element::Pointer ElementPointerType
Definition: potential_wall_condition.h:97
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: potential_wall_condition.cpp:221
PotentialWallCondition(PotentialWallCondition const &rOther)=delete
Copy constructor.
PotentialWallCondition(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: potential_wall_condition.h:116
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: potential_wall_condition.h:93
PotentialWallCondition & operator=(PotentialWallCondition &&rOther)
Move operator.
Definition: potential_wall_condition.h:167
Element::WeakPointer ElementWeakPointerType
Definition: potential_wall_condition.h:95
Vector VectorType
Definition: potential_wall_condition.h:81
PotentialWallCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using Properties.
Definition: potential_wall_condition.h:137
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: potential_wall_condition.h:91
PotentialWallCondition(IndexType NewId=0)
Default constructor.
Definition: potential_wall_condition.h:107
PotentialWallCondition & operator=(PotentialWallCondition const &rOther)
Assignment operator.
Definition: potential_wall_condition.h:160
Node NodeType
Definition: potential_wall_condition.h:73
Properties PropertiesType
Definition: potential_wall_condition.h:75
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: potential_wall_condition.cpp:215
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(PotentialWallCondition)
Pointer definition of PotentialWallCondition.
Matrix MatrixType
Definition: potential_wall_condition.h:83
Geometry< NodeType > GeometryType
Definition: potential_wall_condition.h:77
PotentialWallCondition(PotentialWallCondition &&rOther)=delete
Move constructor.
std::vector< std::size_t > EquationIdVectorType
Definition: potential_wall_condition.h:89
std::size_t IndexType
Definition: potential_wall_condition.h:85
std::size_t SizeType
Definition: potential_wall_condition.h:87
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
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
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 GetSortedIds(std::vector< size_t > &Ids, const GeometryType &rGeom)
Definition: potential_flow_utilities.cpp:921
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
ModelPart::NodesContainerType NodesArrayType
Definition: gid_gauss_point_container.h:42
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307