FluidFlow: a flow-matching generative model for fluid dynamics surrogates on unstructured meshes
Authors: David Ramos, Lucas Lacasa, Fermín Gutiérrez, Eusebio Valero, Gonzalo Rubio
Organizations: ETSIAE-UPM-School of Aeronautics, Universidad Politécnica de Madrid, Plaza Cardenal Cisneros 3, E-28040 Madrid, Spain · Institute for Cross-Disciplinary Physics and Complex Systems (IFISC, CSIC-UIB), 07122 Palma de Mallorca (Spain) · Center for Computational Simulation, Universidad Politécnica de Madrid, Campus de Montegancedo, Boadilla del Monte, 28660 Madrid, Spain
Computational fluid dynamics (CFD) provides high-fidelity simulations of fluid flows but remains computationally expensive for many-query applications. In recent years deep learning (DL) has been used to construct data-driven fluid-dynamic surrogate models. In this work we consider a different learning paradigm and embrace generative modelling as a framework for constructing scalable fluid-dynamics surrogate models. We introduce FluidFlow, a generative model based on conditional flow-matching, a recent alternative to diffusion models that learns deterministic transport maps between noise and data distributions. FluidFlow is specifically designed to operate directly on CFD data defined on both structured and unstructured meshes alike, without the needs to perform any mesh interpolation pre-processing and preserving geometric fidelity. We assess the capabilities of FluidFlow using two different core neural network architectures, a U-Net and diffusion transformer (DiT), and condition their learning on physically meaningful parameters. The methodology is validated on two benchmark problems of increasing complexity: prediction of pressure coefficients along an airfoil boundary across different operating conditions, and prediction of pressure and friction coefficients over a full three-dimensional aircraft geometry discretized on a large unstructured mesh. In both cases, FluidFlow outperform strong multilayer perceptron baselines, achieving significantly lower error metrics and improved generalisation across operating conditions. Notably, the transformer-based architecture enables scalable learning on large unstructured datasets while maintaining high predictive accuracy. These results demonstrate that flow-matching generative models provide an effective and flexible framework for surrogate modelling in fluid dynamics, with potential for realistic engineering and scientific applications.
Figures & tables
Figure 1: U-Net architecture and its main components.
Figure 2: One-dimensional patchification used in the diffusion transformer.
Model
mse
rmse
mae
mre (%)
ae_95
ae_99
R2
Relative L2
Vanilla MLP
0.00129
0.03598
0.01763
16.85219
0.05716
0.14176
0.99730
0.04911
FluidFlow (U-Net)
0.00009
0.00961
0.00240
4.48810
0.00761
0.03175
0.99981
0.01325
FluidFlow (DiT)
0.00009
0.00953
0.00249
3.43723
0.00764
0.03246
0.99981
0.01314
Table 1: Generalisation performance comparison for the airfoil task.
Figure 3: Scatter plots of the true vs predicted pressure coefficient, for all locations and operating conditions in the airfoil’s test set. Color codes the magnitude of the residuals.
Figure 4: Examples of predicted and reference airfoil pressure distributions for different operating conditions.
s
mse
rmse
mae
mre (%)
ae_95
ae_99
R2
Relative L2
1.0
0.000110
0.0105
0.00289
3.520
0.00920
0.0360
0.99977
0.0145
1.5
0.000092
0.0096
0.00252
3.089
0.00766
0.0339
0.99980
0.0132
2.0
0.000091
0.0095
0.00249
3.043
0.00764
0.0325
0.99981
0.0131
2.5
0.000094
0.0097
0.00254
3.118
0.00793
0.0321
0.99980
0.0134
3.0
0.000100
0.0100
0.00261
3.205
0.00824
0.0319
0.99979
0.0138
4.0
0.000113
0.0106
0.00278
3.393
0.00900
0.0306
0.99976
0.0146
Table 2: DiT-based flow-matching model performance metrics across different CFG guidance scales s , for the airfoil case, showing minor dependence on s .
Model
R2
RCp2
RCf,x2
RCf,y2
RCf,z2
MLP [ 34 ]
0.956
0.972
0.944
0.951
0.957
FluidFlow (DiT)
0.965
0.974
0.959
0.960
0.965
Table 3: Comparison of the performance of FluidFlow with the baseline MLP model [ 34 ] for the 3D aircraft task.
MSE
RMSE
MAE
MRE
ae_95
ae_99
R2
Relative L2
0.0013
0.0358
0.0065
23.4211%
0.0271
0.1229
0.9659
0.1835
Table 4: Additional performance metrics for FluidFlow on the 3D aircraft case in the ONERA CRM WBPN dataset (full 3D geometry).
Figure 5: Comparison between (ground true) CFD pressure/friction coefficient fields (top panels) and the prediction generated by the DiT flow-matching model (bottom panels) for one particular operating condition with parameters pi=1×105,M∞=0.3 and AoA=−6\textordmasculine .
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Parameter
Value
Optimizer
Adam
Loss function
Mean Squared Error (MSE)
Activation function
ELU
Weight initialization
Xavier uniform
Initial learning rate
1.47×10−3
Learning rate scheduler
Step scheduler (step size = 1 epoch)
Appendix
Table 5: Summary of the MLP architecture, training configuration, and optimized hyperparameters.
Parameter
Value
Blocks dim
[128, 256, 512]
Num. attention heads
8
Attention hidden dim
512
pdrop
0.2
Total parameters
43.2M
Training steps
200000
Appendix
Table 6: Neural network and training hyperparameters of the U-Net architecture on the airfoil case.
Parameter
Value
Num. blocks
6
Num. heads
4
Hidden dim
128
Patch size
1
MLP ratio
2.5
pdrop
0.2
Appendix
Table 7: Neural network and training hyperparameters of the Diffusion Transformer architecture on the airfoil case.
Parameter
Value
Num. blocks
12
Num. heads
8
Hidden dim
256
Patch size
1
MLP ratio
4
pdrop
0.2
Appendix
Table 8: Neural network and training hyperparameters of the Diffusion Transformer architecture on the 3D aircraft case.
Figure 6: Strong scaling speed-up of the DiT model for the aircraft dataset as a function of the number of GPUs.
While Computational Fluid Dynamics (CFD) provides high-fidelity flow fields for optimizing indoor environments, its computational cost limits rapid exploration. To solve this problem generative surrogates offer better distribution modeling than deterministic networks, but iterative sampling is slow. To enable high-quality, single-pass generation, we adapt the novel generative drifting framework to fluid mechanics. We introduce a conditional architecture that performs drifting in a learned VAE latent space and uses label-aware masking to align generated samples with their boundary conditions. Our label-conditioned model matches iterative diffusion in accuracy and flow consistency while running two orders of magnitude faster. Additionally, we propose a spatial-conditioning variant that establishes a promising path towards generalization to unseen geometries. Ultimately, conditional drifting serves as a highly efficient alternative to diffusion based approaches, unlocking real-time CFD surrogates where inference speed is critical.
Chris R. Jung, Markus Dörr, Natalie Jüngling +3
Center for Machine Learning (ZML) 2Institute for Flow in Additively Manufactured Porous Structures (ISAPS) Heilbronn University of Applied Sciences, 74081 Heilbronn, Germany
Analyzing unsteady fluid flows often requires access to the full distribution of possible temporal states, yet conventional PDE solvers are computationally prohibitive and learned time-stepping surrogates quickly accumulate error over long rollouts. Generative models avoid compounding error by sampling states independently, but diffusion and flow-matching methods, while accurate, are limited by the cost of many evaluations over the entire mesh. We introduce scale-autoregressive modeling (SAR) for sampling flows on unstructured meshes hierarchically from coarse to fine: it first generates a low-resolution field, then refines it by progressively sampling higher resolutions conditioned on coarser predictions. This coarse-to-fine factorization improves efficiency by concentrating computation at coarser scales, where uncertainty is greatest, while requiring fewer steps at finer scales. Across unsteady-flow benchmarks of varying complexity, SAR attains substantially lower distributional error and higher per-sample accuracy than state-of-the-art diffusion models based on multi-scale GNNs, while matching or surpassing a flow-matching Transolver (a linear-time transformer) yet running 2-7x faster than this depending on the task. Overall, SAR provides a practical tool for fast and accurate estimation of statistical flow quantities (e.g., turbulent kinetic energy and two-point correlations) in real-world settings.
Neural surrogate models for computational fluid dynamics (CFD) are typically trained as forward operators that map explicit problem specifications, such as geometry and boundary conditions, to solution fields. This ties the model to the conditioning variables seen during training and limits reuse under boundary-condition shifts or local geometry changes. We propose to reformulate steady CFD inference as an inpainting problem: instead of training on explicit boundary conditions, we learn a self-supervised prior over velocity fields and impose boundary constraints only during inference by fixing known regions such as inlet, outlet or unchanged regions from previous simulations. To scale this idea to large 3D meshes, we introduce a local neighbourhood tokeniser that represents high-resolution velocity fields as compact spatial latent tokens and train latent flow-matching and masked-autoencoder models on these tokens. On intracranial aneurysm hemodynamics, our method reconstructs full velocity fields from sparse boundary context, outperforms supervised neural surrogates under boundary-condition and dataset shift and enables local geometry editing by reusing unchanged simulation context. These results suggest that viewing CFD inference as context-conditioned inpainting can turn neural surrogates from task-specific predictors into reusable flow priors.
Jonas Weidner, Yeray Martin-Ruisanchez, Daniel Rueckert +2
AI for Image-Guided Diagnosis and Therapy, Technical University of Munich · Munich Center for Machine Learning (MCML) · AI in Healthcare and Medicine, Technical University of Munich +1