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.
define_3d_wake_process.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 Marc Nunez
11 //
12 
13 #if !defined(KRATOS_DEFINE_3D_WAKE_PROCESS_H_INCLUDED )
14 #define KRATOS_DEFINE_3D_WAKE_PROCESS_H_INCLUDED
15 
16 #include "concurrentqueue/concurrentqueue.h"
17 
18 namespace Kratos
19 {
20 
23 
25 class KRATOS_API(COMPRESSIBLE_POTENTIAL_FLOW_APPLICATION) Define3DWakeProcess
26  : public Process
27 {
28 public:
31 
34 
35  typedef Node NodeType;
36 
40 
42  Define3DWakeProcess(ModelPart& rTrailingEdgeModelPart,
43  ModelPart& rBodyModelPart,
44  ModelPart& rStlWakeModelPart,
45  Parameters ThisParameters);
46 
48  Define3DWakeProcess(Define3DWakeProcess const& rOther) = delete;
49 
51  ~Define3DWakeProcess() override = default;
52 
56 
59 
63 
65  void ExecuteInitialize() override;
66 
70 
72  std::string Info() const override
73  {
74  return "Define3DWakeProcess";
75  }
76 
78  void PrintInfo(std::ostream& rOStream) const override
79  {
80  rOStream << "Define3DWakeProcess";
81  }
82 
84  void PrintData(std::ostream& rOStream) const override
85  {
86  }
87 
89 private:
92 
93  // The airfoil model part conatining the trailing edge
94  ModelPart& mrTrailingEdgeModelPart;
95  ModelPart& mrBodyModelPart;
96  ModelPart& mrStlWakeModelPart;
97  // Tolerance to avoid nodes laying exactly on the wake
98  double mTolerance;
99  BoundedVector<double, 3> mWakeNormal;
100  BoundedVector<double, 3> mWakeDirection;
101  BoundedVector<double, 3> mSpanDirection;
102 
103  bool mSwitchWakeDirection;
104  bool mCountElementsNumber;
105  bool mWriteElementsIdsToFile;
106  bool mShedWakeFromTrailingEdge;
107  bool mDecreaseWakeWidthAtTheWingTips;
108  int mEchoLevel;
109 
110  double mSheddedWakeDistance;
111  double mSheddedWakeElementSize;
112 
113  BoundedVector<double, 3> mWakeNormalOld;
114 
118  void InitializeTrailingEdgeSubModelpart() const;
119 
120  void InitializeWakeSubModelpart() const;
121 
122  void MarkTrailingEdgeNodesAndFindWingtipNodes();
123 
124  void ComputeWingLowerSurfaceNormals() const;
125 
126  void ComputeAndSaveLocalWakeNormal() const;
127 
128  void ShedWakeSurfaceFromTheTrailingEdge() const;
129 
130  void DecreaseWakeWidthAtTheWingTips(array_1d<double, 3>& rPoint1,
131  const array_1d<double, 3>& rPoint2) const;
132 
133  void CreateWakeSurfaceNodesAndElements(IndexType& rNode_index,
134  const array_1d<double, 3>& rCoordinates1,
135  const array_1d<double, 3>& rCoordinates2,
136  const array_1d<double, 3>& rCoordinates3,
137  const array_1d<double, 3>& rCoordinates4,
138  IndexType& rElement_index,
139  const Properties::Pointer pElemProp) const;
140 
141  std::array<ModelPart::IndexType, 4> CreateWakeSurfaceNodes(
142  IndexType& rNode_index,
143  const array_1d<double, 3>& rCoordinates1,
144  const array_1d<double, 3>& rCoordinates2,
145  const array_1d<double, 3>& rCoordinates3,
146  const array_1d<double, 3>& rCoordinates4) const;
147 
148  double ComputeFaceNormalProjectionToWakeNormal(const array_1d<double, 3>& rCoordinates1,
149  const array_1d<double, 3>& rCoordinates2,
150  const array_1d<double, 3>& rCoordinates3,
151  const array_1d<double, 3>& rCoordinates4) const;
152 
153  void CreateWakeSurfaceElements(const double normal_projection,
154  IndexType& rElement_index,
155  const std::array<ModelPart::IndexType, 4>& rNodes_ids,
156  const Properties::Pointer pElemProp) const;
157 
158  void MarkWakeElements() const;
159 
160  void CheckIfTrailingEdgeElement(Element& rElement,
161  const Geometry<NodeType>& rGeometry,
162  moodycamel::ConcurrentQueue<std::size_t> & rTrailingEdgeElementsOrderedIds) const;
163 
164  void AddTrailingEdgeAndWakeElements(std::vector<std::size_t>& rWakeElementsOrderedIds,
165  std::vector<std::size_t>& rTrailingEdgeElementsOrderedIds) const;
166 
167  void FindClosestTrailingEdgeNode(NodeType::Pointer& pClosest_te_node,
168  const array_1d<double, 3>& rPoint) const;
169 
170  void RecomputeNodalDistancesToWakeOrWingLowerSurface() const;
171 
172  void RecomputeDistance(NodeType::Pointer& pClosest_te_node,
173  NodeType& rNode) const;
174 
175  void MarkKuttaElements() const;
176 
177  unsigned int CountNumberOfTrailindEdgeNodesInElement(const Geometry<NodeType>& rGeometry) const;
178 
179  void CountNumberOfPositiveAndNegativeDistances(
180  const Geometry<NodeType>& rGeometry,
181  unsigned int& number_of_nodes_with_negative_distance,
182  unsigned int& number_of_nodes_with_positive_distance) const;
183 
184  void SelectElementType(Element& rElement,
185  const Geometry<NodeType>& rGeometry,
186  const unsigned int number_of_te_nodes,
187  const unsigned int number_of_nodes_with_negative_distance,
188  const unsigned int number_of_nodes_with_positive_distance) const;
189 
190  void SaveLocalWakeNormalInElements() const;
191 
192  void AddWakeNodesToWakeModelPart() const;
193 
194  void CountElementsNumber() const;
195 
196  void WriteElementIdsToFile() const;
198 
199 }; // Class Define3DWakeProcess
200 
204 
206 inline std::istream& operator >> (std::istream& rIStream,
207  Define3DWakeProcess& rThis);
208 
210 inline std::ostream& operator << (std::ostream& rOStream,
211  const Define3DWakeProcess& rThis)
212 {
213  rThis.PrintInfo(rOStream);
214  rOStream << std::endl;
215  rThis.PrintData(rOStream);
216 
217  return rOStream;
218 }
220 
221 } // namespace Kratos.
222 
223 #endif // KRATOS_DEFINE_3D_WAKE_PROCESS_H_INCLUDED defined
void ExecuteInitialize() override
Definition: periodic_interface_process.hpp:37
Auxiliary process to define the wake in 2 dimensional problems.
Definition: define_3d_wake_process.h:27
Node NodeType
Definition: define_3d_wake_process.h:35
Define3DWakeProcess & operator=(Define3DWakeProcess const &rOther)=delete
Assignment operator.
std::string Info() const override
Turn back information as a string.
Definition: define_3d_wake_process.h:72
KRATOS_CLASS_POINTER_DEFINITION(Define3DWakeProcess)
Pointer definition of Define3DWakeProcess.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: define_3d_wake_process.h:84
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: define_3d_wake_process.h:78
Define3DWakeProcess(Define3DWakeProcess const &rOther)=delete
Copy constructor.
~Define3DWakeProcess() override=default
Destructor.
Base class for all Elements.
Definition: element.h:60
Geometry base class.
Definition: geometry.h:71
Definition: amatrix_interface.h:41
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The base class for all processes in Kratos.
Definition: process.h:49
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
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