From a9fff16ca2667ebffc7e70a271d3638c8bc87fb9 Mon Sep 17 00:00:00 2001 From: 1-Bort-1 <323661610+1-Bort-1@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:32:32 +0200 Subject: [PATCH] Name the deflection .dat with delta_suffix, not a second scheme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit generated_slices built its own `_d.dat` tag, which disagrees with AirfoilAero.delta_suffix — the function that named the file — on every negative or fractional deflection. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NsHXaNNeota4FBimt83s6S --- CHANGELOG.md | 5 +++++ ext/VortexStepMethodMakieExt.jl | 16 +++++++--------- test/plotting/test_plotting.jl | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2de9cb76..5a94133a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ ### Fixed +- `plot_slices_3d` on a generated output directory draws the deflected contour for + every deflection that was generated, not just positive whole degrees. It built its + own `_d.dat` filename tag instead of the `delta_suffix` one the files were + written under, which spells a minus sign `m` and a decimal point `p`, so + `delta=-10` or `delta=2.5` found no `.dat` and drew nothing. - The `NONLIN` solver backtracks along each Newton step instead of always taking it whole, so it converges past stall where the full step used to cycle: on the `test/solver/solver_test_wing.yaml` wing at 26.6° it stopped 3.6% below `LOOP`'s diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index ddd010e2..bb8026a1 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -1601,8 +1601,7 @@ their written `.dat` airfoils — raw slice, wrap, and the `delta`-degree deform when it was generated — assembled for [`plot_slices_3d`](@ref VortexStepMethod.ObjAdapter.plot_slices_3d). Nothing is re-sliced or re-wrapped; only the Kulfan fits of the stored coordinates are -recomputed (via -`fit_pts`), exactly as the polar pipeline fits them. +recomputed (via `fit_pts`), exactly as the polar pipeline fits them. """ function generated_slices(out_dir, delta, fit_pts) geom = VortexStepMethod.YAML.load_file(joinpath(out_dir, "geometry.yaml")) @@ -1611,9 +1610,8 @@ function generated_slices(out_dir, delta, fit_pts) les = [Float64.(r[2:4]) for r in rows] tes = [Float64.(r[5:7]) for r in rows] n = length(rows) - deg = round(float(delta); digits=1) - tag = "_d" * (deg == round(deg) ? string(Int(deg)) : string(deg)) * ".dat" - missing_deltas = String[] + tag = "_$(AirfoilAero.delta_suffix(deg2rad(delta))).dat" + missing_dats = String[] slices = map(1:n) do i id = rows[i][1] tangent = normalize(les[min(i + 1, n)] .- les[max(i - 1, 1)]) @@ -1631,16 +1629,16 @@ function generated_slices(out_dir, delta, fit_pts) def3d = map_airfoil_3d(les[i], tes[i], tangent, xd, yd) d2 = (; d2..., def=Point2f.(xd, yd), def_kulfan=fit_pts(xd, yd)) else - push!(missing_deltas, basename(dpath)) + push!(missing_dats, relpath(dpath, out_dir)) end end (; centroid=Point3f((les[i] .+ tes[i]) ./ 2), label_y=les[i][2], cloud3d=map_airfoil_3d(les[i], tes[i], tangent, xr, yr), wrap3d=map_airfoil_3d(les[i], tes[i], tangent, xw, yw), def3d, d2) end - isempty(missing_deltas) || - @warn "No generated .dat for delta=$(delta)° ($(join(missing_deltas, ", ")));" * - " generated deflections are named airfoils/_d.dat." + isempty(missing_dats) || + @warn "No generated .dat for delta=$(delta)° in $out_dir: " * + join(missing_dats, ", ") return slices, reduce(hcat, les), reduce(hcat, tes) end diff --git a/test/plotting/test_plotting.jl b/test/plotting/test_plotting.jl index b6a973ae..a44113db 100644 --- a/test/plotting/test_plotting.jl +++ b/test/plotting/test_plotting.jl @@ -563,4 +563,18 @@ end ax_lw = Axis3(fig_lw[1, 1]) @test_nowarn Makie.plot!(ax_lw, plain_body; border_linewidth=3.0) end + +@testset "generated_slices reads the deflected .dat under its generated name" begin + generated_slices = getfield(makie_ext, :generated_slices) + gen_dir, _ = ram_air_matrix_dir(; n_sections=4, + alpha_range=deg2rad.(-1:1.0:1), delta_range=deg2rad.(-1:1.0:1)) + fit_pts(x, y) = Point2f.(x, y) + + for delta in (-1.0, 1.0) + slices, _, _ = @test_nowarn generated_slices(gen_dir, delta, fit_pts) + @test all(s -> !isempty(s.d2.def), slices) + @test all(s -> s.def3d !== nothing, slices) + end +end + nothing