HUB
Sign inSign up
subterrax logo

credkellar/subterrax

By credkellar

•Updated 17 days ago

SubterraX: TBM boring rates, spoil math, depth heat + pressure, Dijkstra routing, REFUSED bad plans!

Image
Integration & delivery
Developer tools
Data science
1

152

credkellar/subterrax repository overview

⁠SubterraX 🚇⛏️

Underground Transport & Tunneling Lab — by Darion Kellar

Educational underground transport lab in ONE pure-Python file: a TBM advance-rate model by rock type (penetration per revolution × RPM × utilisation), excavation volumes and spoil mass with a bulking factor, the depth environment (geothermal gradient, lithostatic pressure, ventilation cooling load), a deterministic station/shaft graph routed with Dijkstra over depth-penalised edges, a pod piston-effect and headway-capacity model, and safety interlocks that REFUSE plans — egress spacing, ventilation rate, rock temperature, water ingress — with the violated rule named.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: this is a planning and learning simulator — it designs nothing buildable and guides no excavation. Real tunnels (Gotthard Base 57 km, Channel 50.5 km, Laerdal 24.5 km) are labelled published facts, never computed results, and every real-world construction / blasting / operation action is a permanent HOLD gate (14 total).

⁠🐳 Quick start

docker pull credkellar/subterrax:latest docker run --rm credkellar/subterrax:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 64/64).

Run a specific command instead:

docker run --rm credkellar/subterrax:latest python3 main.py checks # CHECKS 64/64 docker run --rm credkellar/subterrax:latest python3 main.py boring # 10 km schedule per rock type docker run --rm credkellar/subterrax:latest python3 main.py spoil # excavation + spoil accounting docker run --rm credkellar/subterrax:latest python3 main.py depth # heat / pressure / cooling vs depth docker run --rm credkellar/subterrax:latest python3 main.py routing # fastest vs compliant route docker run --rm credkellar/subterrax:latest python3 main.py plans # interlock plan book docker run --rm credkellar/subterrax:latest python3 main.py holds # 14 HOLD gates

⁠🔬 What's inside

  • TBM boring model — advance = penetration × RPM × utilisation, labelled planning rates: granite 12.60 m/day, basalt 18.06, sandstone 34.99, clay 30.24, mixed face 5.76. A 10 km heading: 793.7 days in granite, 1,736.1 days in mixed face.
  • Excavation & spoil — 10 m bore = 78.54 m² face; 10 km of granite = 785,398 m³ in situ, 1,256,637 m³ bulked (×1.6), 2,120,575 t of spoil = 106,029 truck loads or 2,121 spoil trains.
  • Depth environment — geothermal gradient 25 °C/km (labelled average): rock 40 °C at 1 km, 65 °C at 2 km, 72.5 °C at 2.3 km. Lithostatic pressure ρgh: 26.5 MPa/km, 60.9 MPa at 2.3 km.
  • Ventilation sizing — wall heat load at 2 km depth: 581.2 kW per km of tunnel, needing 60.2 m³/s of air per km to carry it out.
  • Labelled references — Gotthard Base Tunnel 57 km (longest rail tunnel, 2016), Channel Tunnel 50.5 km (1994), Laerdal Tunnel 24.5 km (longest road tunnel, 2000). Published facts, printed for scale.
  • Dijkstra routing — from-scratch Dijkstra over portals / shafts / stations with depth-penalised edge times: fastest portal-to-portal 12.55 min over 11,200 m via the 4,600 m express bore; compliant route 14.11 min over 12,900 m.
  • Safety interlocks — four rules, refusals named: EGRESS_SPACING (express bore refused), ROCK_TEMPERATURE (67.5 °C deep run refused without refrigeration), WATER_INGRESS (wet link refused without grouting), VENTILATION_RATE (starved fan refused).
  • Pod model — 3.5 m pod in an 8 m bore: blockage 0.191, piston pulse 70.1 Pa at 80 km/h; 120 s headway → 30 pods/h → 1,200 passengers/h per direction.
  • TinyML kNN classifier — favourable / difficult / prohibitive from (UCS, depth, water risk), consistent with the boring model.
  • Advisory seats — Gemini Carbon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

⁠✅ Verified

  • pytest: 36 passed
  • Built-in checks: CHECKS 64/64
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

⁠🏷️ Categories

Transportation · Science · Developer tools

  • License: MIT © 2026 Darion Kellar
  • Image: credkellar/subterrax:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:e8fecc292…
Size
41.6 MB
Last updated
17 days ago
docker pull credkellar/subterrax:latest