Diffusion-based-Flow-Prediction

Official implementation of the AIAA Journal paper "Uncertainty-aware Surrogate Models for Airfoil Flow Simulations with Denoising Diffusion Probabilistic Models"

APACHE-2.0 License

Stars
36

This repository contains a framework for uncertainty prediction of Reynolds-averaged Navier-Stokes flows around airfoils using Denoising Diffusion Probabilistic Models (DDPM). It features code for generating a dataset evaluating the simulation uncertainty induced by simulation parameters, and training code for diffusion models, in addition to baselines using Bayesian neural networks (BNNs) and heteroscedastic uncertainty models.

Paper Info

Abstract: Leveraging neural networks as surrogate models for turbulence simulation is a topic of growing interest. At the same time, embodying the inherent uncertainty of simulations in the predictions of surrogate models remains very challenging. The present study makes a first attempt to use denoising diffusion probabilistic models (DDPMs) to train an uncertainty-aware surrogate model for turbulence simulations. Due to its prevalence, the simulation of flows around airfoils with various shapes, Reynolds numbers, and angles of attack is chosen as the learning objective. Our results show that DDPMs can successfully capture the whole distribution of solutions and, as a consequence, accurately estimate the uncertainty of the simulations. The performance of DDPMs is also compared with varying baselines in the form of Bayesian neura networks and heteroscedastic models. Experiments demonstrate that DDPMs outperformthe other methods regarding a variety of accuracy metrics. Besides, it offers the advantageof providing access to the complete distributions of uncertainties rather than providing a set of parameters. As such, it can yield realistic and detailed samples from the distribution of solutions. We also evaluate an emerging generative modeling variant, flow matching, in comparison to regular diffusion models. The results demonstrate that flow matching addresses the problem of slow sampling speed typically associated with diffusion models. As such, it offers a promising new paradigm for uncertainty quantification with generative models.

Read from: [AIAA Journal ] [Arxiv]

Cite as:

@article{Liu2024DDPM,
author = {Liu, Qiang and Thuerey, Nils},
title = {Uncertainty-Aware Surrogate Models for Airfoil Flow Simulations with Denoising Diffusion Probabilistic Models},
journal = {AIAA Journal},
doi = {10.2514/1.J063440},
volume = {62},
issue = {8},
pages = {2192-2933}
}

Code Guide

Notebooks

We provide several notebooks to show how to use our code:

  • generate_dataset.ipynb: How to use OpenFOAM to generate dataset in parallel.

  • process_dataset.ipynb: How to post-process the dataset for training and analysis.

  • train_networks.ipynb: How to train networks for diffusion models, BNNs and heteroscedastic uncertainty models.

  • sample.ipynb: How to sample from the solutions using diffusion models, BNNs and heteroscedastic uncertainty models.

  • flow_matching.ipynb (NEW): How to use flow matching to solve the airfoil flow problems.

By using these note books, you will be able to reproduce the results in our manuscript step by step. You can also run any of the notebooks directly, and we have prepared the corresponding preamble file.

Datasets and Pre-trained Models

The full training data set is available for download at here. In this repository, we also provide a reduced version of our dataset corresponding to the single-parameter test in our manuscript. For more details, please see \datasets\1_parameter and process_dataset.ipynb. You can also use generate_dataset.ipynb to generate this dataset.

The pre-trained network weights can be found in pre_trained folder, where you can find the weights trained with different random seeds and the corresponding network configuration. You can refer to sample.ipynb to see the details on how to use them.

Please let us know if you find anything doesn't work in the repository.

Additional information

Our work focuses on the probabilistic prediction of airfoil flows to evaluate the inherent uncertainty of flow simulation. For more research on deterministic prediction, please check out our previous work:

The application of diffusion models in the field of fluid dynamics is a very ascendant direction. If you are interested in this, you can refer to our other work below:

  • SMDP: Solving Inverse Physics Problems with Score Matching.

  • autoreg-pde-diffusion: Prediction of PDE Simulations using Autoregressive Conditional Diffusion Models (ACDMs).

Other physics-based deep learning works of our group can be found at https://ge.in.tum.de/publications/.