Reconstruct NeuralFoil's surface pressure from edge velocity in arc length - #266
Open
1-Bart-1 wants to merge 1 commit into
Open
Reconstruct NeuralFoil's surface pressure from edge velocity in arc length#2661-Bart-1 wants to merge 1 commit into
1-Bart-1 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ength NeuralFoil samples at the cell centres of a uniform chordwise grid, so it reports nothing over the first and last 1/2N of chord -- the nose, which is almost all of the axial force, and the trailing edge. The old reconstruction extrapolated Cp linearly off the end of each surface, independently. Through a stagnation point the inviscid surface speed is linear in arc length and Cp = 1 - ue^2 is quadratic, so extrapolating Cp runs a straight line through the curve's own turning point. On an SK100 mid-span section at 5 deg that put Cp = -1.60 at the leading edge, where it has to approach +1, and left the two surfaces at 0.057 and 0.117 at the trailing edge where a sharp edge carries one pressure. Chord fraction is also the wrong coordinate there: the unsampled nose is 4.1% of arc against 1.6% of chord. Interpolate ue instead, in arc length, over both surfaces at once. Signing the lower surface negative makes them one continuous curve whose zero is the stagnation point, so the nose is interpolated between the innermost station on each side rather than extrapolated off the end of one, and Cp passes through exactly 1 at stagnation without that being imposed -- including the fact that stagnation sits on the lower surface at positive incidence. The stagnation point goes in as its own knot, placed where the two innermost stations interpolate linearly to zero, which is the stagnation-point-flow result rather than a fit. The trailing edge takes the mean of the two surfaces' extrapolated speeds, the Kutta condition. Between stations the interpolation is a shape-preserving monotone cubic, the family NeuralFoil's own training pipeline resamples XFoil boundary layers with. Measured on that section, integrating the surface traction: max Cp goes from 0.689 to 1.000, leading-edge Cp from -1.60 to +0.77 (XFoil 0.41), the two trailing-edge values from 0.057/0.117 to a matched 0.093, and the integrated drag from -0.0199, the wrong sign, to +0.0269 against NeuralFoil's own reported 0.0276. The lift integral loses about a point of accuracy (Cl_int 0.934 -> 0.919 against a reported 0.949), and on smooth sections whose true drag is small the integral now overshoots rather than inverting. Both are far smaller than what they replace. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1-Bart-1
force-pushed
the
nf-surface-closure
branch
from
August 25, 2026 10:24
09b607e to
5b60042
Compare
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.
The bug
NeuralFoil samples
ue/u∞at the cell centres of a uniform chordwise grid(
compute_optimal_x_points), so with 32 stations per surface the first sits at1.5625% chord and the last at 98.4375%. Nothing is reported at either end.
neuralfoil_contour_solutionfilled those gaps by extrapolatingCplinearly offthe end of each surface, independently.
Through a stagnation point the inviscid surface speed is linear in arc length, so
Cp = 1 − ue²is quadratic. ExtrapolatingCpruns a straight line backwardsthrough the curve's own turning point. On an SK100 mid-span section at 5°:
Cpcannot exceed 1, and the two trailing-edge values must be equal on a sharpedge (Kutta). Chord fraction is also the wrong coordinate across a blunt nose: the
unsampled region is 4.1% of arc against 1.6% of chord.
The fix
Interpolate
ue, in arc length, over both surfaces as one curve:ue = 0by definition. The nose is then interpolated between the innermoststation on each side rather than extrapolated off the end of one, and
Cpreaches exactly 1 at stagnation without that being imposed — including the fact
that stagnation sits on the lower surface at positive incidence, not at the nose.
interpolate linearly to zero. That placement is the stagnation-point-flow result,
not a fit, and it stops the cubic guessing the region's width from two distant
samples.
FritschButland), the familyNeuralFoil's own training pipeline resamples XFoil boundary layers with.
neuralfoil_sectionnow also returnsue_upper/ue_lower.No new dependencies;
FritschButlandMonotonicInterpolationis in Interpolations.Honest limits
The lift integral loses about a point (
Cl_int0.934 → 0.919 against a reported0.949), and on smooth sections whose true drag is small the traction integral now
overshoots (0.027 against 0.009) rather than coming out negative. Both are much
smaller than the sign inversion they replace, but they are real.
This changes nothing about NeuralFoil's integrated
CL/CD/CM, only thedistribution reconstructed on the contour — which matters to anything integrating
the surface traction, e.g. a structural coupling.
Not verified locally
Both changed files parse and the reconstruction was exercised against XFoil on four
SK100 section variants. The suite is left to CI.
🤖 Generated with Claude Code