Skip to content

Run health

New in 0.9

The run-health checks, result.healthy and result.warnings, sim.run_health() and the healthy and run_health fields of the CLI --json summary are not in 0.8.

The engine's tests check the engine's own decks. Nothing in them checks your deck while it runs: a deck can be wrong in ways no test covers (too few cells, steps too short, a tolerance it cannot carry) and still finish with status completed and plausible KPIs. Run-health checks are cheap tests the solver makes after every cycle for the symptoms of such a run. They never stop a run, change its status, exit code or results: they add warnings and set healthy to false.

result = sim.run()
result.ok, result.healthy          # finished, and no run-health check fired
for w in result.warnings:          # RunHealthWarning
    print(w.code, w.value, w.threshold, w.cycle, w.step_name, w.suspects, w.hint)
sim.run_health().cycles            # the measures of every completed cycle

The CLI's --json summary has healthy and run_health (the same structured warnings; their messages are also appended to warnings), the text summary has a Health: line, and run-health warnings are printed to stderr even with -q. The solver logs each warning once at the end of the run, at log level low.

Each warning is {code, value, threshold, cycle, step, suspects, hint} (plus step_name, component and a one-line message). Each code fires at most once per run, at the cycle where its value was largest. Each has a switch, settings.warn_<code in lower case> (on by default); a switched-off check is not reported and does not make the run unhealthy. The warning manifest (skarstrom.warning_manifest()) lists them with their code.

The checks

MOLE_FRACTION_SUM

The largest \(|\sum_i y_i - 1|\) over the cycle's logged times and the column's cells (packed and void cells). Every component balance is solved for its own mole fraction, so nothing forces the sum to 1: it drifts when a convective scheme or a source does not conserve the gas composition. A past advection defect let the sum reach about 3 while the run still reported completed.

Suspects: the advection scheme (settings.advection_scheme), the grid, the step and outlet where the largest error is. Try: re-run with upwind (or weno) and with more cells to compare; a sum that moves with them is numerical, one that does not is in the model.

MASS_BALANCE_STUCK

The cycle mole balance of each component (the mass_balance_error diagnostic of the KPIs, from the KPI quadratures when they are on, else the trapezoid): the net moles that entered through every endpoint, plus the moles that the reactions made, minus the change of the column's gas and adsorbed inventory, over the moles supplied (those that entered plus those that the reactions made; a reactant's net generation is negative and adds nothing; changed in 0.19). A reaction product that enters only as a trace is thus measured against its production. It compares flows with the inventory, so a conservative run closes it on every cycle up to the integration error, whether or not it is near the cyclic steady state. One that stays open as the run settles is a model error (moles gained or lost), not slow convergence. The rule, at cycle \(k\), with the window \(W\) = 5 cycles:

  • the end-of-cycle state change at \(k\) (the CSS state test's measure, Cyclic steady state) is at most \(10^{-3}\): the run has settled;
  • every \(|e|\) in the window \(k-W+1 \dots k\) is above the threshold; and
  • the balance stopped falling: \((|e_k| / |e_{k-W+1}|)^{1/(W-1)} \ge 0.9\), it fell by less than 10 % per cycle over the window.

A component whose supply over the cycle is round-off has no balance (NaN) and is not checked. The round-off floor is \(10^{-12}\) of the column inventory (all components, fluid and adsorbed). On a liquid deck, a trace component with a reference mole fraction \(x_\text{ref}\) (its largest inlet or initial mole fraction, see Cyclic steady state) uses its own scale instead, if that is smaller: \(10^{-6}\,x_\text{ref}\) times the moles of all components that entered over the cycle. Thus a 1 ng/L solute (about \(10^{-16}\) mol per cycle against an inventory of a few moles) is checked too. Gas decks, and liquid decks with trace scaling off (settings.trace_tolerance_factor 0 and no fluid.component_abstol), keep the inventory floor. Changed in 0.19. The per-component CSS balance (Mass Balance (Per-Component), Cyclic steady state) uses the same trace floor, so a trace solute that this check tests is tested there too.

Needs the KPI quadratures (on by default, Performance metrics): without them the column inventory is not recorded and the check is skipped.

STEP_RETRIES

The integrator's rejected attempts in a cycle (error-test failures, nonlinear convergence failures and the solver's own step recoveries) per accepted internal step, over a cycle of at least 50 accepted steps. Many rejections mean the integrator is fighting the deck: a tolerance it cannot meet, an abrupt boundary condition, a grid too coarse for a front.

