BearCFD-Ventilation / README.md
yushuang88's picture
Update README and model configuration
ef1c287 verified
|
Raw History Blame Contribute Delete
4.28 kB
---
license: apache-2.0
language:
- en
library_name: pytorch
tags:
- OneScience
- fluid-dynamics
- indoor-ventilation
- neural-operator
datasets:
- alwaysbyx/Bear-CFD-dataset
---
<p align="center">
<strong><span style="font-size: 30px;">BearCFD-Ventilation</span></strong>
</p>
# Model Introduction
BearCFD-Ventilation predicts indoor CO2 concentration from the BEAR-CFD dataset. Given historical CO2 distributions and ventilation-control parameters, it forecasts how the CO2 concentration evolves.
Paper: [Building Control CFD: Efficient Deep Learning of Indoor CO2 Dynamics from Sustainable CFD Simulations](https://arxiv.org/pdf/2504.21243)
This repository is an independent OneScience reproduction of the BearCFD-Ventilation experiment using the paper description, official configuration, and Bear-CFD dataset.
# Model Description
BearCFD-Ventilation uses a neural-operator Transformer architecture for transient indoor-ventilation data and performs multistep CO2 forecasting in occupied regions.
## Intended Uses
| Use case | Description |
| :--- | :--- |
| Indoor-ventilation prediction | Predict indoor CO2 concentration from supply-air velocity, supply-air angle, and occupancy. |
| CFD acceleration | Build a fast surrogate for transient indoor-ventilation CFD simulations. |
# Usage
## 1. OneCode
Try one-click AI-for-Science programming in the OneCode online environment:
[Launch OneCode](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 2. Manual Setup
**Hardware requirements**
- A GPU or DCU is recommended.
- A CPU can be used for imports and small connectivity checks, but full training and inference will be slow.
- DCU users should install DTK 25.04.2 or later, or the OneScience-recommended version for the target cluster.
### Download the model repository from Hugging Face
```bash
pip install -U huggingface_hub
hf download OneScience-Group/BearCFD-Ventilation --local-dir ./BearCFD-Ventilation
cd BearCFD-Ventilation
```
### Install the runtime environment
**DCU environment**
```bash
# Activate DTK first.
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
```
**GPU environment**
```bash
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
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
```
### Download the training dataset from Hugging Face
```bash
hf download alwaysbyx/Bear-CFD-dataset --repo-type dataset --local-dir ./data
```
The directory contains `unsteady_10.pkl` through `unsteady_41.pkl`. Each sample includes occupied-zone CO2 concentration, inlet velocity, inlet angle, occupancy, and related fields. Before training, verify the data path in `config/config.yaml`.
### Train
```bash
python scripts/train.py
```
The best checkpoint is saved to `weight/best_model.pth`.
### Pretrained weights
The repository includes `weight/best_model.pth`, trained on BEAR-CFD data and ready for inference.
The recorded test results are `relative_l2=0.144541` and `rmse=94.616395`. Table 3 of the paper reports an ensemble-test `l2 error` of 10.90%; the values here are from a run on 32 original official samples.
### Inference
```bash
python scripts/inference.py
```
### Evaluation and visualization
```bash
python scripts/result.py
```
# OneScience
| Platform | OneScience repository | OneSkills 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 |
# Citation and License
- Paper: [Building Control CFD: Efficient Deep Learning of Indoor CO2 Dynamics from Sustainable CFD Simulations](https://arxiv.org/pdf/2504.21243).
- Dataset: [BEAR-CFD dataset](https://huggingface.co/datasets/alwaysbyx/Bear-CFD-dataset).
- This model repository uses the Apache License 2.0 identifier (`apache-2.0`) required by Hugging Face metadata. The dataset and other third-party assets remain subject to their original licenses and terms.