Skip to content

Commit 43836c7

Browse files
committed
replace Umag with v_a
1 parent ed80331 commit 43836c7

File tree

10 files changed

+49
-49
lines changed

10 files changed

+49
-49
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Apart from the wing geometry there is no input file yet, the input has to be def
8585
n_panels = 20 # Number of panels
8686
span = 20.0 # Wing span [m]
8787
chord = 1.0 # Chord length [m]
88-
Umag = 20.0 # Magnitude of inflow velocity [m/s]
88+
v_a = 20.0 # Magnitude of inflow velocity [m/s]
8989
density = 1.225 # Air density [kg/m³]
9090
alpha_deg = 30.0 # Angle of attack [degrees]
9191
alpha = deg2rad(alpha_deg)
@@ -107,7 +107,7 @@ add_section!(wing,
107107
wa = WingAerodynamics([wing])
108108

109109
# Set inflow conditions
110-
vel_app = [cos(alpha), 0.0, sin(alpha)] .* Umag
110+
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
111111
set_va!(wa, (vel_app, 0.0)) # Second parameter is yaw rate
112112
```
113113
It is possible to import the wing geometry using an `.obj` file as shown in the example `ram_air_kite.jl`.

examples/ram_air_kite.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ VSM_with_stall_correction = Solver(
3333
)
3434

3535
# Setting velocity conditions
36-
Umag = 15.0
36+
v_a = 15.0
3737
aoa = 15.0
3838
side_slip = 0.0
3939
yaw_rate = 0.0
@@ -42,7 +42,7 @@ vel_app = [
4242
cos(aoa_rad) * cos(side_slip),
4343
sin(side_slip),
4444
sin(aoa_rad)
45-
] * Umag
45+
] * v_a
4646
wing_aero.va = vel_app
4747

4848
# Plotting geometry
@@ -67,7 +67,7 @@ plot_distribution(
6767
[CAD_y_coordinates, CAD_y_coordinates],
6868
[results, results_with_stall],
6969
["VSM", "VSM with stall correction"];
70-
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_beta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_Umag_$(round(Umag, digits=1))",
70+
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))",
7171
data_type=".pdf",
7272
is_save=false,
7373
is_show=true
@@ -85,7 +85,7 @@ plot_polars(
8585
angle_of_attack=0,
8686
side_slip=0,
8787
yaw_rate=0,
88-
Umag=10,
88+
v_a=10,
8989
title="tutorial_testing_stall_model_n_panels_$(wing.n_panels)_distribution_$(wing.spanwise_panel_distribution)",
9090
data_type=".pdf",
9191
is_save=false,

examples/rectangular_wing.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using VortexStepMethod
66
n_panels = 20 # Number of panels
77
span = 20.0 # Wing span [m]
88
chord = 1.0 # Chord length [m]
9-
Umag = 20.0 # Magnitude of inflow velocity [m/s]
9+
v_a = 20.0 # Magnitude of inflow velocity [m/s]
1010
density = 1.225 # Air density [kg/m³]
1111
alpha_deg = 30.0 # Angle of attack [degrees]
1212
alpha = deg2rad(alpha_deg)
@@ -28,7 +28,7 @@ add_section!(wing,
2828
wa = WingAerodynamics([wing])
2929

3030
# Set inflow conditions
31-
vel_app = [cos(alpha), 0.0, sin(alpha)] .* Umag
31+
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
3232
set_va!(wa, (vel_app, 0.0)) # Second parameter is yaw rate
3333

3434
# Step 4: Initialize solvers for both LLT and VSM methods
@@ -81,7 +81,7 @@ plot_polars(
8181
["LLT", "VSM"],
8282
angle_range=angle_range,
8383
angle_type="angle_of_attack",
84-
Umag=Umag,
84+
v_a=v_a,
8585
title="Rectangular Wing Polars"
8686
)
8787
nothing

examples/stall_model.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ VSM_with_stall_correction = Solver(
4646
)
4747

4848
# Setting velocity conditions
49-
Umag = 15.0
49+
v_a = 15.0
5050
aoa = 17.0
5151
side_slip = 0.0
5252
yaw_rate = 0.0
@@ -55,7 +55,7 @@ vel_app = [
5555
cos(aoa_rad) * cos(side_slip),
5656
sin(side_slip),
5757
sin(aoa_rad)
58-
] * Umag
58+
] * v_a
5959
wing_aero_CAD_19ribs.va = vel_app
6060

6161
# # Plotting geometry
@@ -81,7 +81,7 @@ plot_distribution(
8181
[CAD_y_coordinates, CAD_y_coordinates],
8282
[results, results_with_stall],
8383
["VSM", "VSM with stall correction"];
84-
title="CAD_spanwise_distributions_alpha_$(round(aoa, digits=1))_beta_$(round(side_slip, digits=1))_yaw_$(round(yaw_rate, digits=1))_Umag_$(round(Umag, digits=1))",
84+
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))",
8585
data_type=".pdf",
8686
save_path=joinpath(save_folder, "spanwise_distributions"),
8787
is_save=false,
@@ -112,7 +112,7 @@ plot_polars(
112112
angle_of_attack=0,
113113
side_slip=0,
114114
yaw_rate=0,
115-
Umag=10,
115+
v_a=10,
116116
title="tutorial_testing_stall_model_n_panels_$(n_panels)_distribution_$(spanwise_panel_distribution)",
117117
data_type=".pdf",
118118
save_path=joinpath(save_folder, "polars"),

src/plotting.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ Generate polar data for aerodynamic analysis over a range of angles.
477477
- `angle_of_attack`: Initial angle of attack in radians
478478
- `side_slip`: Initial side slip angle in radians
479479
- `yaw_rate`: Yaw rate
480-
- `Umag`: Magnitude of velocity
480+
- `v_a`: Magnitude of velocity
481481
482482
# Returns
483483
- Tuple of polar data array and Reynolds number
@@ -490,7 +490,7 @@ function generate_polar_data(
490490
angle_of_attack=0.0,
491491
side_slip=0.0,
492492
yaw_rate=0.0,
493-
Umag=10.0
493+
v_a=10.0
494494
)
495495
n_panels = length(wing_aero.panels)
496496
n_angles = length(angle_range)
@@ -529,7 +529,7 @@ function generate_polar_data(
529529
cos(α) * cos(β),
530530
sin(β),
531531
sin(α)
532-
] * Umag
532+
] * v_a
533533
)
534534

535535
# Solve and store results
@@ -566,7 +566,7 @@ end
566566
"""
567567
plot_polars(solver_list, wing_aero_list, label_list;
568568
literature_path_list=String[], angle_range=range(0, 20, 2), angle_type="angle_of_attack", angle_of_attack=0.0,
569-
side_slip=0.0, yaw_rate=0.0, Umag=10.0, title="polar", data_type=".pdf", save_path=nothing,
569+
side_slip=0.0, yaw_rate=0.0, v_a=10.0, title="polar", data_type=".pdf", save_path=nothing,
570570
is_save=true,
571571
is_show=true)
572572
@@ -593,7 +593,7 @@ function plot_polars(
593593
angle_of_attack=0.0,
594594
side_slip=0.0,
595595
yaw_rate=0.0,
596-
Umag=10.0,
596+
v_a=10.0,
597597
title="polar",
598598
data_type=".pdf",
599599
save_path=nothing,
@@ -617,7 +617,7 @@ function plot_polars(
617617
angle_of_attack=angle_of_attack,
618618
side_slip=side_slip,
619619
yaw_rate=yaw_rate,
620-
Umag=Umag
620+
v_a=v_a
621621
)
622622
push!(polar_data_list, polar_data)
623623
# Update label with Reynolds number

src/solver.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function solve(solver::Solver, wing_aero::WingAerodynamics, gamma_distribution=n
112112

113113
@debug "Initial gamma_new: $gamma_initial"
114114
# Run main iteration loop
115-
converged, gamma_new, alpha_array, Umag_array = gamma_loop(
115+
converged, gamma_new, alpha_array, v_a_array = gamma_loop(
116116
solver,
117117
wing_aero,
118118
gamma_initial,
@@ -130,7 +130,7 @@ function solve(solver::Solver, wing_aero::WingAerodynamics, gamma_distribution=n
130130
# Try again with reduced relaxation factor if not converged
131131
if !converged && relaxation_factor > 1e-3
132132
@warn "Running again with half the relaxation_factor = $(relaxation_factor/2)"
133-
converged, gamma_new, alpha_array, Umag_array = gamma_loop(
133+
converged, gamma_new, alpha_array, v_a_array = gamma_loop(
134134
solver,
135135
wing_aero,
136136
gamma_initial,
@@ -156,7 +156,7 @@ function solve(solver::Solver, wing_aero::WingAerodynamics, gamma_distribution=n
156156
solver.core_radius_fraction,
157157
solver.mu,
158158
alpha_array,
159-
Umag_array,
159+
v_a_array,
160160
chord_array,
161161
x_airf_array,
162162
y_airf_array,
@@ -196,7 +196,7 @@ function gamma_loop(
196196
)
197197
converged = false
198198
alpha_array = wing_aero.alpha_array
199-
Umag_array = wing_aero.Umag_array
199+
v_a_array = wing_aero.v_a_array
200200

201201
iters = 0
202202
for i in 1:solver.max_iterations
@@ -218,11 +218,11 @@ function gamma_loop(
218218
v_tangential_array = vec(sum(y_airf_array .* relative_velocity_array, dims=2))
219219
alpha_array .= atan.(v_normal_array, v_tangential_array)
220220

221-
Umag_array .= norm.(relative_velocity_crossz)
222-
Umagw_array = norm.(Uinfcrossz_array)
221+
v_a_array .= norm.(relative_velocity_crossz)
222+
v_aw_array = norm.(Uinfcrossz_array)
223223

224224
cl_array = [calculate_cl(panel, alpha) for (panel, alpha) in zip(panels, alpha_array)]
225-
gamma_new .= 0.5 .* Umag_array.^2 ./ Umagw_array .* cl_array .* chord_array
225+
gamma_new .= 0.5 .* v_a_array.^2 ./ v_aw_array .* cl_array .* chord_array
226226

227227
# Apply damping if needed
228228
if solver.is_with_artificial_damping
@@ -257,7 +257,7 @@ function gamma_loop(
257257
@warn "NO convergence after $(solver.max_iterations) iterations"
258258
end
259259

260-
return converged, gamma_new, alpha_array, Umag_array
260+
return converged, gamma_new, alpha_array, v_a_array
261261
end
262262

263263
"""

src/wing_aerodynamics.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mutable struct WingAerodynamics
1515
stall_angle_list::Vector{Float64}
1616

1717
alpha_array::Vector{Float64}
18-
Umag_array::Vector{Float64}
18+
v_a_array::Vector{Float64}
1919
work_vectors::NTuple{10,Vector{Float64}}
2020

2121
function WingAerodynamics(
@@ -58,7 +58,7 @@ mutable struct WingAerodynamics
5858
stall_angle_list = calculate_stall_angle_list(panels)
5959

6060
alpha_array = zeros(n_panels)
61-
Umag_array = zeros(n_panels)
61+
v_a_array = zeros(n_panels)
6262
work_vectors = ntuple(_ -> Vector{Float64}(undef, 3), 10)
6363

6464
new(
@@ -71,7 +71,7 @@ mutable struct WingAerodynamics
7171
nothing, # alpha_corrected
7272
stall_angle_list,
7373
alpha_array,
74-
Umag_array,
74+
v_a_array,
7575
work_vectors
7676
)
7777
end
@@ -377,7 +377,7 @@ end
377377
calculate_results(wa::WingAerodynamics, gamma_new::Vector{Float64},
378378
density::Float64, aerodynamic_model_type::String,
379379
core_radius_fraction::Float64, mu::Float64,
380-
alpha_array::Vector{Float64}, Umag_array::Vector{Float64},
380+
alpha_array::Vector{Float64}, v_a_array::Vector{Float64},
381381
chord_array::Vector{Float64}, x_airf_array::Matrix{Float64},
382382
y_airf_array::Matrix{Float64}, z_airf_array::Matrix{Float64},
383383
va_array::Matrix{Float64}, va_norm_array::Vector{Float64},
@@ -396,7 +396,7 @@ function calculate_results(wa::WingAerodynamics,
396396
core_radius_fraction::Float64,
397397
mu::Float64,
398398
alpha_array::Vector{Float64},
399-
Umag_array::Vector{Float64},
399+
v_a_array::Vector{Float64},
400400
chord_array::Vector{Float64},
401401
x_airf_array::Matrix{Float64},
402402
y_airf_array::Matrix{Float64},
@@ -422,9 +422,9 @@ function calculate_results(wa::WingAerodynamics,
422422
end
423423

424424
# Calculate forces
425-
lift = reshape((cl_array .* 0.5 .* density .* Umag_array.^2 .* chord_array), :, 1)
426-
drag = reshape((cd_array .* 0.5 .* density .* Umag_array.^2 .* chord_array), :, 1)
427-
moment = reshape((cm_array .* 0.5 .* density .* Umag_array.^2 .* chord_array), :, 1)
425+
lift = reshape((cl_array .* 0.5 .* density .* v_a_array.^2 .* chord_array), :, 1)
426+
drag = reshape((cd_array .* 0.5 .* density .* v_a_array.^2 .* chord_array), :, 1)
427+
moment = reshape((cm_array .* 0.5 .* density .* v_a_array.^2 .* chord_array), :, 1)
428428

429429
# Calculate alpha corrections based on model type
430430
alpha_corrected = if aerodynamic_model_type == "VSM"

test/test_plotting.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function create_wa()
77
n_panels = 20 # Number of panels
88
span = 20.0 # Wing span [m]
99
chord = 1.0 # Chord length [m]
10-
Umag = 20.0 # Magnitude of inflow velocity [m/s]
10+
v_a = 20.0 # Magnitude of inflow velocity [m/s]
1111
density = 1.225 # Air density [kg/m³]
1212
alpha_deg = 30.0 # Angle of attack [degrees]
1313
alpha = deg2rad(alpha_deg)
@@ -28,7 +28,7 @@ function create_wa()
2828
# Step 3: Initialize aerodynamics
2929
wa = WingAerodynamics([wing])
3030
# Set inflow conditions
31-
vel_app = [cos(alpha), 0.0, sin(alpha)] .* Umag
31+
vel_app = [cos(alpha), 0.0, sin(alpha)] .* v_a
3232
set_va!(wa, (vel_app, 0.0)) # Second parameter is yaw rate
3333
wa
3434
end
@@ -82,15 +82,15 @@ plt.ioff()
8282
@test fig isa plt.PyPlot.Figure
8383

8484
# Step 8: Plot polar curves
85-
Umag = 20.0 # Magnitude of inflow velocity [m/s]
85+
v_a = 20.0 # Magnitude of inflow velocity [m/s]
8686
angle_range = range(0, 20, 20)
8787
fig = plot_polars(
8888
[llt_solver, vsm_solver],
8989
[wa, wa],
9090
["LLT", "VSM"],
9191
angle_range=angle_range,
9292
angle_type="angle_of_attack",
93-
Umag=Umag,
93+
v_a=v_a,
9494
title="Rectangular Wing Polars",
9595
data_type=".pdf",
9696
save_path="/tmp",

test/test_wing_aerodynamics.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ include("utils.jl")
1616
N = 40
1717
max_chord = 1.0
1818
span = 15.709 # AR = 20
19-
Umag = 20.0
19+
v_a = 20.0
2020
AR = span^2 /* span * max_chord / 4)
2121
aoa = deg2rad(5)
22-
Uinf = [cos(aoa), 0.0, sin(aoa)] .* Umag
22+
Uinf = [cos(aoa), 0.0, sin(aoa)] .* v_a
2323
model = "VSM"
2424

2525
# Setup wing geometry
@@ -118,9 +118,9 @@ end
118118
@debug "N: $N"
119119
@debug "size(coord): $(size(coord))"
120120

121-
Umag = 20.0
121+
v_a = 20.0
122122
aoa = 5.7106 * π / 180
123-
Uinf = [cos(aoa), 0.0, sin(aoa)] .* Umag
123+
Uinf = [cos(aoa), 0.0, sin(aoa)] .* v_a
124124

125125
# Create wing geometry
126126
core_radius_fraction = 1e-20
@@ -215,9 +215,9 @@ end
215215
span = 17.0
216216
AR = span^2 /* span * max_chord / 4)
217217
@debug "AR: $AR"
218-
Umag = 20.0
218+
v_a = 20.0
219219
aoa = 5.7106 * π / 180
220-
Uinf = [cos(aoa), 0.0, sin(aoa)] .* Umag
220+
Uinf = [cos(aoa), 0.0, sin(aoa)] .* v_a
221221

222222
coord = if wing_type == "rectangular"
223223
twist = range(-0.5, 0.5, length=N)

test/thesis_oriol_cayon.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ function output_results(Fmag, aero_coeffs, ringvec, Uinf, controlpoints, Atot)
7474
SFtot += SideF[i] * norm(ringvec[i]["r0"])
7575
end
7676

77-
Umag = norm(Uinf)
78-
CL = Ltot / (0.5 * Umag^2 * Atot * rho)
79-
CD = Dtot / (0.5 * Umag^2 * Atot * rho)
80-
CS = SFtot / (0.5 * Umag^2 * Atot * rho)
77+
v_a = norm(Uinf)
78+
CL = Ltot / (0.5 * v_a^2 * Atot * rho)
79+
CD = Dtot / (0.5 * v_a^2 * Atot * rho)
80+
CS = SFtot / (0.5 * v_a^2 * Atot * rho)
8181

8282
return F_rel, F_gl, Ltot, Dtot, CL, CD, CS
8383
end

0 commit comments

Comments
 (0)