|
Download README.md from OneScience-Group/HardBCPINN-SinePipeFlow: direct link, hf CLI and curl.
- Browser
- Download file 5.08 kB
-
https://huggingface.co/OneScience-Group/HardBCPINN-SinePipeFlow/resolve/main/README.md
- Command line
-
hf download hf://OneScience-Group/HardBCPINN-SinePipeFlow/README.md
-
curl -L -o README.md https://huggingface.co/OneScience-Group/HardBCPINN-SinePipeFlow/resolve/main/README.md
5.08 kB
| license: apache-2.0 | |
| language: | |
| - en | |
| library_name: pytorch | |
| tags: | |
| - OneScience | |
| - computational-fluid-dynamics | |
| - physics-informed-neural-network | |
| - navier-stokes | |
| - hard-boundary-conditions | |
| <p align="center"> | |
| <strong> | |
| <span style="font-size: 30px;">HardBCPINN-SinePipeFlow</span> | |
| </strong> | |
| </p> | |
| # Model Overview | |
| 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. | |
| Paper: [Solving Navier-Stokes Equations Using Data-free Physics-Informed Neural Networks With Hard Boundary Conditions](https://arxiv.org/pdf/2511.14497) | |
| # Model Description | |
| 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. | |
| ## Use Cases | |
| | Use Case | Description | | |
| | :--- | :--- | | |
| | Internal pipe-flow solution | Solve two-dimensional steady velocity and pressure fields in a pipe with sinusoidal boundaries | | |
| | PINN workflow validation | Validate data-free PINN training with hard boundary constraints | | |
| # Usage | |
| ## 1. OneCode | |
| Use the online OneCode environment for an intelligent, one-click AI for Science (AI4S) programming experience: | |
| [Launch OneCode for one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home) | |
| ## 2. Manual Setup | |
| **Hardware Requirements** | |
| - A GPU or DCU is recommended. | |
| - A CPU can be used for import checks and small-scale pipeline validation, but full training will be slow. | |
| - DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version for the target cluster, is recommended. | |
| ### Download the Model Package from Hugging Face | |
| ```bash | |
| pip install -U huggingface_hub | |
| hf download OneScience-Group/HardBCPINN-SinePipeFlow --local-dir ./HardBCPINN-SinePipeFlow | |
| cd HardBCPINN-SinePipeFlow | |
| ``` | |
| ### Set Up the Runtime Environment | |
| **DCU Environment** | |
| ```bash | |
| # Activate DTK and Conda first | |
| conda create -n onescience311 python=3.11 -y | |
| conda activate onescience311 | |
| # Installation with uv is also supported | |
| pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai | |
| ``` | |
| **GPU Environment** | |
| ```bash | |
| # Activate Conda first | |
| 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 | |
| # Installation with uv is also supported | |
| pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai | |
| ``` | |
| ### Training Data | |
| 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: | |
| ```bash | |
| python scripts/fake_data.py | |
| ``` | |
| 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`. | |
| ### Training | |
| ```bash | |
| python scripts/train.py | |
| ``` | |
| The default training configuration saves the checkpoint to: | |
| ```text | |
| ./weight/best_model.pth | |
| ``` | |
| ### Model Weights | |
| The `weight/` directory contains a trained checkpoint that can be used directly for inference. | |
| - Weight file: `weight/best_model.pth` | |
| - File size: 340,962 bytes | |
| - SHA256: `f41bf976775dc18af7d01857dc858517c1978de9830c55afd68ccbf9b6cbd030` | |
| - Training length: 300,000 iterations | |
| - Measured metrics: `eval_loss_total=2.567469e-4`, `wall_u_max_abs=0`, and `wall_v_max_abs=0` | |
| 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. | |
| ### Inference | |
| ```bash | |
| python scripts/inference.py | |
| ``` | |
| ### Evaluation and Visualization | |
| ```bash | |
| python scripts/result.py | |
| ``` | |
| # Official OneScience Resources | |
| | Platform | OneScience 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 | | |
| # Citations and License | |
| - Original paper: [Solving Navier-Stokes Equations Using Data-free Physics-Informed Neural Networks With Hard Boundary Conditions](https://arxiv.org/pdf/2511.14497). | |
| - This repository retains source attribution and is organized for reproducible execution with OneScience and distribution through Hugging Face. | |