Skip to content

Commit ede1bca

Browse files
authored
Change names, tests pass (#122)
1 parent 343f6e7 commit ede1bca

File tree

11 files changed

+63
-63
lines changed

11 files changed

+63
-63
lines changed

examples/ram_air_kite.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ body_aero = BodyAerodynamics([wing];)
1212

1313
if DEFORM
1414
alpha = [deg2rad(10), 0]
15-
beta = [deg2rad(10), 0]
16-
@time VortexStepMethod.deform!(wing, alpha, beta; width=1.0)
15+
delta = [deg2rad(10), 0]
16+
@time VortexStepMethod.deform!(wing, alpha, delta; width=1.0)
1717
@time VortexStepMethod.init!(body_aero)
1818
end
1919

@@ -62,7 +62,7 @@ PLOT && plot_distribution(
6262
[body_y_coordinates],
6363
[results],
6464
["VSM"];
65-
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_beta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))",
65+
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))",
6666
data_type=".pdf",
6767
is_save=false,
6868
is_show=true,

examples/stall_model.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ PLOT && plot_distribution(
9191
[CAD_y_coordinates, CAD_y_coordinates],
9292
[results, results_with_stall],
9393
["VSM", "VSM with stall correction"];
94-
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_beta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))",
94+
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_delta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_v_a_$(round(v_a, digits=1))",
9595
data_type=".pdf",
9696
save_path=joinpath(save_folder, "spanwise_distributions"),
9797
is_save=false,

src/VortexStepMethod.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ Enumeration of the implemented aerodynamic models. See also: [AeroData](@ref)
8383
# Elements
8484
- `LEI_AIRFOIL_BREUKELS`: Polynom approximation for leading edge inflatable kites
8585
- `POLAR_VECTORS`: Polar vectors as function of alpha (lookup tables with interpolation)
86-
- `POLAR_MATRICES`: Polar matrices as function of alpha and beta (lookup tables with interpolation)
86+
- `POLAR_MATRICES`: Polar matrices as function of alpha and delta (lookup tables with interpolation)
8787
- INVISCID
8888
89-
where `alpha` is the angle of attack, `beta` is trailing edge angle.
89+
where `alpha` is the angle of attack, `delta` is trailing edge angle.
9090
"""
9191
@enum AeroModel begin
9292
LEI_AIRFOIL_BREUKELS
@@ -153,9 +153,9 @@ Union of different definitions of the aerodynamic properties of a wing section.
153153
- nothing for INVISCID
154154
- (`tube_diameter`, camber) for `LEI_AIRFOIL_BREUKELS`
155155
- (`alpha_range`, `cl_vector`, `cd_vector`, `cm_vector`) for `POLAR_VECTORS`
156-
- (`alpha_range`, `beta_range`, `cl_matrix`, `cd_matrix`, `cm_matrix`) for `POLAR_MATRICES`
156+
- (`alpha_range`, `delta_range`, `cl_matrix`, `cd_matrix`, `cm_matrix`) for `POLAR_MATRICES`
157157
158-
where `alpha` is the angle of attack [rad], `beta` is trailing edge angle [rad], `cl` the lift coefficient,
158+
where `alpha` is the angle of attack [rad], `delta` is trailing edge angle [rad], `cl` the lift coefficient,
159159
`cd` the drag coefficient and `cm` the pitching moment coefficient. The camber of a kite refers to
160160
the curvature of its airfoil shape. The camber is typically measured as the maximum distance
161161
between the mean camber line (the line equidistant from the upper and lower surfaces)

src/body_aerodynamics.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ function init!(body_aero::BodyAerodynamics;
113113
# Create panels
114114
for i in 1:wing.n_panels
115115
if wing isa RamAirWing
116-
beta = wing.beta_dist[i]
116+
delta = wing.delta_dist[i]
117117
else
118-
beta = 0.0
118+
delta = 0.0
119119
end
120120
init!(
121121
body_aero.panels[idx],
@@ -128,7 +128,7 @@ function init!(body_aero::BodyAerodynamics;
128128
panel_props.x_airf[i],
129129
panel_props.y_airf[i],
130130
panel_props.z_airf[i],
131-
beta;
131+
delta;
132132
remove_nan=wing.remove_nan
133133
)
134134
idx += 1

src/kite_geometry.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ mutable struct RamAirWing <: AbstractWing
338338
te_interp::NTuple{3, Extrapolation}
339339
area_interp::Extrapolation
340340
alpha_dist::Vector{Float64}
341-
beta_dist::Vector{Float64}
341+
delta_dist::Vector{Float64}
342342
end
343343

344344
"""
@@ -401,7 +401,7 @@ function RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10
401401
end
402402