Under weno or van_leer the hint also suggests settings.advection_scheme = weno_scaled for a deck with a fast reaction: both schemes are unstable on its steep front, and the run then takes many short steps or stops with "too much work" (numerics). New in 0.19.

The integrator counters, including the recovered-step count (recovered_steps), are the same for a run in slices (the chunked solver, CoupledSolverChuncked::GetStatistics()) as for a blocking run. New in 0.9.

REACTION_STIFF

The integrator's step collapsed at a reacting cell: in one cycle step, 100 accepted internal steps shorter than \(10^{-4}\) s had the largest weighted local error estimate in a cell that carries a reaction, or the step failed while its last accepted step was that short there. A reaction that relaxes far faster than the flow can hold the step at its own time scale (microseconds) for the rest of the step; the run then crawls or fails with "too much work".

The warning names the reaction (reaction) and the component (component) to look at. Of the components the cell's reactions raise to a power below 1 (a negative order, a square root in a reverse term), it takes the one with the smallest mole fraction in that cell, else the participant with the smallest mole fraction; of the reactions that involve it, the one with the largest rate there. The value is the number of short steps.

Unlike the checks above, which run as each cycle completes, this one counts within the cycle step and is reported at once, so it also reaches a run that then fails: the failed run's log carries the message.

Suspects: the reaction and its rate law, the near-zero mole fraction of the component (typically a product in a bed that holds none yet), the initial gas composition. Try: start the bed with some of the component in initial.y, or at the gas-phase equilibrium of the feed; add a trace to the feed; check the orders and the units of the rate constants. See Reactions: start-up of fast reactions.

SUPERSATURATION

New in 0.16

The SUPERSATURATION check, its switch settings.warn_supersaturation, the start-of-run warnings for supersaturated inlets and initial gas, and the supersaturation_gas and supersaturation_wall measures of sim.run_health().cycles are not in 0.15.

A component's partial pressure passed its saturation pressure, and the deck does not model the condensation of that component. Without a condensation model no liquid forms, the gas keeps the supersaturated mole fraction, no heat of condensation is released, and the GAB, GAB–Young and cubic-Langmuir kinds continue smoothly past saturation (see Isotherms). A run that crosses saturation is outside the model's range, and its results after that point are not physical. A component whose condensation is modelled is judged differently: see Components that condense below.

The measure is the relative saturation

\[S = \frac{y_i P}{p_{sat,i}(T)}\]

the largest over the cycle's logged times, the column's cells (packed and void cells) and the components that can condense: those with a saturation curve in the engine's component table (the vapour-pressure ancillary, adsim::SaturationPressure) and below their critical temperature at \(T\). Above \(T_c\) nothing condenses, so nitrogen, hydrogen, methane and helium at ambient temperature never count; carbon dioxide counts below 304.1 K. The check takes \(S\) twice:

  • in the gas, at the gas temperature: the gas itself is supersaturated;
  • at the wall, at the wall temperature (the cold-wall measure): every cell of the axial model touches the wall, and vapour condenses on a wall below its dew point even while the bulk gas is not saturated. A cold jacket, a cold ambient through a thin wall or a cold initial wall gives this one first.

It fires when either measure passes 1, with no margin: saturation itself is the limit of the model. The value is the gas measure when the gas itself is supersaturated, else the wall measure; the message names which measure, the component, the cell and its height, the step, the time in the step and the other measure. The measures of each cycle are supersaturation_gas and supersaturation_wall in sim.run_health().cycles (NaN when no component can condense, and while the check is switched off: it costs one evaluation of the saturation curve per logged point, cell and condensable component).

The same switch turns on a check at the start of the run, logged with the other deck warnings: the initial gas (at the initial temperature and at the initial wall temperature) and every inlet that carries its own gas (not a connected stream or a buffer-tank inlet) at its inlet temperature. A flow inlet is taken at the bed pressure, estimated as the end value of the step's pressure boundary at the other end, else the initial pressure; a pressure inlet at its own end value. An isothermal run uses the isothermal temperature.

