Index of Python Examples
This is an index of Python examples included with Cantera.
Cantera's Python examples can be downloaded by clicking the "Source" link at the top of each example page.
Table of Contents
- Reactor Networks
- One-Dimensional Flames
- Multiphase Mixtures
- Surface Chemistry
Print the critical state properties for the fluids for which Cantera has built-in liquid/vapor equations of state.
This example demonstrates how to set a mixture according to equivalence ratio and mixture fraction.
Isentropic, adiabatic flow example - calculate area ratio vs. Mach number curve.
Mixing two streams using `Quantity` objects.
Calculate the efficiency of a Rankine vapor power cycle using a pure fluid model for water.
Compute the "equilibrium" and "frozen" sound speeds for a gas.
This example generates a saturated steam table and plots the vapor dome. The steam table corresponds to data typically found in thermodynamic text books and uses the same customary units.
A simple example to demonstrate the difference between Blowers-Masel reaction and elementary reaction.
An example demonstrating how to use custom reaction objects.
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.
Reactor Networks ¶
Calculate steady-state solutions for a combustor, modeled as a single well-stirred reactor, for different residence times.
Solve an ignition problem where the normal reactor governing equations are extended with additional equations implemented in Python.
Solve a constant pressure ignition problem where the governing equations are implemented in Python.
Simulation of fuel injection into a vitiated air mixture to show formation of soot precursors.
Simulation of a (gaseous) Diesel-type internal combustion engine.
Mixing two streams.
Ignition delay time computations in a high-pressure reflected shock tube reactor, comparing ideal gas and Redlich-Kwong real gas models.
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 that moves with a speed proportional to the pressure difference between the reactors.
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.
A burner-stabilized premixed methane-air flame with charged species.
A freely-propagating, premixed methane-air flat flame with charged species.
An opposed-flow premixed strained flame.
Simulate two counter-flow jets of reactants shooting into each other. This simulation differs from the similar premixed_counterflow_flame.py example as the latter simulates a jet of reactants shooting into products.
A detached flat flame stabilized at a stagnation point.
Multiphase Mixtures ¶
Surface Chemistry ¶
Catalytic combustion of methane on platinum.
A CVD example simulating growth of a diamond film.
This example calculates the cell voltage of a lithium-ion battery at given temperature, pressure, current, and range of state of charge (SOC).
A simple model of a solid oxide fuel cell.