Cluster 4 Navier-Stokes PINN
A Physics-Informed Neural Network predicting the 2D incompressible
Navier-Stokes velocity field (u, v) and pressure p for laminar flow over
a flat plate, at any free-stream velocity. Trained as part of the 9-cluster
Scientific AI Cluster Orchestration Framework,
which pairs this network with an exact symbolic ("Symetria") Blasius
similarity solver and two physics-grounded safety audits under LangGraph
supervision.
Architecture
| Input | (x, y, U∞) — 3 features |
| Output | (u, v, p) — streamwise velocity, wall-normal velocity, pressure |
| Hidden layers | 5 × 128 neurons, Tanh activation |
| Parameters | ~66,000 |
| Input/output scaling | Similarity-variable normalization (see below) |
The Blasius similarity solution shows u/U∞ = f'(η) and
v / (0.5·√(ν·U∞/x)) = η·f'(η) − f(η) are both universal O(1) functions of
the similarity variable η = y·√(U∞/(ν·x)) alone — independent of the
specific x/U∞ sampled. Rather than feeding raw (x, y) (poorly conditioned:
y is millimeters, x is O(1) meter) and predicting raw u, v (which scale
directly with U∞, up to 50x across the training range), the network takes
(x, η, U∞) and predicts the universal O(1) quantities, with physical
u, v reconstructed via exact per-sample scale factors outside the learned
part. This is a normalization choice, not a decomposition that bypasses
learning — the network still has to learn the actual shape of f'(η) and
η·f'(η) − f(η) from data.
Quickstart
import torch
from huggingface_hub import hf_hub_download
from modeling import NavierStokesPINN
ckpt_path = hf_hub_download("dave1368/cluster-04-navier-stokes-pinn", "navier_stokes_pinn.pt")
# weights_only=False: the checkpoint is a dict with metadata (model_state_dict
# plus training info), not a bare tensor, so torch's default-safe loader can't
# be used as-is. Only do this for checkpoints you trust the source of.
checkpoint = torch.load(ckpt_path, map_location="cpu", weights_only=False)
model = NavierStokesPINN()
model.load_state_dict(checkpoint["model_state_dict"]) # checkpoint also carries training-time loss history, see training_metrics.json
model.eval()
# coords: (x, y, free_stream_velocity_m_s)
coords = torch.tensor([[0.5, 0.002, 10.0]])
u_v_p = model(coords)
print(u_v_p) # tensor([[u, v, p]])
Training data
Exact Blasius similarity solution — no synthetic correlation needed. The
third-order Blasius ODE 2f''' + f''f = 0 (boundary condition f''(0) =
0.33205733, Symetria's exact classical constant) is integrated once via
RK4 over η ∈ [0, 8], then reused for every (x, η, U∞) sample via
interpolation:
- 60,000 training points, 10,000 validation points
- Domain:
x ∈ [0.05·L, L],η ∈ [0, 8],U∞ ∈ [1, 50] m/s - Final train loss: 1.62e-05 · Final val loss: 8.62e-06 (MSE, 3000 epochs)
Validated against classical sources (post-deployment finding)
Cross-checked against Navier (1822) & Stokes (1845), Prandtl (1904), and Blasius (1908) — the papers cited in this cluster's Master Specification. Full data tables in the Space README.
| Check | Result |
|---|---|
| Symetria f''(0) vs. Blasius (1908) | Exact match (0.33205733) |
| RK4 similarity profile vs. classical table (Schlichting) | Matches to 4-5 decimal places at every tested η |
| Continuity, exact solution (analytic) | u_x + v_y = 0 exactly, for any U∞ |
| Continuity, this network (autograd, full sweep) | Passes at every tested U∞ ∈ [1, 50] m/s |
| Skin friction Cf vs. Blasius' Cf = 0.664/√Re_x | Correct 1/√Re_x decay across 3 orders of magnitude in Re_x, ~12-15% systematic underestimate |
| Pointwise u, v vs. exact Blasius profile | Largest error near the wall (η≈0); ~0.2% of U∞ elsewhere |
A units note found during validation: the continuity audit compares a velocity-gradient residual (units 1/s) against a tolerance scaled by U∞ (units m/s) — not dimensionally equal, but empirically calibrated, since the residual scales linearly with U∞ in practice (confirmed both analytically and in the network's own behavior). Documented rather than changed, since there's no evidence it causes incorrect pass/fail behavior.
Limitations
- Valid only for laminar, zero-pressure-gradient flow over a flat plate — no turbulence, transition, or separation modeling.
- Pointwise accuracy is weakest right at the wall (η≈0), the region of steepest velocity gradient.
- The continuity audit's tolerance is a calibrated proxy scale, not a dimensionally exact physical bound (see note above).