Repository navigation
Expand file tree
/
Copy pathSolverWrapper.py
More file actions
92 lines (73 loc) · 2.59 KB
/
Copy pathSolverWrapper.py
File metadata and controls
92 lines (73 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"""
Viscous and inviscid solvers
@Author: Guillermo Peña Martínez
@Date: 05/05/2023
"""
from LinearVortexPanelMethod.LinVortexBuilder import *
from ConstantVortexPanelMethod.ConstVortexSolver import *
from LinearVortexPanelMethod.ParamInit import *
from ViscousFlow.ViscBuilder import *
from Pfoil import *
from FileManager import *
def PfoilBuilder(GUIParameters):
"""
Generates the foil coordinates from file or from NACA expression.
"""
if GUIParameters.nPanels%2 == 0 and GUIParameters.model != 0:
GUIParameters.nPanels += 1 # odd pannels set
fromfile = GUIParameters.fromfile # foil from file flag
file = GUIParameters.foil_file # dat file directory
if not fromfile: # NACA generated airfoil
naca_foil = NacaFoil(foil_name=GUIParameters.nacafoil, model = GUIParameters.model)[2]
if GUIParameters.model == 0:
paneles, coords = panel_division_CVPM(
coord=naca_foil,
N=GUIParameters.nPanels,
foil_name=GUIParameters.nacafoil)
else:
paneles, coords = panel_division(
coord = naca_foil,
N=GUIParameters.nPanels,
foil_name=GUIParameters.nacafoil)
foil = Foil(coord=coords, N=GUIParameters.nPanels,
foil=GUIParameters.nacafoil)
foil.geom.panels = paneles
else:
file_coords = OpenFile(file)
if all(file_coords[1:20, 1] > 0):
file_coords = np.flip(file_coords,axis= 0)
paneles, coords = panel_division(
coord=file_coords,
N=GUIParameters.nPanels,
foil_name=GUIParameters.nacafoil)
foil = Foil(coord=coords, N=GUIParameters.nPanels,
foil=GUIParameters.nacafoil)
foil.geom.panels = paneles
foil.FoilInit() # Inicialización del perfil
foil.geom.nPoints = foil.N+1
return foil
def PfoilExe(Foil, GUIParameters):
"""
Executes the program
INPUT:
- GUIParameters : operating parameters introduced in the GUI
Three models:
- Model 0 : Constant Vortex Panel Method
- Model 1 : Linear Vortex Panel Method
- Model 2 : LVPM + Transpiration Method (viscous)
"""
Foil.oper.model = GUIParameters.model # model
Foil.oper.alpha = GUIParameters.alpha # angle of attack
Foil.oper.Re = GUIParameters.Re # Reynolds number
Foil.oper.Ma = GUIParameters.Mach # Mach
Sval(Foil) # spline length
build_term(Foil) # thermodynamics
if GUIParameters.model == 0:
CVPM_solver(Foil)
elif GUIParameters.model == 1:
LVSolver(Foil)
else:
ViscousSolver(Foil)
FolderDir(Foil) # creates a folder for the foil in case there's not already one
DataSave(Foil) # Excel file
return Foil