Extend NASA9 Temperature Limits for Kinetics#

This example shows how to extend NASA9 thermodynamic data to higher temperatures with a constant-\(C_p\) continuation and inspect the resulting curves.

Workflow#

  1. Load an input NASA9 thermo mechanism.

  2. Fit an extended NASA9 representation with PMUTT.

  3. Write a new YAML file with updated temperature ranges.

  4. Plot one species to compare valid, native-extrapolated, and corrected trends.

Tags: kinetics thermo NASA9 cantera

Import required libraries.#

from pathlib import Path

from rizer.kin.extend_NASA9_temperature_limits import Nasa9TemperatureLimitsExtender
from rizer.misc.utils import get_path_to_data

Configure the extension task.#

thermo_path = get_path_to_data("mechanisms", "thermo")
data_to_extend = [
    # "burcat_thermo_nasa9.yaml",
    "graphite.yaml",
    "grc_nasa9_Ar.yaml",
    "grc_nasa9_C_H.yaml",
    "grc_nasa9_N_O.yaml",
]
extenders: list[Nasa9TemperatureLimitsExtender] = []

for i, data in enumerate(data_to_extend):
    print(f"Available NASA9 thermo data: {thermo_path / data}")
    input_mechanism = thermo_path / data

    # Write the output near the input file for demonstration purposes.
    output_mechanism = Path(input_mechanism).with_name(
        f"extended_{Path(data).stem}.yaml"
    )

    extender = Nasa9TemperatureLimitsExtender(
        mechanism_to_extend=input_mechanism,
        new_mechanism_to_write=output_mechanism,
        max_temperature_extrapolated=200_000.0,
        number_of_points_fit=500,
    )

    extenders.append(extender)
Available NASA9 thermo data: /home/runner/work/rizer/rizer/data/mechanisms/thermo/graphite.yaml
Available NASA9 thermo data: /home/runner/work/rizer/rizer/data/mechanisms/thermo/grc_nasa9_Ar.yaml
Available NASA9 thermo data: /home/runner/work/rizer/rizer/data/mechanisms/thermo/grc_nasa9_C_H.yaml
Available NASA9 thermo data: /home/runner/work/rizer/rizer/data/mechanisms/thermo/grc_nasa9_N_O.yaml

Generate the extended mechanism.#

for extender in extenders:
    extender.write()
    print(f"Extended mechanism written to: {output_mechanism}")
Processing species C(gr)...
Processing species C(s)...
Processing species C(soot)...
Extended mechanism written to: /home/runner/work/rizer/rizer/data/mechanisms/thermo/extended_grc_nasa9_N_O.yaml
Processing species Ar...
Processing species Ar+...
Extended mechanism written to: /home/runner/work/rizer/rizer/data/mechanisms/thermo/extended_grc_nasa9_N_O.yaml
Processing species e-...
Processing species C...
Processing species C+...
Processing species C-...
Processing species CH...
Processing species CH+...
Processing species CH2...
Processing species CH3...
Processing species CH4...
Processing species C2...
Processing species C2+...
Processing species C2-...
Processing species C2H...
Processing species C2H2...
Processing species C2H2,vinylidene...
Processing species C2H3...
Processing species C2H4...
Processing species C2H5...
Processing species C2H6...
Processing species C3...
Processing species C3H3,1-propynl...
Processing species C3H3,2-propynl...
Processing species C3H4,allene...
Processing species C3H4,propyne...
Processing species C3H4,cyclo-...
Processing species C3H5,allyl...
Processing species C3H6,propylene...
Processing species C3H6,cyclo-...
Processing species C3H7,n-propyl...
Processing species C3H7,i-propyl...
Processing species C3H8...
Processing species C4...
Processing species C4H2,butadiyne...
Processing species C4H4,1,3-cyclo-...
Processing species C4H6,butadiene...
Processing species C4H6,1butyne...
Processing species C4H6,2butyne...
Processing species C4H6,cyclo-...
Processing species C4H8,1-butene...
Processing species C4H8,cis2-buten...
Processing species C4H8,tr2-butene...
Processing species C4H8,isobutene...
Processing species C4H8,cyclo-...
Processing species C4H9,n-butyl...
Processing species C4H9,i-butyl...
Processing species C4H9,s-butyl...
Processing species C4H9,t-butyl...
Processing species C4H10,n-butane...
Processing species C4H10,isobutane...
Processing species C5...
Processing species C5H6,1,3cyclo-...
Processing species C5H8,cyclo-...
Processing species C5H10,1-pentene...
Processing species C5H10,cyclo-...
Processing species C5H11,pentyl...
Processing species C5H11,t-pentyl...
Processing species C5H12,n-pentane...
Processing species C5H12,i-pentane...
Processing species CH3C(CH3)2CH3...
Processing species C6H2...
Processing species C6H5,phenyl...
Processing species C6H6...
Processing species C6H10,cyclo-...
Processing species C6H12,1-hexene...
Processing species C6H12,cyclo-...
Processing species C6H13,n-hexyl...
Processing species C6H14,n-hexane...
Processing species C7H7,benzyl...
Processing species C7H8...
Processing species C7H14,1-heptene...
Processing species C7H15,n-heptyl...
Processing species C7H16,n-heptane...
Processing species C7H16,2-methylh...
Processing species C8H8,styrene...
Processing species C8H10,ethylbenz...
Processing species C8H16,1-octene...
Processing species C8H17,n-octyl...
Processing species C8H18,n-octane...
Processing species C8H18,isooctane...
Processing species C9H19,n-nonyl...
Processing species C10H8,naphthale...
Processing species C10H21,n-decyl...
Processing species C11H21...
Processing species C12H9,o-bipheny...
Processing species C12H10,biphenyl...
Processing species H...
Processing species H+...
Processing species H-...
Processing species H2...
Processing species H2+...
Processing species H2-...
Extended mechanism written to: /home/runner/work/rizer/rizer/data/mechanisms/thermo/extended_grc_nasa9_N_O.yaml
Processing species N...
Processing species N+...
Processing species N-...
Processing species NO...
Processing species NO+...
Processing species NO2...
Processing species NO2-...
Processing species NO3...
Processing species NO3-...
Processing species N2...
Processing species N2+...
Processing species N2-...
Processing species N2O...
Processing species N2O+...
Processing species O...
Processing species O+...
Processing species O-...
Processing species O2...
Processing species O2+...
Processing species O2-...
Processing species O3...
Extended mechanism written to: /home/runner/work/rizer/rizer/data/mechanisms/thermo/extended_grc_nasa9_N_O.yaml

Plot one species thermo continuation.#

# For demonstration purposes, we plot the first species of the first mechanism.
extender = extenders[0]
species_to_plot = extender.species_list[0].name
print(f"Plotting thermo data for species: {species_to_plot}")
extender.plot_species_thermo_data(species_to_plot)
Species: C(gr)
Plotting thermo data for species: C(gr)

Total running time of the script: (0 minutes 2.516 seconds)