Download README.md from OneScience-Group/MARIO: direct link, hf CLI and curl.
- Browser
- Download file 8.16 kB
-
https://huggingface.co/OneScience-Group/MARIO/resolve/main/README.md
- Command line
-
hf download hf://OneScience-Group/MARIO/README.md
-
curl -L -o README.md https://huggingface.co/OneScience-Group/MARIO/resolve/main/README.md
license: apache-2.0
language:
- en
library_name: pytorch
tags:
- OneScience
- fluid-dynamics
- aerodynamic-surrogate
- neural-field
datasets:
- OneScience-Group/airfrans
MARIO
Model Introduction
MARIO is a resolution-independent aerodynamic surrogate developed by researchers affiliated with ISAE-SUPAERO. It rapidly predicts velocity, pressure, turbulent viscosity, and surface-pressure distributions for different geometries and flight conditions.
This repository is an independent OneScience reproduction of the AirfRANS field-prediction experiment from the MARIO paper.
Model Description
MARIO uses a modulation-conditioned neural-field architecture trained on two-dimensional AirfRANS airfoil data to predict steady aerodynamic fields across mesh resolutions.
Intended Uses
| Use case | Description |
|---|---|
| 2D airfoil surrogate | Predict velocity, pressure, and turbulent viscosity for AirfRANS-style steady RANS cases. |
| Unstructured-mesh querying | Sample points during training and query complete meshes in chunks during inference. |
| Surface-pressure evaluation | Report surface-pressure MSE to analyze near-wall and aerodynamic-force errors. |
| Hugging Face/OneCode execution | Download the standalone package and run the provided scripts. |
Usage
1. OneCode
Launch the OneCode AI-for-Science environment
2. Manual Setup
Hardware requirements
- A GPU or DCU is recommended.
- A CPU can run 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 cluster.
Download the model repository from Hugging Face
pip install -U huggingface_hub
hf download OneScience-Group/MARIO --local-dir ./MARIO
cd MARIO
Install the runtime environment
DCU environment
# 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
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
hf download OneScience-Group/airfrans --repo-type dataset --local-dir ./data
After downloading, update these entries in config/config.yaml:
paths.data_root: the AirfRANS root containingmanifest.jsonand the simulation samples.paths.project_root: the absolute path to this MARIO project.
Train
Run the full two-stage experiment, including SDF geometry-encoder training and flow-field-decoder training:
python scripts/train.py --config config/config.yaml
Geometry-encoding loss, flow-field loss, and per-field MSE are printed during training. The full experiment uses the 200 training samples from the AirfRANS scarce task and trains the geometry encoder and field decoder for 1,000 epochs each.
Pretrained weights
The repository includes weight/best_model.pth, trained on AirfRANS.
Inference and visualization
python scripts/inference.py --config config/config.yaml
For each sample, inference reports SDF reconstruction error, normalized MSE for each physical field, surface-pressure MSE, aerodynamic coefficients, and runtime. Results are saved under results/.
Generate field-prediction, ground-truth, absolute-error, surface-pressure, and paper-comparison figures with:
python scripts/result.py --config config/config.yaml
Citation and License
- Paper: MARIO: A Modulated Neural Field Framework for Resolution-Independent Surrogate Modeling of Aerodynamics.
- This repository uses the Hugging Face-compatible Apache License 2.0 identifier (
apache-2.0). AirfRANS and other third-party resources remain subject to their original licenses and terms.
中文说明
模型简介
MARIO 是由 ISAE-SUPAERO 相关研究人员开发的分辨率无关气动代理模型(surrogate model)。它可以快速预测不同几何形状和飞行条件下的速度、压力、湍流黏度及表面压力分布。
本仓库是 OneScience 对 MARIO 论文中 AirfRANS 场预测实验的独立复现。
模型描述
MARIO 使用以调制为条件的神经场架构,在二维 AirfRANS 翼型数据上训练,以跨网格分辨率预测稳态气动场。
预期用途
| 使用场景 | 说明 |
|---|---|
| 2D 翼型代理模型 | 预测 AirfRANS 风格稳态 RANS 算例的速度、压力和湍流黏度。 |
| 非结构化网格查询 | 在训练时对点采样,在推理(inference)时分块查询完整网格。 |
| 表面压力评估 | 报告表面压力 MSE,用于分析近壁面误差和气动力误差。 |
| Hugging Face/OneCode 运行 | 下载独立软件包并运行提供的脚本。 |
使用方法
1. OneCode
2. 手动配置
硬件要求
- 建议使用 GPU 或 DCU。
- CPU 可用于导入和小规模连通性检查,完整训练和推理会较慢。
- DCU 用户应安装 DTK 25.04.2 或更高版本,或使用 OneScience 为所在集群推荐的版本。
从 Hugging Face 下载模型仓库
pip install -U huggingface_hub
hf download OneScience-Group/MARIO --local-dir ./MARIO
cd MARIO
安装运行环境
DCU 环境
# 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 环境
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
从 Hugging Face 下载训练数据集
hf download OneScience-Group/airfrans --repo-type dataset --local-dir ./data
下载后,更新 config/config.yaml 中的以下条目。
paths.data_root为包含manifest.json和模拟样本的 AirfRANS 根目录。paths.project_root为此 MARIO 项目的绝对路径。
训练
运行完整的两阶段实验,包括 SDF 几何编码器训练和流场解码器训练。
python scripts/train.py --config config/config.yaml
训练期间会打印几何编码损失、流场损失和各场的 MSE。完整实验使用 AirfRANS 稀缺数据任务中的 200 个训练样本,几何编码器和场解码器各训练 1,000 轮。
预训练权重
本仓库包含在 AirfRANS 上训练得到的 weight/best_model.pth。
推理与可视化
python scripts/inference.py --config config/config.yaml
对于每个样本,推理报告 SDF 重建误差、各物理场的归一化 MSE、表面压力 MSE、气动系数及运行时间。结果保存至 results/。
使用以下命令生成场预测图、真值图、绝对误差图、表面压力图,以及与论文的对比图。
python scripts/result.py --config config/config.yaml
引用与许可证
- 论文MARIO:用于分辨率无关气动代理建模的调制神经场框架。
- 本仓库使用与 Hugging Face 兼容的 Apache License 2.0 标识符(
apache-2.0)。AirfRANS 和其他第三方资源仍受其原始许可证和条款约束。