Index of Python Examples

This is an index of the examples included with the Cantera Python module. They can be found in the examples subdirectory of the Cantera Python module’s installation directory. To determine the location of this directory, run the following in your Python interpreter:

import cantera.examples

Thermodynamics Print the critical state properties for the fluids for which Cantera has built-in liquid/vapor equations of state. Isentropic, adiabatic flow example - calculate area ratio vs. Mach number curve Mixing two streams using Quantity objects. A Rankine vapor power cycle Compute the “equilibrium” and “frozen” sound speeds for a gas

Kinetics An example demonstrating how to use Species and Reaction objects to programmatically extract a reaction submechanism. In this example, the CO/H2 oxidation reactions are extracted from the GRI 3.0 mechanism. A simplistic approach to mechanism reduction which demonstrates Cantera’s features for dynamically manipulating chemical mechanisms. Viewing a reaction path diagram.

Transport Dusty Gas transport model. This example demonstrates how Cantera can be used with the ‘multiprocessing’ module.

Reactor Networks A combustor. Two separate stream - one pure methane and the other air, both at 300 K and 1 atm flow into an adiabatic combustor where they mix and burn. Solve a constant pressure ignition problem where the governing equations are implemented in Python. Simulation of a (gaseous) Diesel-type internal combustion engine. Mixing two streams. This example illustrates a continuously stirred tank reactor (CSTR) with steady inputs but periodic interior state. This example solves a plug-flow reactor problem of hydrogen-oxygen combustion. The PFR is computed by two approaches: The simulation of a Lagrangian fluid particle, and the simulation of a chain of reactors. Two reactors separated by a piston Constant-pressure, adiabatic kinetics simulation. Two reactors connected with a piston, with heat loss to the environment Constant-pressure, adiabatic kinetics simulation with sensitivity analysis This example solves a plug flow reactor problem, where the chemistry is surface chemistry. The specific problem simulated is the partial oxidation of methane over a platinum catalyst in a packed bed reactor.

One-dimensional Flames A freely-propagating, premixed hydrogen flat flame with multicomponent transport properties. A burner-stabilized lean premixed hydrogen-oxygen flame at low pressure. An opposed-flow ethane/air diffusion flame This example creates two batches of counterflow diffusion flame simulations. The first batch computes counterflow flames at increasing pressure, the second at increasing strain rates. This example computes the extinction point of a counterflow diffusion flame. A hydrogen-oxygen diffusion flame at 1 bar is studied. A burner-stabilized, premixed methane/air flat flame with multicomponent transport properties and a specified temperature profile. Sensitivity analysis for a freely-propagating, premixed methane-air flame. Computes the sensitivity of the laminar flame speed with respect to each reaction rate constant. An opposed-flow premixed strained flame Simulate two counter-flow jets of reactants shooting into each other. This simulation differs from the similar example as the latter simulates a jet of reactants shooting into products. A detached flat flame stabilized at a stagnation point

Multiphase Mixtures Adiabatic flame temperature and equilibrium composition for a fuel/air mixture as a function of equivalence ratio, including formation of solid carbon. An equilibrium example with charged species in the gas phase and multiple condensed phases.

Surface Chemistry CATCOMB – Catalytic combustion of methane on platinum. A CVD example simulating growth of a diamond film A simple model of a solid oxide fuel cell.