From 787fb610ca2291c8e55f69f2fdf3b8a6c6b966e6 Mon Sep 17 00:00:00 2001 From: Bart Date: Thu, 6 Aug 2026 14:37:54 +0200 Subject: [PATCH] Fix lofted-airfoil rib placement for +spanwise section order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `airfoil_skin_geometry` chose which panel edge to loft each section's contour onto with `plus_edge = i <= n_panels ? !increasing : increasing`, where `increasing` tests whether the refined sections run along +spanwise. But panels are always built with `refined_sections[p]` as corner 1/2 and `refined_sections[p+1]` as corner 4/3 (`init_pos!`), independent of span order, so the correct edge is purely index-based: section `i` sits on panel `i`'s first edge for `i <= n_panels`, and on the last panel's second edge for the final section. For a wing whose sections run −y→+y (`increasing == true`) the old expression inverted every mapping, drawing each section's contour at its neighbour's station: the first-section tip got no rib and the last-section tip got a doubled (folded) rib, while the VSM panels rendered correctly. Replace it with `first_edge = i <= n_panels`, which reproduces the previous (correct) result for −spanwise wings and fixes the +spanwise case. Co-Authored-By: Claude Opus 4.8 --- ext/VortexStepMethodMakieExt.jl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ext/VortexStepMethodMakieExt.jl b/ext/VortexStepMethodMakieExt.jl index c206eb30..aa1fcfe1 100644 --- a/ext/VortexStepMethodMakieExt.jl +++ b/ext/VortexStepMethodMakieExt.jl @@ -136,9 +136,6 @@ function airfoil_skin_geometry(body; R_b_w=nothing, T_b_w=nothing) n = length(sections) n_panels = n - 1 n_panels < 1 && continue - spanwise = Point3f(wing.spanwise_direction) - increasing = dot(Point3f(sections[n].LE_point) - - Point3f(sections[1].LE_point), spanwise) > 0 for (i, section) in enumerate(sections) isnothing(section.section_aero) && continue panel_idx = panel_offset + min(i, n_panels) @@ -147,9 +144,9 @@ function airfoil_skin_geometry(body; R_b_w=nothing, T_b_w=nothing) corners = panel.corner_points corner1 = Point3f(corners[:, 1]); corner3 = Point3f(corners[:, 3]) corner2 = Point3f(corners[:, 2]); corner4 = Point3f(corners[:, 4]) - plus_edge = i <= n_panels ? !increasing : increasing - leading = plus_edge ? corner1 : corner4 - trailing = plus_edge ? corner2 : corner3 + first_edge = i <= n_panels + leading = first_edge ? corner1 : corner4 + trailing = first_edge ? corner2 : corner3 chord = trailing - leading chord_len = norm(chord) chord_len < 1e-9 && continue