Skip to content

Commit 60ef204

Browse files
committed
#185 setting standard printing to false, adding literature results for V3 Kite, and adjusting plotting script to handle arbitrary column sorting of literature input
1 parent 420017d commit 60ef204

8 files changed

+164
-74
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
alpha,beta,CL,CD,CS,CMy
2+
1.02,0,0.2278625272194466,0.0490919571607997,-0.028991478200473,-0.0971304889257096
3+
4.02,0,0.4610104802890269,0.0516566817024969,-0.06116291297791359,-0.177995425157634
4+
7.02,0,0.6748642166054709,0.0643789856608573,-0.09170612013580448,-0.2399628564061313
5+
10.02,0,0.8685945393341531,0.0841781647387978,-0.12014981939630065,-0.2873743657009342
6+
13.02,0,1.042518829707241,0.1099699784207837,-0.14632493718395287,-0.3234126609849657
7+
15.02,0,1.147266423064987,0.1293063892392999,-0.16260131332214534,-0.3422906659660041
8+
17.02,0,1.248363457881334,0.1505397278170317,-0.17819835351371366,-0.3593648645427019
9+
19.02,0,1.340909392696446,0.172443901716702,-0.19275273990602687,-0.3729793258363525
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CL,CD,alpha,CS
2+
-0.133333333,0.0728,-3.98,0
3+
-0.066666667,0.0672,-2.98,0
4+
0.073015873,0.0552,-0.98,0
5+
0.225396825,0.051,1.02,0
6+
0.384126984,0.052,3.02,0
7+
0.46031746,0.0536,4.02,0
8+
0.536507937,0.06,5.02,0
9+
0.673015873,0.07,7.02,0
10+
0.803174603,0.075,9.02,0
11+
0.873015873,0.085,10.02,0
12+
0.93015873,0.09,11.02,0
13+
1.041269841,0.115,13.02,0
14+
1.146031746,0.135,15.02,0
15+
1.24,0.151,17.02,0
16+
1.342857143,0.171,19.02,0
17+
0.88,0.31,21.02,0
18+
0.91,0.34,23.02,0
19+
0.93,0.38,25.02,0
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
alpha,CL,CD,CL/CD,CS
2+
-12.0,-0.2382871512913027,0.10555351086138359,-2.2575009523295666,8.493387378390686e-14
3+
-11.0,-0.23078413996904473,0.10186112684362705,-2.265674326608765,6.616874649497016e-14
4+
-10.0,-0.22230140038021914,0.09806363640487119,-2.266909616347621,4.373272668096159e-14
5+
-9.0,-0.21585315982172304,0.0931590398953698,-2.317039334713575,2.739682786368477e-14
6+
-8.0,-0.20625706590216833,0.08814998331707347,-2.339842370250558,1.1046588689401156e-14
7+
-7.0,-0.1998343140258721,0.08290261953105998,-2.410470442987666,-2.389661935808156e-14
8+
-6.0,-0.18199775713691974,0.07765158375393942,-2.343773923705537,-3.872611350474041e-14
9+
-5.0,-0.14850648581010087,0.07109437185188841,-2.0888641666246923,-3.2393754503524565e-14
10+
-4.0,-0.10858858872468641,0.06522454108866148,-1.6648425103839215,-3.0271060429342046e-14
11+
-3.0,-0.06288342322853809,0.06000714503007155,-1.0479322620168838,-2.895668145826433e-14
12+
-2.0,-0.007429949914950523,0.055498453779690086,-0.13387670122207165,-3.2169539191587655e-14
13+
-1.0,0.05656004203302359,0.05159811771021331,1.0961648320327801,-3.44716398526909e-14
14+
0.0,0.12392449645064037,0.04839062569141725,2.5609194896733913,-3.597944298611074e-14
15+
1.0,0.19309362003485317,0.04593968204080192,4.203198878550238,-3.699581064093612e-14
16+
2.0,0.2625331911314792,0.044328371503610776,5.922464151657241,-3.6349856219703554e-14
17+
3.0,0.3323792213186091,0.04356996032047687,7.628632637574346,-3.6413469417385087e-14
18+
4.0,0.40297413442239444,0.04359394940688724,9.243808829092464,-3.773253515649088e-14
19+
5.0,0.4734826904404322,0.04438413803893367,10.667835658430365,-3.826806223929053e-14
20+
6.0,0.5430144326845379,0.04590240400649957,11.829760214903983,-4.0253505670851383e-14
21+
7.0,0.610689137470121,0.04806877475261435,12.704487281255428,-4.406262078692334e-14
22+
8.0,0.6758859112182876,0.05085291168580261,13.290997286336015,-4.723118897422392e-14
23+
9.0,0.7383699770457292,0.054242295408895566,13.612439729544315,-5.20455622927876e-14
24+
10.0,0.7982179068869607,0.05807229829781809,13.74524395079696,-5.5385868816441935e-14
25+
11.0,0.8557802537306283,0.062209616690946774,13.756398114170796,-5.702371714996311e-14
26+
12.0,0.8988323082495834,0.0690977304744752,13.008130687904623,-6.141415623852904e-14
27+
13.0,0.9147135983203839,0.08124056010481986,11.259321663220728,6.491282774779828e-13
28+
14.0,0.9112748609115651,0.0966853408597458,9.425160554933385,4.54748749597064e-13
29+
15.0,0.9085348699441353,0.11140779158846578,8.155038862095148,3.3836985824286487e-13
30+
16.0,0.9062580847970818,0.1257712798490804,7.2056043787146695,2.6754981159878576e-13
31+
17.0,0.8882638215990443,0.13985252773614038,6.3514320118327126,4.0927876403191203e-13
32+
18.0,0.8801641114980264,0.15426592918480644,5.7054990440800015,2.5988028226070375e-13
33+
19.0,0.8799535802082414,0.16798064710830107,5.238422373982847,1.821903726884496e-13
34+
20.0,0.8812698509369349,0.18370556270697425,4.797186530179459,1.3007693874618696e-13
35+
21.0,0.871379428960392,0.198621428734149,4.387137050185641,5.975307998613411e-15
36+
22.0,0.8680573492907033,0.21572711063981947,4.023867685040394,-1.822880946847326e-15
37+
23.0,0.8639910136639356,0.23075669712075686,3.7441644140529626,-5.408316146275571e-16
38+
24.0,0.8613474653095494,0.24594284553183446,3.5022261511488364,-4.729369019706576e-15
39+
25.0,0.8583553232582976,0.2571571564052344,3.3378628666498424,-7.613518753563846e-15

