File size: 4,488 Bytes
e5a6e71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3ae335e
e5a6e71
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
language:
- en
tags:
- OneScience
- computational-fluid-dynamics
- shallow-water-equations
frameworks: PyTorch
---
<p align="center"><strong><span style="font-size: 30px;">FluxNet-ShallowWater-LAP</span></strong></p>

# Model Introduction

FluxNet-ShallowWater-LAP reproduces the two-dimensional shallow-water FluxNet-LAP pushforward experiment in the [FluxNet paper](https://arxiv.org/pdf/2602.01941). It forecasts water depth and two momentum fields on a 64x64 grid.

# Model Description

The model takes `(h, mx, my)` and predicts the next state. The configuration uses 64 channels, six residual blocks, 5x5 kernels, a 3x3 transport neighborhood and five-step pushforward training.

## Use Cases

| Use case | Description |
| --- | --- |
| Shallow-water forecasting | Forecast depth and momentum on a regular grid |
| Simulation acceleration | Compare surrogate rollouts against numerical reference trajectories |

# Usage

## 1. OneCode

[Open OneCode](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)

## 2. Manual Setup

**Hardware requirements**

- Training and inference require a Slurm-allocated HIP/DCU compute node; there is no silent CPU fallback.
- The formal run used one DCU, eight CPU cores and 30 GB of host memory. GPU execution was not validated.

### Download the Model

```bash
hf download OneScience-Group/FluxNet-ShallowWater-LAP --local-dir ./FluxNet-ShallowWater-LAP
cd FluxNet-ShallowWater-LAP
```

### Install Dependencies

**DCU environment**

```bash
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 h5py PyYAML matplotlib
```

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

The GPU commands describe dependency installation only; the provided scripts were validated on Slurm HIP/DCU.

### Training Data

The [OneScience/FluxNet-ShallowWater dataset on ModelScope](https://www.modelscope.cn/datasets/OneScience/FluxNet-ShallowWater) contains 50 training, 20 validation, 50 short-test and 50 long-test trajectories produced with the paper's official numerical generator. Each HDF5 trajectory contains `h`, `mx`, `my` and `t`. The dataset is not mirrored on Hugging Face. Download it into the model directory:

```bash
modelscope download --dataset OneScience/FluxNet-ShallowWater --local_dir ./data
```

Run commands from the package root. `data.root` in `config/config.yaml` defaults to `./data`.

### Training

On a Slurm-allocated DCU node:

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

The full run trains for 300 epochs and writes `weight/best_model.pth`. Back up the included `best_model.pth` and `last_model.pth` before retraining if they must be preserved.

### Trained Weights

The included checkpoint is the best validation-MSE model at epoch 283 of a completed 300-epoch run. `weight/best_model.pth` is 15636928 bytes; SHA256: `47fb0a029b0c5baa10b2452c70b12f54c958b548cb9aff300b85183d55f1ae70`.

### Inference

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

### Evaluation and Visualization

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

Outputs are written to `results/`. At the long-horizon endpoint (4.8 time units), MAE for `(h, mx, my)` is `(1.5568e-3, 1.9634e-3, 1.7648e-3)`; averaging over all predicted steps gives `(1.4063e-3, 1.8558e-3, 1.7632e-3)`. The paper's Table 3 two-times extrapolation means are `(1.75e-3, 2.38e-3, 2.30e-3)`. This run uses one seed rather than the paper's five independently trained models, so the figures are not a strict like-for-like reproduction.

# OneScience Repositories

| Platform | Main repository | Skills 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: [FluxNet](https://arxiv.org/pdf/2602.01941).
- [Original public repository](https://github.com/Lan-zs/FluxNet); [public dataset and its provenance](https://www.modelscope.cn/datasets/OneScience/FluxNet-ShallowWater). This model package is an independent reproduction.