OneScience-Group/CFDBench
<p align="center"> <strong> <span style="font-size: 30px;">CFDBench</span> </strong> </p>
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
Supported Models
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 CFDBenchSet 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.aiGPU 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.aiTraining 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 ./dataTraining
Autoregressive Training
The default configuration sets root.model.name: fno, so use the autoregressive training entry point:
python scripts/train_auto.pyTo select another autoregressive model, edit conf/config.yaml:
root:
model:
name: "auto_ffn"Non-autoregressive Training
python scripts/train.py --model deeponetModel 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>.ptDefault FNO inference and visualization:
python scripts/inference.py
python scripts/result.pyNon-autoregressive models can likewise be selected through a command-line argument:
python scripts/inference.py --model ffn
python scripts/result.py --model ffnOfficial OneScience Resources
Citations and License
- Original CFDBench paper: CFDBench: A Large-Scale Benchmark for Machine Learning Methods in Fluid Dynamics
- Original CFDBench code repository: https://github.com/luo-yining/CFDBench
- This repository retains source attribution and has been adapted for automated execution through OneScience and ModelScope. Before public redistribution, verify the applicable licensing requirements of the upstream project.
