XFOIL Surrogate

XFOIL, PyTorch

I wanted to see if a model could predict XFOIL lift coefficient from a limited corpus of XFOIL runs, and how accurately it would do so. It's not really a tool, rather, it's a way to experiment with the intersection of ML and aerodynamics. I want to maybe expand on this, using XFOIL and Selig's UIUC airfoil database to make a model that knows when it's wrong, because this one doesn't.

How it works

The model takes the three digits of a NACA 4-digit code (camber, camber position, thickness), the Reynolds number, and angle of attack. It returns the lift coefficient.

The part that matters is feeding the NACA digits in as continuous numbers rather than as a categorical airfoil ID. With an ID, the model cannot generalize to an airfoil it never saw; there is no way for it to know that 0013 sits between 0012 and 0014. With the digits as real inputs it interpolates to codes that were never simulated.

Predicted versus actual lift coefficient for NACA codes held out of the training set
Held-out interpolation test on NACA codes absent from training: 0013, 0009, 4413 and 4416. Points are XFOIL, lines are the model. Agreement is close through the linear range and falls apart past stall at Re = 1×106, where the model keeps climbing and XFOIL turns over.

Training data

926 samples generated with XFOIL: ten airfoils (camber 0 and 4, thickness 8 through 18), three Reynolds numbers from 1×106 to 1×107, and angles of attack from −10° to 20°. Held-out codes reach an MAE of 0.012 to 0.027 depending on Reynolds number.

What it does not do

The model learned to imitate XFOIL, which means it imitates XFOIL where XFOIL is wrong. The output is what XFOIL would say, not what the airfoil does, which is problematic, because XFOIL sucks at low Reynolds numbers.

It is also weakest exactly where airfoil behavior gets interesting, at low Reynolds numbers and during stall. That's why I want to potentially explore another PINN or UIUC model that can predict where it's wrong and fix it based on experimental data and real fluid dynamics.

Source on GitHub