|
20 | 20 |
|
21 | 21 | @eval @everywhere using VortexStepMethod, Xfoil, Statistics, SharedArrays |
22 | 22 |
|
23 | | - alphas = -deg2rad(5):deg2rad(1.0):deg2rad(50) |
24 | | - # alphas = -1.0:1.0:1.0 |
25 | | - d_trailing_edge_angles = -deg2rad(5):deg2rad(1.0):deg2rad(50) |
26 | | - # d_trailing_edge_angles = -1.0:1.0:1.0 |
| 23 | + alphas = -deg2rad(5):deg2rad(1.0):deg2rad(20) |
| 24 | + d_trailing_edge_angles = -deg2rad(5):deg2rad(1.0):deg2rad(20) |
| 25 | + |
27 | 26 | cl_matrix = SharedArray{Float64}((length(alphas), length(d_trailing_edge_angles))) |
28 | 27 | cd_matrix = SharedArray{Float64}((length(alphas), length(d_trailing_edge_angles))) |
29 | 28 | cm_matrix = SharedArray{Float64}((length(alphas), length(d_trailing_edge_angles))) |
|
248 | 247 | end |
249 | 248 | return nothing |
250 | 249 | end |
| 250 | + |
| 251 | + function plot_values(alphas, d_trailing_edge_angles, matrix, interp, name) |
| 252 | + fig = plt.figure() |
| 253 | + ax = fig.add_subplot(projection="3d") |
| 254 | + |
| 255 | + X_data = collect(d_trailing_edge_angles) .+ zeros(length(alphas))' |
| 256 | + Y_data = collect(alphas)' .+ zeros(length(d_trailing_edge_angles)) |
| 257 | + |
| 258 | + interp_matrix = similar(matrix) |
| 259 | + int_alphas, int_d_trailing_edge_angles = alphas .+ deg2rad(0.5), d_trailing_edge_angles .+ deg2rad(0.5) |
| 260 | + interp_matrix .= [interp(alpha, d_trailing_edge_angle) for alpha in int_alphas, d_trailing_edge_angle in int_d_trailing_edge_angles] |
| 261 | + X_int = collect(int_d_trailing_edge_angles) .+ zeros(length(int_alphas))' |
| 262 | + Y_int = collect(int_alphas)' .+ zeros(length(int_d_trailing_edge_angles)) |
| 263 | + |
| 264 | + ax.plot_wireframe(X_data, Y_data, matrix, edgecolor="royalblue", lw=0.5, rstride=5, cstride=5, alpha=0.6) |
| 265 | + ax.plot_wireframe(X_int, Y_int, interp_matrix, edgecolor="orange", lw=0.5, rstride=5, cstride=5, alpha=0.6) |
| 266 | + plt.xlabel("Alpha") |
| 267 | + plt.ylabel("Flap angle") |
| 268 | + plt.zlabel("$name values") |
| 269 | + plt.title("$name for different d_flap and angle") |
| 270 | + plt.legend() |
| 271 | + plt.grid(true) |
| 272 | + plt.show() |
| 273 | + end |
251 | 274 |
|
252 | 275 | replace_nan!(cl_matrix) |
253 | 276 | replace_nan!(cd_matrix) |
|
256 | 279 | cl_interp = extrapolate(scale(interpolate(cl_matrix, BSpline(Linear())), alphas, d_trailing_edge_angles), NaN) |
257 | 280 | cd_interp = extrapolate(scale(interpolate(cd_matrix, BSpline(Linear())), alphas, d_trailing_edge_angles), NaN) |
258 | 281 | cm_interp = extrapolate(scale(interpolate(cm_matrix, BSpline(Linear())), alphas, d_trailing_edge_angles), NaN) |
| 282 | + |
| 283 | + plot_values(alphas, d_trailing_edge_angles, cl_matrix, cl_interp, "Cl") |
| 284 | + plot_values(alphas, d_trailing_edge_angles, cd_matrix, cd_interp, "Cd") |
| 285 | + plot_values(alphas, d_trailing_edge_angles, cm_matrix, cm_interp, "Cm") |
| 286 | + display(plot(alphas, cd_interp.(alphas, 0.0))) |
259 | 287 |
|
260 | | - @info "Relative trailing_edge height: $upper - $lower" |
| 288 | + @info "Relative trailing_edge height: $(upper - lower)" |
261 | 289 | @info "Reynolds number for flying speed of $kite_speed is $reynolds_number" |
262 | 290 |
|
263 | 291 | toc() |
|
0 commit comments