Chemical Kinetics

Kinetics Managers

Kinetics

class cantera.Kinetics(infile='', phaseid='', phases=())

Bases: cantera._cantera._SolutionBase

Instances of class Kinetics are responsible for evaluating reaction rates of progress, species production rates, and other quantities pertaining to a reaction mechanism.

add_reaction(self, Reaction rxn)

Add a new reaction to this phase.

creation_rates

Creation rates for each species. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.

delta_enthalpy

Change in enthalpy for each reaction [J/kmol].

delta_entropy

Change in entropy for each reaction [J/kmol/K].

delta_gibbs

Change in Gibbs free energy for each reaction [J/kmol].

delta_standard_enthalpy

Change in standard-state enthalpy (independent of composition) for each reaction [J/kmol].

delta_standard_entropy

Change in standard-state entropy (independent of composition) for each reaction [J/kmol/K].

delta_standard_gibbs

Change in standard-state Gibbs free energy (independent of composition) for each reaction [J/kmol].

destruction_rates

Destruction rates for each species. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.

equilibrium_constants

Equilibrium constants in concentration units for all reactions.

forward_rate_constants

Forward rate constants for all reactions. Units are a combination of kmol, m^3 and s, that depend on the rate expression for the reaction.

forward_rates_of_progress

Forward rates of progress for the reactions. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.

is_reversible(self, int i_reaction)

True if reaction i_reaction is reversible.

kinetics_species_index(self, species, int phase=0)

The index of species species of phase phase within arrays returned by methods of class Kinetics. If species is a string, the phase argument is unused.

modify_reaction(self, int irxn, Reaction rxn)

Modify the Reaction with index irxn to have the same rate parameters as rxn. rxn must have the same reactants and products and be of the same type (i.e. ElementaryReaction, FalloffReaction, PlogReaction, etc.) as the existing reaction. This method does not modify the third-body efficiencies, reaction orders, or reversibility of the reaction.

multiplier(self, int i_reaction)

A scaling factor applied to the rate coefficient for reaction i_reaction. Can be used to carry out sensitivity analysis or to selectively disable a particular reaction. See set_multiplier.

n_phases

Number of phases in the reaction mechanism.

n_reactions

Number of reactions in the reaction mechanism.

n_total_species

Total number of species in all phases participating in the kinetics mechanism.

net_production_rates

Net production rates for each species. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.

net_rates_of_progress

Net rates of progress for the reactions. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.

product_stoich_coeff(self, k_spec, int i_reaction)

The stoichiometric coefficient of species k_spec as a product in reaction i_reaction.

product_stoich_coeffs(self)

The array of product stoichiometric coefficients. Element [k,i] of this array is the product stoichiometric coefficient of species k in reaction i.

products(self, int i_reaction)

The products portion of the reaction equation

reactant_stoich_coeff(self, k_spec, int i_reaction)

The stoichiometric coefficient of species k_spec as a reactant in reaction i_reaction.

reactant_stoich_coeffs(self)

The array of reactant stoichiometric coefficients. Element [k,i] of this array is the reactant stoichiometric coefficient of species k in reaction i.

reactants(self, int i_reaction)

The reactants portion of the reaction equation

reaction(self, int i_reaction)

Return a Reaction object representing the reaction with index i_reaction.

reaction_equation(self, int i_reaction)

The equation for the specified reaction. See also reaction_equations.

reaction_equations(self, indices=None)

Returns a list containing the reaction equation for all reactions in the mechanism (if indices is unspecified) or the equations for each reaction in the sequence indices. For example:

>>> gas.reaction_equations()
['2 O + M <=> O2 + M', 'O + H + M <=> OH + M', 'O + H2 <=> H + OH', ...]
>>> gas.reaction_equations([2,3])
['O + H + M <=> OH + M', 'O + H2 <=> H + OH']

See also reaction_equation.

reaction_phase_index

The index of the phase where the reactions occur.

reaction_type(self, int i_reaction)

Type of reaction i_reaction.

reactions(self)

Return a list of all Reaction objects

reverse_rate_constants

Reverse rate constants for all reactions. Units are a combination of kmol, m^3 and s, that depend on the rate expression for the reaction.

reverse_rates_of_progress

