Skip to content

Deck View and Manifests

A front end (a web workspace, a notebook, a script that renders a form) needs two things from the engine: the deck's structure with its editable values, and the fixed lists the engine defines (KPIs, units, warnings, example decks, components). The engine emits both as JSON, so a front end does not need its own copy of either.

The deck view

import skarstrom as sk

sim = sk.examples.Perez2019_A.load()
view = sim.deck_view()          # dict
schema = sk.deck_view_schema()  # JSON Schema (draft 4) of the view

In C++ the same calls are adsim::DeckView(UserData&) and adsim::DeckViewSchema() (adsim/objects/deck_view.h). Both return JSON text.

The view has the deck's structure: components (name, formula, molar mass), adsorbents (each component's isotherm kind and rate-model kinds, reactions), layers (kind, transport models, composition), the bed and its wall, steps (time mode, the bottom and top ends with their streams, profiles, pumps and buffer tanks, energy sources, the heating medium), connections, the KPI configuration (each component's entry also lists its kpi[C].tracked value, and kpi_settings holds kpi.breakthrough_fraction, New in 0.19), user variables, the cost (cost estimate) and sensitivity (the stored study: its settings, inputs, outputs and per-run settings) sections and the info, settings, css and energy_balance sections. Every node has its stable id (step, endpoint, layer, adsorbent and reaction id). Model kinds are given by the builder's kind names (skarstrom.build_kinds()).

Each node's values list holds the editable values that belong to it. Every value is an entry of the parameter registry, with its fields copied from the registry:

Field Meaning
path Stable, id-based registry path (endpoint[5].temperature)
alias The same address with display names (step[Feed].bottom[Feed inlet].temperature)
key The path relative to its node (temperature, pump.efficiency)
label, category, subcategory Display names
symbol The LaTeX symbol (no $) of a model-kind parameter, as the symbol table of its kind in these docs gives it (q_{sat}, \Delta H_0); "" when the docs give none. New in 0.19
kind real, expression, integer, boolean or string
value Number in SI units (boolean or string for those kinds; null when not finite)
text The text form: the expression for an expression entry
formula True when an expression entry is a formula of user variables
unit, unit_checked SI unit symbol (- dimensionless); whether values given with a unit are converted
unit_category The unit's category key in the unit manifest (heat_transfer_coefficient, inverse_pressure, ...; custom when no category describes it; "" without a unit). New in 0.19
unit_display The unit's display form (W/(m²·K)). New in 0.19
tunable, lower, upper For optimisers and studies
choices, choice For an enumerated value: every {name, label, index} and the current name. label is the display label (New in 0.19): a model kind's descriptor label (Ergun), a layer choice's label (Wakao-Funazkri), a fixed label (Local thermal equilibrium (LTE)), else the name with spaces for underscores
group Layer values only: the panel group, geometry, composition (the mass fractions), momentum, film, dispersion, heat_dispersion, internal_heat_transfer or external_heat_transfer. A closure parameter takes the family of the layer's current kind of that closure. New in 0.19

Each node claims the registry entries under its path prefix (endpoint[5].pump. for a pump, endpoint[5]. for the rest of the stream). So every registry entry appears exactly once. An entry no node claims is listed under other, so a newer registry family is never hidden from the view.

The view is read-only. Change a value by its path (sim.set(path, value), Parameter::SetValue or SetText in C++), change structure with the builder, then take a new view. The test suite checks, for every example deck, that the view validates against the schema and that setting every value back by path leaves the deck unchanged.

Experimental datasets

New in 0.10

The root field experimental_data.

experimental_data lists the datasets stored in the deck, in deck order. Each has index (the position the edits take), name, x_label, y_label, the points x and y as measured, and observable: what the dataset measures (see Python API).

observable field Meaning
kind none (not bound), bulk, component or kpi
variable, component The series name or KPI name, and the component for a component variable or a KPI
location, z top, bottom or position (with z [m] from the bottom)
cycle The 0-based cycle of a time series (-1: the last logged)
cycle_offset For a KPI: solver cycle = x + cycle_offset
x_axis, x_unit, x_scale time (in x_unit, x_scale seconds each) or cycle
y_unit, si_unit The unit of y (empty: si_unit), and the observable's SI unit
uncertainty, weight Per-point standard deviation in y_unit (null when none), and the dataset's weight

The datasets are not registry values. Change them with the edits add_experimental_data, set_experimental_data_binding and remove_experimental_data (sim.edit operations; AddExperimentalData, SetExperimentalDataBinding, RemoveExperimentalData in adsim/objects/deck_edit.h), or through sim.experimental_data in Python.

The sensitivity study

New in 0.19

The fields inputs, outputs and settings of sensitivity.

sensitivity holds the deck's stored sensitivity study. Its values are the study's registry settings (sensitivity.*: seed, trajectories, runs and the others). The lists of the study are not registry values; the view gives them as they are stored:

Field Meaning
inputs Each input: path (registry path), distribution (uniform, triangular or normal) and its numbers lower, upper, mode, mean, sd (null when the distribution does not use one; a normal input's lower and upper are an optional truncation)
outputs Component.kpi names; empty means the deck's default outputs when the study runs
settings {path, text}: the registry text sets applied to every run before its sample values

Change the lists as a whole: in Python save a study into the deck with sensitivity.Study.save_to(sim); in C++ assign UserData::sensitivity_study. Then take a new view.

view_version changes when the view's shape changes incompatibly. Version 2 changed a stream's type to its tag in the stream kind list (flow, valve, pump), the tag that set_stream_kind takes; version 1 said stream for a set-flow stream.

Each layer has kind (packed, monolith, laminate), channel_shape (a monolith's; else null), particle_shape (a packed layer's sphere or cylinder; null for a structured layer; Kinetic Models), momentum, film_correlation, the transport model kinds, composition, values and derived.

New in 0.9

The layer field particle_shape and its registry entry layer[L].particle_shape.

derived lists the geometry that a layer's inputs give, with the engine code the solver uses (LayerGeometrySummary). These entries are read-only: they are not registry entries, and nothing sets them. Each entry has key, label, unit (SI) and value (null when the geometry gives no value). A packed layer has the first four keys (New in 0.19; before, its list was empty).

Key Meaning Unit
open_frontal_area Open (gas) fraction of the cross-section; a packed layer's bed void fraction -
hydraulic_diameter Hydraulic diameter of a channel; for a packed layer \(4\epsilon_b/a_v\) m
specific_surface Channel wall area per bed volume; for a packed layer the particle surface per bed volume \(a_v\) 1/m
diffusion_length Washcoat thickness, else half the wall or sheet; for a packed layer \(d_p/2\) m
channel_count Channels across the column (monolith only; absent for a laminate) -
washcoat_fraction Washcoat share of the solid cross-section -

A structured layer's values still has particle_diameter. No closure that a structured layer accepts reads it, but the registry keeps the path for sweeps and for a switch back to packed, and the view lists every registry entry.

New in 0.13

The layer field derived.

Parameter symbols

New in 0.19

symbol on deck-view values, model-kind parameters and sim.parameters().

The symbols come only from the symbol tables of these docs (the isotherm sections of Isotherms, the closure sections of Transport Correlations, the valve laws of Boundary Conditions). scripts/docs/gen_parameter_symbols.py reads the tables and writes core/src/objects/parameter_symbols.inc; a test checks that each symbol occurs in the doc it comes from. The engine invents no notation: a parameter whose kind has no symbol table (the rate coefficients, most closures, profiles, flows and pumps) has symbol "". To add symbols, add the table to the docs and run the script (--report lists the coverage of each kind).

Kinetics entries

Each component of an adsorbent has rate_model and rate_coefficient. The coefficient is the resistance model, so rate_coefficient is series_resistance for every deck. These fields describe it:

Field Meaning
resistances The switch of each resistance: {film, macropore, molecular, knudsen, micropore, lumped} (booleans; New in 0.12: molecular)
capacity_factor_mode none, slope, secant or fixed
preset The preset the switches, mode and values match (a former kind: constant, haynes, ...), or custom. The engine calculates it each time; the deck does not store it
equation The LaTeX of the coefficient: the packed form (sphere, or cylinder when the first packed layer that holds the adsorbent has cylinders) if the adsorbent is in a packed layer, else the slab form
equation_slab The slab form, if the adsorbent is in a packed layer and in a structured layer; else null
slow_resistances, slow_capacity_factor_mode, slow_preset, slow_equation, slow_equation_slab The same for the slow site of a dual-rate model; null without a slow site

All of them are null for a component without a rate model. The registry values of the switches and the mode (kinetics[C].resistances.<tag>, kinetics[C].capacity_factor_mode) are in the component's values.

New in 0.9

The kinetics fields above, and rate_coefficient = series_resistance (in 0.8 it was the tag of the preset the switches matched). model_kinds()["rate_coefficient"] gives the descriptor that a front end builds its resistance checkboxes, parameters and preset shortcuts from.

Boundary-profile samples

New in 0.19

sim.profile_samples(...) and SampleProfile (adsim/objects/profile_samples.h).

A front end that draws the time profile a user edits can take the samples from the engine instead of a copy of the profile shapes. sim.profile_samples(endpoint, target, n) evaluates the profile of one endpoint value over its step, with the engine's own profile code, on a copy of the profile (the deck is not changed):

sim = sk.examples.Ferre2026_NaYF.load()
s = sim.profile_samples(3, "pressure", n=5, start_pressure=5e5)
print(s["kind"], s["unit"], s["step_time"], s["start_from_bed"])
print(s["time"], s["value"])

target is pressure (a pressure boundary, or a valve stream's back pressure), flow (a set-flow stream, in the unit of its flow kind) or temperature (the inlet temperature). The result has kind (the profile kind tag), unit (SI), step_time, start_value, start_from_bed, and n equally spaced time and value samples from the step start to its end.

A run starts a pressure ramp from the bed-end pressure at the start of the step, which only a run knows. Give it as start_pressure [Pa] (for example the end pressure of the step before); without it the samples start from the deck's initial pressure, and start_from_bed is true either way. A flow or inlet-temperature ramp starts from its own start value, as in a run. A constant gives n equal samples. An unknown endpoint, a target the endpoint does not have, or n outside 2 to 10000 raises a ValueError (in C++, ok is false and message says why).

Manifests

Python C++ (adsim/objects/manifests.h) Contents
sk.kpi_manifest() KpiManifest(), KpiDefinitions() Each KPI the engine reports, in report order: key (the KPIRecord field), label, short_label, SI unit, family (purity, recovery, productivity, energy, thermal), description, display, per_step, diagnostic. The reported KPIs come first, then the diagnostics (diagnostic: true: the trapezoid_* values and the mass_balance_error fractions, [mol/mol]), which a front end can show in a separate section. better: the direction that is better, higher (purity, recovery, productivity, yield), lower (energy per product, carbon use rate, peak temperature) or none (positions, times, balance terms); a trapezoid_* diagnostic has the direction of its KPI. New in 0.19: better
sk.unit_manifest() UnitManifest(), UnitCategoryKeys() Unit categories (key, name, si_unit) with suggested display units, the parser's symbol overrides and syntax notes. Each unit has symbol (the text the parser reads), display (the same unit for display: m³/s, W/(m²·K), °C, µm; sk.unit_display(text), UnitDisplay(text)), category, dimension, factor and offset. Each category has si_display and variable_category: true for the user-variable categories, false for the categories of parameter and KPI units that a user variable cannot take (inverse_pressure 1/Pa, henry_coefficient mol/(kg·Pa), molar_volume m³/mol, ldf2_rate_constant kg/(mol·s), molar_heat_capacity J/(mol·K), power W, productivity_mass kg/(kg·s), productivity_volume kg/(m³·s); and for registry values inverse_temperature 1/K, inverse_length 1/m, inverse_area 1/m², surface_concentration mol/m², adsorption_rate mol/(kg·s)). check_unit places a unit of their dimension in them. New in 0.19: display, si_display, variable_category and the categories with variable_category false
sk.check_unit(text, category) CheckUnit(text, category) {ok, category, dimension, factor, offset, message} from the engine's unit parser
sk.warning_manifest() WarningManifest(), WarningDefinitions() Advisory warnings: key, label, phase (start of a run or end), setting (registry path of its switch, or null), default_on, message template
sk.example_manifest() ExampleDeckManifest(manifest, decks_dir) Example decks: file, name, title, family (display label, "Perez (2019)"), family_key ("Perez2019"), hidden, summary, description
sk.model_kinds() ModelKindManifest() Each model kind by family: tag, label, legacy (a kind kept for old decks and as a preset tag, not offered), parameters (name, unit, default, lower, upper, tunable, label, symbol; New in 0.19: symbol, the parameter's LaTeX symbol from the docs or ""). The rate-coefficient kind series_resistance also has resistances (tag, label, parent, scaled_by_capacity, parameters, LaTeX fragments per shape: sphere, cylinder, slab; source), capacity_modes (tag, label, latex) and presets (tag, on, capacity_mode, values). The entry particle_shape lists the packed particle shapes in the same form. New in 0.9. The kinds of the layer closure families (dispersion, heat_dispersion, internal_heat_transfer, external_heat_transfer) also have layer_kinds: the layer kinds (packed, monolith, laminate) that the deck checks accept the kind on. New in 0.13: layer_kinds. The momentum kinds have layer_kinds ["packed"]: a structured layer does not use its momentum kind (laminar channel flow), and the deck checks accept any. The entry film_correlation lists the packed film correlations (layer[L].film_correlation) in the same form, with labels and layer_kinds ["packed"]: a structured layer uses its channel film coefficients. New in 0.19: layer_kinds on momentum, and film_correlation. The entry isotherm lists the isotherm kinds in the same form, each also with competitive (a mixture form), water_coupled, fittable (the isotherm fitter offers it), iast (IAST can mix it) and paired (the tag of its competitive or pure-component pair, or null). New in 0.19: isotherm in the C++ manifest (the Python list had it already; it now also has legacy). The Python list also has the isotherm kinds
sk.component_manifest() ComponentManifest(), DescribeComponent(name) Components: name (CoolProp), formula, molar_mass [kg/mol], cas, properties_source, aliases, ideal_gas_heat_capacity, heat_capacity_held (always false; kept for one release), cp_species, cp_source (provenance of the Cp polynomial). The manifest is {cp_reference, components}: cp_reference names the table the polynomials come from

The deck view's unit is the registry's spelling (W/m2-K); its unit_category names the manifest category, whose si_unit (W/(m2-K)) is the same unit in the manifest's spelling. Use the category to offer conversions and its si_display or the value's unit_display to show it.

Units: the parser accepts any LLNL-units symbol with an SI prefix, combined as described in Global Variables and Units. So the manifest lists suggested units for each category, not every accepted unit. Their factor and offset come from the parser itself. To validate a unit someone typed, use check_unit rather than a list.

Example decks: examples/example_decks.json declares each deck's family label and key, hidden flag and summary. Titles and descriptions come from the decks themselves. The manifest must list every deck in examples/decks/; the test suite checks this.

Results series and profiles are listed by sk.bulk_variables() and its siblings. Model kinds are listed by sk.build_kinds().