Cluster 6 Bubble Dynamics PINN
A Physics-Informed Neural Network predicting bubble radius R(t) during
spherical cavity collapse, at any initial radius and driving acoustic
pressure. Trained as part of the 9-cluster Scientific AI Cluster
Orchestration Framework,
which pairs this network with an exact symbolic ("Symetria") Rayleigh
collapse-time solver and two physics-grounded safety audits under LangGraph
supervision.
Architecture
| Input | (t, R0, ΔP) — 3 features |
| Output | R(t) — bubble radius, meters |
| Hidden layers | 4 × 64 neurons, GELU activation |
| Parameters | ~13,000 |
| Output form | Predicts x=R/R0 (universal collapse shape), reconstructs R=R0·x |
The Rayleigh collapse is self-similar — x(τ) = R/R0 as a function of
τ = t/Tc(R0,ΔP) is a universal curve, independent of the specific R0/ΔP
sampled (the same structural fact as Cluster 4's Blasius similarity
variable). The network is given τ (computed internally using the same
exact Tc formula Symetria's own solver uses) plus log-scaled R0/ΔP (both
span ~500x on their Gradio sliders), and predicts the universal x value
directly.
Quickstart
import torch
from huggingface_hub import hf_hub_download
from modeling import BubbleDynamicsPINN
ckpt_path = hf_hub_download("dave1368/cluster-06-bubble-dynamics-pinn", "bubble_dynamics_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 = BubbleDynamicsPINN()
model.load_state_dict(checkpoint["model_state_dict"]) # checkpoint also carries training-time loss history, see training_metrics.json
model.eval()
# inputs: (time_seconds, initial_radius_meters, driving_pressure_pascals)
inputs = torch.tensor([[1.0e-6, 50e-6, 1e6]])
radius_m = model(inputs)
print(radius_m) # tensor([[R]])
Training data
Exact self-similar Rayleigh cavity-collapse solution — no synthetic
correlation needed. The universal ODE dx/dτ = −K·√(x⁻³−1)
(K=RAYLEIGH_CONST·√(2/3)≈0.74683) is integrated once via RK4 from x=1
(τ=0) down to a small floor (avoiding the model's genuine finite-time
singularity at R→0), then reused for every (t, R0, ΔP) sample via
interpolation:
- 60,000 training points, 10,000 validation points
- Domain: R0 ∈ [1, 500] μm, ΔP ∈ [10, 5000] kPa, τ oversampled near the collapse-completion point
- Final train loss: 2.02e-05 · Final val loss: 2.06e-05 (MSE, 3000 epochs)
Validated against classical sources (post-deployment finding)
Cross-checked against Rayleigh (1917), Plesset (1949), and Keller & Miksis (1980) — the papers cited in this cluster's Master Specification. Full data tables in the Space README.
| Check | Result |
|---|---|
| Rayleigh constant 0.91468 vs. independent Beta-function derivation | Exact match |
| Symetria exact Tc vs. independent recomputation | Exact match at every tested (R0, ΔP) |
| Universal collapse curve vs. energy equation (finite-diff self-consistency) | Matches to numerical precision away from the true singularity |
| Network R(t) vs. exact, across 3 (R0,ΔP) pairs × 6 τ values | Errors under ~1.5% of R0, largest at τ=0 |
| Mach-limit audit across full slider range | Never fires — see finding below |
A genuine, documented finding: the Mach-limit audit — meant to catch when collapse wall velocity exceeds water's sound speed — never fires anywhere in the practical input range, even at the most extreme slider corner (R0=1μm, ΔP=5000kPa, max predicted velocity 818 m/s vs. a 1481 m/s threshold). The underlying physics genuinely does go supersonic near true collapse for any input (the idealized Rayleigh model has a finite-time singularity at R→0), but a smooth neural network cannot represent that divergence — its fitted curve necessarily flattens out before reaching it. This is a function-class limitation already identified during training and not chased with more epochs.
Limitations
- The Rayleigh model has a genuine finite-time singularity as R→0 — real physics (it's why bubble collapse produces shock waves and sonoluminescence), not a numerical artifact, and this network cannot represent it.
- Gas-free (vapor-cavity) Rayleigh collapse only — no gas cushion, viscosity, or surface tension effects past the collapse point.
- The Mach-limit audit does not currently discriminate in practice for any input in this app's slider range (see finding above).