data/TUDELFT_V3_KITE/literature_results/V3_CL_CD_RANS_Lebesque_2024_Rey_300e4.csv

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CL,CL_ci,CD,CD_ci,alpha
2+
-0.28023315356081796,0.011070533538875897,0.09785297775939765,0.012935829196785585,-11.568121157001665
3+
-0.2144913736143728,0.012287227041809052,0.06853577957407217,0.015525138484707877,-6.099059501611582
4+
-0.0007680391233001299,0.01068508564308875,0.04885867739007862,0.0076696455159627275,-1.9996385577164184
5+
0.07398995139159774,0.00953159417113588,0.05739081465627228,0.008889911090057321,-1.3348199670846914
6+
0.46519267467797903,0.009475707060472788,0.05616787766119728,0.009084810793467887,3.0810784665258444
7+
0.610180915884597,0.0045250228316688484,0.07431024337243476,0.004621689815286087,5.412846420261046
8+
0.7430356350927991,0.009465755795905533,0.08664306372317211,0.009633413459228232,7.350324457982788
9+
0.887298865863501,0.010638047578235603,0.10233695227784106,0.00900521264610847,9.382433604529174
10+
0.9255655151637727,0.014238431399063743,0.17599439630813363,0.01507120428946693,11.464425166301869
11+
0.9327251987983486,0.015877506028324398,0.18888674805756867,0.01693686866633114,12.461055790544702
12+
0.9512282813613351,0.014573344990978988,0.2127454401843595,0.018047053186439406,13.352348165878231
13+
0.9770715203611249,0.018103047941433924,0.22788683966364287,0.0204637541133525,14.540186234231973
14+
1.008562675819161,0.016658847313704747,0.24447585438450992,0.018378234971297258,16.225366370508798
15+
1.0681034642531901,0.0154900038338791,0.319919197381967,0.02298889264565519,18.29734623730859
16+
1.0099938012961718,0.015447658557709807,0.3573016324548397,0.015144711790384626,20.224692877134817
17+
0.9979635604848679,0.01181112128634061,0.4199851182071093,0.011605298627928523,23.03035435658158
18+
0.9749275179241531,0.01301729603627638,0.43498425522432616,0.012174929509637398,24.54119521035482