Reverse rates of progress for the reactions. [kmol/m^3/s] for bulk phases or [kmol/m^2/s] for surface phases.

set_multiplier(self, double value, int i_reaction=-1)

Set the multiplier for for reaction i_reaction to value. If i_reaction is not specified, then the multiplier for all reactions is set to value. See multiplier.

InterfaceKinetics

class cantera.InterfaceKinetics(infile='', phaseid='', phases=(), *args, **kwargs)

Bases: cantera._cantera.Kinetics

A kinetics manager for heterogeneous reaction mechanisms. The reactions are assumed to occur at an interface between bulk phases.

advance_coverages(self, double dt)

This method carries out a time-accurate advancement of the surface coverages for a specified amount of time.

get_creation_rates(self, phase)

Creation rates for each species in phase phase. Use the creation_rates property to get the creation rates for species in all phases.

get_destruction_rates(self, phase)

Destruction rates for each species in phase phase. Use the destruction_rates property to get the destruction rates for species in all phases.

get_net_production_rates(self, phase)

Net production rates for each species in phase phase. Use the net_production_rates property to get the net_production rates for species in all phases.

phase_index(self, phase)

Get the index of the phase phase, where phase may specified using the phase object, the name, or the index itself.

Reactions

These classes contain the definition of a single reaction and its associated rate expression, independent of a specific Kinetics object.

Reaction

class cantera.Reaction(reactants='', products='')

Bases: object

A class which stores data about a reaction and its rate parameterization so that it can be added to a Kinetics object.

Parameters:

The static methods listFromFile, listFromCti, and listFromXml can be used to create lists of Reaction objects from existing definitions in the CTI or XML format. All of the following will produce a list of the 325 reactions which make up the GRI 3.0 mechanism:

R = ct.Reaction.listFromFile('gri30.cti')
R = ct.Reaction.listFromCti(open('path/to/gri30.cti').read())
R = ct.Reaction.listFromXml(open('path/to/gri30.xml').read())

The methods fromCti and fromXml can be used to create individual Reaction objects from definitions in these formats. In the case of using CTI definitions, it is important to verify that either the pre-exponential factor and activation energy are supplied in SI units, or that they have their units specified:

R = ct.Reaction.fromCti('''reaction('O + H2 <=> H + OH',
        [3.87e1, 2.7, 2.619184e7])''')

R = ct.Reaction.fromCti('''reaction('O + H2 <=> H + OH',
                [(3.87e4, 'cm3/mol/s'), 2.7, (6260, 'cal/mol')])''')
ID

Get/Set the identification string for the reaction, which can be used in filtering operations.

allow_negative_orders

Get/Set a flag which is True if negative reaction orders are allowed. Default is False.

allow_nonreactant_orders

Get/Set a flag which is True if reaction orders can be specified for non-reactant species. Default is False.

duplicate

Get/Set a flag which is True if this reaction is marked as a duplicate or False otherwise.

equation

A string giving the chemical equation for this reaction. Determined automatically based on reactants and products.

static fromCti(text)

Create a Reaction object from its CTI string representation.

static fromXml(text)

Create a Reaction object from its XML string representation.

static listFromCti(text)

Create a list of Species objects from all the species defined in a CTI string.

static listFromFile(filename)

Create a list of Reaction objects from all of the reactions defined in a CTI or XML file.

Directories on Cantera’s input file path will be searched for the specified file.

In the case of an XML file, the <reactions> nodes are assumed to be children of the <reactionsData> node in a document with a <ctml> root node, as in the XML files produced by conversion from CTI files.

static listFromXml(text)

Create a list of Reaction objects from all the reaction defined in an XML string. The <reaction> nodes are assumed to be children of the <reactionData> node in a document with a <ctml> root node, as in the XML files produced by conversion from CTI files.

orders

Get/Set the reaction order with respect to specific species as a dict with species names as the keys and orders as the values, or as a composition string. By default, mass-action kinetics is assumed, with the reaction order for each reactant species equal to each its stoichiometric coefficient.

product_string

A string representing the products side of the chemical equation for this reaction. Determined automatically based on products.

products

Get/Set the products in this reaction as a dict where the keys are species names and the values, are the stoichiometric coefficients, e.g. {'CH3':1, 'H2O':1}, or as a composition string, e.g. 'CH3:1, H2O:1'.

