ApexFlow Airfoil Aerodynamics Surrogate
Two small PyTorch models that predict steady, incompressible 2D RANS flow
around NACA 4-digit airfoils, trained on OpenFOAM (simpleFoam, kOmegaSST)
CFD data. Learned surrogates, not CFD -- see Limitations below.
Demo Space: see the linked Space on this model's page (or search "ApexFlow" on Hugging Face Spaces).
Files
best.pt-- Route A, a small U-Net (483,763 params). Input: 5-channel (signed distance function, fluid/solid mask, x, z, angle of attack) on a 128x128 grid. Output: (u/U∞, v/U∞, Cp) on the same grid.best_surface.pt-- Route B, a coordinate-based MLP (8,897 params). Input: (fractional arc-length position, x, z, camber m, camber location p, thickness t, angle of attack) per surface point. Output: Cp at that point. This is the more accurate force-recovery path (see Metrics) -- reading Cp off Route A's 128x128 grid and interpolating it onto the exact airfoil surface has an inherent resolution-limited error that predicting Cp directly at surface points avoids.
Both files are self-contained PyTorch checkpoints: model_state_dict,
config (architecture hyperparameters), and norm_stats (per-channel
normalization statistics computed from the training split only) all bundled
together.
Training data
- Reference flow condition: Re = 3e6, incompressible, kOmegaSST turbulence model (fixed across every case -- not a model input)
- Training geometry / condition range: camber m ∈ [0, 0.04], camber location p ∈ [0.2, 0.6], thickness t ∈ [0.08, 0.18], angle of attack ∈ [-5°, 9°]
- 99 independent CFD cases total (69 train / 15 val / 15 test), Latin Hypercube sampled, steady-state and passing a physical-convergence check (cases with oscillating, non-converged force coefficients -- mostly at AoA above ~9°, consistent with progressive stall/separation onset for this airfoil family at this Reynolds number -- are excluded from training and evaluation entirely, not silently included)
Metrics (held-out test split, 15 cases)
| Metric | Route A (U-Net, field) | Route B (surface MLP) |
|---|---|---|
| Params | 483,763 | 8,897 |
| Field MSE (u*, v*, Cp), physical units | 0.00031 / 0.00005 / 0.00013 | -- |
| Mean |Cl error| vs CFD | 0.076 | 0.023 |
| Mean |Cd (pressure) error| vs CFD | 0.0034 | 0.0043 |
| Cd within 0.01 tolerance | -- | 15/15 |
Route A's Cl recovery is bounded by a known grid-interpolation artifact, isolated during evaluation by also integrating the ground-truth gridded Cp the same way (mean |Cl error| 0.24 from gridding alone) -- confirming the gap is resolution, not model quality. Route B avoids this by predicting Cp directly at surface points instead of reading it off the grid, which is why it's the recommended path for lift/drag, and Route A is the one to use for the full flow field.
Both models degrade specifically near AoA ≈ 8-9°, the separation-onset boundary -- consistent with, not contradicting, the training-data exclusion above.
Limitations
- Small number of independent CFD cases (99) for a 4-D input space
- NACA 4-digit geometries only -- no guarantee of generalization to other airfoil families
- Single fixed Reynolds number / flow condition
- 2D steady RANS assumptions throughout (no 3D effects, no transient/unsteady behavior even where physically present)
- Reported drag is pressure drag only -- there is no wall-shear/viscous term anywhere in this pipeline, so it is a lower bound on total drag, never "total Cd"
- Predictions outside the training ranges above are extrapolation with no accuracy guarantee, and predictions near/above AoA ≈ 8-9° are in the known weaker region even within the nominal training range
- No guarantee of CFD-equivalent accuracy anywhere -- this is a surrogate for fast approximate evaluation, not a CFD replacement