Skip to content

Batch Reactor (marimo notebook)

A self-contained walkthrough of Sobol global sensitivity analysis on a batch reactor running a first-order liquid-phase reaction AB. The rate constant k(T,pH) combines an Arrhenius temperature dependence with a Hill-type pH saturation curve, and the inlet concentration CA,0 feeds the mass balance directly. The mechanistic model is treated as already fitted — the example focuses on variance attribution, not estimation.

The notebook source lives at examples/batch_reactor_gsa.py. Run it interactively with uv run marimo edit examples/batch_reactor_gsa.py, or read the rendered output below.

What this example covers

  • A three-input Sobol problem (CA,0, T, pH) defined with gsax.Problem.from_dict(...) and uniform marginals.
  • A closed-form batch reactor start-up trajectory used as the model — the kind of cheap surrogate you would plug a fitted mechanistic predictor into.
  • A single gsax.analyze(..., num_resamples=200, key=...) call to obtain S1, ST, Sij along with bootstrap 95 % confidence intervals.
  • Three plots that read the indices off: steady-state bar chart with CI error bars, time-resolved S1(t) and ST(t) with shaded bootstrap envelopes, and a pairwise Sij heatmap.

See also

Released under the MIT License.