reactant_string

A string representing the reactants side of the chemical equation for this reaction. Determined automatically based on reactants.

reactants

Get/Set the reactants in this reaction as a dict where the keys are species names and the values, are the stoichiometric coefficients, e.g. {'CH4':1, 'OH':1}, or as a composition string, e.g. 'CH4:1, OH:1'.

reversible

Get/Set a flag which is True if this reaction is reversible or False otherwise.

ElementaryReaction

class cantera.ElementaryReaction(reactants='', products='')

Bases: cantera._cantera.Reaction

A reaction which follows mass-action kinetics with a modified Arrhenius reaction rate.

allow_negative_pre_exponential_factor

Get/Set whether the rate coefficient is allowed to have a negative pre-exponential factor.

rate

Get/Set the Arrhenius rate coefficient for this reaction.

ThreeBodyReaction

class cantera.ThreeBodyReaction(reactants='', products='')

Bases: cantera._cantera.ElementaryReaction

A reaction with a non-reacting third body “M” that acts to add or remove energy from the reacting species.

default_efficiency

Get/Set the default third-body efficiency for this reaction, used for species used for species not in efficiencies.

efficiencies

Get/Set a dict defining non-default third-body efficiencies for this reaction, where the keys are the species names and the values are the efficiencies.

efficiency(self, species)

Get the efficiency of the third body named species considering both the default efficiency and species-specific efficiencies.

FalloffReaction

class cantera.FalloffReaction(reactants='', products='')

Bases: cantera._cantera.Reaction

A reaction that is first-order in [M] at low pressure, like a third-body reaction, but zeroth-order in [M] as pressure increases.

default_efficiency

Get/Set the default third-body efficiency for this reaction, used for species used for species not in efficiencies.

efficiencies

Get/Set a dict defining non-default third-body efficiencies for this reaction, where the keys are the species names and the values are the efficiencies.

efficiency(self, species)

Get the efficiency of the third body named species considering both the default efficiency and species-specific efficiencies.

falloff

Get/Set the Falloff function used to blend the high- and low-pressure rate coefficients

high_rate

Get/Set the Arrhenius rate constant in the high-pressure limit

low_rate

Get/Set the Arrhenius rate constant in the low-pressure limit

ChemicallyActivatedReaction

class cantera.ChemicallyActivatedReaction(reactants='', products='')

Bases: cantera._cantera.FalloffReaction

A reaction where the rate decreases as pressure increases due to collisional stabilization of a reaction intermediate. Like a FalloffReaction, except that the forward rate constant is written as being proportional to the low- pressure rate constant.

PlogReaction

class cantera.PlogReaction(reactants='', products='')

Bases: cantera._cantera.Reaction

A pressure-dependent reaction parameterized by logarithmically interpolating between Arrhenius rate expressions at various pressures.

rates

Get/Set the rate coefficients for this reaction, which are given as a list of (pressure, Arrhenius) tuples.

ChebyshevReaction

class cantera.ChebyshevReaction(reactants='', products='')

Bases: cantera._cantera.Reaction

A pressure-dependent reaction parameterized by a bivariate Chebyshev polynomial in temperature and pressure.

Pmax

Maximum pressure [Pa] for the Chebyshev fit

Pmin

Minimum pressure [Pa] for the Chebyshev fit

Tmax

Maximum temperature [K] for the Chebyshev fit

Tmin

Minimum temperature [K] for the Chebyshev fit

coeffs

2D array of Chebyshev coefficients of size (nTemperature, nPressure).

nPressure

Number of pressures over which the Chebyshev fit is computed

nTemperature

Number of temperatures over which the Chebyshev fit is computed

set_parameters(self, Tmin, Tmax, Pmin, Pmax, coeffs)

Simultaneously set values for Tmin, Tmax, Pmin, Pmax, and coeffs.

InterfaceReaction

class cantera.InterfaceReaction(reactants='', products='')

Bases: cantera._cantera.ElementaryReaction

A reaction occurring on an Interface (i.e. a surface or an edge)

coverage_deps

Get/Set a dict containing adjustments to the Arrhenius rate expression dependent on surface species coverages. The keys of the dict are species names, and the values are tuples specifying the three coverage parameters (a, m, E) which are the modifiers for the pre-exponential factor [m, kmol, s units], the temperature exponent [nondimensional], and the activation energy [J/kmol], respectively.

