Cluster 2 Hydrostatic PINN
A ~30,000-parameter network that fits pointwise pressure to 0.04% error — but whose calculus (not just its curve-fit) is honestly ~1.2% off from Archimedes.
Predicts hydrostatic pressure at any point inside a fluid container, trained directly against the exact physics (no synthetic correlation needed here — unlike Cluster 1, this cluster's own symbolic solver already computes the true label). Part of Cluster 2 of the Scientific AI Cluster Orchestration Framework — see the live demo at dave1368/cluster-02-fluid-statics.
Status: Proof of Concept. Trained on exact physics, not measured data. See Limitations before using this for anything beyond demonstrating the architecture pattern.
What it is
| Architecture | 4-layer MLP, Tanh activations, 64 hidden units/layer |
| Parameters | ~30,000 |
| Input | [x, y, z] container coordinates, each in [0, 1] |
| Output | Hydrostatic pressure, Pa |
| Framework | PyTorch (plain nn.Module, no transformers dependency) |
| Training | Full-batch Adam, 2,000 epochs, CPU-only |
Quickstart
from huggingface_hub import hf_hub_download
import torch
from modeling import HydrostaticPINN # download modeling.py from this repo alongside the checkpoint
ckpt_path = hf_hub_download("dave1368/cluster-02-hydrostatic-pinn", "hydrostatic_pinn.pt")
checkpoint = torch.load(ckpt_path, map_location="cpu")
model = HydrostaticPINN()
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
with torch.no_grad():
coords = torch.tensor([[0.5, 0.5, 0.5]])
pressure = model(coords).item()
print(f"Pressure at (0.5, 0.5, 0.5): {pressure:.2f} Pa")
modeling.py in this repo is a self-contained copy of the architecture — you don't
need the full orchestration framework to use the checkpoint.
Training data: exact physics, not invented numbers
Unlike Cluster 1 (which needed an external empirical correlation since no exact
label existed), Cluster 2's own SymetriaHydrostaticsSolver already computes the
literal correct answer: Stevin's Law (Simon Stevin, 1586, De Beghinselen der
Weeghconst — the first rigorous derivation that hydrostatic pressure depends only
on depth, not vessel shape, the "hydrostatic paradox"), later generalized by
Pascal (1647, Traités de l'équilibre des liqueurs) into the principle that
pressure applied to an enclosed fluid transmits undiminished:
P = P0 + rho * g * z
with P0 = standard atmospheric pressure (101,325 Pa), rho = fresh water density
(1000 kg/m³), g = standard gravity (9.80665 m/s²). Training labels are this exact
formula evaluated at randomly sampled coordinates — not an approximation.
Validated against classical sources
Every table below was independently recomputed in a fresh verification script before publishing — not read back from a log file or from the orchestrator's own internal call — against the exact closed-form formulas, not measured data.
Exact solver vs. Archimedes (~250 BC), On Floating Bodies. This checks the
symbolic solver's code, not the network — confirming no unit error, no
off-by-constant bug. The benchmark column is rho * V * g re-typed independently.
| Volume (m³) | Solver output (N) | rhoVg, independently computed (N) | Difference |
|---|---|---|---|
| 0.1 | 980.66 | 980.66 | 0.0000 |
| 50.0 | 490,332.50 | 490,332.50 | 0.0000 |
| 99.9 | 979,684.33 | 979,684.33 | 0.0000 |
| 100.0 | 980,665.00 | 980,665.00 | 0.0000 |
Network's pointwise pressure vs. Stevin (1586) / Pascal (1647). The network's
raw forward pass at 7 depths x 3 horizontal positions each, compared against
P0 + rho*g*z. Position shouldn't matter (only depth) -- that's Stevin's paradox
itself, which the three x,y rows per depth exist specifically to check.
| Depth z (m) | x, y | Network pred. (Pa) | Exact (Pa) | Error |
|---|---|---|---|---|
| 0.00 | 0.1, 0.1 | 101,403.25 | 101,325.00 | 0.0772% |
| 0.00 | 0.5, 0.5 | 101,324.15 | 101,325.00 | 0.0008% |
| 0.00 | 0.9, 0.9 | 101,451.00 | 101,325.00 | 0.1244% |
| 0.10 | 0.1, 0.1 | 102,342.02 | 102,305.67 | 0.0355% |
| 0.10 | 0.5, 0.5 | 102,267.26 | 102,305.67 | 0.0375% |
| 0.10 | 0.9, 0.9 | 102,360.59 | 102,305.67 | 0.0537% |
| 0.25 | 0.1, 0.1 | 103,785.66 | 103,776.66 | 0.0087% |
| 0.25 | 0.5, 0.5 | 103,726.79 | 103,776.66 | 0.0481% |
| 0.25 | 0.9, 0.9 | 103,772.04 | 103,776.66 | 0.0045% |
| 0.50 | 0.1, 0.1 | 106,242.61 | 106,228.33 | 0.0134% |
| 0.50 | 0.5, 0.5 | 106,234.11 | 106,228.33 | 0.0054% |
| 0.50 | 0.9, 0.9 | 106,210.03 | 106,228.33 | 0.0172% |
| 0.75 | 0.1, 0.1 | 108,677.81 | 108,679.99 | 0.0020% |
| 0.75 | 0.5, 0.5 | 108,741.77 | 108,679.99 | 0.0568% |
| 0.75 | 0.9, 0.9 | 108,668.85 | 108,679.99 | 0.0102% |
| 0.90 | 0.1, 0.1 | 110,084.00 | 110,150.99 | 0.0608% |
| 0.90 | 0.5, 0.5 | 110,195.90 | 110,150.99 | 0.0408% |
| 0.90 | 0.9, 0.9 | 110,105.62 | 110,150.99 | 0.0412% |
| 1.00 | 0.1, 0.1 | 110,984.94 | 111,131.65 | 0.1320% |
| 1.00 | 0.5, 0.5 | 111,128.38 | 111,131.65 | 0.0029% |
| 1.00 | 0.9, 0.9 | 111,031.61 | 111,131.65 | 0.0900% |
Mean error across all 21 points: 0.0411%. Max: 0.1320% (bolded above).
The story worth telling: pointwise accuracy and derivative accuracy are different questions
The network fits the pointwise pressure field very well: ~0.04% mean error, 0.13% max, independently re-verified across a full sweep of depths (z = 0 to 1) and horizontal positions before publishing this checkpoint.
But Archimedes' principle (~250 BC, On Floating Bodies) — buoyant force equals
the weight of displaced fluid, Fb = rho * V * g — isn't really about pointwise
pressure values. It's about the pressure gradient integrated over a submerged
volume. Computing the network's buoyant-force estimate via autograd (dP/dz, a
genuinely different computational path than the values the MSE loss directly
targeted) reveals a consistent ~1.2% error against the exact Archimedes value,
across the full slider range this checkpoint powers (0.1–100 m³):
| Volume (m³) | Autograd-implied Fb (N) | Exact Fb = ρVg (N) | Error |
|---|---|---|---|
| 0.1 | 968.93 | 980.66 | 1.197% |
| 50.0 | 484,460.56 | 490,332.50 | 1.198% |
| 99.9 | 968,020.38 | 979,684.33 | 1.191% |
| 100.0 | 969,057.62 | 980,665.00 | 1.184% |
This is a well-documented PINN phenomenon: minimizing pointwise MSE loss doesn't automatically minimize derivative error, since the loss function never directly sees the gradient during training. A model that looks nearly perfect by one metric (0.04% pointwise error) can be meaningfully less accurate by another (1.2% derivative error) — and you only find out by testing the specific physical quantity you actually care about, not by trusting the training loss curve alone.
Note: the ~1.2% error stays essentially flat across three orders of magnitude of volume (0.1 to 100 m³). That's expected, not a coincidence — the autograd check measures a local pressure gradient (a fluid property, constant everywhere in a hydrostatic fluid) and multiplies it by an independently-specified volume, so the network's derivative accuracy at any one point governs the error regardless of how large the multiplied-in volume is.
Training curve
| Epoch | Train loss (normalized MSE) | Val loss |
|---|---|---|
| 1 | 0.333 | 0.253 |
| 100 | 4.06e-4 | 3.92e-4 |
| 500 | 1.29e-4 | 1.26e-4 |
| 1000 | 2.88e-5 | 2.84e-5 |
| 1500 | 1.46e-5 | 1.44e-5 |
| 2000 | 1.07e-5 | 1.05e-5 |
Loss is on the network's normalized pre-scale output, not raw Pascals — since the
model bakes in a fixed ~9,807× output multiplier for the P0/ρg scale, training
directly against raw Pascal² values would badly imbalance the loss (the same
input-side normalization discipline from Cluster 1, applied here to the output side).
Loss converges cleanly across all 2,000 epochs — full per-epoch history in
training_metrics.json.
Limitations
- Synthetic vs. exact: unlike most clusters, there's no synthetic-label caveat here — labels are the literal correct physics. The caveat instead is architecture: a plain MLP trained on point values doesn't automatically get derivatives exactly right (see above).
- Buoyancy audit tolerance (2%) is set to match observed accuracy, not an
idealized target — see the orchestrator's
failsafes.pyfor the full reasoning. - No held-out real-world validation — this is a first-principles physics problem with an exact closed-form solution, so "validation" here means checking against that exact solution, not independent measured data.
Part of a larger framework
This is one of 9 clusters in the Scientific AI Cluster Orchestration Framework, each pairing a small trained neural surrogate with an exact symbolic baseline and its own physics-grounded safety audits (buoyancy balance and Pascal transmission checks, in this cluster's case). See the Space for the full interactive pipeline this checkpoint powers, and Cluster 1's model for the first cluster in the series.
Foundational references: Archimedes (~250 BC), Stevin (1586), Pascal (1647).
License: MIT.