FlowBench-FNO-LDC2D-Harmonics
Model Overview
FlowBench-FNO-LDC2D-Harmonics is a Fourier Neural Operator (FNO) baseline for two-dimensional lid-driven cavity flow. It is built on the FlowBench dataset and predicts steady flow fields in complex geometries.
Paper: FlowBench: A Large Scale Benchmark for Flow Simulation over Complex Geometries
Model Description
FlowBench-FNO-LDC2D-Harmonics uses a Fourier Neural Operator to reproduce the LDC_NS_2D, 128x128, harmonics-geometry lid-driven cavity baseline from the paper. The model takes a three-channel field from the official dataset as input and predicts a four-channel flow field.
Use Cases
| Use Case | Description |
|---|---|
| Internal-flow prediction for complex geometries | Predict two-dimensional lid-driven cavity flow containing complex internal obstacles |
| Neural-operator baseline validation | Validate FNO training, inference, evaluation, and visualization on FlowBench data |
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 from Hugging Face
pip install -U huggingface_hub
hf download OneScience-Group/FlowBench-FNO-LDC2D-Harmonics --local-dir ./FlowBench-FNO-LDC2D-Harmonics
cd FlowBench-FNO-LDC2D-Harmonics
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
This model uses the LDC_NS_2D/128x128/harmonics subset of the official FlowBench dataset on Hugging Face. Download the two required files with:
hf download BGLab/FlowBench \
LDC_NS_2D/128x128/harmonics_lid_driven_cavity_X.npz \
LDC_NS_2D/128x128/harmonics_lid_driven_cavity_Y.npz \
--repo-type dataset \
--local-dir ./FlowBench-LDC2D-Harmonics
Then set data.root_dir in config/config.yaml to the downloaded FlowBench-LDC2D-Harmonics directory. The two main files are:
LDC_NS_2D/128x128/harmonics_lid_driven_cavity_X.npz
LDC_NS_2D/128x128/harmonics_lid_driven_cavity_Y.npz
The data array in the X file has shape [1000, 3, 128, 128], and the data array in the Y file has shape [1000, 4, 128, 128]. By default, the samples are divided into training and validation sets using an 80/20 split.
Training
python scripts/train.py
The default training configuration saves the checkpoint to:
./weight/best_model.pth
Model Weights
The weight/ directory contains the best checkpoint obtained during this training run and can be used directly for inference:
./weight/best_model.pth
Inference
python scripts/inference.py
Metrics measured on the validation split for the included checkpoint:
mse = 0.0012336337
relative_l2 = 0.0434478655
mae = 0.0087878581
Evaluation and Visualization
python scripts/result.py
The evaluation summary is saved to results/result_summary.json, and generated figures are saved under results/figures/.
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 FlowBench paper: FlowBench: A Large Scale Benchmark for Flow Simulation over Complex Geometries.
- This repository retains source attribution and is organized for reproducible execution with OneScience and distribution through Hugging Face.