Skip to content

Commit be42fae

Browse files
committed
Add enum WingType
1 parent 7c10d21 commit be42fae

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

docs/src/types.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CurrentModule = VortexStepMethod
44
## Enumerations
55
```@docs
66
Model
7+
WingType
78
AeroModel
89
PanelDistribution
910
InitialGammaDistribution

src/VortexStepMethod.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ Enumeration of the implemented model types.
7777
"""
7878
@enum Model VSM LLT
7979

80+
"""
81+
WingType `RECTANGULAR` `CURVED` `ELLIPTICAL`
82+
83+
Enumeration of the implemented wing types.
84+
85+
# Elements:
86+
- RECTANGULAR
87+
- CURVED
88+
- ELLIPTICAL
89+
"""
90+
@enum WingType RECTANGULAR CURVED ELLIPTICAL
91+
8092
"""
8193
AeroModel `LEI_AIRFOIL_BREUKELS` `POLAR_VECTORS` `POLAR_MATRICES` `INVISCID`
8294

src/body_aerodynamics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ function calculate_results(
547547
moment = reshape((cm_array .* 0.5 .* density .* v_a_array.^2 .* chord_array), :, 1)
548548

549549
# Calculate alpha corrections based on model type
550-
if aerodynamic_model_type === VSM
550+
if aerodynamic_model_type VSM
551551
update_effective_angle_of_attack!(
552552
alpha_corrected,
553553
body_aero,

src/panel.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function init_aero!(
121121
# Validate aero model consistency
122122
panel.aero_model = section_1.aero_model
123123
aero_model_2 = section_2.aero_model
124-
if !(panel.aero_model === aero_model_2)
124+
if !(panel.aero_model == aero_model_2)
125125
throw(ArgumentError("Both sections must have the same aero model, not $(panel.aero_model) and $aero_model_2"))
126126
end
127127

@@ -174,7 +174,7 @@ function init_aero!(
174174
throw(ArgumentError("Polar data in wrong format: $aero_1"))
175175
end
176176

177-
elseif !(panel.aero_model === INVISCID)
177+
elseif !(panel.aero_model == INVISCID)
178178
throw(ArgumentError("Unsupported aero model: $(panel.aero_model)"))
179179
end
180180
end

src/plotting.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
859859
is_show = true,
860860
use_tex = false
861861
)
862-
if body_aero.panels[1].aero_model === POLAR_MATRICES
862+
if body_aero.panels[1].aero_model == POLAR_MATRICES
863863
set_plot_style()
864864

865865
# Create figure with subplots

src/wing_geometry.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ Add a new section to the wing.
161161
"""
162162
function add_section!(wing::Wing, LE_point::Vector{Float64},
163163
TE_point::Vector{Float64}, aero_model::AeroModel, aero_data::AeroData=nothing)
164-
if aero_model === POLAR_VECTORS && wing.remove_nan
164+
if aero_model == POLAR_VECTORS && wing.remove_nan
165165
aero_data = remove_vector_nans(aero_data)
166-
elseif aero_model === POLAR_MATRICES && wing.remove_nan
166+
elseif aero_model == POLAR_MATRICES && wing.remove_nan
167167
interpolate_matrix_nans!.(aero_data[3:5])
168168
end
169169
push!(wing.sections, Section(LE_point, TE_point, aero_model, aero_data))
@@ -282,7 +282,7 @@ function calculate_new_aero_data(aero_model,
282282

283283
model_type = aero_model[section_index]
284284
model_type_2 = aero_model[section_index+1]
285-
if !(model_type === model_type_2)
285+
if !(model_type == model_type_2)
286286
throw(ArgumentError("Different aero models over the span are not supported"))
287287
end
288288

@@ -326,7 +326,7 @@ function calculate_new_aero_data(aero_model,
326326
return (alpha_left, delta_left, CL_data, CD_data, CM_data)
327327
end
328328

329-
elseif model_type === LEI_AIRFOIL_BREUKELS
329+
elseif model_type == LEI_AIRFOIL_BREUKELS
330330
tube_diameter_left = aero_data[section_index][1]
331331
tube_diameter_right = aero_data[section_index + 1][1]
332332
tube_diameter_i = tube_diameter_left * left_weight + tube_diameter_right * right_weight
@@ -462,7 +462,7 @@ function refine_mesh_for_linear_cosine_distribution!(
462462
end
463463

464464
# Apply van Garrel distribution if requested
465-
if spanwise_panel_distribution === :cosine_van_Garrel
465+
if spanwise_panel_distribution == COSINE_VAN_GARREL
466466
idx = calculate_cosine_van_Garrel!(wing, idx)
467467
end
468468

test/test_body_aerodynamics.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ end
253253
@test wing.sections[1].TE_point [0.0, 0.0, -3.0]
254254
end
255255

256-
function create_geometry(; model=VSM, wing_type=:rectangular, plotting=false, N=40)
256+
function create_geometry(; model=VSM, wing_type=RECTANGULAR, plotting=false, N=40)
257257
max_chord = 1.0
258258
span = 17.0
259259
AR = span^2 /* span * max_chord / 4)
@@ -262,7 +262,7 @@ end
262262
aoa = 5.7106 * π / 180
263263
v_a = [cos(aoa), 0.0, sin(aoa)] .* v_a
264264

265-
coord = if wing_type === :rectangular
265+
coord = if wing_type == RECTANGULAR
266266
theta = range(-0.5, 0.5, length=N)
267267
beta = range(-2, 2, length=N)
268268
generate_coordinates_rect_wing(
@@ -273,14 +273,12 @@ end
273273
N,
274274
"lin"
275275
)
276-
elseif wing_type === :curved
276+
elseif wing_type == CURVED
277277
generate_coordinates_curved_wing(
278278
max_chord, span, π/4, 5, N, "cos"
279279
)
280-
elseif wing_type === :elliptical
280+
elseif wing_type == ELLIPTICAL
281281
generate_coordinates_el_wing(max_chord, span, N, "cos")
282-
else
283-
error("Invalid wing type")
284282
end
285283

286284
coord_left_to_right = flip_created_coord_in_pairs(deepcopy(coord))
@@ -301,7 +299,7 @@ end
301299

302300
for model in [VSM, LLT]
303301
@debug "model: $model"
304-
for wing_type in [:rectangular, :curved, :elliptical]
302+
for wing_type in [RECTANGULAR, CURVED, ELLIPTICAL]
305303
@debug "wing_type: $wing_type"
306304
body_aero, coord, v_a, model = create_geometry(
307305
model=model, wing_type=wing_type

0 commit comments

Comments
 (0)