--- license: apache-2.0 language: - en tags: - OneScience - fluid-dynamics - shallow-water-equations frameworks: PyTorch ---

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](https://arxiv.org/pdf/2501.11372) # 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](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home) ## 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 ```bash hf download OneScience-Group/PINN-SWE-CircularDamBreak --local-dir ./PINN-SWE-CircularDamBreak cd PINN-SWE-CircularDamBreak ``` ### Install dependencies **DCU** ```bash # 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** ```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 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. ```bash 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: ```bash 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 ```bash python scripts/inference.py --config config/config.yaml ``` ### Evaluation and visualization ```bash 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 | 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: [Physics-Informed Neural Networks for Solving the Two-Dimensional Shallow Water Equations with Terrain Topography and Rainfall Source Terms](https://arxiv.org/pdf/2501.11372). - Authors' open repository: [PINN_SWE_open](https://github.com/tianyongsen/PINN_SWE_open), licensed under Apache License 2.0. This package is an independent reproduction and retains attribution.