-
Notifications
You must be signed in to change notification settings - Fork 1
Postprocessing
After a KiMecO run completes, postprocessing uses a user specified ensemble (ex: [G0001, GT-1]) of models to calculate their rate coefficients at new T,P conditions. This is useful for extrapolating mechanism performance beyond the original optimization temperatures and pressures, or analyzing specific ensembles.
Postprocessing is invoked after the main optimization run finishes. Use the CLI command:
kmopp input.jsonThis reads the same JSON input file (with pp_* keywords added) and the existing run's workdir, then executes the postprocessing workflow. The command loads all databases and GOAT file from the original run automatically.
| Keyword | Default value | Description |
|---|---|---|
| pp_experiments | [] |
List of dicts — postprocessing conditions to simulate. Same schema as experiments but without data_file/error_file; each entry adds its own times and species. See below. |
| pp_ensembles | ["G0001", "GT-1"] |
List of strings — tags of ensembles to process (see token syntax below). |
The MESS extrapolation grid (
pp_temp/pp_pres) is derived automatically from the unique temperatures and pressures ofpp_experiments; it is not specified directly.
Each entry mirrors an experiments entry but is only simulated, never scored, so it has no data_file/error_file. Instead it must provide:
-
times— list of floats (seconds, ascending): the solver/output time grid. -
species— list of strings: species recorded in the output profiles.
Required keys per entry: temp (K), pres, cantera_tpl, times, species, and exactly one of initial_ratio / initial_concentration. Optional: pres_unit (defaults to the global pres_unit). The composition syntax — including marking one species as "base" to auto-fill the remainder — is identical to experiments.
The unique temperatures/pressures across all pp_experiments define the MESS rate-coefficient grid used for extrapolation. Identical cantera_tpl files are de-duplicated, so each unique template becomes a single simulation array task.
Example entry:
{
"temp": 500,
"pres": 1.0,
"pres_unit": "bar",
"cantera_tpl": "templates/reactor_template.py",
"initial_ratio": {"CH4": 0.01, "O2": 0.21, "N2": "base"},
"times": [0.0, 0.01, 0.02, 0.03],
"species": ["CH4", "O2", "HO2", "CH3"]
}Each token specifies which models to extrapolate:
| Token syntax | Example | Meaning |
|---|---|---|
G#### (4 digits) |
G0005 |
All models from a specific GA generation (e.g., generation 5). |
GT#### or GT-#
|
GT0010, GT-1
|
GOAT (elite) ensemble for a generation. GT-1 → final/elite list. |
NM#### or NM-#
|
NM0002, NM-1
|
Best model from Nelder-Mead optimization for a specific NM generation. |
NMS |
NMS |
Nelder-Mead Swarm — all final simplex members from the last NM run. |
NMSG#### |
NMSG0003 |
All Nelder-Mead Swarm candidates from a specific GA generation (advanced). |
TIP: Ensembles are stored in the SOP_DB as tables named G0001, NM0001, etc. They must exist in your database for the postprocessing command to succeed. To get a GOAT ensemble, one can construct a GOAT object from the goats.txt file generated by the main run.
{
"mess_inputs": ["mess_input.inp"],
"ct_yaml": "mechanism.yaml",
"experiments": [...],
"pp_experiments": [
{
"temp": 500,
"pres": 1.0,
"pres_unit": "bar",
"cantera_tpl": "templates/reactor_template.py",
"initial_ratio": {"CH4": 0.01, "O2": 0.21},
"times": [0.00, 0.01, 0.02, 0.03],
"species": ["CH4", "O2", "HO2", "CH3"]
},
{
"temp": 600,
"pres": 10.0,
"pres_unit": "bar",
"cantera_tpl": "templates/reactor_template.py",
"initial_ratio": {"CH4": 0.01, "O2": 0.21},
"times": [0.00, 0.01, 0.02, 0.03],
"species": ["CH4", "O2", "HO2", "CH3"]
}
],
"pp_ensembles": ["G0001", "GT-1", "NM0005"]
}Postprocessing generates two new SQLite databases in the workdir:
-
PP_DB_KIN.db— Rate coefficients at the PP condition grid.- Tables named
X<token>(e.g.,XG0001,XGT0005,XNM0001). - Stores k(T, P) for each reaction pair, computed via MESS at your PP P/T grid.
- Tables named
-
PP_DB_SIM.db— Species-time profiles from Cantera simulations.- Tables named
X<token>with rows indexed by (mdl_id,condition_id). - Columns:
time(float), and one binary blob per requested species (Feather-encoded). - Useful for plotting concentration–time trajectories and validating extrapolation trends.
- Tables named
Where files are saved: All results are written to workdir/, organized in subdirectories by ensemble token (e.g., workdir/XG0001/, workdir/XGT0005/). Intermediate job scripts (SLURM or local) and scratch files are created there.
- Validate pp settings — check that all P/T/composition/time combinations are consistent.
- Open existing run databases — SOP_DB, KIN_DB, SIM_DB from the original run.
- Create PP databases — initialize PP_DB_KIN and PP_DB_SIM in workdir.
-
Load GOAT file — read
workdir/goats.txtto reconstruct elite ensembles. -
Loop over
pp_ensembles:- Load models (SOP parameters) from the SOP_DB table matching the token.
- Submit rate-coefficient jobs (MESS) to compute k(T, P) at the PP grid.
- Submit Cantera simulation jobs to run reactor dynamics.
- Store profiles in PP_DB_SIM.
- Finalize — no re-scoring; results are persisted as-is.