Table format for tabulated chemistry (HDF5, version 1)¶
Status: specified (#631), revised before its first release with chemtab (#1582). The contract between Mallard and the programs that write tables for it. Mallard reads tables and does not generate them: tables are written by chemtab, a separate table generator designed with this format. Any other program that writes this format works too. Mallard owns the specification and the reference fixtures (section 10); chemtab checks its tables against them independently. The reasons for the format are in flamelet.md; this page is the specification.
The words must, must not, should and may are requirements on writers; the checks Mallard makes are listed in section 7.
1. Overview¶
A table holds stored quantities (fields) on the nodes of a tensor-product grid whose axes are the model's control variables. Each field lives on its own subset of the axes: the tabulated state on all of them, bounds and other per-column data on fewer. A table also carries:
- a model tag, which says what the axes and the model's fields mean;
- a thermodynamics tag, which says how the solver gets temperature and pressure from the table;
- a species block, the mass fractions the table carries for output;
- the pressure it was generated at, model data and provenance.
The format is generic: FPV with Saghafian's compressible thermodynamics is the first model Mallard reads. FGM/FPI, heat-loss axes, pressure axes, several streams and other thermodynamics are new tags, axes and fields in the same format, not new formats (section 8).
The file is the generator's and the user's layout, not the lookup's: Mallard reads the fields it uses and packs its own lookup records from them (section 2), so the device layout is Mallard's private choice and can change without touching the format.
A table is an HDF5 file (any extension; .h5 by convention), readable with
h5py alone (section 9). Mallard reads it in
builds with HDF5 (-DMallard_ENABLE_HDF5=ON; -DUSE_SYSTEM_HDF5=OFF builds
the bundled HDF5); a build without HDF5 refuses a table with an input error
that says so.
2. File layout¶
/ attributes: format, version, model, thermodynamics, species, axes, pressure
/axes/<NAME> float64, 1-D: the nodes of an axis; attributes units, quantity, transform (of, grid)
/fields/<NAME> float64 or float32, one dataset per field, shape = the node counts of its axes;
attributes axes, units
/model_data model data, with the attribute transport
/provenance what made the table
| Object | Kind | Required | Contents |
|---|---|---|---|
/ |
root group | yes | The attributes of section 3 |
/axes/<NAME> |
dataset | yes, one per axis | The nodes of axis <NAME>: float64, one-dimensional, at least 2 finite nodes, strictly increasing, not necessarily uniform; attributes below |
/fields/<NAME> |
dataset | the fields of the contract; any others | The values of field <NAME>: float64 or float32, one dimension per axis it lives on; attributes below |
/model_data |
group | yes | Model-specific data (section 5) and the attribute transport (section 4.1) |
/provenance |
group | yes | What made the table (section 3.2) |
Attributes of /axes/<NAME>:
| Attribute | Type | Required | Meaning |
|---|---|---|---|
units |
string | yes | The axis' units (section 3.1) |
quantity |
string | yes | The quantity the solver enters this axis with: "Z" (mixture fraction), "ZVAR" (its variance), "C" (progress variable), "H" (enthalpy), "P" (pressure), or another the model names |
transform |
string | yes | How the axis' coordinate follows from quantity and the axes before it: "identity" (the quantity itself), "normalized-variance" (q_var / (q (1 - q)) of the quantity q of the axis of), "bounds" ((Q - Q_MIN) / (Q_MAX - Q_MIN), with the fields Q_MIN and Q_MAX below), "log" (the natural logarithm of the quantity) |
of |
string | with normalized-variance |
The axis, before this one, whose quantity's variance this axis normalizes |
grid |
string | no | Descriptive: how the nodes were placed ("uniform", "power", "piecewise", "log", "error-controlled", ...), with its parameters as optional number attributes grid_<parameter>. For regeneration, plots and other exporters; Mallard does not read it |
Bounds. For an axis with transform = "bounds" and quantity = Q, the
fields Q_MIN and Q_MAX exist on exactly the axes that precede it, with
Q_MAX >= Q_MIN at every node. Normalizing between bounds turns a domain
that is not rectangular (the reachable C depends on Z) into a tensor grid,
with no search on the device.
Attributes of /fields/<NAME>:
| Attribute | Type | Meaning |
|---|---|---|
axes |
array of strings | The names of the axes the field lives on, in the order of the dataset's dimensions: a subset of the table's axes, in the table's order. Empty for a scalar |
units |
string | The field's units (section 3.1) |
The value of a field at node (i_0, ..., i_(k-1)) of its k axes is at index
(...(i_0 n_1 + i_1) n_2 + ...) n_(k-1) + i_(k-1) (NumPy's C order), n_a the
node count of its axis a.
Names. Axis and field names match [A-Z][A-Z0-9_]*, uppercased faithfully
from their symbols (RHO0, A_GAMMA, OMEGA_C), except that the species part
of Y_<species> and OMEGA_Y_<species> keeps the mechanism's spelling, as in
Mallard's output (Y_CH2(S)). A source is named OMEGA_ and the name of the
transported quantity it is the source of: OMEGA_C is the source of the
progress variable C, OMEGA_Y_<species> that of the mass fraction
Y_<species>, so that a species named C (atomic carbon) never collides with
the progress source (flamelet.md).
Reserved namespaces: Y_<species> (mass fraction), OMEGA_<Q> (source of the
quantity Q at RHO0, kg m-3 s-1; OMEGA_Y_<species> for a species), the
suffixes _PROD and _CONS of a source split into production and
consumption, and <Q>_MIN, <Q>_MAX (bounds). Every other name is free.
Structural names (groups and attributes) are lower-case, as Mallard's TOML
keys are. Table fields and Mallard's output fields are separate namespaces:
the table's T0 (the flamelet temperature, output as T_TABLE) is not the
output's T0 (stagnation temperature).
Strings may be variable or fixed length, ASCII or UTF-8 (h5py writes Python strings as variable-length UTF-8). Numbers in attributes are scalars of any integer or floating-point type.
Storage. Field datasets must be stored without filters (no
compression, no shuffle): Mallard's HDF5 may be built without zlib, and a
table must read in every build. They should be contiguous and
little-endian, h5py's and HDF5's default; Mallard reads any layout and byte
order. Axes should be attached to the fields as HDF5 dimension scales
(h5py: axis.make_scale(name), then field.dims[i].attach_scale(axis)), so
that generic tools (h5dump, ParaView, xarray) label the dimensions. Mallard
ignores the scales and reads axes.
Precision. A field may be float64 or float32, each field on its own. The axes stay float64, and lookups sum in double precision.
Loading. Mallard reads the fields it uses (those of the contract, HRR
and the species block) into memory and ignores the others, so fields a run
does not use (unused species, diagnostics) cost disk only. From them it packs
its own lookup records: the fields the solver reads in every cell (the
thermodynamics, transport and source fields, one record on all the axes) and
the bounds (a record on the axes before the bounds axis), node-major with a node's fields contiguous, so one lookup reads 2^d short
runs. Each record takes the precision of its own fields: float32 when every
one of them is float32, float64 otherwise, whatever the other record's
(float64 bounds beside float32 fields give a float32 solver record). A float32 table therefore halves the memory and bandwidth
of the solver's lookups, and looks up as its float64 source to float32
rounding (a relative error of 6e-8 of the largest value in the lookup's cell);
lookups of a float32 record are bitwise those of the same values stored as
float64. The packed records are copied to the device on GPU backends. Output
fields (HRR, Y_<species>) are looked up on the host, each packed as a
record of its own in its precision. After packing, Mallard frees the fields as
read.
3. Attributes of the root group¶
| Attribute | Type | Required | Meaning |
|---|---|---|---|
format |
string | yes | "mallard-table" |
version |
integer | yes | 1 |
model |
string | yes | Model tag (section 5): what the axes and the model's fields mean |
thermodynamics |
string | yes | Thermodynamics tag (section 6) |
species |
array of strings | yes | The species block, possibly empty: species names as in the mechanism. Species k is stored as the field Y_k (mass fraction, units "1"). Every field whose name starts with Y_ must be in this list. An empty block is an empty array of strings: h5py writes an empty Python list as float64, which is refused, so write numpy.array([], dtype=h5py.string_dtype()) |
axes |
array of strings | yes | The table's axes, in order; each names a dataset /axes/<NAME> |
pressure |
number | yes, unless an axis is named P |
The pressure the table was generated at, in Pa, positive. A table with a pressure axis P has none |
Writers may add other attributes, groups and datasets. Readers ignore what they do not know, so additions that old readers can ignore need no new version (section 8).
3.1 Units¶
Units are strings in UDUNITS-2 syntax, with SI base and derived units, spaces
between factors and integer exponents: "1" for dimensionless quantities,
"K", "kg m-3", "J kg-1 K-1", "kg m-3 s-1". Mallard does not convert
units. A field it uses must carry exactly the units listed for it below, or the
table is refused. Fields Mallard does not use may have any units string.
3.2 Provenance¶
The group /provenance:
| Object | Kind | Required | Meaning |
|---|---|---|---|
generator |
group with string attributes name, version |
yes | The program that wrote the table; an optional string attribute revision gives its source revision |
created |
string attribute | yes | Time of writing, RFC 3339 in UTC (2026-11-15T12:00:00Z) |
mechanism |
group with string attributes name, sha256 |
yes | The mechanism file's name and the SHA-256 of its bytes, as 64 lowercase hexadecimal digits |
dependencies |
group of string attributes | yes | The versions of the libraries the generator used, one attribute per library, named by it (cantera = "3.1.0"); empty for a writer without any |
input |
scalar string dataset | yes | The generator's input, verbatim, so that a table can be regenerated from its own file. A dataset rather than an attribute, because attributes are limited to 64 KiB |
| anything else | any | no | For example run statistics or a report |
Provenance must not hold personal data (user names, host names, paths below a home directory). When the solver reads a table (stage 2), it prints the generator, its version and the mechanism's hash in the run log.
4. Fields every table holds¶
Every field of this section and of the model's and thermodynamics' contracts lives on all of the table's axes, unless its row says otherwise.
4.1 Transport¶
Every table that a solver couples to holds the transport properties of the tabulated state.
| Field | Units | Meaning | Check |
|---|---|---|---|
MU |
Pa s |
Dynamic viscosity | > 0 |
KAPPA |
W m-1 K-1 |
Thermal conductivity | > 0 |
CP |
J kg-1 K-1 |
Specific heat at constant pressure | > 0 |
The string attribute transport of /model_data (required) names the
transport model the flamelets were computed with: "unity-lewis",
"mixture-averaged" or "multicomponent"; Mallard refuses any other value.
Mallard's flamelet gas diffuses
every control variable at unity Lewis number, rho D = KAPPA / CP; it reads a
table of any other transport with the warning W-TABLE-TRANSPORT, since
differential-diffusion tables are a legitimate study but not what the solver
assumes.
4.2 Optional fields¶
Fields Mallard reads when a table has them, checked as the others:
| Field | Units | Meaning | Check |
|---|---|---|---|
HRR |
W m-3 |
Heat release rate -sum_k h_k omega_k of the tabulated state, at its density RHO0 (output only) |
finite |
4.3 Species block¶
Every species k in species has the field Y_k, units "1", with values in
[0, 1]. The block may be partial, for example only the species that output or
radiation needs. Mallard does not require the mass fractions to sum to one.
5. Models¶
The model tag sets the axes (names, order, ranges, quantities and transforms),
the model's fields and model_data. Mallard checks that the declared
transforms are those its map for the model implements.
5.1 fpv: flamelet/progress variable¶
Steady flamelets of an S-curve. The presumed PDF is beta in Z and delta in
the flamelet parameter, integrated by the generator
(flamelet.md).
Axes, in this order, each in units "1" with first node exactly 0:
| Axis | quantity |
transform |
Last node | Meaning |
|---|---|---|---|---|
Z |
Z |
identity |
exactly 1 | Mean mixture fraction (Bilger) |
SZ |
ZVAR |
normalized-variance, of = "Z" |
in (0, 1] | Normalized variance Zvar / (Z (1 - Z)); lookups beyond the last node clamp to it |
LAMBDA |
C |
bounds |
exactly 1 | Normalized mean progress variable (C - C_MIN) / (C_MAX - C_MIN) at that (Z, SZ) |
SZ is FPVgen's normalized variance and LAMBDA its normalized progress
variable Λ. Prose and equations write them Sz and Lambda. LAMBDA is not
Ihme & Pitsch's flamelet parameter C(Z_st)
(flamelet.md).
Fields:
| Field | Units | Axes | Meaning | Check |
|---|---|---|---|---|
C_MIN, C_MAX |
1 |
Z, SZ |
The least and largest mean progress variable sum_k w_k Y_k at (Z, SZ), the bounds of LAMBDA |
>= 0, C_MAX >= C_MIN |
OMEGA_C |
kg m-3 s-1 |
all | Mean source of rho C at the tabulated state |
finite |
RHO0 |
kg m-3 |
all | Density of the tabulated state | > 0 |
The mean progress variable at a node is C = C_MIN + LAMBDA (C_MAX - C_MIN),
exact by construction: Mallard maps a transported C to LAMBDA from the
bounds at (Z, SZ), so the table's C at the lookup point is the transported
C itself (flamelet.md). There is no
stored 3-D C.
OMEGA_C is tabulated at the flamelet's density RHO0. The compressible
solver scales it to the local state (stage 2 decides the scaling, for example
(rho / RHO0)^2 for a source that is second order in density). That is why
RHO0 is required.
The fields of an fpv table at Sz = 0 over (Z, Lambda), from the sample
flamelets of the documentation (H2/N2 against air, C = Y_H2O,
tools/docs/flamelet.py; flamelet.md).
Above the dashed line the nodes come from the stable branch of the S-curve,
between it and the dotted line from the unstable branch, and below the dotted
line they are interpolated to the mixing solution:
/model_data:
| Object | Kind | Required | Meaning |
|---|---|---|---|
transport |
string attribute | yes | The flamelets' transport model (section 4.1) |
stoichiometric_mixture_fraction |
number attribute, in (0, 1) | yes | Stoichiometric mixture fraction |
progress_variable |
group, at least one attribute | yes | The weights w_k of C: one number attribute per species, named by the species |
streams/fuel, streams/oxidizer |
groups | yes | The streams that define Z = 1 and Z = 0: number attribute T (K, positive) and a group Y with one number attribute per species, its mass fraction in [0, 1] |
pdf |
group of string attributes | no | The presumed PDF along each axis, one attribute per axis (Z = "beta", SZ = "none", LAMBDA = "delta"); descriptive |
flamelets |
group | no | Per-flamelet diagnostics of the source S-curve (for example chi_st, T_max, C_st, branch), one row per flamelet; descriptive |
5.2 Optional fields of saghafian2015¶
chemtab writes, and Mallard will read once a separately validated change
adopts them, the rest of Saghafian's model: the temperature exponents of
viscosity and KAPPA / CP, and the activation temperature of the source.
| Field | Units | Meaning |
|---|---|---|
A_MU |
1 |
mu = MU (T / T0)^A_MU |
A_KAPPA_CP |
1 |
kappa / cp = (KAPPA / CP) (T / T0)^A_KAPPA_CP |
T_A |
K |
Source factor exp(-T_A (1 / T - 1 / T0)) |
Mallard ignores them today.
5.3 Reserved model tags¶
These tags are reserved for the models the generator will add. Their contracts will be specified here when Mallard reads them. Until then, Mallard refuses them by name:
fgm,fpi: premixed and partially premixed manifolds, axesZ,SZ,LAMBDA;slfm: steady laminar flamelets, axesZ,SZ,CHI_ST;fpv-h: FPV with heat loss,fpv's axes plusH_NORMwithquantity = "H"andtransform = "bounds"(fieldsH_MIN,H_MAX);- names for several streams (two mixture fractions) when they are designed.
More dimensions (pressure, heat loss, a second stream) are extra axes of
one tensor table, never several tables in a file: a pressure axis is P
(quantity = "P", transform = "identity" or "log"), and a table with it
has no root pressure. Memory grows by the axis' node count.
6. Thermodynamics¶
The thermodynamics tag sets the fields from which the solver gets temperature and pressure from the conservative state.
6.1 saghafian2015: compressible, linearized gamma(T)¶
After Saghafian, Terrapon & Pitsch (2015). The ratio of specific heats is linear
in temperature about the tabulated state, gamma(T) = gamma0 + a_gamma (T - T0),
and with cv = R / (gamma - 1) the temperature follows from the internal energy
in closed form:
with the limit T = T0 + (gamma0 - 1)(e - e0) / R as a_gamma -> 0.
| Field | Units | Meaning | Check |
|---|---|---|---|
T0 |
K |
Temperature of the tabulated state | > 0 |
E0 |
J kg-1 |
Internal energy at T0, formation energies included, on Cantera's reference: species enthalpies of formation at 298.15 K |
finite |
R |
J kg-1 K-1 |
Specific gas constant R_u / W |
> 0 |
GAMMA0 |
1 |
gamma at T0 |
> 1 |
A_GAMMA |
K-1 |
d gamma / d T at T0 |
finite |
6.2 Reserved thermodynamics tags¶
These are reserved and refused by name until specified: low-mach (tabulated
T and rho, pressure from the equation of state only), and tags for fuller
compressible models (for example a tabulated cv(T) per node).
7. What Mallard checks¶
Mallard reads a table once at setup and refuses it, with the file name and the reason, unless:
- The build has HDF5, and the file is an HDF5 file.
- The root's
formatis"mallard-table"andversionis 1. modelandthermodynamicsare tags this version of Mallard supports. An unknown or reserved tag is refused by name, with the list of supported tags.- Every required attribute, group and dataset is present with its type.
pressureis positive (unless an axis isP)./model_datahastransport, one of the three of section 4.1./provenancehasgenerator(name,version),created,input,dependenciesandmechanism(name,sha256of 64 lowercase hexadecimal digits). The model's/model_datais present and in range. - There is at least one axis; neither the format nor Mallard limits their
number. Each axis has at least 2 finite, strictly increasing nodes, and its
transformis one of the four; anormalized-varianceaxis names an axis before it inof. Axis and field names are of the form[A-Z][A-Z0-9_]*(orY_/OMEGA_Y_of a species of the block), and unique. A file in the layout before the format's revision (one packed/valuesdataset, no rootaxes) is refused as such, with how to regenerate it. - Every
Y_field is a species inspecies. - Every field Mallard reads is float64 or float32, unfiltered, on a subset of the table's axes in their order, with the shape of their node counts, and every value is finite.
- For every
boundsaxis of quantityQ,Q_MINandQ_MAXexist on the axes before it, andQ_MAX >= Q_MINat every node. - The model's axes have the required names, order, units, range, quantities and transforms.
- Every field required by the model, the thermodynamics, transport and the species block is present on its axes, with exactly the listed units, and its values meet the listed checks.
mallard table check FILE makes these checks without a case and reports
the result, also as JSON for a generator's conformance tests
(Tabulated chemistry).
At run time (stage 2), Mallard also warns when the table's pressure differs
from the run's reference pressure by more than 10% (W-TABLE-PRESSURE), and
when its transport is not "unity-lewis" (W-TABLE-TRANSPORT).
8. Versioning and new models¶
- Version 1 is this page. The version changes when the layout changes, when a required attribute, group, dataset or field is added or removed, or when the meaning of an existing one or of a tag changes. Mallard refuses versions it does not know.
- New optional attributes, groups, datasets and fields, and new provenance, need no new version: readers ignore what they do not know.
- New models and thermodynamics are new tags, specified here before Mallard reads them. They need no new version. A Mallard that does not support a tag refuses the table by name.
- Fields are float64 or float32 within version 1 (section 2).
9. Reading a table with h5py¶
import h5py
with h5py.File("table.h5", "r") as f:
assert f.attrs["format"] == "mallard-table" and f.attrs["version"] == 1
axes = {a: f["axes"][a][()] for a in f.attrs["axes"]}
T0 = f["fields/T0"][()] # shape (n_Z, n_SZ, n_LAMBDA)
C_max = f["fields/C_MAX"][()] # shape (n_Z, n_SZ)
print(list(f["fields/C_MAX"].attrs["axes"])) # ['Z', 'SZ']
weights = dict(f["model_data/progress_variable"].attrs)
writer = f["provenance/input"][()].decode()
With the dimension scales attached, h5dump -d /fields/T0 and other generic
tools show each dimension's axis. Writing a table takes the same calls in
reverse; the fixture's writer below is a complete example.
10. Reference fixtures¶
test/data/flamelet/fixture_fpv.h5
is a small valid fpv / saghafian2015 table (5 x 3 x 4 nodes, 16 fields,
species H2, O2, H2O and N2) in float64, and
fixture_fpv_f32.h5 the same
table in float32. Their full-rank fields are synthetic functions, multilinear in
(Z, SZ, LAMBDA), so lookups reproduce them exactly; C = Y_H2O as its
progress_variable says, between C_MIN = 0 and C_MAX on (Z, SZ). They
test the format, not combustion. The h5py script that wrote them is in their
own /provenance/input. The solver_*.h5 tables beside them are the
solver tests' synthetic tables, also with their writer inside. A generator
checks its writer against these files at a pinned Mallard commit, and
Mallard's tests (test/flamelet_table_test.cpp) read them.
References¶
- A. Saghafian, V. E. Terrapon and H. Pitsch, An efficient flamelet-based combustion model for compressible flows, Combust. Flame 162, 652–667 (2015).
- FPVgen: M. Bonanni, M. Ihme and the Laboratory of Fluids in Complex Environments, FPV flamelet table generation software, doi:10.5281/zenodo.14728543, MIT License. chemtab's design draws on it.