Cantera/CTI Files/Reactions: Difference between revisions
From charlesreid1
| Line 3: | Line 3: | ||
=Reaction Specification= | =Reaction Specification= | ||
Processing of reactions in CTI files occurs in the file <code>ctml_writer.py</code>, located in <code>cantera/interfaces/python/ctml_writer.py</code>. This class is defined around line 968 or so | Processing of reactions in CTI files occurs in the file <code>ctml_writer.py</code>, located in <code>cantera/interfaces/python/ctml_writer.py</code>. This class is defined around line 968 or so. | ||
The file uses special notation for things that the CTI interpreter knows how to understand. For example, the reaction direction can be specified using different symbols: | |||
forward reactions are specified using <code>=></code>, reverse reactions are specified using <code><=</code>, and reversible reactions are specified using <code><=></code>, like this: | |||
<pre> | <pre> | ||
Revision as of 23:16, 29 January 2014
Main Cantera page on CTI files: Cantera/CTI Files
Reaction Specification
Processing of reactions in CTI files occurs in the file ctml_writer.py, located in cantera/interfaces/python/ctml_writer.py. This class is defined around line 968 or so.
The file uses special notation for things that the CTI interpreter knows how to understand. For example, the reaction direction can be specified using different symbols:
forward reactions are specified using =>, reverse reactions are specified using <=, and reversible reactions are specified using <=>, like this:
A + B => C G <= E + F W + X <=> Y + Z
Gas Reactions
An example gas reaction CTI file is located at cantera/data/inputs/h2o2.cti.
In general, the gas phase reaction rate can be modeled as:
$ r_{j} = k_j \sum_{i} \nu_{ij} c_{i}^{n_{ij}} $
where $ \nu_{ij} $ is the stoichiometric coefficient for species i in reaction j, $ c_i $ is the molar concentration of species i, and $ n_{ij} $ is the order of reaction j with respect to species i.
Arrhenius Gas Kinetics
The standard way to model reaction kinetics in the gas phase is to use Arrhenius kinetics. This models the reaction rate constant $ k_j $ as:
$ k_j = A_j T^{b_j} \exp \left( - \dfrac{ E_j }{ RT } \right) $
where the Arrhenius reaction parameters are:
- $ A_j $ - Arrhenius parameter pre-exponential factor
- $ b_j $ - Arrhenius parameter, degree of temperature influence on kinetic rate constant
- $ E_j $ - Arrhenius parameter, activation energy of reaction
These quantities can be specified in a CTI file as follows:
reaction( "A + B => C + D", [A, b, E] )
and the units of each are:
- $ A_j $ - specified in units of $ \frac{ \text{cm}^3 }{ \text{mol} \cdot \text{s} } $
- $ b_j $ - dimensionless
- $ E_j $ - specified in units of $ \frac{ \text{cal} }{ \text{mol} } $
Arrhenius Gas Kinetics Example
Example:
Specify the reaction
$ \text{H} + \text{O}_2 \rightarrow \text{O} + \text{OH} $
which has the following parameter values:
$ A = 3.54700E+15 \quad \frac{ \text{cm}^3 }{ \text{mol} \cdot \text{s} } $
$ b = -0.406 $
$ E = 16599 \quad \frac{ \text{cal} }{ \text{mol} } $
Result:
reaction( "H + O2 <=> O + OH", [3.54700E+15, -0.406, 16599])
Arrhenius Gas Kinetics Code
More information on what blocks of code process this stuff from the CTI file.
Three-Body Gas Reactions
A three body gas reaction is... I don't know.
three_body_reaction( "H2 + M <=> H + H + M", [4.57700E+19, -1.4, 104380],
efficiencies = " AR:0 CO:1.9 CO2:3.8 H2:2.5 H2O:12 HE:0 ")
Three Body Gas Reactions Example
It would help if I could figure out what this reaction type is, before putting together an example.
Three Body Gas Reactions Code
When Cantera processes a CTI file, it determines what kind of kinetics object to use. If the kinetics is for a gas phase, the object is a GasKinetics object. The GasKinetics object has a GasKinetics::addReaction() method, which is run for each reaction in the CTI file:
void GasKinetics::
addReaction(ReactionData& r)
{
switch (r.reactionType) {
case ELEMENTARY_RXN:
addElementaryReaction(r);
break;
case THREE_BODY_RXN:
addThreeBodyReaction(r);
break;
case FALLOFF_RXN:
addFalloffReaction(r);
break;
case PLOG_RXN:
addPlogReaction(r);
break;
case CHEBYSHEV_RXN:
addChebyshevReaction(r);
break;
default:
throw CanteraError("GasKinetics::addReaction", "Invalid reaction type specified");
}
The three body reaction computation is set up in GasKinetics::addThreeBodyReaction:
void GasKinetics::
addThreeBodyReaction(ReactionData& r)
{
// install rate coeff calculator
size_t iloc = m_rates.install(reactionNumber(), r);
// add constant term to rate coeff value vector
m_rfn.push_back(r.rateCoeffParameters[0]);
// forward rxn order equals number of reactants + 1
m_fwdOrder.push_back(r.reactants.size() + 1);
m_3b_concm.install(reactionNumber(), r.thirdBodyEfficiencies,
r.default_3b_eff);
registerReaction(reactionNumber(), THREE_BODY_RXN, iloc);
}
Falloff Gas Reactions
falloff_reaction( "H + O2 (+ M) <=> HO2 (+ M)",
kf = [1.47500E+12, 0.6, 0],
kf0 = [6.36600E+20, -1.72, 524.8],
falloff = Troe(A = 0.8, T3 = 1e-30, T1 = 1e+30),
efficiencies = " CO:1.9 CO2:3.8 H2:2 H2O:11 O2:0.78 ")
Falloff Gas Reaction Example
Falloff Gas Reaction Code
Other Gas Reaction Options
Duplicate is the only option I see:
reaction( "HO2 + HO2 <=> H2O2 + O2", [1.30000E+11, 0, -1629.3],
options = ["duplicate"])
Surface Reactions
Any surface reaction can be specified in the cti file using the surface_reaction function. The usage depends on the surface reaction form.
There are a variety of forms of surface reactions, each with a different specification method.
An example surface reaction CTI file is located at cantera/data/inputs/ptcombust.cti.
Arrhenius Surface Kinetics
The plain/default way, which uses Arrhenius kinetics:
surface_reaction( "A(s) => B(s) + C", [A, b, E])
where:
- A(s), B(s), C - species whose properties are defined in the species section (see above)
- A - Arrhenius parameter, pre-exponential factor (specified in units of...)
- b - Arrhenius parameter, degree of temperature influence on kinetic rate constant
- E - Arrhenius parameter, activation energy of reaction
The Arrhenius expression is:
$ k = A T^b \exp \left( \frac{E}{RT} \right) $
Arrhenius Surface Kinetics Example
A catalytic reaction where H2O (adsorbed onto a platinum surface) desorbs would look like this:
surface_reaction( "H2O(S) => H2O + PT(S)", [1.00000E+13, 0, 40300])
Arrhenius Surface Kinetics Code
Not sure where this is dealt with in the Cantera code.
Surface Reactions with Coverage-Dependent Rates
Still working through this coverage dependency.
This uses some kind of expression containing a, m, and e.
surface_reaction( "A(s) => B(s) + C", Arrhenius(A, b, E, coverage=['A(s)', surface_a, surface_m, surface_e])
Attempting to uncover how this is dealt with:
importKinetics::getCoverageDependence() rdata.cov vector contains coverage-related parameters/information rdata.cov.push_back(species_index) rdata.cov.push_back(a) rdata.cov.push_back(m) rdata.cov.push_back(e)
and then
InterfaceKinetics::addElementaryReaction
if r.cov.size > 3:
this rxn is dependent on coverage
register rxn
Surface Reactions with Sticking Equations
No idea how this works.
surface_reaction( "A + B(s) => C + D(s)", stick(1.00000E+00, 0, 0))
Sticking Surface Reactions Example
surface_reaction( "OH + PT(S) => OH(S)", stick(1.00000E+00, 0, 0))
Sticking Surface Reactions Code
Dunno
Surface Reactions with Falloff
No idea.
Surface Reactions with Falloff Example
To do
Surface Reactions with Falloff Code
To do
Other Surface Reaction Options
surface_reaction( "O2 + 2 PT(S) => 2 O(S)", Arrhenius(1.80000E+21, -0.5, 0),
options = 'duplicate')