The stored hydrogen obeys the ideal gas law PV = nRT. The cavern's rigid salt volume V never changes, so every mole of H₂ injected or withdrawn moves the pressure directly:
P = nRT / V
n(t+dt) = n(t) + (ṁ / M) · dt [ṁ = mass flow rate, M = 2.016 g/mol]
T = T_surface + geothermal gradient × depth (≈ 15°C + 30°C/km)
A real cavern can't be cycled across its full pressure range — the salt roof and walls need enough internal gas pressure to counteract the surrounding rock's own weight (lithostatic pressure) without creeping shut, but not so much that it fractures the rock. Industry practice keeps operating pressure inside a band expressed as a fraction of the lithostatic pressure Plith = ρrock·g·depth:
P_min ≈ 0.30 × P_lith (below this: cavern convergence / roof instability)
P_max ≈ 0.80 × P_lith (above this: risk of hydraulic fracturing)
The injection/withdrawal valve here is a real safety interlock, not decoration: it auto-closes the instant simulated pressure would cross Pmin or Pmax, exactly like the pressure-relief and shut-in logic on a real cavern wellhead. Depth controls both Plith (and hence the safe envelope) and the geothermal temperature, so pulling the depth slider re-derives everything downstream rather than being cosmetic.
- Gauge — current pressure against the green safe band between Pmin and Pmax.
- Strip chart — pressure history; a full "auto seasonal cycle" run traces a full summer-injection / winter-withdrawal breathing cycle.
- Energy stored — mass × 33.3 kWh/kg (hydrogen's lower heating value), the useful quantity a grid operator actually cares about.