Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Changed

- Requires Julia 1.12 or 1.13; 1.10 and 1.11 keep resolving v5.1.1.
- The Makie `plot!` methods for a `Panel` or a `BodyAerodynamics` return a
`Vector{Makie.AbstractPlot}` instead of a `Vector{Any}`; for a `BodyAerodynamics`
drawn as flat panels it is one flat list rather than a list per panel.

## VortexStepMethod v5.1.1 2026-09-12

Expand Down
14 changes: 5 additions & 9 deletions examples/stall_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,15 @@ csv_file_path = joinpath(
)

df = CSV.read(csv_file_path, DataFrame)
rib_list = []
for row in eachrow(df)
LE = [row.LE_x, row.LE_y, row.LE_z]
TE = [row.TE_x, row.TE_y, row.TE_z]
push!(rib_list, (LE, TE, LEI_AIRFOIL_BREUKELS,
lei_poly_coeffs(row.d_tube, row.camber)))
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: With rib_list gone, a stray blank line now separates df = CSV.read(...) from its only use, and the # Create wing geometry comment now also sits over the CSV read loop. Moving the read down next to the loop would keep reading the data and building the wing in one place.

# Create wing geometry
# n_unrefined_sections will be automatically set to the number of ribs (18 sections)
CAD_wing = Wing(n_panels; spanwise_distribution)
for rib in rib_list
add_section!(CAD_wing, rib[1], rib[2], rib[3], rib[4])
for row in eachrow(df)
LE = [row.LE_x, row.LE_y, row.LE_z]
TE = [row.TE_x, row.TE_y, row.TE_z]
add_section!(CAD_wing, LE, TE, LEI_AIRFOIL_BREUKELS,
lei_poly_coeffs(row.d_tube, row.camber))
end
refine!(CAD_wing)
body_aero = BodyAerodynamics([CAD_wing])
Expand Down
13 changes: 6 additions & 7 deletions ext/VortexStepMethodMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ If `use_observables=true`, creates observables for dynamic updates.
"""
function Makie.plot!(ax, panel::VortexStepMethod.Panel; color=(:red, 0.2), R_b_w=nothing, T_b_w=nothing,
use_observables=false, border_linewidth=1.5, transparency=true, kwargs...)
plots = []
plots = Makie.AbstractPlot[]
points = panel_plate_geometry(panel; R_b_w, T_b_w)

if use_observables
Expand Down Expand Up @@ -253,7 +253,7 @@ function Makie.plot!(ax, body::VortexStepMethod.BodyAerodynamics; color=(:red, 0
use_observables=false, airfoils=false,
airfoil_color=:deepskyblue, airfoil_opacity=0.2, rib_color=:black,
border_linewidth=1.5, transparency=true, kwargs...)
plots = []
plots = Makie.AbstractPlot[]

if airfoils
vertices, faces, ribs = airfoil_skin_geometry(body; R_b_w, T_b_w)
Expand Down Expand Up @@ -316,9 +316,8 @@ function Makie.plot!(ax, body::VortexStepMethod.BodyAerodynamics; color=(:red, 0
else
# Static plotting (original behavior)
for panel in body.panels
p = Makie.plot!(ax, panel; color, R_b_w, T_b_w, use_observables=false,
border_linewidth, transparency, kwargs...)
push!(plots, p)
append!(plots, Makie.plot!(ax, panel; color, R_b_w, T_b_w,
use_observables=false, border_linewidth, transparency, kwargs...))
end
end

Expand Down Expand Up @@ -931,8 +930,8 @@ function VortexStepMethod.plot_polars(
main_title = replace(title, " " => "_")

# Generate polar data
polar_data_list = []
cm_data_list = []
polar_data_list = Vector{Array{Float64}}[]
cm_data_list = NamedTuple{(:cmx, :cmy, :cmz), NTuple{3, Vector{Float64}}}[]
labels_with_re = copy(label_list)
for (i, (solver, body_aero)) in enumerate(zip(solver_list, body_aero_list))
result = VortexStepMethod.generate_polar_data(
Expand Down
4 changes: 2 additions & 2 deletions src/obj_adapter/obj_geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Read vertices and faces from an OBJ file.
- faces: Vector of triangle vertex indices
"""
function read_faces(filename)
vertices = []
faces = []
vertices = Vector{Float64}[]
faces = Vector{Int64}[]

