Microflow 3D  v1.0
BoundaryFunctions.h
Go to the documentation of this file.
1 // ==============================================================================================
2 // Microflow 3D, http://www.microflow.pwr.edu.pl/
3 // Created by Roman Szafran on 18.05.19.
4 // Modified by Roman Szafran, last on 07.09.19.
5 // Copyright (c) 2019 Wroclaw University of Science and Technology.
6 // Distributed under the Apache License, Version 2.0, You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0 or see accompanying file license.txt.
8 // Redistributions of source code must retain the above copyright and license notice.
9 // ==============================================================================================
10 
11 # pragma once
12 
13 #include <cstdint>
14 #include <memory>
15 #include <algorithm>
16 #include <cmath>
17 
20 #include "MFDatabase/Node.h"
21 #include "MFDatabase/Vec3.h"
22 #include "MFDatabase/Vec4.h"
23 #include "MFDatabase/ThreadArray.h"
24 
25 namespace MF {
26  namespace Solver_CPU {
27 
31  {
32  public:
33  BoundaryFunctions() = default;
34  ~BoundaryFunctions() = default;
35 
36  inline static std::shared_ptr<MF::Solver_CPU::CaseParameters> m_CaseParameters_Ptr = nullptr;;
37  inline static std::shared_ptr<MF::GU::LatticeParametersD3Q19> m_LatticeParameters_Ptr = nullptr;;
38 
39  static void Initialize (const std::shared_ptr<MF::Solver_CPU::CaseParameters>& CaseParameters_Ptr, const std::shared_ptr<MF::GU::LatticeParametersD3Q19>& LatticeParameters_Ptr) {
40  m_CaseParameters_Ptr = CaseParameters_Ptr;
41  m_LatticeParameters_Ptr = LatticeParameters_Ptr;
42  };
43 
44  static void SetBoundaryNodePointerToFunc(const std::shared_ptr<MF::Database::ThreadArray>& ThreadArray_Ptr);
45 
46  private:
47  static double MeanRHOAdjFluidNodes(const MF::Database::Node *pNode);
48 
49 
50 //----------------------------------------------------------------------------------------------------------------------------
51 // Quasi compressible and Incompressible
52 //----------------------------------------------------------------------------------------------------------------------------
53 
54 // //Bounce Back type 2 (61)- full way standard quasi compressible and incompressible. Do nothing since propagation function includes swap f(i) procedure.
55  static void BF_BounceBack2_61(MF::Database::Node * pNode) {};
56  static MF::Database::Vec4<double> VRBFQC_BounceBack2_61(const MF::Database::Node *pNode); // V and Rho LB for BB 61 quasi compressible
57  static MF::Database::Vec4<double> VRBFIC_BounceBack2_61(const MF::Database::Node *pNode); // V and Rho LB for BB 61 incompressible
58 
59 // Periodic boundary 4 requires two opposite surfaces (nodes). Do not require any computations at pre-collide stage.
60 
61 // Velocity 0, Dirichlet type, own derivation
62  static void BF_Velocity0North_41(MF::Database::Node * pNode); // North Velocity0
63  static MF::Database::Vec4<double> VRBF_Velocity0North_41(const MF::Database::Node *pNode); // V and Rho LB for Velocity0
64  static void BF_Velocity0South_42(MF::Database::Node * pNode); // South Velocity0
65  static MF::Database::Vec4<double> VRBF_Velocity0South_42(const MF::Database::Node *pNode); // V and Rho LB for South Velocity0
66  static void BF_Velocity0East_43(MF::Database::Node * pNode); // East Velocity0
67  static MF::Database::Vec4<double> VRBF_Velocity0East_43(const MF::Database::Node *pNode); // V and Rho LB for East Velocity0
68  static void BF_Velocity0West_44(MF::Database::Node * pNode); // West Velocity0
69  static MF::Database::Vec4<double> VRBF_Velocity0West_44(const MF::Database::Node *pNode); // V and Rho LB for West Velocity0
70  static void BF_Velocity0Bottom_45(MF::Database::Node * pNode); // Bottom Velocity0
71  static MF::Database::Vec4<double> VRBF_Velocity0Bottom_45(const MF::Database::Node *pNode); // V and Rho LB for Bottom Velocity0
72  static void BF_Velocity0Top_46(MF::Database::Node * pNode); // Top Velocity0
73  static MF::Database::Vec4<double> VRBF_Velocity0Top_46(const MF::Database::Node *pNode); // V and Rho LB for Top Velocity0
74 
75 //----------------------------------------------------------------------------------------------------------------------------
76 // Quasi compressible
77 //----------------------------------------------------------------------------------------------------------------------------
78 
79 // Velocity, Dirichlet type, Hecht and Harting (2010) for D3Q19 own derivation, (Zou,He 1997, Dirichlet boundary)
80  static void BFQC_VelocityNorth_21(MF::Database::Node * pNode); // North Velocity
81  static MF::Database::Vec4<double> VRBFQC_VelocityNorth_21(const MF::Database::Node *pNode); // V and Rho LB for North Velocity
82  static void BFQC_VelocitySouth_22(MF::Database::Node * pNode); // South Velocity
83  static MF::Database::Vec4<double> VRBFQC_VelocitySouth_22(const MF::Database::Node *pNode); // V and Rho LB for South Velocity
84  static void BFQC_VelocityEast_23(MF::Database::Node * pNode); // East Velocity
85  static MF::Database::Vec4<double> VRBFQC_VelocityEast_23(const MF::Database::Node *pNode); // V and Rho LB for East Velocity
86  static void BFQC_VelocityWest_24(MF::Database::Node * pNode); // West Velocity
87  static MF::Database::Vec4<double> VRBFQC_VelocityWest_24(const MF::Database::Node *pNode); // V and Rho LB for West Velocity
88  static void BFQC_VelocityBottom_25(MF::Database::Node * pNode); // Bottom Velocity
89  static MF::Database::Vec4<double> VRBFQC_VelocityBottom_25(const MF::Database::Node *pNode); // V and Rho LB for Bottom Velocity
90  static void BFQC_VelocityTop_26(MF::Database::Node * pNode); // Top Velocity
91  static MF::Database::Vec4<double> VRBFQC_VelocityTop_26(const MF::Database::Node *pNode); // V and Rho LB for Top Velocity
92 
93 // Pressure, Neumann type, Hecht and Harting (2010) for D3Q19, own derivation
94  static void BFQC_PressureNorth_31(MF::Database::Node * pNode); // North Pressure
95  static MF::Database::Vec4<double> VRBFQC_PressureNorth_31(const MF::Database::Node *pNode); // V and Rho LB for North Pressure
96  static void BFQC_PressureSouth_32(MF::Database::Node * pNode); // South Pressure
97  static MF::Database::Vec4<double> VRBFQC_PressureSouth_32(const MF::Database::Node *pNode); // V and Rho LB for South Pressure
98  static void BFQC_PressureEast_33(MF::Database::Node * pNode); // East Pressure
99  static MF::Database::Vec4<double> VRBFQC_PressureEast_33(const MF::Database::Node *pNode); // V and Rho LB for East Pressure
100  static void BFQC_PressureWest_34(MF::Database::Node * pNode); // West Pressure
101  static MF::Database::Vec4<double> VRBFQC_PressureWest_34(const MF::Database::Node *pNode); // V and Rho LB for West Pressure
102  static void BFQC_PressureBottom_35(MF::Database::Node * pNode); // Bottom Pressure
103  static MF::Database::Vec4<double> VRBFQC_PressureBottom_35(const MF::Database::Node *pNode); // V and Rho LB for Bottom Pressure
104  static void BFQC_PressureTop_36(MF::Database::Node * pNode); // Top pressure
105  static MF::Database::Vec4<double> VRBFQC_PressureTop_36(const MF::Database::Node *pNode); // V and Rho LB for Top pressure
106 
107 //----------------------------------------------------------------------------------------------------------------------------
108 // Incompressible Zou et al. 1995
109 //----------------------------------------------------------------------------------------------------------------------------
110 
111 // Velocity, Dirichlet type, Hecht and Harting (2010) for D3Q19, own derivation (Zou,He 1997,Dirichlet boundary)
112  static void BFIC_VelocityNorth_21(MF::Database::Node * pNode); // North Velocity
113  static MF::Database::Vec4<double> VRBFIC_VelocityNorth_21(const MF::Database::Node *pNode); // V and Rho LB for North Velocity
114  static void BFIC_VelocitySouth_22(MF::Database::Node * pNode); // South Velocity
115  static MF::Database::Vec4<double> VRBFIC_VelocitySouth_22(const MF::Database::Node *pNode); // V and Rho LB for South Velocity
116  static void BFIC_VelocityEast_23(MF::Database::Node * pNode); // East Velocity
117  static MF::Database::Vec4<double> VRBFIC_VelocityEast_23(const MF::Database::Node *pNode); // V and Rho LB for East Velocity
118  static void BFIC_VelocityWest_24(MF::Database::Node * pNode); // West Velocity
119  static MF::Database::Vec4<double> VRBFIC_VelocityWest_24(const MF::Database::Node *pNode); // V and Rho LB for West Velocity
120  static void BFIC_VelocityBottom_25(MF::Database::Node * pNode); // Bottom Velocity
121  static MF::Database::Vec4<double> VRBFIC_VelocityBottom_25(const MF::Database::Node *pNode); // V and Rho LB for Bottom Velocity
122  static void BFIC_VelocityTop_26(MF::Database::Node * pNode); // Top Velocity
123  static MF::Database::Vec4<double> VRBFIC_VelocityTop_26(const MF::Database::Node *pNode); // V and Rho LB for Top Velocity
124 
125 // Pressure, Neumann type, Hecht and Harting (2010) for D3Q19, own derivation
126  static void BFIC_PressureNorth_31(MF::Database::Node * pNode); // North Pressure
127  static MF::Database::Vec4<double> VRBFIC_PressureNorth_31(const MF::Database::Node *pNode); // V and Rho LB for North Pressure
128  static void BFIC_PressureSouth_32(MF::Database::Node * pNode); // South Pressure
129  static MF::Database::Vec4<double> VRBFIC_PressureSouth_32(const MF::Database::Node *pNode); // V and Rho LB for South Pressure
130  static void BFIC_PressureEast_33(MF::Database::Node * pNode); // East Pressure
131  static MF::Database::Vec4<double> VRBFIC_PressureEast_33(const MF::Database::Node *pNode); // V and Rho LB for East Pressure
132  static void BFIC_PressureWest_34(MF::Database::Node * pNode); // West Pressure
133  static MF::Database::Vec4<double> VRBFIC_PressureWest_34(const MF::Database::Node *pNode); // V and Rho LB for West Pressure
134  static void BFIC_PressureBottom_35(MF::Database::Node * pNode); // Bottom Pressure
135  static MF::Database::Vec4<double> VRBFIC_PressureBottom_35(const MF::Database::Node *pNode); // V and Rho LB for Bottom Pressure
136  static void BFIC_PressureTop_36(MF::Database::Node * pNode); // Top pressure
137  static MF::Database::Vec4<double> VRBFIC_PressureTop_36(const MF::Database::Node *pNode); // V and Rho LB for Top pressure
138  };
139 
140  } /* namespace Solver_CPU */
141 } /* namespace MF */
142 
143 
static std::shared_ptr< MF::Solver_CPU::CaseParameters > m_CaseParameters_Ptr
Basic data structure for storing f(i) data for each computational grid node.
Definition: Node.h:26
static std::shared_ptr< MF::GU::LatticeParametersD3Q19 > m_LatticeParameters_Ptr
static void Initialize(const std::shared_ptr< MF::Solver_CPU::CaseParameters > &CaseParameters_Ptr, const std::shared_ptr< MF::GU::LatticeParametersD3Q19 > &LatticeParameters_Ptr)
static void SetBoundaryNodePointerToFunc(const std::shared_ptr< MF::Database::ThreadArray > &ThreadArray_Ptr)
Sets the pointer to the function that performs calculations for the edge node (Thread.h -> its_pBoundaryFunction).
The BoundaryFunctions class stores the implementations of all boundary conditions with the distinctio...