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.
fluid_auxiliary_utilities.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: Ruben Zorrilla
11 // Suneth Warnakulasuriya
12 //
13 
14 #if !defined(KRATOS_FLUID_AUXILIARY_UTILITIES_H)
15 #define KRATOS_FLUID_AUXILIARY_UTILITIES_H
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "geometries/geometry.h"
23 #include "includes/node.h"
24 #include "includes/model_part.h"
27 
28 // Application includes
29 
30 
31 namespace Kratos
32 {
35 
38 
39 class KRATOS_API(FLUID_DYNAMICS_APPLICATION) FluidAuxiliaryUtilities
40 {
41 public:
44 
45  using IndexType = std::size_t;
46 
47  using NodeType = Node;
48 
50 
51  using ModifiedShapeFunctionsFactoryType = std::function<ModifiedShapeFunctions::UniquePointer(const GeometryType::Pointer, const Vector&)>;
52 
56 
64  static inline bool IsSplit(const Vector& rElementDistancesVector)
65  {
66  std::size_t n_pos(0);
67  std::size_t n_neg(0);
68  const std::size_t pts_number = rElementDistancesVector.size();
69  for (std::size_t i_node = 0; i_node < pts_number; ++i_node){
70  if (rElementDistancesVector[i_node] > 0.0)
71  n_pos++;
72  else
73  n_neg++;
74  }
75  return (n_pos > 0 && n_neg > 0) ? true : false;
76  }
77 
85  static inline bool IsPositive(const Vector &rElementDistancesVector)
86  {
87  std::size_t n_pos (0);
88  const std::size_t pts_number = rElementDistancesVector.size();
89  for (std::size_t i_node = 0; i_node < pts_number; ++i_node){
90  if (rElementDistancesVector[i_node] > 0.0)
91  n_pos++;
92  }
93  return (n_pos == pts_number) ? true : false;
94  }
95 
103  static inline bool IsNegative(const Vector &rElementDistancesVector)
104  {
105  std::size_t n_neg (0);
106  const std::size_t pts_number = rElementDistancesVector.size();
107  for (std::size_t i_node = 0; i_node < pts_number; ++i_node){
108  if (rElementDistancesVector[i_node] < 0.0)
109  n_neg++;
110  }
111  return n_neg == pts_number;
112  }
113 
120  static double CalculateFluidVolume(const ModelPart& rModelPart);
121 
132  static double CalculateFluidPositiveVolume(const ModelPart& rModelPart);
133 
144  static double CalculateFluidNegativeVolume(const ModelPart& rModelPart);
145 
153  static double CalculateFlowRate(const ModelPart& rModelPart);
154 
162  static double CalculateFlowRatePositiveSkin(const ModelPart& rModelPart);
163 
171  static double CalculateFlowRateNegativeSkin(const ModelPart& rModelPart);
172 
181  static double CalculateFlowRatePositiveSkin(
182  const ModelPart& rModelPart,
183  const Flags& rSkinFlag);
184 
193  static double CalculateFlowRateNegativeSkin(
194  const ModelPart& rModelPart,
195  const Flags& rSkinFlag);
196 
205  static ModifiedShapeFunctionsFactoryType GetStandardModifiedShapeFunctionsFactory(const GeometryType& rGeometry);
206 
217  static void MapVelocityFromSkinToVolumeRBF(
218  ModelPart& rVolumeModelPart,
219  ModelPart& rSkinModelPart,
220  const double SearchRadius);
221 
229  static double FindMaximumEdgeLength(
230  ModelPart& rModelPart,
231  const bool CalculateNodalNeighbours = true);
232 
234 private:
235 
242  static double CalculateConditionFlowRate(const GeometryType& rGeometry);
243 
253  template<bool IsPositiveSubdomain, bool CheckConditionFlag>
254  static double CalculateFlowRateAuxiliary(
255  const ModelPart& rModelPart,
256  const Flags& rSkinFlag = Flags());
257 
267  template<bool CheckConditionFlag>
268  static bool CheckConditionFlagAuxiliary(
269  const Condition& rCondition,
270  const Flags& rSkinFlag);
271 
281  template<bool IsPositiveSubdomain>
282  static inline bool CheckNonSplitConditionSubdomain(const Vector &rElementDistancesVector);
283 
295  template<bool IsPositiveSubdomain>
296  static void CalculateSplitConditionGeometryData(
297  const ModifiedShapeFunctions::UniquePointer& rpModShapeFunc,
298  const std::size_t FaceId,
299  Matrix& rShapeFunctions,
300  std::vector<array_1d<double,3>>& rNormals,
301  Vector& rWeights);
302 
303 };
304 
306 
307 } // namespace Kratos
308 
309 #endif // KRATOS_FLUID_AUXILIARY_UTILITIES_H
Base class for all Conditions.
Definition: condition.h:59
Definition: flags.h:58
Definition: fluid_auxiliary_utilities.h:40
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class defines the node.
Definition: node.h:65
std::size_t IndexType
Definition: fluid_auxiliary_utilities.h:45
std::function< ModifiedShapeFunctions::UniquePointer(const GeometryType::Pointer, const Vector &)> ModifiedShapeFunctionsFactoryType
Definition: fluid_auxiliary_utilities.h:51
static bool IsPositive(const Vector &rElementDistancesVector)
Checks if an element is positive From the given vector containing the distance in each node,...
Definition: fluid_auxiliary_utilities.h:85
static bool IsSplit(const Vector &rElementDistancesVector)
Checks if an element is split From the given vector containing the distance in each node,...
Definition: fluid_auxiliary_utilities.h:64
static bool IsNegative(const Vector &rElementDistancesVector)
Checks if an element is negative From the given vector containing the distance in each node,...
Definition: fluid_auxiliary_utilities.h:103
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21