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

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

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/RNO --local-dir ./RNO
cd RNO

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/cfd_benchmark \
  --repo-type dataset \
  --local-dir ./data

The Darcy files are stored under data/data/darcy/ after this download:

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

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

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:

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

python scripts/result.py --results results

Outputs:

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

Citation and License


中文说明

模型简介

RNO 是浙江工业大学研究人员提出的 Radon 神经算子(Radon Neural Operator),通过 Radon 变换在正弦图域中利用全局及局部特征学习 PDE 求解映射。

本仓库是 OneScience 对达西流(Darcy flow)实验的独立复现。RNO 学习参数化达西求解算子,根据多孔介质渗透率场或扩散系数场预测稳态压力。

论文:通过 Radon 神经算子求解偏微分方程

模型描述

对于达西流,RNO 将二维渗透率场或扩散系数场 (a(x,y)) 映射为标量压力解 (u(x,y))。

架构由特征提升、Physics-Attention、Radon 块和输出投影组成。输入场和空间坐标被提升至高维特征,Physics-Attention 提取非局部信息,Radon 块将特征投影到正弦图域。角度重加权及正弦图卷积学习不同投影方向的贡献,再通过滤波反投影恢复空间特征,得到最终达西解。

适用场景

使用场景 说明
达西流预测 根据二维渗透率场或扩散场预测多孔介质稳态压力。
参数化 PDE 求解 学习从系数、初始条件或边界条件到 PDE 解的算子。
科学代理 使用快速批量预测替代部分耗费资源的数值求解。
跨分辨率预测 训练设置支持时,在不同空间分辨率下评估学得的算子。

使用指南

1. OneCode

启动 OneCode AI for Science 环境

2. 手动配置

硬件要求

  • 建议使用 GPU 或 DCU。
  • CPU 可执行导入及小规模连通性检查,完整训练与推理(inference)速度较慢。
  • DCU 用户应安装 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的适配集群的版本。

从 Hugging Face 下载模型仓库

pip install -U huggingface_hub
hf download OneScience-Group/RNO --local-dir ./RNO
cd RNO

安装运行环境

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/cfd_benchmark \
  --repo-type dataset \
  --local-dir ./data

此次下载后,达西数据文件存放于 data/data/darcy/ 下。

data/data/darcy/
├── piececonst_r421_N1024_smooth1.mat
└── piececonst_r421_N1024_smooth2.mat

将 config/config.yaml 中的 data.root 设为达西数据目录。每个 MAT 文件包含 1,024 个原始分辨率为 421 x 421 的规则网格样本。

  • coeff 为达西渗透率场或扩散系数场。
  • sol 为相应的稳态压力解。

此实验使用 piececonst_r421_N1024_smooth1.mat 训练,并使用 piececonst_r421_N1024_smooth2.mat 测试。下采样和归一化由实验配置定义。

训练

python scripts/train.py --config config/config.yaml

以配置的间隔记录及打印逐轮指标。训练相对 L2 最低的模型权重(检查点)(checkpoint)保存到 weight/best_model.pth。

预训练权重

本仓库在 weight/best_model.pth 提供使用达西数据训练的 RNO 模型权重(检查点),可用于推理或继续训练。

推理与评估

python scripts/inference.py \
  --config config/config.yaml \
  --checkpoint weight/best_model.pth \
  --device auto

脚本评估固定测试集,打印逐样本相对 L2 的均值,对照论文参考值计算相对 L2 和梯度相对 L2,并写入以下内容。

results/evaluation_metrics.json
results/predictions.npz

predictions.npz 包含预测和目标压力场、归一化渗透率场及逐样本相对 L2 值。

可视化

python scripts/result.py --results results

输出

results/training_curve.png
results/darcy_prediction.png
results/visualization_summary.json
  • training_curve.png 展示总训练损失、相对 L2 和梯度相对 L2。
  • darcy_prediction.png 对比渗透率、目标压力、预测压力及绝对误差。
  • visualization_summary.json 记录可视化路径、测试相对 L2 和与论文的对比。

OneScience

引用与许可证

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train OneScience-Group/RNO