open(filename) do file
for line in eachline(file)
Expand Down
2 changes: 1 addition & 1 deletion src/panel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ Calculate filaments for plotting with their positions and colors.
- Color string
"""
function calculate_filaments_for_plotting(panel::Panel)
filaments_plot = []
filaments_plot = Tuple{Vector{Float64}, Vector{Float64}, String}[]

for (i, filament) in enumerate(panel.filaments)
x1 = filament.x1
Expand Down
2 changes: 1 addition & 1 deletion src/settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ wing = Wing(settings)
"""
@Base.kwdef mutable struct VSMSettings
condition::ConditionSettings = ConditionSettings()
wings::Vector{WingSettings} = []
wings::Vector{WingSettings} = WingSettings[]
solver_settings::SolverSettings = SolverSettings()
end

Expand Down
11 changes: 11 additions & 0 deletions test/panel/test_panel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ end
@test isapprox(panel.y_airf, [0.0, 1.0, 0.0])
end

@testset "Filaments for plotting have a concrete element type" begin
section1 = Section([0.0, 0.0, 0.0], [1.0, 0.0, 0.0], INVISCID)
section2 = Section([0.0, 10.0, 0.0], [1.0, 10.0, 0.0], INVISCID)
panel = create_panel(section1, section2)
panel.va = [10.0, 0.0, 0.0]

filaments = VortexStepMethod.calculate_filaments_for_plotting(panel)
@test filaments isa Vector{Tuple{Vector{Float64}, Vector{Float64}, String}}
@test length(filaments) == length(panel.filaments)
end