is_sticking_coefficient

Get/Set a boolean indicating if the rate coefficient for this reaction is expressed as a sticking coefficient rather than the forward rate constant.

sticking_species

The name of the sticking species. Needed only for reactions with multiple non-surface reactant species, where the sticking species is ambiguous.

use_motz_wise_correction

Get/Set a boolean indicating whether to use the correction factor developed by Motz & Wise for reactions with high (near-unity) sticking coefficients when converting the sticking coefficient to a rate coefficient.

Auxilliary Reaction Data

Arrhenius

class cantera.Arrhenius(A, b, E)

Bases: object

A reaction rate coefficient which depends on temperature only and follows the modified Arrhenius form:

\[k_f = A T^b \exp{-\tfrac{E}{RT}}\]

where A is the pre_exponential_factor, b is the temperature_exponent, and E is the activation_energy.

activation_energy

The activation energy E [J/kmol].

pre_exponential_factor

The pre-exponential factor A in units of m, kmol, and s raised to powers depending on the reaction order.

temperature_exponent

The temperature exponent b.

Falloff

class cantera.Falloff(coeffs=(), init=True)

Bases: object

A parameterization used to describe the fall-off in reaction rate constants due to intermolecular energy transfer. These functions are used by reactions defined using the FalloffReaction and ChemicallyActivatedReaction classes.

This base class implements the simple falloff function \(F(T,P_r) = 1.0\).

Parameters:
  • params – Not used for the “simple” falloff parameterization.
  • init – Used internally when wrapping Falloff objects returned from C++.
parameters

The array of parameters used to define this falloff function.

type

A string defining the type of the falloff parameterization

TroeFalloff

class cantera.TroeFalloff(coeffs=(), init=True)

Bases: cantera._cantera.Falloff

The 3- or 4-parameter Troe falloff function.

Parameters:params – An array of 3 or 4 parameters: \([a, T^{***}, T^*, T^{**}]\) where the final parameter is optional (with a default value of 0).

SriFalloff

class cantera.SriFalloff(coeffs=(), init=True)

Bases: cantera._cantera.Falloff

The 3- or 5-parameter SRI falloff function.

Parameters:params – An array of 3 or 5 parameters: \([a, b, c, d, e]\) where the last two parameters are optional (with default values of 1 and 0, respectively).

Reaction Path Analysis

ReactionPathDiagram

class cantera.ReactionPathDiagram(Kinetics kin, str element)

Bases: object

ReactionPathDiagram(Kinetics kin, str element)

Create a reaction path diagram for the fluxes of the element element according the the net reaction rates determined by the Kinetics object kin.

add(self, ReactionPathDiagram other)

Add fluxes from other to this diagram

arrow_width

Get/Set the arrow width. If < 0, then scale with flux value.

bold_color

Get/Set the color for bold lines

bold_threshold

Get/Set the minimum relative flux for bold lines

build(self, verbose=False)

Build the reaction path diagram. Called automatically by methods which return representations of the diagram, e.g. write_dot().

dashed_color

Get/Set the color for dashed lines

display_only(self, int k)
dot_options

Get/Set options for the ‘dot’ program

flow_type

Get/Set the way flows are drawn. Either ‘NetFlow’ or ‘OneWayFlow’

font

Get/Set the name of the font used

get_data(self)

Get a (roughly) human-readable representation of the reaction path diagram.

get_dot(self)

Return a string containing the reaction path diagram formatted for use by Graphviz’s ‘dot’ program.

label_threshold

Get/Set the minimum relative flux for labels

log

Logging messages generated while building the reaction path diagram

normal_color

Get/Set the color for normal-weight lines

normal_threshold

Get/Set the maximum relative flux for dashed lines

scale

Get/Set the scaling factor for the fluxes. Set to -1 to normalize by the maximum net flux.

show_details

Get/Set whether to show the details of which reactions contribute to the flux.

threshold

Get/Set the threshold for the minimum flux relative value that will be plotted.

title

Get/Set the diagram title

write_dot(self, filename)

Write the reaction path diagram formatted for use by Graphviz’s ‘dot’ program to the file named filename.