This example analyses a set of thermochemical states stored in an external file called testdata.dat, containing \(N\) lines, each one being a full thermochemical state of the kind [t, T, P, Y_1, ..., Y_Ns]. Such a file is written by examples/dataImportExport/export_import.py. The kinetic mechanism is hydrogen.yaml, containing 9 species and 19 reversible reactions. The dataset is the time evolution of a stoichiometric H\(_2\)/air constant-pressure homogeneous reactor, with an initial temperature of 1000 K and a pressure of one atmosphere.
calc_subspaces() returns both the number of exhausted modes \(M\) and the Head index \(H\), which partition the modes into fast \([0, M)\), active \([M, H)\) and slow \([H, N_v - N_{el})\) subspaces (see Theory). The script examples/cspAnalysis/subspaces.py computes them along the ignition of a stoichiometric CH\(_4\)/air mixture (GRI-3.0, 1000 K, 1 atm):
Figure 3: Eigenvalues (black, log-scaled) during CH4/air ignition, with the eigenvalues of mode M+1 (orange) and of mode H (blue) bounding the active subspace. Generated with PyCSP v1.5.0.
The indices are arrays of shape [N\(_v \times\) 2N\(_r\)] (modes for api and tpi, variables for ifast and islow), and the reaction names, forward and backward, are given by gas.reaction_names(). With gas.index_norm = 'none' the indices are not normalized and can be integrated in time (indices-integral.py).