Skip to content

About

A repeatable, interpretable training pipeline for a classifier that reads aerodynamic measurements at a given flight condition and predicts the flow state around the body

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Predicting Flow Separation and Turbulence Onset

A repeatable, interpretable training pipeline for a classifier that reads aerodynamic measurements at a given flight condition and predicts the flow state around the body.

The final deliverable is an XGBoost classifier whose feature importances are checked against known aerodynamic physics with SHAP.

Flow-state labels

Label State Physical meaning
0 Attached Clean, efficient flow; lift rising, turbulence calm
1 Near Onset Transition zone; lift flattening, turbulence rising
2 Separated Post-stall; lift collapsing, turbulence elevated

Data

The dataset begins with 80 real CFD simulations on a 4 × 20 grid of velocity (20, 25, 30, 35 m/s) × angle-of-attack (−2° to 17°). To make it large enough for ML:

  1. Fit a Gaussian Process Regression (GPR) surrogate with a Matérn kernel.
  2. Validate it with Leave-One-Out CV (R² > 0.91 on all key outputs).
  3. Sample 1,200 new input combinations via Latin Hypercube Sampling.
  4. Drop points whose GPR predictive uncertainty exceeded 2× the median on two or more outputs simultaneously.

Result: 1,057 high-quality points (80 real + 977 synthetic).

Pipeline

  1. Exploratory physics review — understand stall behaviour from the real CFD data.
  2. Feature engineering — TKE_norm, CL/CD slopes, LD_ratio, delta_P, plus data-quality fixes.
  3. Labelling (reviewed) — start from a physics-based AoA-banded rule, then move to a behaviour-first label that is not trivially recoverable from AoA alone.
  4. Honest evaluation design — train on the synthetic GPR pool, hold out the 80 real CFD rows.
  5. Model training — 5-fold stratified cross-validation + class-balanced sample weights.
  6. Model evaluation — confusion matrices, per-class F1, CV-vs-real gap.
  7. SHAP interpretability and a physics validation of the learned feature hierarchy.

Engineered features

Feature Definition Why it helps
TKE_norm TKE / V² Removes velocity bias so turbulence is comparable across speeds
dCL_dAoA d(CL)/d(AoA) Lift slope — positive attached, crosses zero at stall
dCD_dAoA d(CD)/d(AoA) Drag slope — accelerates sharply at separation
LD_ratio CL / CD Efficiency — high attached, collapses at stall
delta_P Pressure Max − Pressure Min Full surface pressure loading

The labelling result

The original v3 rule was AoA-banded: classes sat in fixed AoA bands, so a model using only Velocity and AoA could nearly solve the task (an AoA-only rule scored ~0.90 macro F1). The target was a labelling artifact, not a hidden physics signal.

The reviewed v8 rule defines state from aerodynamic behaviour, with no AoA term:

if TKE_norm < 0.045:                          -> Attached (0)
elif TKE_norm < 0.075 and CL > 0.15:          -> Near Onset (1)
elif TKE_norm >= 0.075 and CL > 0.15:         -> Separated (2)
# rows where CL <= 0.15 are forced back to Attached regardless of TKE

The CL > 0.15 guard removes low-AoA settling-transient false positives. Under v8 the AoA-only baseline drops to ~0.74 macro F1, so the full-feature model performs genuine inference rather than recovering a labelling artifact.

Evaluation design

The split is by data origin, not random:

  • Training pool — the 977 synthetic GPR rows; all cross-validation happens here.
  • Final holdout — the 80 real CFD rows; touched exactly once at the end.

Three feature sets share the same model and class-balanced weights:

Set Features Purpose
Full 12 features (post-CFD outputs + engineered) Best-case model
Reduced 10 features (drops CL, TKE_norm) Honesty check for the labelling rule
Pre-CFD Velocity, AoA only Practical pre-simulation surrogate

Physics validation (SHAP)

The learned hierarchy matches aerodynamic theory: AoA dominates, followed by CL, CD, TKE_norm, and dCL_dAoA, with Velocity near the bottom — consistent with all velocity groups stalling at the same AoA.

Rank Feature Expectation Verdict
1 AoA (deg) Primary driver — stall is angle-driven Confirmed
2–3 CL, CD CL peaks at stall, CD accelerates after Confirmed
4 TKE_norm Direct turbulence signal; outperforms raw TKE Confirmed
5 dCL_dAoA Slope reversal marks post-stall Confirmed
low Velocity (m/s) Secondary — geometry-driven stall Confirmed (near-zero)
low Pressure features Consequence, not cause Confirmed

Results

  • Full-feature model — best performance; SHAP hierarchy consistent with theory.
  • Reduced model — shows the classifier is not merely re-encoding the v8 rule.
  • Pre-CFD model — quantifies how much signal is available from inputs alone.

How to run

Place the dataset beside the notebook (or in outputs/) and run wake-nb-reviewed-pplx.ipynb top to bottom.

Required inputs:

  • outputs/CFD_high_confidence_only.csv — the 1,057-row real+synthetic dataset (primary).
  • (optional) CFD_ml_ready_v2.csv — pre-engineered fallback if the raw file is unavailable.

The first code cell checks for these files and fails loudly with instructions if they are missing.

Notebook status: the notebook is delivered unexecuted. The underlying CFD CSV files were not included with the source notebooks, so outputs, figures, and metrics render once you run it against the data.

Limitations

  • Labels are derived, not experimental ground truth. v8 is a physics-informed rule applied to surrogate data — a strong target, but not measured reality.
  • Synthetic GPR data may carry surrogate bias. Training on GPR outputs and testing on real CFD is the right design, but a 977-row pool built from 80 real points inherits the surrogate's assumptions.
  • The real holdout is only 80 rows. Per-class holdout metrics — especially for the minority Near Onset class — have wide uncertainty.
  • v8 uses CL and TKE_norm directly, which is why the reduced-feature experiment matters.

Repository contents

Path Description
wake-nb-reviewed-pplx.ipynb Reviewed, consolidated notebook (main pipeline)
outputs/CFD_high_confidence_only.csv 1,057-row high-confidence dataset
CFD_ml_ready_v2.csv Pre-engineered fallback dataset

This notebook consolidates and reviews work previously spread across four separate notebooks (data preparation, the original v3 labelling pipeline, the behaviour-first relabelling study, and the pre-CFD / holdout evaluation).

About

A repeatable, interpretable training pipeline for a classifier that reads aerodynamic measurements at a given flight condition and predicts the flow state around the body

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages