File size: 4,407 Bytes
0ce837d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ---
license: apache-2.0
language:
- en
library_name: pytorch
tags:
- OneScience
- fluid-dynamics
- aerodynamic-surrogate
- neural-field
datasets:
- OneScience-Group/airfrans
---
<p align="center">
<strong><span style="font-size: 30px;">MARIO</span></strong>
</p>
# 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.
Paper: [MARIO: A Modulated Neural Field Framework for Resolution-Independent Surrogate Modeling of Aerodynamics](https://arxiv.org/abs/2505.14704)
# 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](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 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
```bash
pip install -U huggingface_hub
hf download OneScience-Group/MARIO --local-dir ./MARIO
cd MARIO
```
### 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 OneScience-Group/airfrans --repo-type dataset --local-dir ./data
```
After downloading, update these entries in `config/config.yaml`:
- `paths.data_root`: the AirfRANS root containing `manifest.json` and 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:
```bash
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
```bash
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:
```bash
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](https://arxiv.org/abs/2505.14704).
- 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.
|