Build ion-neutral reactions from UMIST into a Cantera YAML file.#

This example converts UMIST reactions to Cantera YAML format for the CH4-to-C2 chemistry subset used in the project.

Tags: kinetics UMIST cantera mechanism generation

from rizer.kin.umist_to_cantera import convert_umist_to_cantera
from rizer.misc.utils import get_path_to_data

accepted_species = [
    # "e-",
    "H",
    "H+",
    "H2",
    "H2+",
    "C",
    "C+",
    "CH",
    "CH+",
    "CH2",
    "CH2+",
    "CH3",
    "CH3+",
    "CH4",
    "CH4+",
    "C2",
    "C2+",
    "C2H",
    "C2H+",
    "C2H2",
    "C2H2+",
    "C2H3",
    "C2H3+",
    "C2H4",
    "C2H4+",
    "C2H5",
    "C2H5+",
    "CH3CH3",  # "C2H6",
    "CH3CH3+",  # "C2H6+",
]

ignored_reactions = [
    ("H + C2H3+ <=> C2H2+ + H2", "Duplicate of UMIST 3216"),
    ("H + CH+ <=> C+ + H2", "Duplicate of UMIST 3211"),
    ("H + CH2+ <=> CH+ + H2", "Duplicate of UMIST 3240"),
    ("H + CH3+ <=> CH2+ + H2", "Duplicate of UMIST 3241"),
]

output_path = get_path_to_data(
    "mechanisms",
    "Goutier2025",
    "builder",
    "ion_neutral_reactions.yaml",
    force_return=True,
)

convert_umist_to_cantera(
    accepted_species=accepted_species,
    ignored_reactions=ignored_reactions,
    output_path=output_path,
    include_only_reactions_involving_accepted_species=True,
    convert_species_names=[
        ("CH3CH3+", "C2H6+"),
        ("CH3CH3", "C2H6"),
    ],
)