Fix lofted-airfoil rib placement for +spanwise section order - #256
Merged
Conversation
`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>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the Makie extension,
airfoil_skin_geometrydraws one lofted airfoil rib per section by fitting the section's contour onto a panel edge. It picked the edge with:where
increasingtests whetherrefined_sectionsrun along+spanwise.Panels are always built with
refined_sections[p]→corner_pointscol 1/2 andrefined_sections[p+1]→ col 4/3 (init_pos!), independent of span order. So the edge for sectioniis purely index-based:i <= n_panels→ paneli's first edge (col 1/2)i == n(last section) → last panel's second edge (col 4/3)The
increasingterm is spurious. It is a no-op for−spanwisewings (increasing == false) but inverts every mapping for+spanwisewings (increasing == true): each section's contour is lofted onto its neighbour's station. The result is a missing rib at the first-section tip and a doubled/folded rib at the last-section tip, while the VSM panels themselves render correctly.Observed on an SK100 wing (sections ordered −y→+y): no lofted airfoil at the most-negative-y tip, a folded double airfoil at the most-positive-y tip.
Fix
This reproduces the previous (correct) output for
−spanwisewings and fixes the+spanwisecase.spanwise/increasingare no longer needed and are removed.Notes
🤖 Generated with Claude Code