PINTO-Kovasznay
Model Introduction
PINTO-Kovasznay is a two-dimensional steady-flow surrogate based on PINTO, the physics-informed Transformer neural operator developed by the QUEST Lab at the Indian Institute of Science (IISc). It combines spatial coordinates, boundary conditions, and Navier–Stokes constraints to predict the velocity and pressure fields of Kovasznay flow.
Model Description
PINTO-Kovasznay takes query coordinates, boundary coordinates, and boundary values [u, v, p] as input. Query projection, boundary-position encoding, boundary-value encoding, and multi-head cross-attention combine the boundary conditions before the model predicts two velocity components and pressure. Training combines analytical-solution error, boundary-condition error, and steady incompressible Navier–Stokes residuals.
Intended Uses
| Use case | Description |
|---|---|
| Kovasznay-flow prediction | Predict steady velocity and pressure at different kinematic viscosities. |
| Steady Navier–Stokes solution | Approximate two-dimensional incompressible steady Navier–Stokes flow. |
| Boundary-aware modeling | Learn the map from boundary locations and values to the full flow solution through cross-attention. |
Usage
1. OneCode
Launch the OneCode AI-for-Science environment
2. Manual Setup
Hardware requirements
- A GPU or DCU is recommended.
- A CPU can run imports, forward passes, and small connectivity checks.
- DCU users must install DTK and use a OneScience Python environment compatible with the cluster.
Download the model repository from Hugging Face
pip install -U huggingface_hub
hf download OneScience-Group/PINTO-Kovasznay-Flow --local-dir ./PINTO-Kovasznay-Flow
cd PINTO-Kovasznay-Flow
Install the runtime environment
DCU environment
# Activate DTK 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
GPU environment
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
Training data
No external dataset is required. scripts/fake_data.py generates training, boundary, and test samples from the analytical Kovasznay solution. See config/config.yaml for configuration details.
The default data setup uses:
- Domain: (x\in[-0.5,1.0]), (y\in[-0.5,1.5])
- Training viscosities (\nu): 0.05, 1/30, 0.02, and 0.0125
- Interior query points: Latin hypercube sampling
- Boundary points: random samples from all four sides of the rectangular domain
- Inputs: query coordinates, boundary coordinates, and boundary
[u, v, p] - Targets: analytical Kovasznay velocity components (u,v) and pressure (p)
The default script is a minimal smoke-training run: it uses 32 interior points per viscosity, 5 points on each boundary side (20 boundary points in total), and one parameter update. This is an analytically generated reproduction experiment rather than a prepackaged dataset.
Train
python scripts/train.py
The best checkpoint is saved to weight/best_model.pt, and a standard-run checkpoint is included in the same location.
Inference
python scripts/inference.py
Outputs are saved to:
results/metrics.json
results/predictions.npz
Metrics for the included checkpoint:
| Metric | Value |
|---|---|
| relative_l2_u | 1.029836654663086 |
| relative_l2_v | 1.3754936456680298 |
| relative_l2_p | 1.0770763158798218 |
| relative_l2_mean | 1.1608022054036458 |
Evaluation and visualization
python scripts/result.py
The summary is saved to results/summary.json.
OneScience
| Platform | OneScience repository | OneSkills 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: PINTO: Physics-informed transformer neural operator for learning generalized solutions of partial differential equations for any initial and boundary condition.
- Upstream implementation: quest-lab-iisc/PINTO.
- The upstream PINTO repository does not currently declare a license. The Hugging Face metadata therefore uses the valid identifier
other; obtain the necessary permission before publicly redistributing derived code or weights. The paper and all third-party materials remain subject to their respective terms.