--- license: mit language: - en library_name: pytorch tags: - OneScience - fluid-dynamics - neural-operator - radon-transform - darcy-flow datasets: - OneScience-Group/cfd_benchmark ---
RNO
# Model Introduction RNO (Radon Neural Operator), proposed by researchers from Zhejiang University of Technology, learns PDE solution mappings with both global and local features in the sinogram domain through the Radon transform. This repository is an independent OneScience reproduction of the Darcy-flow experiment. RNO learns the parameterized Darcy solution operator and predicts steady pressure from a porous-medium permeability or diffusion-coefficient field. Paper: [Solving Partial Differential Equations via Radon Neural Operator](https://proceedings.neurips.cc/paper_files/paper/2025/file/e66233a208ef32f56df6312263239fa0-Paper-Conference.pdf) # Model Description For Darcy flow, RNO maps a two-dimensional permeability or diffusion-coefficient field \(a(x,y)\) to its scalar pressure solution \(u(x,y)\). The architecture consists of feature lifting, Physics-Attention, a Radon block, and output projection. The input field and spatial coordinates are lifted to high-dimensional features; Physics-Attention extracts nonlocal information; and the Radon block projects features into the sinogram domain. Angle reweighting and sinogram convolution learn the contribution of different projection directions before filtered back-projection restores spatial features for the final Darcy solution. ## Intended Uses | Use case | Description | | --- | --- | | Darcy-flow prediction | Predict steady porous-medium pressure from a two-dimensional permeability or diffusion field. | | Parameterized PDE solution | Learn an operator from coefficients, initial conditions, or boundary conditions to PDE solutions. | | Scientific surrogate | Replace part of a costly numerical solve with fast batched prediction. | | Cross-resolution prediction | Evaluate the learned operator at different spatial resolutions when supported by the training setup. | # 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/RNO --local-dir ./RNO cd RNO ``` ### 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/cfd_benchmark \ --repo-type dataset \ --local-dir ./data ``` The Darcy files are stored under `data/data/darcy/` after this download: ```text data/data/darcy/ ├── piececonst_r421_N1024_smooth1.mat └── piececonst_r421_N1024_smooth2.mat ``` Set `data.root` in `config/config.yaml` to the Darcy directory. Each MAT file contains 1,024 regular-grid samples at the original `421 x 421` resolution: - `coeff`: the Darcy permeability or diffusion-coefficient field. - `sol`: the corresponding steady pressure solution. This experiment uses `piececonst_r421_N1024_smooth1.mat` for training and `piececonst_r421_N1024_smooth2.mat` for testing, with downsampling and normalization defined by the experiment configuration. ### Train ```bash python scripts/train.py --config config/config.yaml ``` Per-epoch metrics are logged and printed at the configured interval. The checkpoint with the lowest training relative L2 is saved to `weight/best_model.pth`. ### Pretrained weights The repository includes a Darcy-trained RNO checkpoint at `weight/best_model.pth` for inference or continued training. ### Inference and evaluation ```bash python scripts/inference.py \ --config config/config.yaml \ --checkpoint weight/best_model.pth \ --device auto ``` The script evaluates the fixed test set, prints the mean per-sample relative L2, computes relative L2 and gradient-relative L2 against paper references, and writes: ```text results/evaluation_metrics.json results/predictions.npz ``` `predictions.npz` contains predicted and target pressure fields, normalized permeability fields, and per-sample relative L2 values. ### Visualization ```bash python scripts/result.py --results results ``` Outputs: ```text results/training_curve.png results/darcy_prediction.png results/visualization_summary.json ``` - `training_curve.png` shows total training loss, relative L2, and gradient-relative L2. - `darcy_prediction.png` compares permeability, target pressure, predicted pressure, and absolute error. - `visualization_summary.json` records visualization paths, test relative L2, and the paper comparison. # 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: [Solving Partial Differential Equations via Radon Neural Operator](https://proceedings.neurips.cc/paper_files/paper/2025/file/e66233a208ef32f56df6312263239fa0-Paper-Conference.pdf). - Official implementation: [wenbin-lu/Radon-Neural-Operator](https://github.com/wenbin-lu/Radon-Neural-Operator), released under the [MIT License](https://github.com/wenbin-lu/Radon-Neural-Operator/blob/main/LICENSE). - This repository uses the Hugging Face-compatible MIT identifier (`mit`). The dataset and other third-party resources remain subject to their original licenses and terms.