Bases: object
A class which stores data about a reaction and its rate parameterization sothat it can be added to a Kinetics object.
- Parameters
reactants – Value used to set reactants
products – Value used to set products
The static methods listFromFile, listFromYaml, listFromCti, andlistFromXml can be used to create lists of Reaction objects fromexisting definitions in the YAML, CTI, or XML formats. All of the followingwill produce a list of the 325 reactions which make up the GRI 3.0mechanism:
R = ct.Reaction.listFromFile('gri30.yaml', gas)R = ct.Reaction.listFromCti(open('path/to/gri30.cti').read())R = ct.Reaction.listFromXml(open('path/to/gri30.xml').read())
where gas
is a Solution object with the appropriate thermodynamic model,which is the ideal-gas
model in this case.
The static method listFromYaml can be used to create lists of Reactionobjects from a YAML list:
rxns = ''' - equation: O + H2 <=> H + OH rate-constant: {A: 3.87e+04, b: 2.7, Ea: 6260.0} - equation: O + HO2 <=> OH + O2 rate-constant: {A: 2.0e+13, b: 0.0, Ea: 0.0}'''R = ct.Reaction.listFromYaml(rxns, gas)
The methods fromYaml, fromCti, and fromXml can be used to createindividual Reaction objects from definitions in these formats. In the caseof using YAML or CTI definitions, it is important to verify that either thepre-exponential factor and activation energy are supplied in SI units, orthat they have their units specified:
R = ct.Reaction.fromYaml('''{equation: O + H2 <=> H + OH, rate-constant: {A: 3.87e+04 cm^3/mol/s, b: 2.7, Ea: 6260 cal/mol}}''', gas)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 infiltering operations.
allow_negative_orders
¶Get/Set a flag which is
True
if negative reaction orders are allowed.Default isFalse
.
allow_nonreactant_orders
¶Get/Set a flag which is
True
if reaction orders can be specified fornon-reactant species. Default isFalse
.
equation
¶A string giving the chemical equation for this reaction. Determinedautomatically based on reactants and products.
- static
fromCti
(text)¶ Create a Reaction object from its CTI string representation.
Deprecated since version 2.5: The CTI input format is deprecated and will be removed in Cantera 3.0.
- static
fromXml
(text)¶ Create a Reaction object from its XML string representation.
Deprecated since version 2.5: The XML input format is deprecated and will be removed in Cantera 3.0.
- static
fromYaml
(text, Kinetics kinetics)¶ Create a Reaction object from its YAML string representation.
- Parameters
text – The YAML reaction string
kinetics – A Kinetics object whose associated phase(s) contain the speciesinvolved in the reaction.
- static
listFromCti
(text)¶ Create a list of Reaction objects from all the reactions defined in aCTI string.
Deprecated since version 2.5: The CTI input format is deprecated and will be removed in Cantera 3.0.
- static
listFromFile
(filename, Kinetics kinetics=None, section=u'reactions')¶ Create a list of Reaction objects from all of the reactions defined in aYAML, CTI, or XML file.
For YAML input files, a Kinetics object is required as the secondargument, and reactions from the section section will be returned.
Directories on Cantera’s input file path will be searched for thespecified file.
In the case of an XML file, the
<reactions>
nodes are assumed to bechildren of the<reactionsData>
node in a document with a<ctml>
root node, as in the XML files produced by conversion from CTI files.Deprecated since version 2.5: The CTI and XML input formats are deprecated and will be removed inCantera 3.0.
- static
listFromXml
(text)¶ Create a list of Reaction objects from all the reaction defined in anXML string. The
<reaction>
nodes are assumed to be children of the<reactionData>
node in a document with a<ctml>
root node, as inthe XML files produced by conversion from CTI files.Deprecated since version 2.5: The XML input format is deprecated and will be removed in Cantera 3.0.
- static
listFromYaml
(text, Kinetics kinetics)¶ Create a list of Reaction objects from all the reactions defined in aYAML string.
orders
¶Get/Set the reaction order with respect to specific species as a dictwith species names as the keys and orders as the values, or as acomposition string. By default, mass-action kinetics is assumed, withthe reaction order for each reactant species equal to each itsstoichiometric coefficient.
product_string
¶A string representing the products side of the chemical equation forthis reaction. Determined automatically based on products.
products
¶Get/Set the products in this reaction as a dict where the keys arespecies 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 forthis reaction. Determined automatically based on reactants.
reactants
¶Get/Set the reactants in this reaction as a dict where the keys arespecies 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'
.