Skip to content

KaiCHEN-HT/NeuralOperator_DiffusionModel

 
 

Repository files navigation

NO+DM

This repository contains the code accompanying our paper, "Integrating Neural Operators with Diffusion Models Improves Spectral Representation in Turbulence Modeling". Our work demonstrates how diffusion models can help mitigate the spectral bias suffered by neural operators. Check out our project page. Below, you will find the structure, usage instructions, and dependencies for this repository.


Repository Structure

  • case_1_kolmogorov/: Contains code and data access instructions for the Kolmogorov flow case.
  • case_2_buoyancy/: Contains code and data access instructions for the buoyancy-driven flow case.
  • case_3_airfoil/: Contains code and data access instructions for the LES airfoil case.
  • case_4_LES_jet/: Contains code and data access instructions for the LES jet case.
  • case_5_schlieren_jet/: Contains code and data access instructions for the schlieren jet case.
  • requirements.txt: Minimal dependencies required to run the code.
  • requirements_full.txt: Full dependencies for all features and cases.

Diffusion-Corrected Autoregressive (DCAR) Rollouts

We found that DCAR rollouts help stabilize longer forecasts. Checkout our implementation case_3_airfoil/no_dm/tc_unet/dm/dcar_rollout.ipynb


Installation

  1. Clone this repository:

    git clone https://github.com/vivekoommen/NeuralOperator_DiffusionModel.git
    cd NeuralOperator_DiffusionModel
  2. Create a virtual environment and install dependencies:

    python3 -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    pip install -r requirements.txt
  3. For full features, install:

    pip install -r requirements_full.txt

Usage

Dataset Preparation

Each case folder contains a data/ subdirectory with scripts for dataset preparation. The datasets can be accessed or generated as follows:

Case Dataset Details
Kolmogorov Flow Generated by ns_data_generator.ipynb link
Buoyancy-Driven Flow From PDEArena link
LES Airfoil airfoilLES_snapshots_midspan.zip from link
LES Jet jet_3D_01000.zip from link
Schlieren Jet 20210125-Run1.zip from link

General Workflow

  1. Train the Neural Operator: Navigate to the desired case folder and run:

    python3 -u train_no.py
  2. Prepare Data for Diffusion Model: Run the Jupyter Notebook no_postprocess.ipynb.

  3. Train the Diffusion Model: Navigate to the dm/ folder inside the case directory and run:

    python3 -u train_dm.py
  4. Post-process Results: Run the Jupyter Notebook dm_postprocess.ipynb to generate figures.


Citing This Work

If you use this code, please cite our paper:

@article{oommen2024integrating,
  author = {Oommen, Vivek  and Bora, Aniruddha  and Zhang, Zhen  and Karniadakis, George Em },
  title = {Integrating neural operators with diffusion models improves spectral representation in turbulence modelling},
  journal = {Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences},
  volume = {481},
  number = {2309},
  pages = {20240819},
  year = {2025},
  doi = {10.1098/rspa.2024.0819}
}

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

  • The Kolmogorov flow was simulated using the pseudo-spectral solver provided in FNO's Repository.
  • This repository builds upon the diffusion model implementation by Phil Wang.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jupyter Notebook 98.6%
  • Python 1.4%