Skip to content

Solver Settings

Once the fluid, adsorbents, column and cycle are defined, the deck can be run. Skarstrom integrates the coupled governing equations in time as a system of differential-algebraic equations (DAEs) using a variable-order, variable-step implicit method (SUNDIALS IDA), taking the bed through every step of every cycle.

## Running, stopping and monitoring

  • Run. sim.run() (Python), skarstrom run deck.json (CLI) or adsim::Simulation::Run (C++) validates the deck, evaluates every expression and integrates all cycles. If validation fails the run returns status failed with the reason in message; nothing is integrated.
  • Progress and cancel. sim.run(progress=f) calls f(info) after every step with the cycle, step and completed fraction; return False to cancel. Ctrl-C cancels a Python run cleanly.
  • Status. One of completed, reached_css (reached CSS before the cycle limit), failed or cancelled.
  • Solver log. sim.run(log_level="medium", on_message=f) passes the solver's messages to f(level, text); skarstrom run --log medium prints them. Low reports essential milestones, medium adds per-cycle and per-step progress and CSS checks, high adds diagnostics. The run result carries the runtime and solver statistics (steps taken, residual evaluations, non-linear iterations, error-test and convergence failures).

Solver settings

The solver parameters are stored in the deck and are parameters of the registry (settings.*; skarstrom params deck.json --all lists them with their values). The defaults are robust for typical PSA/TSA problems; adjust them only when a run struggles to converge or you need tighter accuracy. The Numerics page explains what each one does inside the integrator.

Setting Parameter Default Meaning
Maximum Time Step settings.max_step 0 (no limit) Largest step the integrator may take; 0 leaves the step size to IDA's error control. Lowering it can stabilise stiff, fast-transient steps. Results are logged from IDA's interpolant, so the logged trajectory does not depend on it. Decks saved with the old default of 2 s load with no limit.
Minimum Time Step settings.min_step 1×10⁻¹⁵ s Smallest permitted step.
Initial Step Size settings.init_step 1×10⁻¹⁰ s First step attempted.
Relative Tolerance settings.reltol 1×10⁻⁶ Relative accuracy target per variable. Tighten for more accuracy, loosen to speed up a hard run.
Maximum BDF Order settings.max_order 5 Highest order of the backward-differentiation formula (1–5).
Maximum Nonlinear Iterations Per Step settings.max_nonlin_iters 15 Newton iterations allowed per step before the step is retried smaller.
Nonlinear Convergence Coefficient settings.nonlin_conv_coef 0.1 Safety factor on the Newton convergence test (0–1).
Maximum Convergence Failures settings.max_conv_fails 200 Non-linear-solver failures tolerated before giving up.
Maximum Error Test Failures settings.max_err_test_fails 40 Local error-test failures tolerated before giving up.
Maximum Number of Steps settings.max_num_steps 100000 Cap on total integrator steps.
Advection Scheme settings.advection_scheme weno Face reconstruction of the mole fractions and of the energy balance's convective face temperature: weno (third order), van_leer (limited second order) or upwind (first order, the default up to engine 0.4). WENO reaches a grid-converged result on 4-10 times fewer cells than upwind; see Numerics.
Thin the Result Log settings.thin_log off Keep about 200 to 400 rows per step of the profile data (one to two times settings.max_log_points_per_step), plus the transient at each step start, instead of every solver step. See Thinning the result log. New in 0.20.
Maximum Number of Cycles to Log settings.max_cycles_to_keep 1 How many recent cycles of full profile data are retained for plotting. Every solver step of each kept cycle is stored, so this sets most of a run's memory (on a fine grid, hundreds of MB per cycle). KPIs and the CSS history are kept for every cycle whatever this is (well under 1 MB for 2000 cycles). With a CSS method on, at least the cycles the CSS check reads are kept (4 with the default three consecutive cycles).

Absolute tolerances are set internally on a per-variable basis (10⁻⁸ for concentrations, mole fractions and loadings, 10⁻⁶ for pressure and velocity, 10⁻⁴ K for temperatures), so only the single relative tolerance is a setting. See Numerics.

Thinning the result log

New in 0.20

The setting settings.thin_log.

The result log keeps the full bed state (every variable in every cell) at every accepted solver step, plus fill-in points so that a step has at least settings.max_log_points_per_step (200) of them. A long or stiff step can take thousands of solver steps: the bundled decks keep 444 to 4,278 rows in their longest step, up to 272 MB for one step of Casas2012_Fig4_50_50_15bar_25C.

