dave1368/cluster-04-navier-stokes-pinn
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
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.
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).
