DeepCFD
Model Overview
DeepCFD is a U-Net-based surrogate model developed by the German Aerospace Center for two-dimensional steady-state laminar flows. It uses geometric information to rapidly predict velocity and pressure fields, accelerating the evaluation of channel flows, flows around obstacles, and aerodynamic designs.
Paper: DeepCFD: Efficient Steady-State Laminar Flow Approximation with Deep Convolutional Neural Networks.
Model Description
DeepCFD uses a U-Net deep convolutional architecture that takes a signed distance field (SDF) and flow-region mask as inputs to rapidly predict velocity and pressure fields for two-dimensional, nonuniform, steady-state laminar flows.
Use Cases
| Use Case | Description |
|---|---|
| Steady-state laminar flow prediction | Approximate velocity and pressure fields in two-dimensional, nonuniform, steady-state laminar flows |
| Channel-flow simulation | Predict flow distributions around randomly shaped obstacles in a channel |
| CFD surrogate modeling | Replace conventional CFD workflows such as OpenFOAM to improve inference efficiency |
| Aerodynamic and fluid-shape optimization | Evaluate large numbers of candidate geometries for low-speed laminar-flow design |
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
modelscope download --model OneScience/DeepCFD --local_dir ./DeepCFD
cd DeepCFD
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 deepcfd dataset for training. Download it with the command below and verify that the data path in conf/config.yaml is configured correctly:
modelscope download --dataset OneScience/deepcfd --local_dir ./data
The project dataset can also be downloaded from Zenodo.
The dataset contains two files:
dataX.pkl: Geometric input data for 981 channel-flow samplesdataY.pkl: Ground-truth CFD solutions for the corresponding samples, computed with thesimpleFOAMsolver
Training
Single GPU:
- Training parameters are read from the
root.datapipe,root.model, androot.trainingsections ofconfig/config.yaml. The default configuration is intended for a minimal smoke test. - For full training, set
root.datapipe.source.data_dirto the actual DeepCFD dataset directory and increase the model size, batch size, and number of epochs as needed.
python scripts/train.py
Multiple GPUs:
torchrun --standalone --nproc_per_node=<num_GPUs> scripts/train.py
By default, training saves the best checkpoint to:
./weight/best_model.pt
Model Weights
This repository will provide pretrained DeepCFD weights in the weights/ directory. The weights will be uploaded soon.
Inference
python scripts/inference.py
Evaluation and Visualization
python scripts/result.py
Official OneScience Resources
| Platform | OneScience Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citations and License
- Original DeepCFD paper: DeepCFD: Efficient Steady-State Laminar Flow Approximation with Deep Convolutional Neural Networks
- This repository retains source attribution and has been adapted for automated execution through OneScience and ModelScope.