Skip to content

Commit

Permalink
[Input/Examples] Update Python examples to demonstrate YAML output
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Apr 12, 2021
1 parent 02900d6 commit 42d5923
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
mechanism and the submechanism, which demonstrates that the submechanism
contains all of the important species and reactions.
Requires: cantera >= 2.5.0, matplotlib >= 2.0
Requires: cantera >= 2.6.0, matplotlib >= 2.0
"""

from timeit import default_timer
Expand Down Expand Up @@ -57,6 +57,8 @@
gas2 = ct.Solution(thermo='ideal-gas', kinetics='gas',
species=species, reactions=reactions)

# Save the resulting mechanism for later use
gas2.write_yaml("gri30-CO-H2-submech.yaml")

def solve_flame(gas):
gas.TPX = 373, 0.05*ct.one_atm, 'H2:0.4, CO:0.6, O2:1, N2:3.76'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
to see whether the reduced mechanisms with a certain number of species are able
to adequately simulate the ignition delay problem.
Requires: cantera >= 2.5.0, matplotlib >= 2.0
Requires: cantera >= 2.6.0, matplotlib >= 2.0
"""

import cantera as ct
Expand Down Expand Up @@ -65,6 +65,9 @@
gas2 = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
species=species, reactions=reactions)

# save the reduced mechanism for later use
gas2.write_yaml("gri30-reduced-{}-reaction.yaml".format(N))

# Re-run the ignition problem with the reduced mechanism
gas2.TPX = initial_state
r = ct.IdealGasConstPressureReactor(gas2)
Expand Down

0 comments on commit 42d5923

Please sign in to comment.