Neural networks that stand in for fluid simulations can reproduce the flow around an airfoil with small average error, yet still get drag wrong. On the AirfRANS benchmark, models with low field error often cannot even order airfoils correctly by drag. Their rank correlation for drag is poor and sometimes negative. The cause is that drag depends on how sharply velocity changes in a very thin layer next to the wing surface, and an average error over the whole flow barely notices that layer. We propose to borrow a tool from neuroscience, representational similarity analysis (RSA). RSA compares two systems through their pattern of pairwise distances over a shared set of inputs rather than through their coordinates. We use it for two purposes. The first is to diagnose what a flow surrogate's internal features actually encode about differences between flow cases. The second is to train it: we add a loss that makes the pattern of distances between cases in the network's hidden layer match the pattern of distances between the cases' true wall shear-stress distributions.
The key observation is that drag rank correlation measures how cases compare with each other, while standard training losses score each case on its own. A loss that constrains how cases relate to each other should target the failing metric directly. It should also get more out of the 103-simulation training regime of the NeurIPS 2024 ML4CFD competition, because every pair of cases supplies a training signal.
Core Claim
We hypothesize that mesh-based surrogates trained on field error organize their hidden features by large-scale flow similarity. That similarity is dominated by angle of attack, Reynolds number and gross shape, and it is enough for lift. The same features are largely blind to differences in the boundary layer, which is what determines skin-friction drag. This is a physical instance of the "mimic effect" described in Obstacles to inferring mechanistic similarity using Representational Similarity Analysis: two systems can have near-identical similarity structure because correlated features hide a mechanistic difference.
If the hypothesis holds, two predictions follow. The first is diagnostic. On "controversial" pairs of cases whose far-field flows are close but whose wall shear differs, the surrogate's hidden-layer distances should follow the far field and not the wall. The second is interventional. Adding a relational loss that aligns a hidden layer's case-by-case dissimilarity matrix with the wall-shear dissimilarity matrix should raise drag rank correlation, especially on the Reynolds and angle-of-attack extrapolation splits. It should also beat both near-wall loss reweighting and a direct drag-ranking loss.
The file reports no prior work applying RSA to fluid simulation. The closest existing work is output-only benchmarking in AirfRANS, PDEBench and ML4CFD, which never looks inside the models.
Research Program
The substrate is AirfRANS. It contains 1,000 steady Reynolds-averaged simulations of NACA airfoils, meaning simulations that solve for the time-averaged flow and model turbulence with the k-ω SST closure, a standard two-equation turbulence model. The meshes resolve the wall with a first-cell height of y+ ≈ 1. The benchmark provides full-data, scarce-data, Reynolds-extrapolation and angle-of-attack-extrapolation splits, and it scores GraphSAGE, Graph U-Net, PointNet and MLP surrogates. We also use the scarce split and scoring pipeline of the NeurIPS 2024 ML4CFD Competition, which has 103 training cases, 200 test cases and 496 out-of-distribution test cases. Both papers report only output metrics. Our additions are the representational analysis and the relational training signal.
The work has three stages.
Stage 1: reference dissimilarity matrices. For a fixed set of N flow cases, we compute several N × N dissimilarity matrices from the simulated ground truth. A dissimilarity matrix records how different each pair of cases is. We compute three kinds:
- a volume matrix, from the full velocity and pressure fields interpolated to a common reference region;
- a wall matrix, from the wall shear-stress and surface-pressure distributions, parameterized by chord position along the airfoil;
- scalar matrices from the lift and drag coefficients alone.
Surface quantities are functions of chord position, so the wall matrix is well defined across different geometries. This removes the coordinate-mismatch problem that RSA was designed to handle (The neuroconnectionist research programme).
Stage 2: diagnosis. For each trained surrogate and each layer, we pool the node features in three physically meaningful bands: near-wall nodes, the wake, and the far field. From each pooled representation we compute the model's dissimilarity matrix. We compare model matrices to the reference matrices with three similarity measures:
- Spearman correlation between the matrices;
- linear centered kernel alignment (CKA), a standard index of how similar two sets of neural features are up to rotation and scaling;
- orthogonal Procrustes distance, the residual after the best rotation aligning one set of features to another.
We report all three because ReSi found no single measure dominates. CKA ranked 1st on language but 11th on graphs, while Procrustes was the most consistent across domains, and meshes are graphs. Because the "modulation effect" makes RSA scores depend on the case distribution, every score is computed on fixed, published case sets for each split and reported with bootstrap intervals over cases.
We also build a controversial set. These are case pairs selected from AirfRANS whose volume-matrix distance is in the bottom decile while their wall-matrix distance is in the top decile, and the reverse. They are the flow analogue of the controversial stimuli recommended by the Obstacles paper. We borrow one more idea from Only Brains Align with Brains. That paper argues that one-layer-to-one-target scores saturate, so we compare the whole pattern of layer-by-band alignments against the pattern the reference matrices imply, rather than any single score.
Stage 3: intervention. We add a relational loss to standard training. For a minibatch of B cases, let $D^{h}$ be the B × B matrix of distances between the near-wall-pooled hidden features of each pair of cases, and let $D^{w}$ be the corresponding wall-shear dissimilarity matrix from ground truth. The training objective becomes
$$ \mathcal{L} = \mathcal{L}_{\text{field}} + \lambda \left(1 - r\big(\mathrm{vec}(D^{h}), \mathrm{vec}(D^{w})\big)\right), $$
where $\mathcal{L}_{\text{field}}$ is the usual per-node field loss, $r$ is the Pearson correlation between the upper triangles of the two matrices, and $\lambda$ is a weight. We use Pearson rather than a rank correlation because it is differentiable; a differentiable soft-rank version is a secondary variant. Forces are still computed by integrating the predicted surface fields, exactly as in AirfRANS, so any gain in drag must pass through better wall predictions and not through a separate head.
We then repeat the study on AhmedML. It contains 500 transient hybrid RANS–LES car-body simulations, a scheme that runs the averaged model near walls and resolves large eddies in the separated wake. This tests whether the effect survives three-dimensional separated flow.
Baselines
The naive reference is the AirfRANS training recipe run unchanged: Graph U-Net and GraphSAGE trained on field error only, on the same splits and seeds we use. For this recipe, AirfRANS reports a Graph U-Net lift Spearman correlation of $\rho_L = 0.967$. We found no reported numerical drag Spearman value on Lacuna for AirfRANS, only the qualitative finding that it is poor or negative. We will therefore reproduce it ourselves. Beating this baseline means a drag Spearman gain whose bootstrap interval excludes zero on the full, scarce and both extrapolation splits, with lift correlation no worse than 0.967 minus its interval width.
The strongest existing system is the ML4CFD winner, the Mesh Morphing Gaussian Process (MMGP), which reports a global score of 81.29% against 32.85% for the fully connected baseline (ML4CFD). MMGP is not a neural network, so the relational loss cannot be attached to it. It serves as the external bar on the competition's scarce split under the official scoring pipeline. Beating it outright is not required for the scientific claim. Closing a meaningful share of the gap between the GNN-FC baseline and MMGP on the physics-compliance and out-of-distribution sub-scores would count as a strong result.
Two competing losses are run with identical architectures, training steps and hyperparameter search budgets: 20 trials over the loss weight and learning rate, selected on the same validation cases. The first is near-wall reweighting, which multiplies the field loss on cells with small wall distance. The second is a direct pairwise drag-ranking loss on the integrated drag coefficient.
Two ablations isolate the key ingredient. The volume-target ablation uses the same relational loss with $D^{w}$ replaced by the volume matrix, which tests whether the wall target specifically matters. The shuffled-target ablation permutes $D^{w}$ across cases, which tests whether any relational regularizer helps simply by acting as generic regularization.
Why not just…?
Why not just score outputs with drag error and physics metrics, since ground truth is available? For evaluation we do exactly that, and every headline claim is an output metric. Output scores say drag is wrong but not why. PDEBench shows that low field error can coexist with violated conservation and distorted frequency spectra, which is the same kind of hidden failure. Stage 2 is the test of whether the failure is representational. If hidden-layer distances already track the wall matrix on the controversial pairs, the diagnosis is wrong, and we would report that the problem sits in the decoder instead.
Why not just upweight the loss near the wall? This is a real threat. Reweighting improves each case's wall prediction, but it gives no direct pressure on how cases are ordered, and that ordering is what drag Spearman measures. The experiment settles it. If reweighting matches the relational loss on drag rank correlation across splits, the relational part adds nothing, and we will say so. We also test the two combined, since the losses are complementary in principle.
Why not just add a ranking loss on predicted drag? This is the most direct competitor. It supplies about 5,000 pairwise constraints from 103 cases, but each constraint carries only one bit, the sign of the drag difference. The wall matrix instead gives graded distances between entire shear-stress distributions, including where along the chord two airfoils differ. Our hypothesis is that this richer signal extrapolates better to unseen Reynolds numbers and angles. If the scalar ranking loss matches us on the extrapolation splits, the simpler method wins.
Why not just compare models with POD modes? Proper orthogonal decomposition (POD) extracts the dominant spatial patterns, or modes, of a flow dataset. It needs a shared spatial grid, and it is linear. A Review of Simulations and Machine Learning Approaches for Flow Separation Analysis notes that linear POD struggles with separated, nonlinear flow. We still include a POD-coefficient matrix as an extra reference target in Stage 1, so any advantage of the wall matrix over POD is measured rather than assumed.
Proposed Experiments
The first decisive check is the controversial-pair test on the baseline Graph U-Net and GraphSAGE. The hypothesis predicts that near-wall hidden distances correlate more with the volume matrix than with the wall matrix on these pairs, and that this gap predicts per-split drag Spearman across architectures and seeds. A null result here would redirect the project toward the decoder.
The second check is the full comparison on the AirfRANS splits and the ML4CFD scarce split. It covers the relational loss, near-wall reweighting, the drag-ranking loss, and both ablations, with five seeds each. We report drag and lift Spearman, relative drag error, wall-shear error and volume field error, plus the official ML4CFD global score. The idea succeeds only if all of the following hold: the relational loss beats both alternative losses on drag Spearman in the extrapolation splits; the shuffled-target ablation shows no gain; and volume error does not rise by more than 10%.
To guard against the relational loss merely producing mimicry, we recompute the Stage 2 controversial-pair test after training. Matching the target matrix on the training cases proves nothing on its own. The claim requires the alignment to hold on held-out controversial pairs and to be accompanied by better integrated drag.
Finally, we rerun the best configuration on AhmedML. There the reference GNN reaches a drag mean absolute error of 0.034 and a lift mean absolute error of 0.085 (AhmedML). The question is whether the gain transfers to three-dimensional separated flow, where pressure drag dominates and the wall-shear target may need to be replaced by a surface-pressure target.
References
- Obstacles to inferring mechanistic similarity using Representational Similarity Analysis
- AirfRANS: High Fidelity Computational Fluid Dynamics Dataset for Approximating Reynolds-Averaged Navier–Stokes Solutions
- NeurIPS 2024 ML4CFD Competition: Harnessing Machine Learning for Computational Fluid Dynamics in Airfoil Design
- The neuroconnectionist research programme
- ReSi: A Comprehensive Benchmark for Representational Similarity Measures
- Only Brains Align with Brains: Cross-Region Alignment Patterns Expose Limits of Normative Models
- AhmedML: High-Fidelity Computational Fluid Dynamics Dataset for Incompressible, Low-Speed Bluff Body Aerodynamics
- PDEBench: An Extensive Benchmark for Scientific Machine Learning
- A Review of Simulations and Machine Learning Approaches for Flow Separation Analysis