Examples¶
Skarstrom ships 66 example decks in examples/decks/, most of them reproducing published adsorption studies. The Python package bundles all of them (skarstrom examples, skarstrom.examples.<name>), so they are the quickest way to see a complete process: run one, inspect how it is set up (skarstrom params deck.json --all), and adapt it.
Every paper-based deck is also an automated validation test; the Validation page lists the simulated and published values and the error metric for each case, including where Skarstrom and the paper disagree, and why.
Example scripts¶
examples/ has one runnable script per deck family. Each builds its cases from scratch in code (fluid, adsorbents, column, every step and boundary condition, KPIs and solver settings, each value with its unit; build(case) returns the simulation), runs them, prints the KPIs or the cyclic-steady-state status, compares the result with the paper's published values (core/test/papers/*/reference_values.csv) or digitised curves (core/data/) when run from a repository checkout, and saves a plot to examples/output/ when matplotlib is installed (--no-plot to skip). Common options: --case NAME (repeatable) to run a subset, --cycles N for a quick look.
pip install "skarstrom[examples]" # or pip install . && pip install matplotlib
python examples/ward_2022.py --case 100 # the fastest: about a second
| Script | Decks | Process | Compared with | Runtime |
|---|---|---|---|---|
ward_2022.py |
Ward2022_Q50ccm, _Q100ccm, _Q200ccm |
CO₂ breakthrough on activated carbon, three flow rates | digitised outlet y_CO₂ and thermocouple; paper-model breakthrough-time interval | 2 s |
casas_2012.py |
Casas2012_Fig4_*, Casas2012_Fig6_* (3) |
CO₂/H₂ breakthrough on AP3-60 at 15 bar | paper-model breakthrough times (Table 5) | 8 s |
nguyen_2022.py |
Nguyen2022_Fig4, _Fig4_50pct, _Fig4_100pct, Nguyen2022_Fig5, _Fig5_5pct, _Fig5_30pct |
CO₂/He and CO₂/N₂ breakthrough on CALF-20, six runs | measured outlet y_CO₂ (NRMSE, half-feed crossing time) and thermocouple (RMSE) | 2 s |
streb_2021.py |
Streb2021_A1–_A7, _B1, _B2 |
CO₂/CH₄ and H₂/CO₂/CH₄ breakthrough on 13X with thermocouples, nine runs | digitised outlet mole fractions and five thermocouples | 16 s (A1, A3; all nine about 3 min) |
arora_2021.py |
Arora2021_LiLSX_PSA, _PVSA |
O₂ PSA and PVSA on LiLSX (50 cycles) | paper-model O₂ purity and net recovery (Table 4) | 2 min |
ferre_2026.py |
Ferre2026_NaYF |
Biogas CO₂/CH₄ PVSA on NaY, to CSS | paper-model purity and recovery of both products (Table 5) | 4 min |
nguyen_2023.py |
Nguyen2023_Exp_I … _X (10) |
CO₂/N₂ VPSA on CALF-20, with and without LPP, to CSS | measured and paper-model CO₂ purity/recovery (Table 2) | 22 min |
haghpanah_2013.py |
Haghpanah2013_Sec61, _PL002 … _PL010, _Fig5Benchmark |
CO₂/N₂ 4-step PVSA on 13X with compression and vacuum energy, to CSS | paper-model CO₂ purity/recovery (Haghpanah 2013 Sect. 6.1; Glover 2026 Table 4) | 4 min |
perez_2019.py |
Perez2019_A, _B, _C1, _D1, _E, _F |
CO₂/N₂ VSA on 13X, with and without LPP, to CSS | measured and paper-model CO₂ purity/recovery (Table 3) | 6 min |
perez_2019_case_study.py |
Perez2019_CaseStudy_Base, _Base_LPP |
Perez 2019 A and D1 run by devices (blower, valves with a ramped opening for pressurisation, vacuum pump) on a 3-bed schedule, to CSS | the validated decks' step-end pressures, purity, recovery and specific energy | 2 min |
vysyaraju_2024.py |
Vysyaraju2024_PSA_exp1 |
He/N₂ 5-step PSA on binderless 5A, to CSS | measured and paper-model He purity/recovery (Table 3) | 30 s |
ward_pini_2024.py |
Ward2024 |
CO₂/N₂ 4-step VSA on Mg-MOF-74, to CSS | paper-model CO₂ purity/recovery (Table 4) | 80 s |
tsa_illustrative.py |
Illustrative_TSA_13X |
Illustrative 4-step TSA with heater and cooler, to CSS | — (KPIs, CSS status, bed temperatures) | 3 s |
illustrative_dac_breakthrough.py |
Illustrative_DAC_Breakthrough |
Illustrative 400 ppm CO₂ breakthrough on Lewatit VP OC 1065 with dual-rate LDF and series-resistance kinetics | — (outlet times to 5, 50 and 95 % of the feed) | 2 s |
illustrative_humid_dac_tvsa.py |
Illustrative_Humid_DAC_TVSA, Illustrative_Humid_DAC_TVSA_Wall_Film, Illustrative_Humid_DAC_TVSA_Holdup |
Illustrative humid DAC TVSA on APDES-NFC whose cooling step crosses water saturation at the wall, to CSS New in 0.16.; the same cycle with water condensing on the wall New in 0.19., or on the solid as a liquid hold-up with a chilled adsorption step New in 0.19. | — (KPIs, CSS status, the SUPERSATURATION warning and the gas and wall relative saturation) | 10 s |
five_step_product_purge.py |
FiveStepProductPurge |
CO₂/N₂ VSA template with product purge | — (CSS status, integrator statistics) | 4 s |
optimise_nsga2.py |
Perez2019_A |
NSGA-II search (pymoo) of feed time and evacuation pressure, each candidate run to CSS in a process pool | — (the CO₂ purity / recovery Pareto front) | about 10 min (estimated: 60 runs of about 30 s, 4 cores) |
calibrate_ward_2022.py |
Ward2022_Q50ccm, _Q100ccm, _Q200ccm |
skarstrom.calibrate: the three breakthrough runs fitted together (shared q_s,2 and dispersion factor, one h_in per flow), the reproducible method of the decks' calibration; New in 0.12. |
the hand calibration (core/test/papers/ward_2022/README.md) |
40 s (--quick: 3 s) |
calibrate_cycle_kpis.py |
Perez2019_A |
skarstrom.calibrate against per-cycle purity and recovery (KPI observables): a twin experiment that fits the CO₂ affinity and the bed voidage back; New in 0.12. |
the values that made the data | 30 s (--quick: 13 s) |
Runtimes are wall-clock times of a full run of the script (all its cases, to cyclic steady state where the deck checks it) on one core of a shared 4-core Linux machine, for the decks' grid-converged WENO settings and feed-loaded starts (from the paper tests, which run the same cases); for a quick look lower cells or pass --cycles. python/tests/test_examples.py imports every script and runs each once with fast options (one breakthrough case, or two cycles of one cyclic case).
Five executed notebooks are in examples/notebooks/: a parametric study of the feed time of a CO₂ VSA cycle, a sensitivity study with error bars on its KPIs, isotherm fitting with the engine's fitter, and the VSA case study (case_study_vsa.ipynb: the base decks, their operating-limit and KPI reports, a small optimisation and the three purity–recovery fronts; New in 0.9.), and calibrate_ward_2022.ipynb (the Ward 2022 calibration with skarstrom.calibrate, with the overlay and residual plots; New in 0.12.).
Worked tutorials¶
- O₂ PSA (Arora 2021): a four-step Skarstrom cycle for medical oxygen on LiLSX, and how to read purity and recovery when product is recycled.
- Case study: CO₂ VSA base decks: the Perez 2019 cycles run by a blower, valves and a vacuum pump on an n-bed schedule, with every plant constraint as a parameter.
- CO₂ VPSA with LPP (Perez 2019): a five-step vacuum swing cycle on zeolite 13X with light-product pressurisation, run to cyclic steady state and compared with experiment.
- TSA regeneration: an illustrative temperature swing cycle with heater and cooler energy sources.
Bundled example decks¶
| Family | Decks | What they are |
|---|---|---|
| Arora (2021) | Arora2021_LiLSX_PSA, Arora2021_LiLSX_PVSA |
O₂ from air on LiLSX zeolite, 4-step PSA and vacuum PSA (Table 4) |
| Casas (2012) | Casas2012_Fig4_50_50_15bar_25C, Casas2012_Fig6_25_75_15bar_25C, Casas2012_Fig6_75_25_15bar_25C |
CO₂/H₂ breakthrough on activated carbon AP3-60 at 15 bar and 25 °C, three feed compositions (Figs. 4 and 6) |
| Dolat (2025) | Dolat2025_DFM_Cycle |
Cyclic CO₂ capture and methanation on a NiRu–Ca/Al dual-function material at 380 °C: adsorption (12.2 % CO₂), N₂ purge and hydrogenation (10 % H₂), with the coverage kinetics as reactions of the adsorbed phase switched by step, from the DFM validation. New in 0.19. |
| Fernández (2015) | Fernandez2015_LightOff, Fernandez2015_RFR_Dry |
Lean methane combustion on a Pd monolith catalyst: the isothermal light-off, a steady catalytic bed (Fig. 2a), and the bench reverse-flow reactor of monolith layers (Fig. 4b: 4500 ppm CH₄, switching time 300 s, dry), from the reaction validation. New in 0.19. |
| Ferré (2026) | Ferre2026_NaYF |
CO₂/CH₄ biogas upgrading, 4-step PVSA on zeolite NaY (Table 5) |
| Haghpanah (2013) | Haghpanah2013_Sec61, Haghpanah2013_PL002 … _PL010, Haghpanah2013_Fig5Benchmark |
CO₂/N₂ 4-step PVSA on zeolite 13X (pressurisation, adsorption, forward blowdown, reverse evacuation) with compressor and vacuum-pump energy: the Sect. 6.1 reference design, the five minimum-energy designs of Table 6, and the CSS benchmark design of Glover et al. (2026) |
| Nguyen (2022) | Nguyen2022_Fig4 (70 % CO₂), Nguyen2022_Fig4_50pct, Nguyen2022_Fig4_100pct, Nguyen2022_Fig5 (15 % CO₂), Nguyen2022_Fig5_5pct, Nguyen2022_Fig5_30pct |
CO₂ in helium (Fig. 4) and CO₂ in nitrogen (Fig. 5) fed into a helium-filled bed of CALF-20 |
| Nguyen (2023) | Nguyen2023_Exp_I … Nguyen2023_Exp_X |
CO₂/N₂ VPSA on structured CALF-20: experiments I–V use the basic 4-step cycle, VI–X the 4-step cycle with light-product pressurisation (Table 2) |
| Nguyen (2025) | Nguyen2024_A0, Nguyen2024_B0 |
The dry cases A0 and B0 (Table 1) of the humid-feed VSA experiments on structured CALF-20 (Adsorption 31 (2025) 45): the Nguyen2023_Exp_VII light-product-pressurisation deck at 0.96 bar and 22 °C. New in 0.10. |
| Perez (2019) | Perez2019_A, _B, _C1, _D1, _E, _F |
CO₂/N₂ VSA on zeolite 13X: A, B and C1 are the basic 4-step cycle, D1, E and F add light-product pressurisation (Table 3) ; Perez2019_CaseStudy_Base and _Base_LPP run A and D1 by devices on a 3-bed schedule (case study, New in 0.9.) |
| Streb (2021) | Streb2021_A1 … Streb2021_A7, Streb2021_B1, Streb2021_B2 |
CO₂/CH₄ (A) and H₂/CO₂/CH₄ (B) breakthrough on zeolite 13X with thermocouple data, calibrated on A3 |
| Vysyaraju (2024) | Vysyaraju2024_PSA_exp1 |
He/N₂ separation on binderless zeolite 5A, 5-step PSA |
| Ward (2022) | Ward2022_Q50ccm, Ward2022_Q100ccm, Ward2022_Q200ccm |
CO₂ breakthrough on activated carbon at three feed flow rates |
| Ward (2024) | Ward2024 |
CO₂/N₂ 4-step VSA on Mg-MOF-74 (Table 4) |
| Ward & Pini (2022) | WardPini2022_13X_PL003, WardPini2022_ZIF36FRL_PL007 |
CO₂/N₂ 4-step PVSA with feed pressurisation and compressor and vacuum-pump energy (Ind. Eng. Chem. Res. 61 (2022) 13650): the minimum-capture-cost designs of Table 7 on zeolite 13X and ZIF-36-FRL. New in 0.14. |
| Illustrative | Illustrative_TSA_13X |
Not a reproduction. A four-step indirectly heated TSA for CO₂ on zeolite 13X, built for the TSA tutorial |
| Illustrative | Illustrative_DAC_Breakthrough |
Not a reproduction. An isothermal breakthrough of 400 ppm CO₂ in N₂ on the Lewatit VP OC 1065 library adsorbent, with the dual-rate LDF and series-resistance kinetics |
| Illustrative | Illustrative_Humid_DAC_Breakthrough |
Not a reproduction. A non-isothermal breakthrough of 400 ppm CO₂ in humid N₂ (49 % RH at 20 °C) on the APDES-NFC library adsorbent: water on a GAB isotherm, CO₂ on the humid Toth that reads the adsorbed water, and the water sorption heat in the temperature trace (Humid feeds). New in 0.9. |
| Illustrative | Illustrative_Humid_DAC_TVSA |
Not a reproduction. A temperature-vacuum swing cycle for direct air capture on the APDES-NFC library adsorbent with a humid air feed. In the cooling step the water-rich gas passes its saturation pressure at the cold wall, so the SUPERSATURATION warning fires; condensation is not modelled (A humid cycle that crosses saturation). New in 0.16. |
| Illustrative | Illustrative_Humid_DAC_TVSA_Wall_Film |
Not a reproduction. The Illustrative_Humid_DAC_TVSA cycle with water condensing on the inner wall as a static liquid film (Condensation on the wall): the film takes the vapour that passes its saturation pressure at the cold wall in the cooling step, the latent heat warms the wall, and the film evaporates again when the wall warms. New in 0.19. |
| Illustrative | Illustrative_Humid_DAC_TVSA_Holdup |
Not a reproduction. The Illustrative_Humid_DAC_TVSA cycle with water condensing on the solid as an immobile liquid hold-up (Condensation on the solid), the wall film off, and chilled water (8 °C) in the jacket and exchanger during adsorption: the 20 °C humid air is supersaturated against the cold bed, so water condenses near the feed end (about 35 mol m⁻³ of bed at CSS) and evaporates again on heating. Not validated against measured in-bed condensation. New in 0.19. |
| Illustrative | Illustrative_Diluted_Bed |
Not a reproduction. The Ward 2022 100 ccm CO₂ breakthrough on activated carbon with the adsorbent diluted by 30 % glass beads by mass in a mixed layer |
| Other | FiveStepProductPurge |
A CO₂/N₂ VSA cycle with feed, blowdown, evacuation, pressurisation and product purge on a 13X-type isotherm; the feed is split into two sub-steps so that one light-product connection pressurises and the other purges (six steps in the deck). It comes from an integration test, has no KPI configuration and no literature source; use it as a template, not as data |
Several decks also carry the experimental curves digitised from their paper (the deck's experimental-data section), the same data as core/data/.
Working with an example¶
import skarstrom
from skarstrom import ureg as u
path = skarstrom.examples.Perez2019_A.copy_to(".") # an editable copy
sim = skarstrom.Simulation(path)
print(sim.steps["Feed"]) # the step's values, with units and string paths
sim.steps["Feed"].time = 80 * u.s
sim.run()
sim.save("Perez2019_A_80s.json")
The cycle templates in data/cycles/ (breakthrough, 4-step VPSA with and without LPP, Skarstrom cycle, 6-step VPSA with rinse) are starting points for building a new process in C++ (see Cycles).