Skip to content

Commit 6288bff

Browse files
1-Bart-1claude
andauthored
Fix lofted-airfoil rib placement for +spanwise section order (#256)
`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 <noreply@anthropic.com>
1 parent 4ba4f14 commit 6288bff

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎ext/VortexStepMethodMakieExt.jl‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ function airfoil_skin_geometry(body; R_b_w=nothing, T_b_w=nothing)
136136
n = length(sections)
137137
n_panels = n - 1
138138
n_panels < 1 && continue
139-
spanwise = Point3f(wing.spanwise_direction)
140-
increasing = dot(Point3f(sections[n].LE_point) -
141-
Point3f(sections[1].LE_point), spanwise) > 0
142139
for (i, section) in enumerate(sections)
143140
isnothing(section.section_aero) && continue
144141
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)
147144
corners = panel.corner_points
148145
corner1 = Point3f(corners[:, 1]); corner3 = Point3f(corners[:, 3])
149146
corner2 = Point3f(corners[:, 2]); corner4 = Point3f(corners[:, 4])
150-
plus_edge = i <= n_panels ? !increasing : increasing
151-
leading = plus_edge ? corner1 : corner4
152-
trailing = plus_edge ? corner2 : corner3
147+
first_edge = i <= n_panels
148+
leading = first_edge ? corner1 : corner4
149+
trailing = first_edge ? corner2 : corner3
153150
chord = trailing - leading
154151
chord_len = norm(chord)
155152
chord_len < 1e-9 && continue

0 commit comments

Comments
 (0)