From df4e10402b38b1b5f6fbf29fa197e798d33a7e6b Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 12 Jun 2026 18:38:56 +0200 Subject: [PATCH 1/3] Split cd and cm --- src/panel.jl | 57 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/src/panel.jl b/src/panel.jl index 966b448f..69973313 100644 --- a/src/panel.jl +++ b/src/panel.jl @@ -396,40 +396,65 @@ end """ - calculate_cd_cm(panel::Panel, alpha::Float64) + calculate_cd(panel::Panel, alpha) -Calculate drag and moment coefficients for given angle of attack. +Calculate the drag coefficient for the given angle of attack. """ -function calculate_cd_cm(panel::Panel{Tp}, alpha::Ta) where {Tp, Ta} +function calculate_cd(panel::Panel{Tp}, alpha::Ta) where {Tp, Ta} R = promote_type(Tp, Ta) - isnan(alpha) && return R(NaN), R(NaN) + isnan(alpha) && return R(NaN) if panel.aero_model == LEI_AIRFOIL_BREUKELS - cd = evalpoly(rad2deg(alpha), reverse(panel.cd_coeffs)) - cm = evalpoly(rad2deg(alpha), reverse(panel.cm_coeffs)) if abs(alpha) > (π/9) # Outside ±20 degrees - cd = 2 * sin(alpha)^3 + return R(2 * sin(alpha)^3) end - return R(cd), R(cm) + return R(evalpoly(rad2deg(alpha), reverse(panel.cd_coeffs))) elseif panel.aero_model == POLAR_VECTORS cd_interp = panel.cd_interp - cm_interp = panel.cm_interp cd_interp isa Union{I1, I2, I5} || throw(ArgumentError("cd_interp is not initialized for POLAR_VECTORS.")) - cm_interp isa Union{I1, I2} || throw(ArgumentError("cm_interp is not initialized for POLAR_VECTORS.")) - return R((cd_interp::Union{I1, I2, I5})(alpha)), - R((cm_interp::Union{I1, I2})(alpha)) + return R((cd_interp::Union{I1, I2, I5})(alpha)) elseif panel.aero_model == POLAR_MATRICES cd_interp = panel.cd_interp - cm_interp = panel.cm_interp cd_interp isa Union{I3, I4, I6} || throw(ArgumentError("cd_interp is not initialized for POLAR_MATRICES.")) + return R((cd_interp::Union{I3, I4, I6})(alpha, panel.delta)) + elseif !(panel.aero_model == INVISCID) + throw(ArgumentError("Unsupported aero model: $(panel.aero_model)")) + end + return zero(R) +end + +""" + calculate_cm(panel::Panel, alpha) + +Calculate the pitching-moment coefficient for the given angle of attack. +""" +function calculate_cm(panel::Panel{Tp}, alpha::Ta) where {Tp, Ta} + R = promote_type(Tp, Ta) + isnan(alpha) && return R(NaN) + if panel.aero_model == LEI_AIRFOIL_BREUKELS + return R(evalpoly(rad2deg(alpha), reverse(panel.cm_coeffs))) + elseif panel.aero_model == POLAR_VECTORS + cm_interp = panel.cm_interp + cm_interp isa Union{I1, I2} || throw(ArgumentError("cm_interp is not initialized for POLAR_VECTORS.")) + return R((cm_interp::Union{I1, I2})(alpha)) + elseif panel.aero_model == POLAR_MATRICES + cm_interp = panel.cm_interp cm_interp isa Union{I3, I4} || throw(ArgumentError("cm_interp is not initialized for POLAR_MATRICES.")) - return R((cd_interp::Union{I3, I4, I6})(alpha, panel.delta)), - R((cm_interp::Union{I3, I4})(alpha, panel.delta)) + return R((cm_interp::Union{I3, I4})(alpha, panel.delta)) elseif !(panel.aero_model == INVISCID) throw(ArgumentError("Unsupported aero model: $(panel.aero_model)")) end - return zero(R), zero(R) + return zero(R) end +""" + calculate_cd_cm(panel::Panel, alpha) + +Calculate drag and moment coefficients for the given angle of attack +([`calculate_cd`](@ref) and [`calculate_cm`](@ref)). +""" +calculate_cd_cm(panel::Panel{Tp}, alpha::Ta) where {Tp, Ta} = + (calculate_cd(panel, alpha), calculate_cm(panel, alpha)) + """ calculate_filaments_for_plotting(panel::Panel) From d45c3b1d52bf869a02554340cef26bd9faf7ea92 Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 12 Jun 2026 18:54:39 +0200 Subject: [PATCH 2/3] Fix ordering --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 39bcd98a..10ae5147 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -58,7 +58,7 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - name: Install matplotlib if: runner.os == 'Linux' - run: sudo apt-get install -y python3-matplotlib + run: sudo apt-get update && 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")' @@ -90,7 +90,7 @@ jobs: - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - name: Install matplotlib - run: sudo apt-get install -y python3-matplotlib + run: sudo apt-get update && sudo apt-get install -y python3-matplotlib - name: Build PyCall with system Python run: julia -e 'ENV["PYTHON"]="python3"; using Pkg; Pkg.add("PyCall"); Pkg.build("PyCall")' - uses: julia-actions/julia-runtest@v1 From 1424f5c7adcf0adff2c83c60346e4e2822494d71 Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 12 Jun 2026 22:08:46 +0200 Subject: [PATCH 3/3] Fix flaky test --- test/Aqua.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Aqua.jl b/test/Aqua.jl index f029a707..4ed9be3c 100644 --- a/test/Aqua.jl +++ b/test/Aqua.jl @@ -4,6 +4,6 @@ using Aqua, VortexStepMethod, Test VortexStepMethod; stale_deps=(ignore=[:Xfoil, :Timers, :PyCall],), deps_compat=(ignore=[:PyCall],), - persistent_tasks=() + persistent_tasks=false ) end