@testset "Velocity Calculations" begin
section1 = Section([0.0, 0.0, 0.0], [1.0, 0.0, 0.0], INVISCID)
section2 = Section([0.0, 10.0, 0.0], [1.0, 10.0, 0.0], INVISCID)
Expand Down
21 changes: 12 additions & 9 deletions test/plotting/test_plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ end
write(io_no_cs, "aoa,cl,cd\n0.0,0.10,0.010\n5.0,0.20,0.020\n")
end
fig_lit_no_cs = plot_polars(
Any[],
Any[],
Solver[],
BodyAerodynamics[],
["Literature no CS"];
literature_path_list=[lit_no_cs_path],
is_save=false,
Expand All @@ -299,8 +299,8 @@ end
write(io_bad, "alpha,cl\n0.0,0.10\n5.0,0.20\n")
end
@test_throws ArgumentError plot_polars(
Any[],
Any[],
Solver[],
BodyAerodynamics[],
["Literature bad"];
literature_path_list=[lit_bad_path],
is_save=false,
Expand All @@ -316,8 +316,8 @@ end
"5.0,0.5,0.02,0.01,0.004,0.005,0.006\n")
end
fig_moments = plot_polars(
Any[],
Any[],
Solver[],
BodyAerodynamics[],
["Literature with moments"];
literature_path_list=[cm_lit_path],
show_moments=true,
Expand All @@ -334,8 +334,8 @@ end
"0.0,0.1,0.01\n5.0,0.5,0.02\n")
end
fig_no_moments = plot_polars(
Any[],
Any[],
Solver[],
BodyAerodynamics[],
["Literature no moments"];
literature_path_list=[no_cm_path],
show_moments=false,
Expand Down Expand Up @@ -453,6 +453,7 @@ end
ax = Axis3(fig[1, 1])
plots = Makie.plot!(ax, body_aero; airfoils=true)
@test !isempty(plots)
@test plots isa Vector{Makie.AbstractPlot}

# Observable airfoil-skin plot registers the body for pose updates.
fig_obs = Figure()
Expand Down Expand Up @@ -501,7 +502,9 @@ end
# border_linewidth flows through the standard (non-airfoil) panel plot.
fig_lw = Figure()
ax_lw = Axis3(fig_lw[1, 1])
@test_nowarn Makie.plot!(ax_lw, plain_body; border_linewidth=3.0)
plots_lw = @test_nowarn Makie.plot!(ax_lw, plain_body; border_linewidth=3.0)
@test plots_lw isa Vector{Makie.AbstractPlot}
@test length(plots_lw) == 2 * length(plain_body.panels)
end

@testset "generated_slices reads the deflected .dat under its generated name" begin
Expand Down
10 changes: 5 additions & 5 deletions test/ram_geometry/test_kite_geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ using Serialization
@test vertices[2] ≈ [1.0, 0.0, 0.0]
@test vertices[3] ≈ [0.0, 1.0, 0.0]
@test faces[1] == [1, 2, 3]
@test vertices isa Vector{Vector{Float64}}
@test faces isa Vector{Vector{Int64}}
end

@testset "Center of Mass Calculation" begin
Expand Down Expand Up @@ -62,10 +64,8 @@ using Serialization
# Create simple curved wing vertices
r = 5.0
z_center = 2.0
vertices = []
for θ in range(-π/4, π/4, length=100)
push!(vertices, [0.0, r*sin(θ), z_center + r*cos(θ)])
end
vertices = [[0.0, r*sin(θ), z_center + r*cos(θ)]
for θ in range(-π/4, π/4, length=100)]

z, radius, gamma_tip = find_circle_center_and_radius(vertices)

Expand All @@ -76,7 +76,7 @@ using Serialization

r = 5.0
@testset "Interpolation Creation" begin
vertices = []
vertices = Vector{Float64}[]
z_center = 2.0
Δθ = π/2 / 1000
for θ in range(-π/4, π/4-Δθ, 1000)
Expand Down
22 changes: 11 additions & 11 deletions test/thesis_oriol_cayon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ CD : Global CD
function output_results(Fmag, aero_coeffs, ringvec, Uinf, controlpoints, Atot)
rho = 1.225
alpha = aero_coeffs[:, 1]
F_rel = []
F_gl = []
Fmag_gl = []
SideF = []
F_rel = Vector{Vector{Float64}}[]
F_gl = Vector{Vector{Float64}}[]
Fmag_gl = Vector{Float64}[]
SideF = Float64[]
Ltot = 0.0
Dtot = 0.0
SFtot = 0.0
Expand Down Expand Up @@ -124,12 +124,12 @@ ringvec : List of dictionaries containing the vectors that define each ring
coord_L : coordinates of the aerodynamic centers of each wing panel
"""
function create_geometry_general(coordinates, Uinf, N, ring_geo, model)
filaments = []
controlpoints = []
rings = []
wingpanels = []
ringvec = []
coord_L = []
filaments = Dict{String, Any}[]
controlpoints = Dict{String, Any}[]
rings = Vector{Dict{String, Any}}[]
wingpanels = Dict{String, Vector{Float64}}[]
ringvec = Dict{String, Vector{Float64}}[]
coord_L = Vector{Float64}[]

# Go through all wing panels
for i in 1:N-1
Expand Down Expand Up @@ -279,7 +279,7 @@ function create_geometry_general(coordinates, Uinf, N, ring_geo, model)
end

push!(rings, filaments)
filaments = []
filaments = Dict{String, Any}[]
end

coord_L = hcat(coord_L...)
Expand Down
10 changes: 3 additions & 7 deletions test/yaml_geometry/test_yaml_wing_deformation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,10 @@ using Test
body_aero = BodyAerodynamics([wing])

# Store original points for multiple panels
original_points = []
test_indices = [1, length(body_aero.panels) ÷ 2, length(body_aero.panels)]
for i in test_indices
push!(original_points, (
LE=copy(body_aero.panels[i].LE_point_1),
TE=copy(body_aero.panels[i].TE_point_1)
))
end
original_points = [(LE=copy(body_aero.panels[i].LE_point_1),
TE=copy(body_aero.panels[i].TE_point_1))
for i in test_indices]

# Apply spanwise-varying deformation (panel-level)
n = wing.n_panels
Expand Down
Loading