Table of Contents
Fetching ...

Flow Matching Meets PDEs: A Unified Framework for Physics-Constrained Generation

Giacomo Baldan, Qiang Liu, Alberto Guardone, Nils Thuerey

TL;DR

This paper introduces Physics-Based Flow Matching (PBFM), a framework that explicitly embeds PDE residuals and algebraic constraints into flow matching to produce physically consistent generative surrogates. By combining a conflict-free gradient update scheme with temporal unrolling during training, PBFM jointly minimizes the flow matching loss and the physics residual without manual loss weighting, while improving final state accuracy. Across Darcy flow, Kolmogorov flow, and dynamic stall benchmarks, PBFM achieves up to an 8× reduction in physical residuals and maintains or improves distributional fidelity, with stochastic sampling further enhancing distributional realism. The approach yields substantial speedups for surrogates (e.g., generating hundreds of dynamic stall samples in seconds on GPU) and offers a scalable tool for uncertainty quantification and accelerated physics simulations.

Abstract

Generative machine learning methods, such as diffusion models and flow matching, have shown great potential in modeling complex system behaviors and building efficient surrogate models. However, these methods typically learn the underlying physics implicitly from data. We propose Physics-Based Flow Matching (PBFM), a novel generative framework that explicitly embeds physical constraints, both PDE residuals and algebraic relations, into the flow matching objective. We also introduce temporal unrolling at training time that improves the accuracy of the final, noise-free sample prediction. Our method jointly minimizes the flow matching loss and the physics-based residual loss without requiring hyperparameter tuning of their relative weights. Additionally, we analyze the role of the minimum noise level, $σ_{\min}$, in the context of physical constraints and evaluate a stochastic sampling strategy that helps to reduce physical residuals. Through extensive benchmarks on three representative PDE problems, we show that our approach yields up to an $8\times$ more accurate physical residuals compared to FM, while clearly outperforming existing algorithms in terms of distributional accuracy. PBFM thus provides a principled and efficient framework for surrogate modeling, uncertainty quantification, and accelerated simulation in physics and engineering applications.

Flow Matching Meets PDEs: A Unified Framework for Physics-Constrained Generation

TL;DR

This paper introduces Physics-Based Flow Matching (PBFM), a framework that explicitly embeds PDE residuals and algebraic constraints into flow matching to produce physically consistent generative surrogates. By combining a conflict-free gradient update scheme with temporal unrolling during training, PBFM jointly minimizes the flow matching loss and the physics residual without manual loss weighting, while improving final state accuracy. Across Darcy flow, Kolmogorov flow, and dynamic stall benchmarks, PBFM achieves up to an 8× reduction in physical residuals and maintains or improves distributional fidelity, with stochastic sampling further enhancing distributional realism. The approach yields substantial speedups for surrogates (e.g., generating hundreds of dynamic stall samples in seconds on GPU) and offers a scalable tool for uncertainty quantification and accelerated physics simulations.

Abstract

Generative machine learning methods, such as diffusion models and flow matching, have shown great potential in modeling complex system behaviors and building efficient surrogate models. However, these methods typically learn the underlying physics implicitly from data. We propose Physics-Based Flow Matching (PBFM), a novel generative framework that explicitly embeds physical constraints, both PDE residuals and algebraic relations, into the flow matching objective. We also introduce temporal unrolling at training time that improves the accuracy of the final, noise-free sample prediction. Our method jointly minimizes the flow matching loss and the physics-based residual loss without requiring hyperparameter tuning of their relative weights. Additionally, we analyze the role of the minimum noise level, , in the context of physical constraints and evaluate a stochastic sampling strategy that helps to reduce physical residuals. Through extensive benchmarks on three representative PDE problems, we show that our approach yields up to an more accurate physical residuals compared to FM, while clearly outperforming existing algorithms in terms of distributional accuracy. PBFM thus provides a principled and efficient framework for surrogate modeling, uncertainty quantification, and accelerated simulation in physics and engineering applications.

Paper Structure

This paper contains 31 sections, 13 equations, 20 figures, 4 tables, 2 algorithms.

Figures (20)

  • Figure 1: The Physics-Based Flow Matching (PBFM) framework: During training, the sample $x_t$ at time $t$ is evolved to $t=1$ over $n$ time steps to compute the residual $\mathcal{R}(\widetilde{x}_1)$. The flow matching loss $\mathcal{L}_\text{FM}$ and residual loss $\mathcal{L}_\mathcal{R}$ are combined in a conflict-free manner.
  • Figure 2: Point distribution and absolute error of the physical residual (circle radius squared) for SOTA reference DM, PIDM-ME Bastek2025, and all proposed approaches.
  • Figure 3: Darcy flow validation over 1024 samples using 20 FM steps. The left panel shows the residual MAE as a function of training steps, followed by visualizations of the residual error (error bars refer to min-max values within the validation dataset samples), pressure, and permeability distributions. Importantly, the low residual error of PIDM-ME is attributed to its partial coverage of pressure, and permeability, distributions (shown right). Both graphs highlight the high distributional accuracy of PBFM.
  • Figure 4: Physical residual of Darcy flow examples for the proposed method with 20 FM steps.
  • Figure 5: Darcy flow MAE residual (error bars refer to min-max values over validation set) and Wasserstein distance over FM steps for 1024 samples.
  • ...and 15 more figures