Plot the chemical equilibrium of a given initial solution.#

The script uses the plot_chemical_equilibrium function from rizer.misc.ct_utils to plot the main species under thermochemical equilibrium with Cantera.

Tags: cantera chemical equilibrium methane CH4

Import the required libraries.#

import numpy as np
import seaborn as sns

from rizer.misc.ct_utils import plot_chemical_equilibrium

sns.set_theme("poster")

Plot the chemical equilibrium.#

The function plot_chemical_equilibrium plots the main species under thermochemical equilibrium with Cantera.

The function receives the following parameters:

  • thermo: Cantera thermo file.

  • initial_solution: Initial solution.

  • temperatures: Temperatures to evaluate.

  • unit: Temperature unit (“K” or “C”).

  • keep_only_first_species: Keep only the n first species.

  • save_file_name: Save file name.

  • fraction: Mole or mass fraction (“mole” or “mass”)

plot_chemical_equilibrium(
    thermo="gri30.yaml",
    initial_solution="CH4:1",
    unit="K",
    temperatures=np.linspace(300, 5000),
    keep_only_first_species=5,
    fraction="mass",
)
Chemical Equilibrium

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