Gradients through the furnace: Bayesian calibration of a gas carburizing pipeline from three Tesseracts

Gas carburizing of steel gears is a case where the whole process is differentiable in principle (furnace schedule, heat transfer, carbon diffusion, quench, phase transformation, hardness), and in practice the pieces live in different numerical worlds.

Ferrumizer composes them into one differentiable function with Tesseract and uses the resulting gradients for Bayesian calibration: given a measured hardness profile, infer the effective process parameters and their credible intervals, not just a point estimate.

F1_hero_loop

The composition (Track 04, cross-track 02). Three Tesseracts cross two real boundaries:

  • Thermal stage — JAX explicit FTCS, native autodiff
  • Carburizing stage — a legacy NumPy finite difference box, deliberately not autodiffed; its Jacobian is finite difference. This is the differentiation strategy boundary: gradients from the loss flow through the AD side, cross into the FD side, and back out.
  • Hardening stage — JAX phase transformation kinetics (Scheil-additivity JMAK + Koistinen–Marburger) to Vickers hardness and effective case depth (ISO 2639 @ 550 HV).

forward_containers() crosses both container boundaries; a verification gate (V4c) checks the end to end gradient against a finite difference reference, and V4 checks the FD Jacobian against JAX autodiff (rel inf-norm < 1e-3).

What the gradients do?

NumPyro NUTS infers {log D₀, Q, C_pot, h_m, ε} from measured hardness traverses, with the forward pipeline as the likelihood.

A two schedule protocol (900 °C + 1000 °C) breaks the D₀–Q degeneracy that identifiability analysis (Fisher information, figure F8) shows a single schedule cannot.

The same gradients drive an inverse design loop: optimize a furnace schedule for a target case depth, with an energy proxy on the Pareto front.

Verification, briefly.

Solver vs closed form erfc solution (L2 < 1e-3), manufactured solution order ≥ 1.85, hardenability vs the published AISI 8620H Jominy band (MAE 2.6 HRC at 13 positions), quench model sanity (Q1–Q3). Posterior calibration (200-simulation SBC): rank uniformity passes (χ² p = 0.074); 90% coverage lands at 0.83 vs the 0.858 binomial band — documented in the README as the single known limitation.

Why Tesseract, specifically?

The middle stage exists to model a real situation: legacy solvers you cannot (or do not want to) rewrite for autodiff.

Tesseract is what lets a FD-Jacobian NumPy box sit inside a JAX-AD pipeline with one differentiable contract between them, the alternative is either rewriting the legacy code or hand rolling the cross boundary chain rule.

Try it. uv tool install -e . --with streamlit and ferrumize app for the interactive Virtual Furnace.