Python Module Documentation#

Objects Representing Phases#

The most frequently used class in Cantera is the Solution. It can represent a mixture of gases, a liquid solution, or a solid solution and provides access to the solution’s thermodynamic, kinetic, and transport properties. The Interface class represents surfaces formed by two adjacent phases or edges where three phases meet. Several special constructors are provided to instantiate Solution objects that implement pure fluid equations of state for certain substances.

The Quantity class represents a specific quantity (mass) of a Solution. It provides methods for accessing the extensive properties of the quantity and computing the state resulting from mixing two substances.

The SolutionArray class provides a convenient interface for representing a multidimensional array of states and accessing properties of those states as arrays.

Thermodynamic Properties#

Class ThermoPhase is one of the base classes for Solution objects. It represents the intensive thermodynamic state using one of the phase thermodynamic models implemented by Cantera and provides methods for computing thermodynamic properties.

A phase is composed of a number of Species objects. Each species has a SpeciesThermo object that implements a particular species thermodynamic model. Element objects can be used to access information about the elements comprising each species or to define custom isotopes.

The Mixture class provides an interface for computing equilibrium properties of mixtures composed of multiple phases.

Chemical Kinetics#

Class Kinetics is a base class of Solution that provides access to reaction rates of progress, species production rates, and other quantities pertaining to a reaction mechanism. InterfaceKinetics provides this information for Interface objects.

A reaction mechanism consists of a set of Reaction objects. The Reaction object specifies the reactants and products of the reaction and has a ReactionRate object that handles the evaluation of the rate constant as a function of the mixture composition, using one of the rate parameterizations implemented by Cantera or a user-defined rate implemented using the ExtensibleRate class.

The ReactionPathDiagram class can be used to analyze reaction pathways.

Transport Properties#

Class Transport is a base class of Solution that provides access to transport properties such as viscosity and species diffusivities, using one of the available transport models. The DustyGasTransport provides a special transport model applicable to porous media. Species properties needed to compute transport properties are handled by the GasTransportData class.

Zero-Dimensional Reactor Networks#

A reactor network consists of one or more interconnected reactors. Several reactor types are implemented by classes derived from Reactor, each with its own set of governing equations.

Reactors can be connected to each other and upstream or downstream Reservoirs using Valves, MassFlowControllers, PressureControllers, and Walls, which introduce additional terms to the governing equations. Heterogeneous reactions are handled by ReactorSurface. User-defined reactor governing equations can be implemented using the ExtensibleReactor class or any of the classes derived from it.

Time integration of reactor networks is handled by the ReactorNet class. For certain types of networks, integration can be accelerated by using the AdaptivePreconditioner class.

One-dimensional Reacting Flows#

The main way of setting up a 1D simulation in Cantera is through one of the specializations of the FlameBase class: FreeFlame, BurnerFlame, CounterflowDiffusionFlame, CounterflowPremixedFlame, CounterflowTwinPremixedFlame, or ImpingingJet. These classes all consist of a flow domain with two boundaries defining inlet/outlet boundary conditions.

Mechanism Conversion#

Cantera includes modules implementing conversion of mechanisms between the YAML and Chemkin formats, conversion from the LXCat format, and conversion from the legacy CTI and CTML (XML) formats that were used prior to Cantera 3.0. The preferred interfaces for these conversions are the executable scripts ck2yaml, yaml2ck, lxcat2yaml, cti2yaml, and ctml2yaml.

Python Interface With Units#

This subpackage provides an alternative interface to thermodynamic properties where physical units are associated with all values, using the pint library. This capability is implemented by the with_units.Solution and with_units.PureFluid classes.

Physical Constants#

Cantera provides definitions for a number of frequently used physical constants. The values are consistent with the 2018 CODATA recommendations.

Utilities#

Classes AnyMap and YamlWriter provide functionality for interacting with input data defined using Cantera’s YAML input format. Classes UnitSystem and Units are used for expressing dimensional quantities in input files.

A number of global functions are provided for managing locations where Cantera looks for data files, for setting how Cantera handles warnings and errors, and how some transitional/legacy features are handled.

The extension() function is used as a decorator for implementations of ExtensibleRate to allow user-defined rate types to be specified from YAML input files.

Classes CanteraError and ThermoModelMethodError are raised for types of errors that are not mapped onto a built-in Python exception type.