-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstall_model.jl
More file actions
104 lines (90 loc) · 2.48 KB
/
stall_model.jl
File metadata and controls
104 lines (90 loc) · 2.48 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
93
94
95
96
97
98
99
100
101
102
103
104
using Pkg
Pkg.activate(@__DIR__)
using GLMakie
using LinearAlgebra
using VortexStepMethod
using CSV
using DataFrames
PLOT = true
USE_TEX = false
# Find root directory
root_dir = dirname(@__DIR__)
save_folder = joinpath(root_dir, "results", "TUDELFT_V3_KITE")
mkpath(save_folder)
# Defining discretisation
n_panels = 54
spanwise_distribution = SPLIT_PROVIDED
# Load rib data from CSV
csv_file_path = joinpath(
root_dir,
"data",
"TUDELFT_V3_KITE",
"rib_list_from_CAD_LE_TE_and_surfplan_d_tube_camber_19ribs.csv"
)
df = CSV.read(csv_file_path, DataFrame)
rib_list = []
for row in eachrow(df)
LE = [row.LE_x, row.LE_y, row.LE_z]
TE = [row.TE_x, row.TE_y, row.TE_z]
push!(rib_list, (LE, TE, LEI_AIRFOIL_BREUKELS, (row.d_tube, row.camber)))
end
# Create wing geometry
# n_unrefined_sections will be automatically set to the number of ribs (18 sections)
CAD_wing = Wing(n_panels; spanwise_distribution)
for rib in rib_list
add_section!(CAD_wing, rib[1], rib[2], rib[3], rib[4])
end
refine!(CAD_wing)
body_aero = BodyAerodynamics([CAD_wing])
# Create solvers
vsm_solver = Solver(body_aero;
aerodynamic_model_type=VSM,
is_with_artificial_damping=false
)
VSM_with_stall_correction = Solver(body_aero;
aerodynamic_model_type=VSM,
is_with_artificial_damping=true
)
# Setting velocity conditions
v_a = 15.0
aoa = 17.0
side_slip = 0.0
yaw_rate = 0.0
aoa_rad = deg2rad(aoa)
vel_app = [
cos(aoa_rad) * cos(side_slip),
sin(side_slip),
sin(aoa_rad)
] * v_a
set_va!(body_aero, vel_app)
# Solve both configurations
results = solve(vsm_solver, body_aero)
@time results_with_stall = solve(VSM_with_stall_correction, body_aero)
@time results_with_stall = solve(VSM_with_stall_correction, body_aero)
# Setup literature data paths
path_cfd_lebesque = joinpath(
root_dir,
"data",
"TUDELFT_V3_KITE",
"literature_results",
"V3_CL_CD_RANS_Lebesque_2024_Rey_300e4.csv"
)
# Only include literature data if file exists
literature_paths = isfile(path_cfd_lebesque) ? [path_cfd_lebesque] : String[]
# Plot combined analysis
PLOT && plot_combined_analysis(
[vsm_solver, VSM_with_stall_correction],
[body_aero, body_aero],
[results, results_with_stall];
solver_label=["VSM", "VSM (with stall)"],
literature_path_list=literature_paths,
angle_range=range(0, 25, length=25),
angle_type="angle_of_attack",
angle_of_attack=aoa,
side_slip=side_slip,
v_a=v_a,
title="Stall Model Comparison",
is_show=true,
use_tex=USE_TEX
)
nothing