Skip to content

Commit d9667c4

Browse files
authored
Rm bin (#129)
* Remove test bin files * Fix range
1 parent dab4dbe commit d9667c4

7 files changed

Lines changed: 30 additions & 165656 deletions

File tree

scripts/polars.jl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ try
2424

2525
@eval @everywhere using VortexStepMethod, Xfoil, Statistics, SharedArrays
2626

27-
alphas = -deg2rad(5):deg2rad(1.0):deg2rad(20)
28-
d_trailing_edge_angles = -deg2rad(5):deg2rad(1.0):deg2rad(20)
27+
# alpha_range = deg2rad.(-5:1:20)
28+
# delta_range = deg2rad.(-5:1:20)
2929

30-
cl_matrix = SharedArray{Float64}((length(alphas), length(d_trailing_edge_angles)))
31-
cd_matrix = SharedArray{Float64}((length(alphas), length(d_trailing_edge_angles)))
32-
cm_matrix = SharedArray{Float64}((length(alphas), length(d_trailing_edge_angles)))
30+
cl_matrix = SharedArray{Float64}((length(alpha_range), length(delta_range)))
31+
cd_matrix = SharedArray{Float64}((length(alpha_range), length(delta_range)))
32+
cm_matrix = SharedArray{Float64}((length(alpha_range), length(delta_range)))
3333

3434
@everywhere begin
3535
function turn_trailing_edge!(angle, x, y, lower_turn, upper_turn, x_turn)
@@ -69,14 +69,14 @@ try
6969
nothing
7070
end
7171

72-
function solve_alpha!(cls, cds, cms, alphas, alpha_idxs, d_trailing_edge_angle, re, x_, y_, lower, upper, kite_speed, speed_of_sound, x_turn)
72+
function solve_alpha!(cls, cds, cms, alpha_range, alpha_idxs, delta, re, x_, y_, lower, upper, kite_speed, speed_of_sound, x_turn)
7373
x = deepcopy(x_)
7474
y = deepcopy(y_)
75-
turn_trailing_edge!(d_trailing_edge_angle, x, y, lower, upper, x_turn)
75+
turn_trailing_edge!(delta, x, y, lower, upper, x_turn)
7676
Xfoil.set_coordinates(x, y)
7777
x, y = Xfoil.pane(npan=140)
7878
reinit = true
79-
for (alpha, alpha_idx) in zip(alphas, alpha_idxs)
79+
for (alpha, alpha_idx) in zip(alpha_range, alpha_idxs)
8080
converged = false
8181
cl = 0.0
8282
cd = 0.0
@@ -92,18 +92,18 @@ try
9292
return nothing
9393
end
9494

95-
function run_solve_alpha(alphas, d_trailing_edge_angle, re, x_, y_, lower, upper, kite_speed, speed_of_sound, x_turn)
96-
@info "solving alpha with trailing edge angle: $(rad2deg(d_trailing_edge_angle)) degrees"
97-
cls = Float64[NaN for _ in alphas]
98-
cds = Float64[NaN for _ in alphas]
99-
cms = Float64[NaN for _ in alphas]
100-
neg_idxs = sort(findall(alphas .< 0.0), rev=true)
101-
neg_alphas = alphas[neg_idxs]
102-
pos_idxs = sort(findall(alphas .>= 0.0))
103-
pos_alphas = alphas[pos_idxs]
104-
solve_alpha!(cls, cds, cms, neg_alphas, neg_idxs, d_trailing_edge_angle,
95+
function run_solve_alpha(alpha_range, delta, re, x_, y_, lower, upper, kite_speed, speed_of_sound, x_turn)
96+
@info "solving alpha with trailing edge angle: $(rad2deg(delta)) degrees"
97+
cls = Float64[NaN for _ in alpha_range]
98+
cds = Float64[NaN for _ in alpha_range]
99+
cms = Float64[NaN for _ in alpha_range]
100+
neg_idxs = sort(findall(alpha_range .< 0.0), rev=true)
101+
neg_alpha_range = alpha_range[neg_idxs]
102+
pos_idxs = sort(findall(alpha_range .>= 0.0))
103+
pos_alpha_range = alpha_range[pos_idxs]
104+
solve_alpha!(cls, cds, cms, neg_alpha_range, neg_idxs, delta,
105105
re, x_, y_, lower, upper, kite_speed, speed_of_sound, x_turn)
106-
solve_alpha!(cls, cds, cms, pos_alphas, pos_idxs, d_trailing_edge_angle,
106+
solve_alpha!(cls, cds, cms, pos_alpha_range, pos_idxs, delta,
107107
re, x_, y_, lower, upper, kite_speed, speed_of_sound, x_turn)
108108
return cls, cds, cms
109109
end
@@ -163,8 +163,8 @@ try
163163
reynolds_number = $reynolds_number
164164
end
165165

166-
@sync @distributed for j in eachindex(d_trailing_edge_angles)
167-
cl_matrix[:, j], cd_matrix[:, j], cm_matrix[:, j] = run_solve_alpha(alphas, d_trailing_edge_angles[j],
166+
@sync @distributed for j in eachindex(delta_range)
167+
cl_matrix[:, j], cd_matrix[:, j], cm_matrix[:, j] = run_solve_alpha(alpha_range, delta_range[j],
168168
reynolds_number, x, y, lower, upper, kite_speed, SPEED_OF_SOUND, x_turn)
169169
end
170170
cl_matrix = Matrix{Float64}(cl_matrix)
@@ -181,7 +181,7 @@ try
181181
@info "Relative trailing_edge height: $(upper - lower)"
182182
@info "Reynolds number for flying speed of $kite_speed is $reynolds_number"
183183

184-
serialize(polar_path, (alphas, d_trailing_edge_angles, cl_matrix, cd_matrix, cm_matrix))
184+
serialize(polar_path, (alpha_range, delta_range, cl_matrix, cd_matrix, cm_matrix))
185185

186186
catch e
187187
@info "Removing processes"

src/kite_geometry.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,9 @@ Constructor for a [RamAirWing](@ref) that allows to use an `.obj` and a `.dat` f
367367
"""
368368
function RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10., mass=1.0,
369369
n_panels=54, n_sections=n_panels+1, spanwise_panel_distribution=UNCHANGED,
370-
spanwise_direction=[0.0, 1.0, 0.0], remove_nan=true)
370+
spanwise_direction=[0.0, 1.0, 0.0], remove_nan=true,
371+
alpha_range=deg2rad.(-5:1:20), delta_range=deg2rad.(-5:1:20)
372+
)
371373

372374
!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"))
373375

@@ -395,8 +397,8 @@ function RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10
395397
width = 2gamma_tip * radius
396398
area = area_interp(gamma_tip)
397399
@eval Main begin
398-
foil_path, polar_path, v_wind, area, width, x_turn =
399-
$dat_path, $polar_path, $wind_vel, $gamma_tip, $width, $crease_frac
400+
foil_path, polar_path, v_wind, area, width, x_turn, alpha_range, delta_range =
401+
$dat_path, $polar_path, $wind_vel, $gamma_tip, $width, $crease_frac, $alpha_range, $delta_range
400402
include(joinpath(dirname(@__FILE__), "../scripts/polars.jl"))
401403
end
402404
end

0 commit comments

Comments
 (0)