You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Comparison of XFOIL and RustFoil curvature-based paneling (PANGEN)
4
+
description: Validation of RustFoil curvature-based paneling against XFOIL's PANGEN
5
5
---
6
6
7
-
# Paneling Validation: XFOIL vs RustFoil
7
+
# Paneling Validation
8
8
9
-
This document compares the paneling algorithms between XFOIL's `PANGEN` subroutine and RustFoil's `resample_xfoil()` implementation.
10
-
11
-
## Algorithm Overview
12
-
13
-
Both implementations use **curvature-based panel distribution** with identical parameters:
9
+
RustFoil's `resample_xfoil()` function is a faithful port of XFOIL's `PANGEN` subroutine. Both use **curvature-based panel distribution** with identical parameters:
14
10
15
11
| Parameter | Value | Description |
16
12
|-----------|-------|-------------|
@@ -19,11 +15,11 @@ Both implementations use **curvature-based panel distribution** with identical p
19
15
|`RDSTE`| 0.667 | TE panel spacing ratio (RTF = 0.334) |
20
16
|`IPFAC`| 5 | Newton refinement factor |
21
17
22
-
### PANGEN Algorithm Steps
18
+
### Algorithm Steps
23
19
24
20
1. Compute arc-length parameterization of buffer airfoil
25
21
2. Calculate curvature at each buffer point: κ(s) = |d²r/ds²|
26
-
3.**Find leading edge via Newton iteration** (tangent ⊥ to chord)
22
+
3. Find leading edge via Newton iteration (tangent ⊥ to chord)
27
23
4. Average curvature over 7 points near LE → κ_avg
28
24
5. Set artificial TE curvature: κ_TE = κ_avg × CTERAT
29
25
6. Smooth curvature with tridiagonal diffusion
@@ -34,115 +30,21 @@ Both implementations use **curvature-based panel distribution** with identical p
34
30
35
31
## Validation Results
36
32
37
-
### Symmetric Airfoils (NACA 0012)
33
+
All tested airfoils match XFOIL's paneling to numerical precision (~4e-7 RMS position error):
38
34
39
-
**Perfect match achieved:**
35
+
| Foil | XFOIL LE Index | RustFoil LE Index | RMS Error |
The discrepancy for cambered airfoils originates in the **leading edge detection** (`lefind` function).
68
-
69
-
### XFOIL's LEFIND Algorithm
70
-
71
-
From `xgeom.f`:
72
-
73
-
```fortran
74
-
C---- Find leading edge location (SBLE) using Newton iteration
75
-
C to find where tangent is perpendicular to chord line
76
-
XCHORD = X(N) - X(1)
77
-
YCHORD = Y(N) - Y(1)
78
-
79
-
C---- Newton iteration
80
-
DO 10 I=1, 50
81
-
XPRIME = DEVAL(SBLE,X,XP,S,N)
82
-
YPRIME = DEVAL(SBLE,Y,YP,S,N)
83
-
84
-
C------ Dot product of tangent with chord should be zero at LE
85
-
RES = XCHORD*XPRIME + YCHORD*YPRIME
86
-
DSLE = -RES / (XCHORD*X2 + YCHORD*Y2)
87
-
SBLE = SBLE + DSLE
88
-
89
-
IF(ABS(DSLE) .LT. 1.0E-6) GO TO 11
90
-
10 CONTINUE
91
-
```
92
-
93
-
The key is finding where:
94
-
95
-
```text
96
-
t(s_LE) · chord = 0
97
-
```
98
-
99
-
where `t` is the tangent vector and `chord` connects TE upper to TE lower.
100
-
101
-
### Issue in RustFoil
102
-
103
-
RustFoil's `lefind` implementation may have subtle differences in:
104
-
1. Initial guess for Newton iteration
105
-
2. Convergence tolerance
106
-
3. Spline derivative evaluation
107
-
108
-
## Fix Applied
109
-
110
-
The original RustFoil implementation had **incorrect symmetry enforcement** in the final node positions (lines 484-492 of `spline.rs`). This worked for symmetric airfoils but caused LE drift for cambered airfoils.
111
-
112
-
**Fix**: Removed the symmetry enforcement, matching XFOIL's behavior which relies purely on curvature-based distribution without post-processing symmetry.
113
-
114
-
## Final Results (All Fixed!)
115
-
116
-
| Foil | XFOIL LE | RustFoil LE | RMS Error | Status |
0 commit comments