examples/V3_kite.jl

Lines changed: 63 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,83 +10,97 @@ yaw_rate = 0.0 # [rad/s] (not used in static analysis)
1010
air_density = 1.225 # [kg/m^3] Air density at sea level
1111
project_dir = dirname(dirname(pathof(VortexStepMethod))) # Go up one level from src to project root
1212
yaml_geometry_path = joinpath(project_dir, "data", "TUDELFT_V3_KITE", "geometry.yaml")
13+
literature_paths = [
14+
# joinpath(project_dir, "data", "TUDELFT_V3_KITE", "literature_results","CFD_RANS_Rey_5e5_Poland2025_alpha_sweep_beta_0_NoStruts.csv"),
15+
# joinpath(project_dir, "data", "TUDELFT_V3_KITE", "literature_results","CFD_RANS_Rey_10e5_Poland2025_alpha_sweep_beta_0.csv"),
16+
joinpath(project_dir, "data", "TUDELFT_V3_KITE", "literature_results","Python_VSM_Rey_5e5_Poland2025_alpha_sweep_beta_0.csv"),
17+
# joinpath(project_dir, "data", "TUDELFT_V3_KITE", "literature_results","WindTunnel_Re_5e5_Poland2025_alpha_sweep_beta_0.csv")
18+
]
19+
labels= [
20+
"VSM Julia",
21+
# "CFD RANS Re=5e5",
22+
# "CFD RANS Re=10e5",
23+
"Python VSM Re=5e5",
24+
# "Wind Tunnel Re=5e5"
25+
]
1326

14-
println("=== Static Aerodynamic Analysis (VSM) ===")
15-
println("Wind speed: $wind_speed m/s")
16-
println("Angle of attack: $angle_of_attack_deg deg")
17-
println("Sideslip: $sideslip_deg deg")
27+
# println("=== Static Aerodynamic Analysis (VSM) ===")
28+
# println("Wind speed: $wind_speed m/s")
29+
# println("Angle of attack: $angle_of_attack_deg deg")
30+
# println("Sideslip: $sideslip_deg deg")
1831

19-
# Create wing geometry from YAML (following RamAirWing pattern)
20-
wing = YamlWing(yaml_geometry_path; n_panels=20, spanwise_distribution=LINEAR)
32+
# Create wing, body_aero, and solver objects
33+
wing = YamlWing(yaml_geometry_path; n_panels=40, spanwise_distribution=LINEAR)
2134
body_aero = BodyAerodynamics([wing])
22-
23-
# --- Set apparent wind vector in body axes ---
24-
α = deg2rad(angle_of_attack_deg)
25-
β = deg2rad(sideslip_deg)
26-
va = wind_speed * [
27-
cos(α)*cos(β), # X_b (forward)
28-
sin(β), # Y_b (right)
29-
sin(α)*cos(β) # Z_b (down)
30-
]
31-
set_va!(body_aero, va)
32-
33-
# --- Create and run VSM solver ---
3435
solver = Solver(body_aero;
3536
aerodynamic_model_type=VSM,
3637
is_with_artificial_damping=false,
3738
rtol=1e-5,
3839
solver_type=NONLIN
3940
)
40-
results = VortexStepMethod.solve(solver, body_aero; log=true)
4141

4242
# Using plotting modules, to create more comprehensive plots
4343
PLOT = true
4444
USE_TEX = false
4545

4646

47-
# Plotting geometry
48-
PLOT && plot_geometry(
49-
body_aero,
50-
"";
51-
data_type=".svg",
52-
save_path="",
53-
is_save=false,
54-
is_show=true,
55-
view_elevation=15,
56-
view_azimuth=-120,
57-
use_tex=USE_TEX
58-
)
59-
6047
# Plotting polars
6148
PLOT && plot_polars(
6249
[solver],
6350
[body_aero],
64-
["V3 Kite"],
65-
angle_range=range(0, 25, length=20),
51+
labels,
52+
literature_path_list=literature_paths,
53+
angle_range=range(5, 10, length=2),
6654
angle_type="angle_of_attack",
67-
angle_of_attack=5,
68-
side_slip=0,
69-
v_a=10,
55+
angle_of_attack=angle_of_attack_deg,
56+
side_slip=sideslip_deg,
57+
v_a=wind_speed,
7058
title="$(wing.n_panels)_distribution_$(wing.spanwise_distribution)",
7159
data_type=".pdf",
7260
is_save=false,
7361
is_show=true,
7462
use_tex=USE_TEX
7563
)
7664

