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
6 changes: 6 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ jobs:
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- name: Install matplotlib
if: runner.os == 'Linux'
run: sudo apt-get install -y python3-matplotlib
- name: Build PyCall with system Python
if: runner.os == 'Linux'
run: julia -e 'ENV["PYTHON"]="python3"; using Pkg; Pkg.add("PyCall"); Pkg.build("PyCall")'
- uses: julia-actions/julia-runtest@v1
env:
BUILD_IS_PRODUCTION_BUILD: ${{ matrix.build_is_production_build }}
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Changelog

## VortexStepMethod v3.3.3 2026-05-21

### Fixed
- `MakieExt` and `ControlPlotsExt` no longer both define
`VortexStepMethod.plot_geometry` for the same type, resolving a method
ambiguity when both extensions were loaded (#236)
- `menu()` and `menu_cp()` now always set the active backend before dispatching
to a plot function, preventing stale-backend errors

## VortexStepMethod v3.3.2 2026-05-18

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "VortexStepMethod"
uuid = "ed3cd733-9f0f-46a9-93e0-89b8d4998dd9"
authors = ["1-Bart-1 <bart@vandelint.net>", "Oriol Cayon and contributors"]
version = "3.3.2"
version = "3.3.3"

[workspace]
projects = ["examples", "examples_cp", "docs", "test"]
Expand Down
2 changes: 2 additions & 0 deletions examples/menu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ using CairoMakie
using VortexStepMethod
using REPL.TerminalMenus

set_plot_backend!(MakieBackend())

url = "https://opensourceawe.github.io/VortexStepMethod.jl/dev"

example_files = [
Expand Down
2 changes: 2 additions & 0 deletions examples_cp/menu_cp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ using ControlPlots
using VortexStepMethod
using REPL.TerminalMenus

set_plot_backend!(ControlPlotsBackend())

url = "https://opensourceawe.github.io/VortexStepMethod.jl/dev"

examples_dir = joinpath(@__DIR__, "..", "examples")
Expand Down
58 changes: 37 additions & 21 deletions ext/VortexStepMethodControlPlotsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import VortexStepMethod: calculate_filaments_for_plotting
export plot_wing, plot_circulation_distribution, plot_geometry, plot_distribution,
plot_polars, save_plot, show_plot, plot_polar_data, plot_combined_analysis

# Set this extension as the active plotting backend when loaded (only if not already set)
function __init__()
isnothing(VortexStepMethod._PLOT_BACKEND[]) &&
(VortexStepMethod._PLOT_BACKEND[] = VortexStepMethod.ControlPlotsBackend())
end

"""
set_plot_style(titel_size=16; use_tex=false)

Expand Down Expand Up @@ -263,16 +269,16 @@ function create_geometry_plot(body_aero::BodyAerodynamics, title, view_elevation
end

"""
plot_geometry(body_aero::BodyAerodynamics, title;
plot_geometry(body_aero::BodyAerodynamics, title, ::ControlPlotsBackend;
data_type=".pdf", save_path=nothing,
is_save=false, is_show=false,
view_elevation=15, view_azimuth=-120, use_tex=false)

Plot wing geometry from different viewpoints and optionally save/show plots.
ControlPlots backend implementation of [`plot_geometry`](@ref).

# Arguments:
- `body_aero`: the [BodyAerodynamics](@ref) to plot
- title: plot title
- `title`: plot title

# Keyword arguments:
- `data_type``: string with the file type postfix (default: ".pdf")
Expand All @@ -284,7 +290,8 @@ Plot wing geometry from different viewpoints and optionally save/show plots.
- `use_tex`: if the external `pdflatex` command shall be used (default: false)

"""
function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title;
function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title,
::VortexStepMethod.ControlPlotsBackend;
data_type=".pdf",
Comment thread
ufechner7 marked this conversation as resolved.
save_path=nothing,
is_save=false,
Expand Down Expand Up @@ -323,11 +330,11 @@ function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title;
end

"""
plot_distribution(y_coordinates_list, results_list, label_list;
plot_distribution(y_coordinates_list, results_list, label_list, ::ControlPlotsBackend;
title="spanwise_distribution", data_type=".pdf",
save_path=nothing, is_save=false, is_show=true, use_tex=false)

Plot spanwise distributions of aerodynamic properties.
ControlPlots backend implementation of [`plot_distribution`](@ref).

# Arguments
- `y_coordinates_list`: List of spanwise coordinates
Expand All @@ -342,7 +349,8 @@ Plot spanwise distributions of aerodynamic properties.
- `is_show`: Whether to display plots (default: true)
- `use_tex`: if the external `pdflatex` command shall be used
"""
function VortexStepMethod.plot_distribution(y_coordinates_list, results_list, label_list;
function VortexStepMethod.plot_distribution(y_coordinates_list, results_list, label_list,
::VortexStepMethod.ControlPlotsBackend;
title="spanwise_distribution",
data_type=".pdf",
save_path=nothing,
Expand Down Expand Up @@ -515,14 +523,14 @@ Generate polar data for aerodynamic analysis over a range of angles.
"""

"""
plot_polars(solver_list, body_aero_list, label_list;
plot_polars(solver_list, body_aero_list, label_list, ::ControlPlotsBackend;
literature_path_list=String[],
angle_range=range(0, 20, 2), angle_type="angle_of_attack",
angle_of_attack=0.0, side_slip=0.0, v_a=10.0,
title="polar", data_type=".pdf", save_path=nothing,
is_save=true, is_show=true, use_tex=false)

Plot polar data comparing different solvers and configurations.
ControlPlots backend implementation of [`plot_polars`](@ref).

# Arguments
- `solver_list`: List of aerodynamic solvers
Expand All @@ -547,7 +555,8 @@ Plot polar data comparing different solvers and configurations.
function VortexStepMethod.plot_polars(
solver_list,
body_aero_list,
label_list;
label_list,
::VortexStepMethod.ControlPlotsBackend;
literature_path_list=String[],
angle_range=range(0, 20, 2),
angle_type="angle_of_attack",
Expand Down Expand Up @@ -741,10 +750,12 @@ function VortexStepMethod.plot_polars(
end

"""
plot_polar_data(body_aero::BodyAerodynamics; alphas=collect(deg2rad.(-5:0.3:25)), delta_tes=collect(deg2rad.(-5:0.3:25)))
plot_polar_data(body_aero::BodyAerodynamics, ::ControlPlotsBackend;
alphas=collect(deg2rad.(-5:0.3:25)),
delta_tes=collect(deg2rad.(-5:0.3:25)))

Plot polar data (Cl, Cd, Cm) as 3D surfaces against alpha and delta_te angles. delta_te is the trailing edge deflection angle
relative to the 2d airfoil or panel chord line.
ControlPlots backend implementation of [`plot_polar_data`](@ref). Plots Cl, Cd, Cm as 3D surfaces
against angle of attack and trailing edge deflection angle.

# Arguments
- `body_aero`: Wing aerodynamics struct
Expand All @@ -755,7 +766,8 @@ relative to the 2d airfoil or panel chord line.
- `is_show`: Whether to display plots (default: true)
- `use_tex`: if the external `pdflatex` command shall be used
"""
function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics,
::VortexStepMethod.ControlPlotsBackend;
alphas=collect(deg2rad.(-5:0.3:25)),
delta_tes = collect(deg2rad.(-5:0.3:25)),
is_show = true,
Expand Down Expand Up @@ -812,10 +824,10 @@ function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
end

"""
plot_combined_analysis(solver, body_aero, results; kwargs...)
plot_combined_analysis(solver, body_aero, results, ::ControlPlotsBackend; kwargs...)

Create combined analysis by calling plot_geometry, plot_distribution,
and plot_polars sequentially. Each creates a separate matplotlib window.
ControlPlots backend implementation of [`plot_combined_analysis`](@ref).
Calls `plot_geometry`, `plot_distribution`, and `plot_polars` sequentially.

# Arguments
- `solver`: Solver or array of solvers
Expand All @@ -827,7 +839,8 @@ See individual functions for detailed parameter descriptions.
function VortexStepMethod.plot_combined_analysis(
solver,
body_aero,
results;
results,
backend::VortexStepMethod.ControlPlotsBackend;
solver_label="VSM",
labels=nothing,
angle_range=range(0, 20, length=20),
Expand Down Expand Up @@ -888,7 +901,8 @@ function VortexStepMethod.plot_combined_analysis(
# Plot geometry (first body_aero only)
plot_geometry(
body_aeros[1],
title;
title,
backend;
data_type, save_path, is_save, is_show,
view_elevation, view_azimuth, use_tex
)
Expand All @@ -897,7 +911,8 @@ function VortexStepMethod.plot_combined_analysis(
plot_distribution(
y_coords_list,
results_spanwise,
solver_labels;
solver_labels,
backend;
title=title * " - Distributions",
data_type, save_path, is_save, is_show, use_tex
)
Expand All @@ -912,7 +927,8 @@ function VortexStepMethod.plot_combined_analysis(
plot_polars(
solvers,
body_aeros,
polar_labels;
polar_labels,
backend;
literature_path_list, angle_range, angle_type,
angle_of_attack, side_slip, v_a,
title=title * " - Polars",
Expand Down
41 changes: 26 additions & 15 deletions ext/VortexStepMethodMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import VortexStepMethod: calculate_filaments_for_plotting
export plot_geometry, plot_distribution, plot_polars, save_plot, show_plot,
plot_polar_data, plot_combined_analysis

# Set this extension as the active plotting backend when loaded (only if not already set)
function __init__()
isnothing(VortexStepMethod._PLOT_BACKEND[]) &&
(VortexStepMethod._PLOT_BACKEND[] = VortexStepMethod.MakieBackend())
end

# Global storage for panel mesh observables (for dynamic plotting)
const PANEL_MESH_OBSERVABLES = Ref{Union{Nothing,Dict}}(nothing)

Expand Down Expand Up @@ -459,12 +465,12 @@ function create_geometry_plot_makie(body_aero::BodyAerodynamics, title,
end

"""
plot_geometry(body_aero::BodyAerodynamics, title;
plot_geometry(body_aero::BodyAerodynamics, title, ::MakieBackend;
data_type=nothing, save_path=nothing,
is_save=false, is_show=false,
view_elevation=15, view_azimuth=-120, use_tex=false)

Plot wing geometry from different viewpoints using Makie.
Makie backend implementation of [`plot_geometry`](@ref).

# Arguments:
- `body_aero`: the BodyAerodynamics to plot
Expand All @@ -479,7 +485,8 @@ Plot wing geometry from different viewpoints using Makie.
- `view_azimuth`: View azimuth angle in degrees (default: -120)
- `use_tex`: Ignored for Makie (default: false)
"""
function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title;
function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title,
::VortexStepMethod.MakieBackend;
data_type=nothing,
Comment thread
ufechner7 marked this conversation as resolved.
save_path=nothing,
is_save=false,
Expand Down Expand Up @@ -516,11 +523,11 @@ function VortexStepMethod.plot_geometry(body_aero::BodyAerodynamics, title;
end

"""
plot_distribution(y_coordinates_list, results_list, label_list;
plot_distribution(y_coordinates_list, results_list, label_list, ::MakieBackend;
title="spanwise_distribution", data_type=nothing,
save_path=nothing, is_save=false, is_show=true, use_tex=false)

Plot spanwise distributions of aerodynamic properties using Makie.
Makie backend implementation of [`plot_distribution`](@ref).

# Arguments
- `y_coordinates_list`: List of spanwise coordinates
Expand All @@ -535,7 +542,8 @@ Plot spanwise distributions of aerodynamic properties using Makie.
- `is_show`: Whether to display (default: true)
- `use_tex`: Ignored for Makie (default: false)
"""
function VortexStepMethod.plot_distribution(y_coordinates_list, results_list, label_list;
function VortexStepMethod.plot_distribution(y_coordinates_list, results_list, label_list,
::VortexStepMethod.MakieBackend;
title="spanwise_distribution",
data_type=nothing,
save_path=nothing,
Expand Down Expand Up @@ -668,14 +676,14 @@ Generate polar data for aerodynamic analysis over a range of angles.
"""

"""
plot_polars(solver_list, body_aero_list, label_list;
plot_polars(solver_list, body_aero_list, label_list, ::MakieBackend;
literature_path_list=String[],
angle_range=range(0, 20, 2), angle_type="angle_of_attack",
angle_of_attack=0.0, side_slip=0.0, v_a=10.0,
title="polar", data_type=nothing, save_path=nothing,
is_save=true, is_show=true, use_tex=false)

Plot polar data comparing different solvers using Makie.
Makie backend implementation of [`plot_polars`](@ref).

# Arguments
- `solver_list`: List of aerodynamic solvers
Expand All @@ -700,7 +708,8 @@ Plot polar data comparing different solvers using Makie.
function VortexStepMethod.plot_polars(
solver_list,
body_aero_list,
label_list;
label_list,
::VortexStepMethod.MakieBackend;
literature_path_list=String[],
angle_range=range(0, 20, 2),
angle_type="angle_of_attack",
Expand Down Expand Up @@ -866,12 +875,12 @@ function VortexStepMethod.plot_polars(
end

"""
plot_polar_data(body_aero::BodyAerodynamics;
plot_polar_data(body_aero::BodyAerodynamics, ::MakieBackend;
alphas=collect(deg2rad.(-5:0.3:25)),
delta_tes=collect(deg2rad.(-5:0.3:25)),
is_show=true, use_tex=false)

Plot polar data (Cl, Cd, Cm) as 3D surfaces using Makie.
Makie backend implementation of [`plot_polar_data`](@ref).

# Arguments
- `body_aero`: Wing aerodynamics struct
Expand All @@ -882,7 +891,8 @@ Plot polar data (Cl, Cd, Cm) as 3D surfaces using Makie.
- `is_show`: Whether to display (default: true)
- `use_tex`: Ignored for Makie (default: false)
"""
function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics,
::VortexStepMethod.MakieBackend;
alphas=collect(deg2rad.(-5:0.3:25)),
delta_tes=collect(deg2rad.(-5:0.3:25)),
is_show=true,
Expand Down Expand Up @@ -929,7 +939,7 @@ function VortexStepMethod.plot_polar_data(body_aero::BodyAerodynamics;
end

"""
plot_combined_analysis(solver, body_aero, results;
plot_combined_analysis(solver, body_aero, results, ::MakieBackend;
solver_label="VSM",
angle_range=range(0,20,length=20),
angle_type="angle_of_attack",
Expand All @@ -940,7 +950,7 @@ end
literature_path_list=String[],
data_type=".png", save_path=nothing, is_save=false)

Create combined multi-panel figure with geometry, polar data, distributions, and polars.
Makie backend implementation of [`plot_combined_analysis`](@ref).

# Arguments
- `solver`: Aerodynamic solver
Expand Down Expand Up @@ -972,7 +982,8 @@ Create combined multi-panel figure with geometry, polar data, distributions, and
function VortexStepMethod.plot_combined_analysis(
solver,
body_aero,
results;
results,
::VortexStepMethod.MakieBackend;
solver_label="VSM",
labels=nothing,
angle_range=range(0, 20, length=20),
Expand Down
Loading
Loading