CFDBench

Model Overview

CFDBench is a large-scale benchmark developed by researchers at Tsinghua University to evaluate machine-learning methods for computational fluid dynamics. It focuses on model generalization across different boundary conditions, fluid properties, and geometric configurations.

Paper: CFDBench: A Large-Scale Benchmark for Machine Learning Methods in Fluid Dynamics

Model Description

CFDBench is built from several representative computational fluid dynamics datasets spanning diverse boundary conditions, fluid properties, and geometries. It evaluates both flow-field prediction performance and the generalization capabilities of machine-learning methods.

Use Cases

Use Case Description
CFD surrogate benchmarking Compare the flow-field prediction capabilities of neural operators and other deep-learning models using consistent data splits and metrics
Autoregressive flow evolution Predict subsequent two-dimensional velocity fields step by step from the current grid-based field and assess error accumulation over multiple steps
Non-autoregressive field queries Predict velocity directly at target locations from operating parameters and spatiotemporal coordinates, enabling evaluation over long time horizons

Supported Models

Type root.model.name Training Entry Point
Non-autoregressive ffn python scripts/train.py
Non-autoregressive deeponet python scripts/train.py
Autoregressive auto_ffn python scripts/train_auto.py
Autoregressive auto_deeponet python scripts/train_auto.py
Autoregressive auto_edeeponet python scripts/train_auto.py
Autoregressive auto_deeponet_cnn python scripts/train_auto.py
Autoregressive resnet python scripts/train_auto.py
Autoregressive unet python scripts/train_auto.py
Autoregressive fno python scripts/train_auto.py

Usage

1. OneCode

Use the online OneCode environment for an intelligent, one-click AI for Science (AI4S) programming experience:

Launch OneCode for one-click AI4S programming

2. Manual Setup

Hardware Requirements

  • A GPU or DCU is recommended.
  • A CPU can be used for import checks and small-scale pipeline validation, but full training and inference will be slow.
  • DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version for the target cluster, is recommended.

Download the Model Package

hf download OneScience-Group/CFDBench --local-dir ./CFDBench
cd CFDBench

Set Up the Runtime Environment

DCU Environment

# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

GPU Environment

# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

Training Data

The OneScience community provides the cfdbench dataset for training. Download it with the command below and verify that the data path in config/config.yaml is configured correctly:

hf download --repo-type dataset OneScience-Group/cfdbench --local-dir ./data

Training

Autoregressive Training

The default configuration sets root.model.name: fno, so use the autoregressive training entry point:

python scripts/train_auto.py

To select another autoregressive model, edit conf/config.yaml:

root:
  model:
    name: "auto_ffn"

Non-autoregressive Training

python scripts/train.py --model deeponet

Model Weights

This repository will provide pretrained CFDBench model weights in the weights/ directory. The weights will be uploaded soon.

Inference and Visualization

The inference script automatically selects the task type from the current model name and reads the following path by default:

./weight/<model.name>.pt

Default FNO inference and visualization:

python scripts/inference.py
python scripts/result.py

Non-autoregressive models can likewise be selected through a command-line argument:

python scripts/inference.py --model ffn
python scripts/result.py --model ffn

Official OneScience Resources

Citations and License


中文说明

模型概览

CFDBench 是清华大学研究人员开发的大规模基准,用于评估计算流体力学(computational fluid dynamics,CFD)的机器学习方法,重点衡量模型在不同边界条件、流体属性和几何配置下的泛化能力。

论文:CFDBench:流体动力学机器学习方法的大规模基准

模型描述

CFDBench 由多个具有代表性的计算流体力学数据集构成,涵盖多种边界条件、流体属性和几何域。该基准既评估流场预测性能,也衡量机器学习方法的泛化能力。

使用场景

使用场景 说明
计算流体力学代理基准测试 使用一致的数据划分和指标,比较神经算子(neural operator)与其他深度学习模型的流场预测能力
自回归流场演变 从当前网格流场逐步预测后续二维速度场,评估多步误差累积
非自回归场查询 根据工况参数和时空坐标直接预测目标位置的速度,支持长时段评估

支持的模型

类型 root.model.name 训练入口
非自回归 ffn python scripts/train.py
非自回归 deeponet python scripts/train.py
自回归 auto_ffn python scripts/train_auto.py
自回归 auto_deeponet python scripts/train_auto.py
自回归 auto_edeeponet python scripts/train_auto.py
自回归 auto_deeponet_cnn python scripts/train_auto.py
自回归 resnet python scripts/train_auto.py
自回归 unet python scripts/train_auto.py
自回归 fno python scripts/train_auto.py

使用指南

1. OneCode

通过 OneCode 在线环境体验面向科学的人工智能(AI4S)智能一键编程。

启动 OneCode 以使用一键 AI4S 编程

2. 手动配置

硬件要求

  • 建议使用 GPU 或 DCU。
  • CPU 可用于导入检查和小规模流程验证,完整训练和推理(inference)速度较慢。
  • DCU 用户须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的适配目标集群的版本。

下载模型包

hf download OneScience-Group/CFDBench --local-dir ./CFDBench
cd CFDBench

配置运行环境

DCU 环境

# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

GPU 环境

# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

训练数据

OneScience 社区提供用于训练的 cfdbench 数据集。使用以下命令下载,并确认 config/config.yaml 中的数据路径配置正确。

hf download --repo-type dataset OneScience-Group/cfdbench --local-dir ./data

训练

自回归训练

默认配置设为 root.model.name: fno,因此使用自回归训练入口。

python scripts/train_auto.py

如需选择其他自回归模型,请编辑 conf/config.yaml。

root:
  model:
    name: "auto_ffn"

非自回归训练

python scripts/train.py --model deeponet

模型权重

本仓库将在 weights/ 目录中提供预训练的 CFDBench 模型权重。权重即将上传。

推理与可视化

推理脚本根据当前模型名称自动选择任务类型,并默认读取以下路径。

./weight/<model.name>.pt

默认 FNO 推理和可视化

python scripts/inference.py
python scripts/result.py

也可以通过命令行参数选择非自回归模型。

python scripts/inference.py --model ffn
python scripts/result.py --model ffn

OneScience 官方资源

引用与许可证

Downloads last month
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for OneScience-Group/CFDBench