@@ -8,17 +8,49 @@ using Plots
88# Create wing geometry
99wing = KiteWing (" data/HL5_ram_air_kite_body.obj" )
1010
11- alphas = - 10 : 1 : 25 # Range of angles from -10 to 25 degrees
11+ alphas = deg2rad .( - 10 : 1 : 25 ) # Range of angles from -10 to 25 degrees
1212polars = zeros (length (alphas), 4 ) # Matrix for [alpha, CD, CL, CM]
1313for (i, alpha) in enumerate (alphas)
1414 # Simplified aerodynamic coefficients
1515 cd = 0.015 + 0.015 * abs (alpha/ 10 )^ 1.5 # Drag increases with angle
16- cl = 0.1 * alpha + 0.01 * alpha^ 2 * exp (- alpha/ 20 ) # Lift with stall behavior
16+ cl = 5.0 * alpha + 0.01 * alpha^ 2 * exp (- alpha/ 20 ) # Lift with stall behavior
1717 cm = - 0.02 * alpha # Linear pitching moment
1818
1919 polars[i, :] .= [alpha, cd, cl, cm]
2020end
2121
22+ # Plot polars directly
23+ p = plot (layout= (2 ,2 ), size= (1000 ,1000 ))
24+
25+ # CL vs alpha
26+ plot! (p[1 ], rad2deg .(polars[:,1 ]), polars[:,3 ],
27+ label= " CL" ,
28+ xlabel= " Angle of Attack [deg]" ,
29+ ylabel= " CL" ,
30+ title= " Lift Coefficient" )
31+
32+ # CD vs alpha
33+ plot! (p[2 ], rad2deg .(polars[:,1 ]), polars[:,2 ],
34+ label= " CD" ,
35+ xlabel= " Angle of Attack [deg]" ,
36+ ylabel= " CD" ,
37+ title= " Drag Coefficient" )
38+
39+ # CM vs alpha
40+ plot! (p[3 ], rad2deg .(polars[:,1 ]), polars[:,4 ],
41+ label= " CM" ,
42+ xlabel= " Angle of Attack [deg]" ,
43+ ylabel= " CM" ,
44+ title= " Moment Coefficient" )
45+
46+ # CL vs CD
47+ plot! (p[4 ], polars[:,2 ], polars[:,3 ],
48+ label= " Polar" ,
49+ xlabel= " CD" ,
50+ ylabel= " CL" ,
51+ title= " Lift-Drag Polar" )
52+ display (p)
53+
2254for gamma in range (wing. gamma_tip - wing. gamma_tip/ 10 , - wing. gamma_tip + wing. gamma_tip/ 10 , 20 )
2355 add_section! (wing, gamma, (" polar_data" , polars))
2456end
@@ -36,7 +68,7 @@ VSM_with_stall_correction = Solver(
3668
3769# Setting velocity conditions
3870Umag = 15.0
39- aoa = 17 .0
71+ aoa = 15 .0
4072side_slip = 0.0
4173yaw_rate = 0.0
4274aoa_rad = deg2rad (aoa)
@@ -47,64 +79,49 @@ vel_app = [
4779] * Umag
4880wing_aero. va = vel_app
4981
50- # # Plotting geometry
51- # plot_geometry(
52- # wing_aero,
53- # "";
54- # data_type=".svg",
55- # save_path="",
56- # is_save=false,
57- # is_show=true,
58- # view_elevation=15,
59- # view_azimuth=-120
60- # )
82+ # Plotting geometry
83+ plot_geometry (
84+ wing_aero,
85+ " " ;
86+ data_type= " .svg" ,
87+ save_path= " " ,
88+ is_save= false ,
89+ is_show= true ,
90+ view_elevation= 15 ,
91+ view_azimuth= - 120
92+ )
6193
6294# Solving and plotting distributions
63- results = solve (VSM, wing_aero)
64- @time results_with_stall = solve (VSM_with_stall_correction, wing_aero)
95+ @time results = solve (VSM, wing_aero)
6596@time results_with_stall = solve (VSM_with_stall_correction, wing_aero)
6697
67- # CAD_y_coordinates = [panel.aerodynamic_center[2] for panel in wing_aero.panels]
98+ CAD_y_coordinates = [panel. aerodynamic_center[2 ] for panel in wing_aero. panels]
6899
69- # plot_distribution(
70- # [CAD_y_coordinates, CAD_y_coordinates],
71- # [results, results_with_stall],
72- # ["VSM", "VSM with stall correction"];
73- # title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_beta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_Umag_$(round(Umag, digits=1))",
74- # data_type=".pdf",
75- # save_path=joinpath(save_folder, "spanwise_distributions"),
76- # is_save=false,
77- # is_show=true
78- # )
79-
80- # # Plotting polar
81- # save_path = joinpath(root_dir, "results", "TUD_V3_LEI_KITE")
82- # path_cfd_lebesque = joinpath(
83- # root_dir,
84- # "data",
85- # "TUDELFT_V3_LEI_KITE",
86- # "literature_results",
87- # "V3_CL_CD_RANS_Lebesque_2024_Rey_300e4.csv"
88- # )
100+ plot_distribution (
101+ [CAD_y_coordinates, CAD_y_coordinates],
102+ [results, results_with_stall],
103+ [" VSM" , " VSM with stall correction" ];
104+ title= " CAD_spanwise_distributions_alpha_$(round (aoa, digits= 1 )) _beta_$(round (side_slip, digits= 1 )) _yaw_$(round (yaw_rate, digits= 1 )) _Umag_$(round (Umag, digits= 1 )) " ,
105+ data_type= " .pdf" ,
106+ is_save= false ,
107+ is_show= true
108+ )
89109
90- # plot_polars(
91- # [VSM, VSM_with_stall_correction],
92- # [wing_aero, wing_aero],
93- # [
94- # "VSM CAD 19ribs",
95- # "VSM CAD 19ribs , with stall correction",
96- # "CFD_Lebesque Rey 30e5"
97- # ];
98- # literature_path_list=[path_cfd_lebesque],
99- # angle_range=range(0, 25, length=25),
100- # angle_type="angle_of_attack",
101- # angle_of_attack=0,
102- # side_slip=0,
103- # yaw_rate=0,
104- # Umag=10,
105- # title="tutorial_testing_stall_model_n_panels_$(n_panels)_distribution_$(spanwise_panel_distribution)",
106- # data_type=".pdf",
107- # save_path=joinpath(save_folder, "polars"),
108- # is_save=true,
109- # is_show=true
110- # )
110+ plot_polars (
111+ [VSM, VSM_with_stall_correction],
112+ [wing_aero, wing_aero],
113+ [
114+ " VSM CAD 19ribs" ,
115+ " VSM CAD 19ribs , with stall correction" ,
116+ ];
117+ angle_range= range (0 , 25 , length= 25 ),
118+ angle_type= " angle_of_attack" ,
119+ angle_of_attack= 0 ,
120+ side_slip= 0 ,
121+ yaw_rate= 0 ,
122+ Umag= 10 ,
123+ title= " tutorial_testing_stall_model_n_panels_$(wing. n_panels) _distribution_$(wing. spanwise_panel_distribution) " ,
124+ data_type= " .pdf" ,
125+ is_save= false ,
126+ is_show= true
127+ )
0 commit comments