Compressing fields: POD
A field is often a few dominant shapes plus small corrections: predict the shapes’ weights instead of every value.
Outcome: Build a snapshot matrix and find its modes with PCA (POD); read the energy captured by each mode; predict a whole field by regressing a few mode coefficients.
Builds on Gaussian processes, From runs to arrays
A pressure field has thousands of values, but across a family of designs they tend to move together. The field of each training run, on a shared mesh, is one row of a snapshot matrix of shape (runs × points), as in from runs to arrays, from which the mean field is subtracted.
Proper orthogonal decomposition (POD; Taira et al. 2017 give an overview for fluid flows) then finds the modes.
DefinitionModes
The computation is the singular value decomposition; statistics calls the same result principal component analysis (PCA).
Each field is then approximated by the mean field plus a weighted sum of a few modes.
Figure 3-3 shows the chordwise pressure distributions at 40 % span of the site’s 36 training runs, decomposed in the browser.
The mean chordwise pressure and the first two POD modes, each scaled to a typical size.
A test design rebuilt from the mean plus the modes kept, using its true coefficients. 1 mode captures 97.1 % of the variation of the training runs: 1 number per design instead of 67, relative L2 error 8.8 %.
The first mode captures 97.1 % of the variation and follows the angle of attack: it is mostly the suction peak growing and shrinking. With the second mode the total reaches 100.0 %, and two modes rebuild each test design almost exactly.
That is a property of this solver, which takes each wing section’s pressure from one 2D table indexed by the local lift. RANS fields with separation or shocks usually need many more modes for the same accuracy.
From modes to a surrogate
Each run is now coefficients instead of thousands of values. A POD surrogate regresses those coefficients on the design inputs, with a Gaussian process or a polynomial, then rebuilds the field from them. It is a non-intrusive reduced-order model: it does not project the governing equations onto the modes, as Galerkin models do. Field prediction becomes a handful of scalar predictions.
Requirements of POD
Every snapshot must sit on the same points in the same order, so a new mesh is interpolated first; the graph and transformer models of later units avoid this.
On a non-uniform mesh, each column of the snapshot matrix is multiplied by , where is the area or volume point stands for (the weight of Equation 3-3, not a mode coefficient), before the modes are found. Every field rebuilt from them is divided by to return to physical units (the modes too, for plotting). Otherwise the refined regions dominate the modes, as in measuring error. Example 3-5 leaves this weighting out and finds the modes of the plain snapshots, although the aircraft’s point areas span about three orders of magnitude.
POD is also linear: a feature that moves from run to run, such as a shock or a separation line, needs many modes. Learned nonlinear compressions aim to address this. They are the latent spaces of later units, with POD as their linear ancestor.
Example 3-5 builds a POD surrogate of the aircraft’s surface : four modes of the 36 training fields, and a GP on their coefficients. It goes into aircraft.py as pod_baseline, a baseline for the models of later units.
# Add to aircraft.py, with its other imports at the top:
from sklearn.decomposition import PCA
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, WhiteKernel
def pod_baseline(d, train, n_modes=4):
"""POD of the training fields, then a GP on the mode
coefficients: a predicted Cp field for every run."""
X = np.column_stack([d["alpha"], d["sweep"]])
Y = d["cp"][train]
pca = PCA(n_components=n_modes, svd_solver="full").fit(Y)1
kernel = RBF([3.0, 10.0]) + WhiteKernel(1e-4)
gp = GaussianProcessRegressor(kernel=kernel,
normalize_y=True)
gp.fit(X[train], pca.transform(Y))2
Z = gp.predict(X).reshape(len(X), n_modes)
return pca.inverse_transform(Z), pca3
# Then, in a script:
from aircraft import load_runs, pod_baseline, scores, split_runs
d = load_runs()
train, val, test, in_box = split_runs(d)
pred, pca = pod_baseline(d, train)
# Energy captured by the first 1, 2, 3 and 4 modes.
print(pca.explained_variance_ratio_.cumsum().round(5))4
s = scores(pred[val], d, val)
print(f"relative L2 on validation runs: {s['rel_L2']:.1%}")
PCAsubtracts the mean field of the training runs itself, then finds the modes of Equation 3-5 with a singular value decomposition, from the training runs only.svd_solver="full"asks for the exact decomposition; on a matrix this size the default picks a randomized one, whose last digits change from run to run.transformprojects each centred training field onto the modes: the coefficients , four per run. scikit-learn fits them with one GP and one shared kernel.reshapekeeps two axes even with a single mode;inverse_transformrebuilds from the predicted coefficients, for every run.explained_variance_ratio_is each mode’s energy as a share of the total; the cumulative sum is the share captured by the first 1, 2, 3 and 4 modes.
Example 3-5 prints the cumulative shares of the energy, [0.97381 0.99879 0.99996 0.99999] and a relative L2 error of 0.2 % on the 8 validation runs, against 21 % for the mean field of Example 3-3. A first surrogate, end to end compares it with a neural network.