Suspects: the water (or other vapour) content and temperature of the feed and of initial.y; the wall, jacket or ambient temperature for the wall measure; the pressure of the step. What to do:

  • if the process really reaches saturation (a cold humid feed, a compressed humid gas), the model does not hold there: dry or warm the feed, or lower its pressure, before the bed; or treat the results as an upper bound only;
  • if only the wall measure fires, check the wall and jacket temperatures (initial.wall_temperature, the heating medium, bed.ambient_temperature) and the wall's heat transfer: insulation or a warmer jacket keeps the wall above the dew point;
  • if it fires only briefly ahead of a front, a finer grid tells whether the overshoot is numerical.

Components that condense

New in 0.19

The step-end rule for condensing components, its threshold 1.05 and the supersaturation_step_end measure of sim.run_health().cycles are not in 0.18.

When the liquid hold-up on the solid (condensation.holdup.enabled[Component]) or the wall film (condensation.wall_film.enabled[Component]) is on for a component, the engine models its condensation. The condensation rate is finite: the liquid grows only while the gas is above saturation, so the gas passes \(S = 1\) wherever liquid forms, and at a sharp front (steam onto a cold bed) it can briefly pass 2. That is the model working, not a gas outside the model's range. For such a component:

  • the two measures above (in the gas and at the wall) do not fire the warning, and the start-of-run check does not warn about its inlets or its initial gas;
  • the check takes instead \(S\) in the gas, at the gas temperature, at the end of each step (the last logged time), over every cell. The condensation model brings the gas back to saturation on its own time scale, so a gas still above saturation when the step ends means that the condensation rate does not keep up with the vapour that the step brings in. The warning fires when this measure passes 1.05. Its message says "still supersaturated in the gas at the end of step", and its threshold is 1.05.

The 5 % margin covers the small excess that a finite rate leaves at steady state where a feed close to saturation enters a condensing zone. The shipped decks with condensation stay below it: about 1.0 for Illustrative_Humid_DAC_TVSA_Holdup and Illustrative_Humid_DAC_TVSA_Wall_Film. A feed that is far above saturation, a rate multiplier well below 1 or a grid too coarse for the front passes it. What to do: raise condensation.holdup.rate_multiplier (or condensation.wall_film.rate_multiplier), refine the grid, or check that the feed is not far above saturation.

The hold-up does not cover a cold wall: with only the hold-up on, water that would condense on a wall below the dew point is not modelled, but the wall measure does not fire for it. Turn on the wall film as well when the wall is the coldest surface. A second vapour whose condensation is not modelled (only one component can condense) is still judged by the measures above.

The check covers the gas in the column only. Gas that is dry at vacuum can still condense after the vacuum pump compresses it: sim.outlet_condensation(step, stream) gives the dew point of a logged outlet stream and the vapour a knock-out removes from it (see Condensation after the column; New in 0.19.).