403403
@info "Loading polars and kite info from $polar_path and $info_path"
404-
(alpha_range, beta_range, cl_matrix::Matrix, cd_matrix::Matrix, cm_matrix::Matrix) = deserialize(polar_path)
404+
(alpha_range, delta_range, cl_matrix::Matrix, cd_matrix::Matrix, cm_matrix::Matrix) = deserialize(polar_path)
405405
if remove_nan
406406
interpolate_matrix_nans!(cl_matrix)
407407
interpolate_matrix_nans!(cd_matrix)
@@ -414,7 +414,7 @@ function RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10
414414
# Create sections
415415
sections = Section[]
416416
for gamma in range(-gamma_tip, gamma_tip, n_sections)
417-
aero_data = (collect(alpha_range), collect(beta_range), cl_matrix, cd_matrix, cm_matrix)
417+
aero_data = (collect(alpha_range), collect(delta_range), cl_matrix, cd_matrix, cm_matrix)
418418
LE_point = [le_interp[i](gamma) for i in 1:3]
419419
TE_point = [te_interp[i](gamma) for i in 1:3]
420420
push!(sections, Section(LE_point, TE_point, POLAR_MATRICES, aero_data))
@@ -426,20 +426,20 @@ function RamAirWing(obj_path, dat_path; alpha=0.0, crease_frac=0.75, wind_vel=10
426426
end
427427

428428
"""
429-
deform!(wing::RamAirWing, alphas::AbstractVector, betas::AbstractVector; width)
429+
deform!(wing::RamAirWing, alphas::AbstractVector, deltas::AbstractVector; width)
430430
431-
Deform wing by applying left and right alpha and beta.
431+
Deform wing by applying left and right alpha and delta.
432432
433433
# Arguments
434434
- `wing`: RamAirWing to deform
435435
- `alphas`: [left, right] the angle between of the kite and the body x-axis in radians
436-
- `betas`: [left, right] the deformation of the trailing edges
436+
- `deltas`: [left, right] the deformation of the trailing edges
437437
- `width`: Transition width in meters to smoothe out the transition from left to right deformation
438438
439439
# Effects
440440
Updates wing.sections with deformed geometry
441441
"""
442-
function deform!(wing::RamAirWing, alphas::AbstractVector, betas::AbstractVector; width)
442+
function deform!(wing::RamAirWing, alphas::AbstractVector, deltas::AbstractVector; width)
443443
local_y = zeros(MVec3)
444444
chord = zeros(MVec3)
445445

@@ -452,12 +452,12 @@ function deform!(wing::RamAirWing, alphas::AbstractVector, betas::AbstractVector
452452
else
453453
alphas[1] * (1.0 - normalized_gamma) + alphas[2] * normalized_gamma
454454
end
455-
wing.beta_dist[i] = if normalized_gamma <= 0.0
456-
betas[1]
455+
wing.delta_dist[i] = if normalized_gamma <= 0.0
456+
deltas[1]
457457
elseif normalized_gamma >= 1.0
458-
betas[2]
458+
deltas[2]
459459
else
460-
betas[1] * (1.0 - normalized_gamma) + betas[2] * normalized_gamma
460+
deltas[1] * (1.0 - normalized_gamma) + deltas[2] * normalized_gamma
461461
end
462462

463463
section1 = wing.non_deformed_sections[i]

src/panel.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Represents a panel in a vortex step method simulation. All points and vectors ar
7070
SemiInfiniteFilament(),
7171
SemiInfiniteFilament()
7272
)
73-
beta::Float64 = 0.0
73+
delta::Float64 = 0.0
7474
end
7575

7676
function init_pos!(
@@ -84,7 +84,7 @@ function init_pos!(
8484
x_airf::PosVector,
8585
y_airf::PosVector,
8686
z_airf::PosVector,
87-
beta
87+
delta
8888
)
8989
# Initialize basic geometry
9090
panel.TE_point_1 .= section_1.TE_point
@@ -108,7 +108,7 @@ function init_pos!(
108108
panel.x_airf .= x_airf
109109
panel.y_airf .= y_airf
110110
panel.z_airf .= z_airf
111-
panel.beta = Float64(beta)
111+
panel.delta = Float64(delta)
112112
return nothing
113113
end
114114

@@ -157,19 +157,19 @@ function init_aero!(
157157

158158
elseif panel.aero_model == POLAR_MATRICES
159159
!all(isapprox.(aero_1[1], aero_2[1])) && @error "Make sure you use the same alpha range for all your interpolations."
160-
!all(isapprox.(aero_1[2], aero_2[2])) && @error "Make sure you use the same beta range for all your interpolations."
160+
!all(isapprox.(aero_1[2], aero_2[2])) && @error "Make sure you use the same delta range for all your interpolations."
161161

162162
polar_data = (
163163
Matrix{Float64}((aero_1[3] + aero_2[3]) / 2),
164164
Matrix{Float64}((aero_1[4] + aero_2[4]) / 2),
165165
Matrix{Float64}((aero_1[5] + aero_2[5]) / 2)
166166
)
167167
alphas = Vector{Float64}(aero_1[1])
168-
betas = Vector{Float64}(aero_1[2])
168+
deltas = Vector{Float64}(aero_1[2])
169169

170-
panel.cl_interp = linear_interpolation((alphas, betas), polar_data[1]; extrapolation_bc)
171-
panel.cd_interp = linear_interpolation((alphas, betas), polar_data[2]; extrapolation_bc)
172-
panel.cm_interp = linear_interpolation((alphas, betas), polar_data[3]; extrapolation_bc)
170+
panel.cl_interp = linear_interpolation((alphas, deltas), polar_data[1]; extrapolation_bc)
171+
panel.cd_interp = linear_interpolation((alphas, deltas), polar_data[2]; extrapolation_bc)
172+
panel.cm_interp = linear_interpolation((alphas, deltas), polar_data[3]; extrapolation_bc)
173173
else
174174
throw(ArgumentError("Polar data in wrong format: $aero_1"))
175175
end
@@ -190,12 +190,12 @@ function init!(
190190
x_airf::PosVector,
191191
y_airf::PosVector,
192192
z_airf::PosVector,
193-
beta;
193+
delta;
194194
init_aero = true,
195195
remove_nan = true
196196
)
197197
init_pos!(panel, section_1, section_2, aero_center, control_point, bound_point_1, bound_point_2,
198-
x_airf, y_airf, z_airf, beta)
198+
x_airf, y_airf, z_airf, delta)
199199
init_aero && init_aero!(panel, section_1, section_2; remove_nan)
200200
return nothing
201201
end
@@ -331,7 +331,7 @@ function calculate_cl(panel::Panel, alpha::Float64)::Float64
331331
elseif panel.aero_model == POLAR_VECTORS
332332
cl = panel.cl_interp(alpha)::Float64
333333
elseif panel.aero_model == POLAR_MATRICES
334-
cl = panel.cl_interp(alpha, panel.beta)::Float64
334+
cl = panel.cl_interp(alpha, panel.delta)::Float64
335335
else
336336
throw(ArgumentError("Unsupported aero model: $(panel.aero_model)"))
337337
end
@@ -356,8 +356,8 @@ function calculate_cd_cm(panel::Panel, alpha::Float64)
356356
cd = panel.cd_interp(alpha)::Float64
357357
cm = panel.cm_interp(alpha)::Float64
358358
elseif panel.aero_model == POLAR_MATRICES
359-
cd = panel.cd_interp(alpha, panel.beta)::Float64
360-
cm = panel.cm_interp(alpha, panel.beta)::Float64
359+
cd = panel.cd_interp(alpha, panel.delta)::Float64
360+
cm = panel.cm_interp(alpha, panel.delta)::Float64
361361
elseif !(panel.aero_model == INVISCID)
362362
throw(ArgumentError("Unsupported aero model: $(panel.aero_model)"))
363363
end

src/plotting.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -839,23 +839,23 @@ function VortexStepMethod.plot_polars(
839839
end
840840

841841
"""
842-
plot_polar_data(body_aero::BodyAerodynamics; alphas=collect(deg2rad.(-5:0.3:25)), beta_tes=collect(deg2rad.(-5:0.3:25)))
842+
plot_polar_data(body_aero::BodyAerodynamics; alphas=collect(deg2rad.(-5:0.3:25)), delta_tes=collect(deg2rad.(-5:0.3:25)))
843843
844-
Plot polar data (Cl, Cd, Cm) as 3D surfaces against alpha and beta_te angles. Beta_te is the trailing edge deflection angle
844+
Plot polar data (Cl, Cd, Cm) as 3D surfaces against alpha and delta_te angles. delta_te is the trailing edge deflection angle
845845
relative to the 2d airfoil or panel chord line.
846846
847847
# Arguments
848848
- `body_aero`: Wing aerodynamics struct
849849
850850
# Keyword arguments
851851
- `alphas`: Range of angle of attack values in radians (default: -5° to 25° in 0.3° steps)
852-
- `beta_tes`: Range of trailing edge angles in radians (default: -5° to 25° in 0.3° steps)
852+
- `delta_tes`: Range of trailing edge angles in radians (default: -5° to 25° in 0.3° steps)
853853
- `is_show`: Whether to display plots (default: true)
854854
- `use_tex`: if the external `pdflatex` command shall be used
855855
"""
856856
function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
857857
alphas=collect(deg2rad.(-5:0.3:25)),
858-
beta_tes = collect(deg2rad.(-5:0.3:25)),
858+
delta_tes = collect(deg2rad.(-5:0.3:25)),
859859
is_show = true,
860860
use_tex = false
861861
)
@@ -877,10 +877,10 @@ function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
877877
ax = fig.add_subplot(1, 3, idx, projection="3d")
878878

879879
# Create interpolation matrix
880-
interp_matrix = zeros(length(alphas), length(beta_tes))
881-
interp_matrix .= [interp(alpha, beta_te) for alpha in alphas, beta_te in beta_tes]
882-
X = collect(beta_tes) .+ zeros(length(alphas))'
883-
Y = collect(alphas)' .+ zeros(length(beta_tes))
880+
interp_matrix = zeros(length(alphas), length(delta_tes))
881+
interp_matrix .= [interp(alpha, delta_te) for alpha in alphas, delta_te in delta_tes]
882+
X = collect(delta_tes) .+ zeros(length(alphas))'
883+
Y = collect(alphas)' .+ zeros(length(delta_tes))
884884

885885
# Plot surface
886886
ax.plot_wireframe(X, Y, interp_matrix,
@@ -891,10 +891,10 @@ function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
891891
alpha=0.6)
892892

893893
# Set labels and title
894-
ax.set_xlabel(L"$\beta$ [rad]")
894+
ax.set_xlabel(L"$\delta$ [rad]")
895895
ax.set_ylabel(L"$\alpha$ [rad]")
896896
ax.set_zlabel(label)
897-
ax.set_title(label * L" vs $\alpha$ and $\beta$")
897+
ax.set_title(label * L" vs $\alpha$ and $\delta$")
898898
ax.grid(true)
899899
end
900900

src/wing_geometry.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,20 +310,20 @@ function calculate_new_aero_data(aero_model,
310310
return (alpha_left, CL_data, CD_data, CM_data)
311311

312312
elseif model_type == POLAR_MATRICES
313-
alpha_left, beta_left, CL_left, CD_left, CM_left = polar_left
314-
alpha_right, beta_right, CL_right, CD_right, CM_right = polar_right
313+
alpha_left, delta_left, CL_left, CD_left, CM_left = polar_left
314+
alpha_right, delta_right, CL_right, CD_right, CM_right = polar_right
315315

316316
# Create common alpha array
317317
!all(isapprox.(alpha_left, alpha_right)) && @error "Make sure you use the same alpha range for all your interpolations."
318-
!all(isapprox.(beta_left, beta_right)) && @error "Make sure you use the same alpha range for all your interpolations."
319-
!isa(CL_right, AbstractMatrix) && @error "Provide polar data in the correct format: (alpha, beta, cl, cd, cm)"
318+
!all(isapprox.(delta_left, delta_right)) && @error "Make sure you use the same alpha range for all your interpolations."
319+
!isa(CL_right, AbstractMatrix) && @error "Provide polar data in the correct format: (alpha, delta, cl, cd, cm)"
320320

321321
# Weighted interpolation
322322
CL_data = CL_left .* left_weight .+ CL_right .* right_weight
323323
CD_data = CD_left .* left_weight .+ CD_right .* right_weight
324324
CM_data = CM_left .* left_weight .+ CM_right .* right_weight
325325

326-
return (alpha_left, beta_left, CL_data, CD_data, CM_data)
326+
return (alpha_left, delta_left, CL_data, CD_data, CM_data)
327327
end
328328

329329
elseif model_type === LEI_AIRFOIL_BREUKELS

test/test_body_aerodynamics.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ end
262262
v_a = [cos(aoa), 0.0, sin(aoa)] .* v_a
263263

264264
coord = if wing_type === :rectangular
265-
twist = range(-0.5, 0.5, length=N)
265+
theta = range(-0.5, 0.5, length=N)
266266
beta = range(-2, 2, length=N)
267267
generate_coordinates_rect_wing(
268268
fill(max_chord, N),
269269
span,
270-
twist,
270+
theta,
271271
beta,
272272
N,
273273
"lin"

test/test_wing_geometry.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ end
7070

7171
# Create matrix data with NaNs
7272
alpha = collect(range(-10, 10, 21))
73-
beta = collect(range(-5, 5, 11))
74-
cl = [cos(a) * cos(b) for a in alpha, b in beta]
75-
cd = [sin(a) * sin(b) for a in alpha, b in beta]
73+
delta = collect(range(-5, 5, 11))
74+
cl = [cos(a) * cos(b) for a in alpha, b in delta]
75+
cd = [sin(a) * sin(b) for a in alpha, b in delta]
7676
cm = zeros(21, 11)
7777

7878
# Insert NaNs at various positions
7979
cl[5,3] = NaN
8080
cd[10,5] = NaN
8181
cm[15,7] = NaN
8282

83-
aero_data = (alpha, beta, cl, cd, cm)
83+
aero_data = (alpha, delta, cl, cd, cm)
8484
add_section!(wing, [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], POLAR_MATRICES, aero_data)
8585

8686
# Check if NaNs were removed consistently
@@ -89,7 +89,7 @@ end
8989
@test !any(isnan, cleaned_data[4]) # cd
9090
@test !any(isnan, cleaned_data[5]) # cm
9191
@test all(diff(cleaned_data[1]) .> 0) # alpha still monotonic
92-
@test all(diff(cleaned_data[2]) .> 0) # beta still monotonic
92+
@test all(diff(cleaned_data[2]) .> 0) # delta still monotonic
9393
end
9494

9595
@testset "Robustness left to right" begin

0 commit comments

Comments
 (0)