PINN-SWE-CircularDamBreak

Model Introduction

PINN-SWE-CircularDamBreak reproduces the dCDB9 circular dam-break experiment for the two-dimensional shallow water equations. It predicts water depth and velocity without labeled training fields.

Paper: Physics-Informed Neural Networks for Solving the Two-Dimensional Shallow Water Equations with Terrain Topography and Rainfall Source Terms

Model Description

The network maps (x, y, t) to (h, u, v). It has five fully connected hidden layers of width 300 with N-LAAF activations. Training uses shallow-water PDE residuals, initial conditions, and periodic boundary conditions.

Applications

Application Description
Circular dam-break prediction Predict water depth and velocity over time
Shallow-water solver verification Compare PINN fields with a numerical reference

Usage

1. OneCode

Open the OneCode AI4S environment

2. Manual Setup

Hardware

  • Formal training, inference, and evaluation were verified on one DCU compute node; the training script requires a Slurm DCU job environment.
  • At least 30 GB of host memory is recommended.
  • CPU is suitable for configuration inspection, not the recorded full training run.

Download the model

hf download OneScience-Group/PINN-SWE-CircularDamBreak --local-dir ./PINN-SWE-CircularDamBreak
cd PINN-SWE-CircularDamBreak

Install dependencies

DCU

# Activate a compatible DTK and Conda environment 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
pip install numpy PyYAML matplotlib

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
pip install numpy PyYAML matplotlib

The formal scripts were verified only in a Slurm DCU environment. The GPU command is provided for dependency setup, not as a tested training claim.

Training data

No external dataset is needed. scripts/fake_data.py creates collocation points and targets from the configuration's PDE, initial condition, and periodic boundary conditions.

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

Train

The downloaded package includes a trained checkpoint. To train from scratch, first archive the bundled weights, then run on an allocated Slurm DCU node:

mkdir -p weight/pretrained
mv weight/best_model.pth weight/last_model.pth weight/pretrained/
python scripts/train.py --config config/config.yaml

The formal run takes 5,000 optimizer steps and writes weight/best_model.pth.

Trained weights

weight/best_model.pth was selected at step 4,100 after the full 5,000-step run and is ready for inference. File size: 1,466,146 bytes. SHA256: 26953fa8d218a585b05dd2775e1d3574a86ec33a2d68fb2bd58c1c78a8b3734e.

Inference

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

Evaluation and visualization

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

Outputs are written to results/. At t=0.8 s, the recorded water-depth RMSE is 0.01066 versus 0.01000 in paper Table 2. The recorded metric uses an independently implemented HLL reference, so it is not strict parity against the paper's exact reference array.

OneScience Repositories

Citation and License


中文说明

模型简介

PINN-SWE-CircularDamBreak 复现二维浅水方程的 dCDB9 圆形溃坝实验,无需带标签的训练场即可预测水深和流速。

论文:使用物理信息神经网络(physics-informed neural network (PINN))求解含地形与降雨源项的二维浅水方程

模型描述

网络将 (x, y, t) 映射至 (h, u, v),包含五个宽度为 300 的全连接隐藏层,采用 N-LAAF 激活。训练使用浅水 PDE 残差、初始条件和周期性边界条件。

应用

Application 说明
圆形溃坝预测 预测水深和流速随时间的变化
浅水方程求解器验证 将物理信息神经网络的场与数值参考结果进行比较

使用指南

1. OneCode

打开 OneCode AI4S 环境

2. 手动配置

硬件

  • 正式训练、推理(inference)和评估已在一个 DCU 计算节点上完成验证。训练脚本需要 Slurm DCU 作业环境。
  • 建议至少使用 30 GB 主机内存。
  • CPU 适用于检查配置,已记录的完整训练并未使用 CPU。

下载模型

hf download OneScience-Group/PINN-SWE-CircularDamBreak --local-dir ./PINN-SWE-CircularDamBreak
cd PINN-SWE-CircularDamBreak

安装依赖

DCU

# Activate a compatible DTK and Conda environment 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
pip install numpy PyYAML matplotlib

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
pip install numpy PyYAML matplotlib

正式脚本仅在 Slurm DCU 环境中通过验证。提供的 GPU 命令用于配置依赖,尚未验证 GPU 训练。

训练数据

无需外部数据集。scripts/fake_data.py 根据配置中的 PDE、初始条件及周期性边界条件生成配点和目标。

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

训练

下载的模型包包含已训练的模型权重(检查点)(checkpoint)。如需从头训练,请先归档随包提供的权重,再在分配到的 Slurm DCU 节点上运行以下命令。

mkdir -p weight/pretrained
mv weight/best_model.pth weight/last_model.pth weight/pretrained/
python scripts/train.py --config config/config.yaml

正式运行执行 5,000 个优化器步,并写入 weight/best_model.pth。

训练权重

在完整的 5,000 步运行后,从第 4,100 步选出 weight/best_model.pth,可直接用于推理。文件大小为 1,466,146 bytes。SHA256 为 26953fa8d218a585b05dd2775e1d3574a86ec33a2d68fb2bd58c1c78a8b3734e。

推理

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

评估与可视化

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

输出写入 results/。在 t=0.8 s,记录的水深 RMSE 为 0.01066,论文表 2 中为 0.01000。记录的指标使用独立实现的 HLL 参考结果,与论文的原始参考数组并非严格同一口径。

OneScience 仓库

引用与许可证

Downloads last month
11
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for OneScience-Group/PINN-SWE-CircularDamBreak