HardBCPINN-SinePipeFlow

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

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

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

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

# 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

# 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:

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

python scripts/train.py

The default training configuration saves the checkpoint to:

./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

python scripts/inference.py

Evaluation and Visualization

python scripts/result.py

Official OneScience Resources

Citations and License

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for OneScience-Group/HardBCPINN-SinePipeFlow