With settings.thin_log on, the log keeps a row once it is half of step_time / max_log_points_per_step after the last row it kept, or a tenth of that row's time since the step start if that is shorter, and it always keeps the first and the newest row of the step. A step then keeps one to two times max_log_points_per_step rows, plus geometrically spaced rows over the transient at its start, however many solver steps it takes.

What does not change:

  • the CSS check: its face-flux integrals are accumulated at every logged point as the log is written, and the state test reads the end of the cycle, which is always kept;
  • the KPIs, which use the solver's quadratures and the stream logs (not thinned);
  • the step integrals of the heating medium's duty and of the reactions' generation;
  • the state at the start and the end of every step.

What is sampled more coarsely:

  • the series and profiles (sim.series, sim.profile, the CSV files), between the kept rows;
  • the peaks read from the rows: the operating limits and the run-health peaks (supersaturation, liquid hold-up), which can be slightly lower than with every row;
  • the bed-end series at an open end: it is read from the stream log by time, not row by row.

On the bundled decks the largest step of a cycle drops from 965 to 359 rows (Perez2019_A, 25.9 to 9.6 MB), from 1,284 to 434 (Ward2024, 42.9 to 14.5 MB) and from 4,278 to 382 (Casas2012_Fig4_50_50_15bar_25C, 271.6 to 24.2 MB); the CSS history and the KPIs are the same to the last bit.

Turn it on for long runs, fine grids or the web solver, where memory is the limit. Leave it off when you compare series with fast transients in the middle of a step, or when you need the exact peaks.

Warnings

A run reports advisory warnings in the solver log; none of them stops it. Each can be switched off in the deck (in the web workspace: the Solver window's Warnings tab, or Turn off on a warning in the Solver Log). A switched-off warning is not logged and not listed by sim.operating_limits(), whose per-step extremes stay complete.

Warning Parameter When
Pressure step change settings.warn_pressure_step_change Start of a run: a step's constant pressure boundary is more than 25 % from the pressure the bed starts the step at; a ramp avoids the instantaneous change.
Wall thickness settings.warn_wall_thickness Start of a run: the wall is thinner than its pressure design requires.
Design pressure settings.warn_design_pressure End of a run: the last cycle's pressure passes the wall's design pressure.
Vacuum settings.warn_vacuum End of a run: the last cycle goes below atmospheric and the wall is not in vacuum service.
Design temperature settings.warn_design_temperature End of a run: the wall temperature passes the design temperature.
Fluidisation settings.warn_fluidisation End of a run: the approach to fluidisation passes 1. Switch it off for a bed that is held down.
Outlet backflow settings.warn_outlet_backflow End of a run: in the last cycle, gas flows back into the bed through an outlet that has no connection to another step (more than 0.1 % of the cycle feed in one step). A valve's check valve stops it. New in 0.9.
Connection pressure settings.warn_connection_pressure End of a run: in the last cycle, gas enters a bed through a connection while that bed is more than 1 kPa the higher (more than 0.1 % of the cycle feed in one step). A diagnostic: the connection does not prevent it. New in 0.9.
Pump stall settings.warn_pump_stall End of a run: in the last cycle, a pump stream's power at the bed-end pressure is zero or negative for more than 5 % of its step, so it moves no gas then. New in 0.19.

All are on by default. The end-of-run checks are described on Wall Design and Operating Limits. The run-health checks have their own switches, settings.warn_<code in lower case>; among them settings.warn_end_pressure_not_reached (New in 0.20) warns when a step that ends on a pressure runs to its maximum time.

Troubleshooting convergence

  • The run fails early with a message about consistent initial conditions. The solver could not reconcile the initial conditions with the first step's boundary conditions. Make the initial pressure, temperature and composition physically consistent with what the first step imposes.
  • The run stalls or reports many convergence/error-test failures. Reduce settings.max_step and/or loosen settings.reltol slightly; check for very stiff inputs (e.g. an extremely large mass-transfer coefficient or a near-instant pressure ramp). Increasing the layer's number of cells gradually rather than in one large jump also helps.
  • Results look under-resolved. Increase the layer's number of cells and re-run; confirm the results stop changing. With the default WENO scheme about 80 cells resolve a 0.3 m VSA column; upwind needs several times more (Numerics).

The KPIs and the CSS history of every cycle are kept whatever settings.max_cycles_to_keep is, so the approach to cyclic steady state and the performance metrics need no more than the default 1. Raise it only to plot the series or profiles of earlier cycles; the web solver has at most 2 GB.