The reported measures supersaturation_gas and supersaturation_wall still cover every component, the condensing one included. supersaturation_step_end is the step-end measure of the condensing component (NaN when no component's condensation is modelled).

LIQUID_HOLDUP

New in 0.19

The LIQUID_HOLDUP check, its switch settings.warn_liquid_holdup and the liquid_holdup_ratio and liquid_volume_fraction measures of sim.run_health().cycles are not in 0.18.

The liquid hold-up on the solid grew past what the model can carry. The hold-up does not drain, does not take gas volume and does not block adsorption, so a large hold-up is outside the model's range. The check runs only for a deck with the hold-up on. Two measures, over the cycle's logged times and the packed cells:

  • (a) \(L / L_{max}\), with \(L_{max}\) the leaf condensation.holdup.max_holdup or, at 0 (auto, the default), the pore volume the adsorbed phase does not fill, \(L_{max} = \max[(1 - \varepsilon_b)\,\varepsilon_p\,\rho_{L,sat}(T_s) - \rho_b\,q_c,\ 0]\) per cell;
  • (b) the liquid volume fraction of the bed's void, \(L / \rho_{L,sat}(T_s) / \varepsilon_t\).

\(T_s\) is the solid temperature, \(\rho_{L,sat}\) the saturated-liquid molar density and \(q_c\) the adsorbed loading of the condensing component. It fires when (a) passes 1 or (b) passes 0.01 (1 %, a stated threshold to be tuned against measured in-bed condensation). The value is the measure that passed, (a) first; the message names the measure, the component, the cell and its height, the step and the time in the step. The measures of each cycle are liquid_holdup_ratio and liquid_volume_fraction in sim.run_health().cycles (NaN without a hold-up). A cell holding less than \(10^{-6}\) mol m⁻³ (the unknown's absolute tolerance) counts as dry.

With the hold-up on, SUPERSATURATION judges the condensing component only on the gas at the end of each step (see Components that condense); LIQUID_HOLDUP covers the liquid itself.

Suspects: the water (or other vapour) content and temperature of the feed and of initial.y; a cold bed, jacket or ambient; condensation.holdup.max_holdup. What to do: lower the vapour content of the feed, or raise the bed temperature; treat results after the warning as outside the model's range.

ENERGY_BALANCE

New in 0.19

The ENERGY_BALANCE check, its switch settings.warn_energy_balance and the energy_balance_error measure of sim.run_health().cycles are not in 0.18.

The cycle energy balance of the column, bed plus wall: the enthalpy that the endpoints carried in and out, the heat that the column exchanged and the heats of adsorption and condensation released in it, against the change of the energy stored in the gas, the solid, the adsorbed phase, the wall and the liquid, over a scale (the gross terms). The energy balances are solved in temperature form, not as a conservative enthalpy balance, so this closure is not exact: it measures how far the discretised balances are from conserving energy. It falls with the grid (first order) and is largest at steep temperature fronts. A closure that stays open as the run settles means a coarse grid for the deck's fronts, or an energy source or sink that the closure does not see (a model error).

The rule is the stuck rule of MASS_BALANCE_STUCK (window of 5 cycles, state change at most \(10^{-3}\), falling by less than 10 % per cycle) with the threshold \(10^{-2}\) on \(|e|\). The measure of each cycle is energy_balance_error in sim.run_health().cycles, the same value as the KPI field. It is NaN, and the check is skipped, without the KPI quadratures, in an isothermal run and for a deck with reactions.

Suspects: the grid (layer[ID].cells) and the temperature fronts; energy sources, the jacket, the heat transfer models. What to do: re-run with twice the cells; a closure that halves is numerical, one that does not is in the model.

END_PRESSURE_NOT_REACHED

New in 0.20

The END_PRESSURE_NOT_REACHED check and its switch settings.warn_end_pressure_not_reached are not in 0.19.

A step that ends on a pressure ran to its maximum time (the step time) without its watched pressure reaching the end pressure. The step's length is then the cap, not the result the deck asks for, and the cycle time, the KPIs and the cyclic steady state follow from that cap.

It is not a measure against a fixed threshold: value is the watched pressure at the step's end and threshold the end pressure, both in Pa. The solver reports it as the step ends, so unlike the other codes it keeps the last cycle that missed (not the largest value), and its message counts the step ends of the run that missed. A target missed only in the first cycles, while the bed starts up, names an early cycle.

Suspects: the step's maximum time (step[ID].time), the end pressure and its direction (step[ID].end_condition.pressure, .direction), the step's boundary conditions at the watched end. What to do: raise the maximum time, or set an end pressure the step can reach.

Thresholds

The thresholds come from the engine's own decks: every one of the 40 bundled example decks (which include the paper cases) was run as shipped, to its own cycle count or CSS stop, and the measures recorded after every cycle. The table gives the largest value any deck reached, the deck, and the threshold; the margin is their ratio. The SUPERSATURATION threshold is physical (saturation itself), not set from the decks; its row was measured on all 60 bundled example decks, and the table gives its margin all the same.

Code Value Largest on the example decks Threshold Margin
MOLE_FRACTION_SUM max \(\lvert\sum y - 1\rvert\) over a cycle \(2.2 \times 10^{-5}\) (Perez2019_B) \(10^{-3}\) 45
MASS_BALANCE_STUCK \(\lvert e\rvert\) of a component, any cycle \(2.2 \times 10^{-4}\) (Perez2019_C1, an early cycle) \(2 \times 10^{-3}\) 9
\(\lvert e\rvert\) once the state change is \(\le 10^{-3}\) \(2.3 \times 10^{-5}\) (Nguyen2023_Exp_IX) \(2 \times 10^{-3}\) 87
STEP_RETRIES rejected attempts per accepted step, per cycle 0.078 (Perez2019_B) 0.25 3.2
REACTION_STIFF steps shorter than \(10^{-4}\) s at a reacting cell, per cycle step 0 (no example deck has a reaction) 100
SUPERSATURATION relative saturation \(y_i P / p_{sat,i}(T)\), gas or wall 0.49 (Illustrative_Humid_DAC_Breakthrough, water) 1 2.0
LIQUID_HOLDUP \(L / L_{max}\); liquid volume fraction of the void \(1.1 \times 10^{-3}\); \(6.4 \times 10^{-4}\) (Illustrative_Humid_DAC_TVSA_Holdup, the only deck with a hold-up) 1; 0.01 900; 16
ENERGY_BALANCE \(\lvert e\rvert\) of the cycle energy balance once the state change is \(\le 10^{-3}\) \(1.3 \times 10^{-3}\) (Vysyaraju2024_PSA_exp1) \(10^{-2}\) 7.7
END_PRESSURE_NOT_REACHED a step that ends on a pressure reaches its maximum time none (no example deck has an end condition) the end pressure

Distribution over the decks (the largest value of each deck):

  • \(\lvert\sum y - 1\rvert\): below \(10^{-10}\) for the breakthrough decks (Casas, Nguyen 2022, Streb, Ward 2022), \(10^{-7}\) to \(2.2 \times 10^{-5}\) for the cyclic ones (WENO at the default reltol).
  • Cycle mole balance: \(10^{-8}\) to \(10^{-6}\) for most decks, up to a few \(10^{-5}\) for the long Nguyen 2023 and Perez 2019 runs; at most \(2.2 \times 10^{-5}\) in the last cycle of any deck.
  • Rejected attempts per accepted step: 0.012 to 0.078 (median about 0.03).
  • Relative saturation (the larger of the gas and wall measures): 0.49 for the humid DAC breakthrough (1.15 % water at 293.15 K and 1 atm), the only deck with water. Carbon dioxide, the one other component below its critical temperature in these decks, reaches at most 0.20 (Streb2021_A5) and 0.17 (Casas 2012 at 15 bar); most decks stay below 0.02.
  • Liquid hold-up (New in 0.19): every deck without the hold-up is silent by construction (the measures are NaN). Illustrative_Humid_DAC_TVSA_Holdup, the only deck with it, condenses about 35 mol m⁻³ of bed near the feed end in its chilled adsorption step: at most \(L/L_{max} = 1.1 \times 10^{-3}\) and a liquid volume fraction of \(6.4 \times 10^{-4}\) over its run to CSS. The 1 % volume threshold is not set from the decks: it is a stated limit, to be tuned against measured in-bed condensation.
  • Cycle energy balance (New in 0.19), on the 52 decks that the suites run to their own CSS or cycle count: \(|e|\) at most \(1.3 \times 10^{-3}\) once the state has settled (Vysyaraju2024_PSA_exp1; Ferre2026_NaYF \(1.2 \times 10^{-3}\), WardPini2022_13X_PL003 \(8.7 \times 10^{-4}\)), \(10^{-5}\) to \(2 \times 10^{-4}\) for most. Early cycles reach \(1.4 \times 10^{-2}\) (WardPini2022_13X_PL003, first cycle) while the state still changes by more than 40 % per cycle; the stuck rule does not count them. The decks with reactions (Dolat 2025, Fernández 2015) and the isothermal Illustrative_DAC_Breakthrough have no closure (NaN). The test CycleEnergyBalanceDecks.ShortRunMatchesTheRegressionTable keeps the second-cycle value of every shipped deck as a regression bound. An inert bed with a 50 K inlet step gives \(3 \times 10^{-2}\) on 10 cells and \(10^{-2}\) on 40.

The broken cases in core/test/integration/test_run_health.cpp sit well past the thresholds: a manufactured CO2 sink in the component balance only (the sum drifts), the same sink in the overall balance too (a leak: the balance stays open at a constant level), and a nonlinear tolerance of \(10^{-6}\) with at most two Newton iterations per step (0.59 rejected attempts per step on Perez2019_A). A tight or loose settings.reltol alone does not trip STEP_RETRIES: from \(10^{-15}\) to \(10^{-1}\) IDA adapts its step and stays at or below 0.15, but at \(10^{-2}\) and looser the mole fractions no longer sum to 1 and MOLE_FRACTION_SUM fires.

Every example deck and paper case runs without a run-health warning; the test suite checks it for each deck it regenerates.