bloc.io.mops#

MOPS export: isothermal pyrolysis -> MOPS .inp gas-phase profile + diagnostic plot.

Given a Cantera X0 composition, an isothermal temperature (K), a residence time (s) and a pressure (bar), run() performs an isothermal Cantera simulation (energy=”off”) and can write a MOPS .inp file. Output columns (MOPS_SPECIES) are fixed; mechanism-specific mapping (SPECIES_MAP) maps them to mechanism species names (e.g. A1 -> C6H6 for CRECK). Units: P (bar), Time (s), T (K), mole fractions, wdotA4 in mol/(s·cm³). Carbon solid = species whose name starts with BIN.

Attributes#

Functions#

mops_case_output_path(x0, temperature_K, path_hint, *, ...)

Build {prefix}_CH4_XX%_{T}K{suffix} in the directory of path_hint.

load_data_for_mops_config(path)

Load a data_for_mops.yaml-shaped config file and return validated mapping.

run(X0, temperature, residence_time[, P_bar, ...])

Run isothermal pyrolysis and write MOPS .inp file.

plot_mops(result, output_path, *[, ...])

Plot MOPS mole fractions, wdotA4 rate, mass fractions, and carbon volume fraction on one PNG.

Module Contents#

bloc.io.mops.MOPS_SPECIES = ['N2', 'CH4', 'C2H2', 'A1', 'A2', 'A3', 'A4', 'OH', 'H', 'H2', 'H2O', 'A5', 'O2']#
bloc.io.mops.DEFAULT_MECHANISM = 'CRECK_2003_TOT_HT_SOOT_kinetics.yaml'#
bloc.io.mops.SPECIES_MAP: dict[str, dict[str, str | list[str]]]#
bloc.io.mops.RHO_SOLID_SOOT_DEFAULT = 1800.0#
bloc.io.mops.mops_case_output_path(x0, temperature_K, path_hint, *, prefix, suffix)#

Build {prefix}_CH4_XX%_{T}K{suffix} in the directory of path_hint.

bloc.io.mops.load_data_for_mops_config(path)#

Load a data_for_mops.yaml-shaped config file and return validated mapping.

Expected keys: x0, temperature_K, residence_time_s, pressure_bar, mechanism, output_inp, plot_png, rho_solid_soot_kg_m3. Optional: plot_suptitle (str or null).

output_inp / plot_png set output directories; filenames are derived as gasphase_CH4_XX%_{T}K.inp and mops_plot_CH4_XX%_{T}K.png.

bloc.io.mops.run(X0, temperature, residence_time, P_bar=1.0, mechanism=None, output_inp=None)#

Run isothermal pyrolysis and write MOPS .inp file.

Parameters:
  • X0 (str) – Initial composition as Cantera mole fraction string, e.g. “CH4:0.1,N2:0.9”.

  • temperature (float) – Isothermal reactor temperature in Kelvin.

  • residence_time (float) – Residence time in seconds.

  • P_bar (float) – Pressure in bar. Default 1.0.

  • mechanism (str, optional) – Cantera mechanism name/path. Default: DEFAULT_MECHANISM. Use SPECIES_MAP to add mappings for other mechanisms.

  • output_inp (str or Path, optional) – If set, write MOPS .inp file (space-separated, scientific format).

Returns:

“states”: Cantera SolutionArray “gas”: final gas state “inp_path”: path of written .inp or None

Return type:

dict

bloc.io.mops.plot_mops(result, output_path, *, rho_solid_soot_kg_m3=RHO_SOLID_SOOT_DEFAULT, suptitle=None)#

Plot MOPS mole fractions, wdotA4 rate, mass fractions, and carbon volume fraction on one PNG.

Four panels: (1) MOPS mole fractions vs time (no N2), (2) wdotA4 in mol/(s·cm³), (3) Mass fractions of MOPS_SPECIES (no N2), (4) Volume fraction of carbon solid (BIN species).

Parameters:
  • rho_solid_soot_kg_m3 – Mass density of solid carbon for BIN volume fraction (kg/m³).

  • suptitle – Figure suptitle; if None, a default title from the mechanism name is used.