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
This example demonstrates (1). the four different dependency models available for coverage-dependent enthalpy and entropy calculations and (2). capability of including self-interaction but also cross-interaction among different surface species.
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.
Isentropic, adiabatic flow example - calculate area ratio vs. Mach number curve. Uses the pint library to include customized units in the calculation.
Mixing two streams using `Quantity` objects.
Calculate the efficiency of a Rankine vapor power cycle using a pure fluid model for water.
Calculate the efficiency of a Rankine vapor power cycle using a pure fluid model for water. Includes the units of quantities in the calculations.
Compute the "equilibrium" and "frozen" sound speeds for a gas.
Compute the "equilibrium" and "frozen" sound speeds for a gas. Uses the pint library to include customized units in the calculation.
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.
Short description: reactor cascade model for reactive flows in inert porous media based on extensible reactors. Showcases adding a temperature equation for a solid-phase and custom heat transfer/radiation models.
Ideal gas, constant-pressure, adiabatic kinetics simulation that compares preconditioned and non-preconditioned integration of nDodecane.
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 with surface chemistry. The specific problem simulated is the partial oxidation of methane over a platinum catalyst in a packed bed reactor. This example solves the DAE system directly, using the FlowReactor class and the SUNDIALS IDA solver, in contrast to the approximation as a chain of steady-state WSRs used in surf_pfr_chain.py.
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. To avoid needing to solve a DAE system, the PFR is approximated as a chain of successive WSRs. See surf_pfr.py for a more advanced implementation that solves the DAE system directly.
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.
A freely-propagating, premixed methane-air flame. Examples of saving and loading a flame and restarting with different initial guesses.
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 ¶
A 1-D steady state plug-flow reactor demonstrating silicon nitride (Si3N4) deposition from ammonia (NH3) and silicon tetrafluoride (SiF4).
Catalytic combustion of methane on platinum.
A CVD example simulating growth of a diamond film.