---
title: NOTS-DarcyFlowRate
canonical_url: "https://www.modelscope.cn/models/OneScience/NOTS-DarcyFlowRate"
md_url: "https://www.modelscope.cn/models/OneScience/NOTS-DarcyFlowRate.md"
repository: OneScience/NOTS-DarcyFlowRate
last_updated: 2026-10-29
license: other
library_name:
  - pytorch
frameworks:
  - PyTorch
language:
  - en
  - zh
downloads: 1
stars: 0
tags:
  - OneScience
  - "流体力学"
  - "多孔介质流动"
---

# NOTS-DarcyFlowRate

> NOTS-DarcyFlowRate - OneScience 在 ModelScope 开源的模型。NOTS-DarcyFlowRate 复现了 Darcy 多孔介质流的流量优化实验，使用神经算子辅助选择低泄漏的渗透率分布。

OneScience/NOTS-DarcyFlowRate 是 ModelScope 魔搭社区上的机器学习模型，采用 other 许可。

- **Repository**: OneScience/NOTS-DarcyFlowRate
- **License**: other
- **Tags**: OneScience, 流体力学, 多孔介质流动
- **Downloads**: 1
- **Stars**: 0
- **Last updated**: 2026-10-29

Source: https://www.modelscope.cn/models/OneScience/NOTS-DarcyFlowRate

---

<p align="center">
  <strong>
    <span style="font-size: 30px;">NOTS-DarcyFlowRate</span>
  </strong>
</p>

# 模型介绍

NOTS-DarcyFlowRate 复现了 Darcy 多孔介质流的流量优化实验，使用神经算子辅助选择低泄漏的渗透率分布。

论文：[Thompson Sampling in Function Spaces via Neural Operators](https://arxiv.org/pdf/2506.21894)

# 模型描述

模型以 16×16 渗透率场为输入，使用 Fourier 神经算子预测压力场，再按论文的负总流量目标开展逐次查询优化。本模型包对应论文 Figure 1 和 Table 1 的 Darcy flow rates 案例。

## 适用场景

| 场景 | 说明 |
| :--- | :--- |
| 多孔介质设计 | 搜索降低边界流量的渗透率分布 |
| 工业仿真优化 | 用压力场代理模型减少候选结构评估成本 |

# 使用说明

## 1. OneCode 使用

可通过 OneCode 在线环境体验智能化一键式 AI4S 编程：

[点击体验智能化一键式 AI4S 编程](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)

## 2. 手动安装使用

**硬件要求**

- 正式训练在 1 张 DCU 的计算节点完成；推理同样需要可用的 PyTorch 加速环境。
- 本次实验执行了 10 次独立试验，每次 300 次查询。

### 下载模型包

从 ModelScope 下载模型包：

```bash
pip install 'modelscope[datasets]'
modelscope download --model OneScience/NOTS-DarcyFlowRate --local_dir ./NOTS-DarcyFlowRate
cd NOTS-DarcyFlowRate
```

### 安装运行环境

**DCU环境**

```bash
# 请首先激活DTK及CONDA
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# 支持uv安装
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
pip install -r requirements.txt
```

**GPU环境**

```bash
# 请首先激活CONDA
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
# 支持uv安装
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
pip install -r requirements.txt
```

### 训练数据介绍

数据来自[论文官方仓库的 Darcy 16×16 数据包](https://github.com/csiro-funml/nots/tree/main/data)。`darcy_train_16.pt` 含 1000 组渗透率场 `x` 和压力场 `y`，`darcy_test_16.pt` 含 50 组；`x` 为布尔张量，`y` 为 `float32`，均为 16×16 网格。原文件已整理到 [OneScience/NOTS-Darcy-16](https://www.modelscope.cn/datasets/OneScience/NOTS-Darcy-16)。配置默认读取包内 `data/`。

```bash
modelscope download --dataset OneScience/NOTS-Darcy-16 --local_dir ./data
```

下载后应有 `data/darcy_train_16.pt` 和 `data/darcy_test_16.pt`，两者 SHA256 分别为 `0be662acdb1dab7dfd1a1da0b140e97f75cc94f98a14edcf768abe6968b3b418` 和 `d2b19af9d4a6ae04ba2de54b8ecccc8b89766472faf6ce7f506c0b2a60f69a4c`。

### 训练

在已分配 GPU/DCU 的计算节点、模型包根目录中运行。配置使用相对路径，不依赖原超算账号的作业登记文件：

```bash
python scripts/train.py
```

默认完成 10 次试验、每次 300 次查询，并保存 `weight/best_model.pt`。重新训练前请另存已提供的权重和结果。训练后依次运行下面的推理和评估命令。

### 训练权重

`weight/best_model.pt` 包含本次正式运行的模型参数。发布时仅将 checkpoint 中的配置摘要更新为可移植配置对应的摘要，40 个模型参数张量保持不变。发布版 SHA256 为 `dac0b15574242acabd25d5bc52b7a415ec72e1d55411433402affe61876131f7`；原始训练文件 SHA256 为 `2cf139f9cf75a01064fe54b5e8ba0d4e58a4b76a39aa7cf924320acbee4336b2`。`results/inference_metrics.json` 保留的是原始训练文件的哈希；重新运行推理会生成发布版对应的记录。

### 推理

在已分配 GPU/DCU 的计算节点运行：

```bash
python scripts/inference.py
```

推理脚本重新加载 `weight/best_model.pt`。本次测试集压力场平均相对 L2 为 `0.339917`。

### 评估和可视化

同一计算节点上，推理完成后执行：

```bash
python scripts/result.py
```

本次 10 次试验的最终平均 regret 为 `0.289031 ± 0.016963`；论文 Table 1 报告 `0.012 ± 0.001`。`results/` 中保存逐次查询结果、汇总指标和图表。这两组数值有明显差距，不能称为达到论文精度。

# OneScience 官方信息

| 平台 | OneScience 主仓库 | Skills 仓库 |
| --- | --- | --- |
| 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 |

# 引用与许可证

- NOTS 论文：[Thompson Sampling in Function Spaces via Neural Operators](https://arxiv.org/pdf/2506.21894)。
- Darcy 数据来自[论文官方仓库](https://github.com/csiro-funml/nots)，该仓库说明数据按原始 MIT 许可证再分发；模型包代码与数据的许可应分别核对。
