Update README and model configuration
Browse files
README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: pytorch
|
| 6 |
+
tags:
|
| 7 |
+
- OneScience
|
| 8 |
+
- computational-fluid-dynamics
|
| 9 |
+
- physics-informed-neural-network
|
| 10 |
+
- navier-stokes
|
| 11 |
+
- hard-boundary-conditions
|
| 12 |
+
---
|
| 13 |
+
<p align="center">
|
| 14 |
+
<strong>
|
| 15 |
+
<span style="font-size: 30px;">HardBCPINN-SinePipeFlow</span>
|
| 16 |
+
</strong>
|
| 17 |
+
</p>
|
| 18 |
+
|
| 19 |
+
# Model Overview
|
| 20 |
+
|
| 21 |
+
HardBCPINN-SinePipeFlow is a reproduction of a hard-boundary-condition physics-informed neural network (PINN) for two-dimensional incompressible steady flow in a pipe with sinusoidal walls.
|
| 22 |
+
|
| 23 |
+
Paper: [Solving Navier-Stokes Equations Using Data-free Physics-Informed Neural Networks With Hard Boundary Conditions](https://arxiv.org/pdf/2511.14497)
|
| 24 |
+
|
| 25 |
+
# Model Description
|
| 26 |
+
|
| 27 |
+
HardBCPINN-SinePipeFlow is trained without labeled flow-field data. It takes two-dimensional coordinates `(x, y)` as input and predicts velocity and pressure `(u, v, p)`. The implementation embeds the inlet pressure, outlet pressure, and no-slip wall conditions in an output transformation, so the model satisfies these hard boundary conditions throughout training. The interior flow is optimized using residuals of the incompressible Navier-Stokes equations.
|
| 28 |
+
|
| 29 |
+
## Use Cases
|
| 30 |
+
|
| 31 |
+
| Use Case | Description |
|
| 32 |
+
| :--- | :--- |
|
| 33 |
+
| Internal pipe-flow solution | Solve two-dimensional steady velocity and pressure fields in a pipe with sinusoidal boundaries |
|
| 34 |
+
| PINN workflow validation | Validate data-free PINN training with hard boundary constraints |
|
| 35 |
+
|
| 36 |
+
# Usage
|
| 37 |
+
|
| 38 |
+
## 1. OneCode
|
| 39 |
+
|
| 40 |
+
Use the online OneCode environment for an intelligent, one-click AI for Science (AI4S) programming experience:
|
| 41 |
+
|
| 42 |
+
[Launch OneCode for one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
|
| 43 |
+
|
| 44 |
+
## 2. Manual Setup
|
| 45 |
+
|
| 46 |
+
**Hardware Requirements**
|
| 47 |
+
|
| 48 |
+
- A GPU or DCU is recommended.
|
| 49 |
+
- A CPU can be used for import checks and small-scale pipeline validation, but full training will be slow.
|
| 50 |
+
- DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version for the target cluster, is recommended.
|
| 51 |
+
|
| 52 |
+
### Download the Model Package from Hugging Face
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
pip install -U huggingface_hub
|
| 56 |
+
hf download OneScience-Group/HardBCPINN-SinePipeFlow --local-dir ./HardBCPINN-SinePipeFlow
|
| 57 |
+
cd HardBCPINN-SinePipeFlow
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
### Set Up the Runtime Environment
|
| 61 |
+
|
| 62 |
+
**DCU Environment**
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
# Activate DTK and Conda first
|
| 66 |
+
conda create -n onescience311 python=3.11 -y
|
| 67 |
+
conda activate onescience311
|
| 68 |
+
# Installation with uv is also supported
|
| 69 |
+
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
**GPU Environment**
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
# Activate Conda first
|
| 76 |
+
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
|
| 77 |
+
conda activate onescience311
|
| 78 |
+
# Installation with uv is also supported
|
| 79 |
+
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
### Training Data
|
| 83 |
+
|
| 84 |
+
This package reproduces the Reynolds-number-100 sinusoidal-wall pipe-flow experiment from Section 3.3 of the paper. It is a data-free PINN task and does not require an external labeled dataset. The script generates collocation points, boundary points, and a visualization grid from the geometry and boundary conditions specified in the paper:
|
| 85 |
+
|
| 86 |
+
```bash
|
| 87 |
+
python scripts/fake_data.py
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
The default geometry parameters are `R0=0.05`, `A=0.005`, `N=6`, and `L=1.0`. The inlet pressure is `0.1`, and the outlet pressure is `0.0`.
|
| 91 |
+
|
| 92 |
+
### Training
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
python scripts/train.py
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
The default training configuration saves the checkpoint to:
|
| 99 |
+
|
| 100 |
+
```text
|
| 101 |
+
./weight/best_model.pth
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
### Model Weights
|
| 105 |
+
|
| 106 |
+
The `weight/` directory contains a trained checkpoint that can be used directly for inference.
|
| 107 |
+
|
| 108 |
+
- Weight file: `weight/best_model.pth`
|
| 109 |
+
- File size: 340,962 bytes
|
| 110 |
+
- SHA256: `f41bf976775dc18af7d01857dc858517c1978de9830c55afd68ccbf9b6cbd030`
|
| 111 |
+
- Training length: 300,000 iterations
|
| 112 |
+
- Measured metrics: `eval_loss_total=2.567469e-4`, `wall_u_max_abs=0`, and `wall_v_max_abs=0`
|
| 113 |
+
|
| 114 |
+
Table 7 of the paper reports errors relative to the CFD reference solution at Re=100: `u=0.0016`, `v=0.0811`, and `p=0.0007`. This model package does not include the CFD reference field used by the paper, so it does not recompute relative L2 error; it reports the PDE residual and hard-boundary errors instead.
|
| 115 |
+
|
| 116 |
+
### Inference
|
| 117 |
+
|
| 118 |
+
```bash
|
| 119 |
+
python scripts/inference.py
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
### Evaluation and Visualization
|
| 123 |
+
|
| 124 |
+
```bash
|
| 125 |
+
python scripts/result.py
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
# Official OneScience Resources
|
| 129 |
+
|
| 130 |
+
| Platform | OneScience Repository | Skills Repository |
|
| 131 |
+
| --- | --- | --- |
|
| 132 |
+
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
|
| 133 |
+
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
|
| 134 |
+
|
| 135 |
+
# Citations and License
|
| 136 |
+
|
| 137 |
+
- Original paper: [Solving Navier-Stokes Equations Using Data-free Physics-Informed Neural Networks With Hard Boundary Conditions](https://arxiv.org/pdf/2511.14497).
|
| 138 |
+
- This repository retains source attribution and is organized for reproducible execution with OneScience and distribution through Hugging Face.
|