77-
# Plotting spanwise distributions
78-
body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels]
7965

80-
PLOT && plot_distribution(
81-
[body_y_coordinates],
82-
[results],
83-
["VSM"];
84-
title="CAD_spanwise_distributions_alpha_$(round(angle_of_attack_deg, digits=1))_delta_$(round(sideslip_deg, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(wind_speed, digits=1))",
85-
data_type=".pdf",
86-
is_save=false,
87-
is_show=true,
88-
use_tex=USE_TEX
89-
)
66+
# # Plotting geometry
67+
# --- Set apparent wind vector in body axes ---
68+
# α = deg2rad(angle_of_attack_deg)
69+
# β = deg2rad(sideslip_deg)
70+
# va = wind_speed * [
71+
# cos(α)*cos(β), # X_b (forward)
72+
# sin(β), # Y_b (right)
73+
# sin(α)*cos(β) # Z_b (down)
74+
# ]
75+
# set_va!(body_aero, va)
76+
77+
# results = VortexStepMethod.solve(solver, body_aero; log=true)
78+
# PLOT && plot_geometry(
79+
# body_aero,
80+
# "";
81+
# data_type=".svg",
82+
# save_path="",
83+
# is_save=false,
84+
# is_show=true,
85+
# view_elevation=15,
86+
# view_azimuth=-120,
87+
# use_tex=USE_TEX
88+
# )
89+
90+
91+
# # Plotting spanwise distributions
92+
# body_y_coordinates = [panel.aero_center[2] for panel in body_aero.panels]
93+
94+
# PLOT && plot_distribution(
95+
# [body_y_coordinates],
96+
# [results],
97+
# ["VSM"];
98+
# title="CAD_spanwise_distributions_alpha_$(round(angle_of_attack_deg, digits=1))_delta_$(round(sideslip_deg, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(wind_speed, digits=1))",
99+
# data_type=".pdf",
100+
# is_save=false,
101+
# is_show=true,
102+
# use_tex=USE_TEX
103+
# )
90104

91105

92106
nothing

src/plotting.jl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -645,15 +645,25 @@ function VortexStepMethod.plot_polars(
645645
# Update label with Reynolds number
646646
label_list[i] = "$(label_list[i]) Re = $(round(Int64, rey*1e-5))e5"
647647
end
648-
649648
# Load literature data if provided
650649
if !isempty(literature_path_list)
651650
for path in literature_path_list
652-
# Read all data first
653651
data = readdlm(path, ',')
654-
# Skip the header row by taking data from row 2 onwards
655-
data = data[2:end, :]
656-
push!(polar_data_list, [data[:, 3], data[:, 1], data[:, 2], zeros(length(data[:, 1]))])
652+
header = lowercase.(string.(data[1, :]))
653+
# Find column indices for alpha, CL, CD, CS (case-insensitive, allow common variants)
654+
alpha_idx = findfirst(x -> occursin("alpha", x), header)
655+
cl_idx = findfirst(x -> occursin("cl", x), header)
656+
cd_idx = findfirst(x -> occursin("cd", x), header)
657+
cs_idx = findfirst(x -> occursin("cs", x), header)
658+
# Fallback: if CS not found, fill with zeros
659+
cs_col = cs_idx === nothing ? zeros(size(data, 1)-1) : data[2:end, cs_idx]
660+
# Push as [alpha, CL, CD, CS]
661+
push!(polar_data_list, [
662+
data[2:end, alpha_idx],
663+
data[2:end, cl_idx],
664+
data[2:end, cd_idx],
665+
cs_col
666+
])
657667
end
658668
end
659669

src/yaml_geometry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function YamlWing(
211211
spanwise_distribution=LINEAR,
212212
spanwise_direction=[0.0, 1.0, 0.0],
213213
remove_nan=true,
214-
prn=true
214+
prn=false
215215
)
216216
!(n_panels % n_groups == 0) && throw(ArgumentError("Number of panels should be divisible by number of groups"))
217217
!isapprox(spanwise_direction, [0.0, 1.0, 0.0]) && throw(ArgumentError("Spanwise direction has to be [0.0, 1.0, 0.0], not $spanwise_direction"))

0 commit comments

Comments
 (0)