Skip to content

Commit

Permalink
[CTI/CTML] Add 'nonreactant_orders' option to allow non-reactant orders
Browse files Browse the repository at this point in the history
The flag 'allow_nonreactant_orders' in class Reaction is set to 'true' when
using this option in cti/ctml.

Resolves #317
Resolves #321
  • Loading branch information
imitrichev authored and speth committed Feb 27, 2016
1 parent f0e6d09 commit 7e71645
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 9 additions & 0 deletions doc/sphinx/cti/reactions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ This reaction could be defined as::
Special care is required in this case since the units of the pre-exponential
factor depend on the sum of the reaction orders, which may not be an integer.

Note that you can change reaction orders only for irreversible reactions.

Normally, reaction orders are required to be positive. However, in some cases
negative reaction orders are found to be better fits for experimental data. In
these cases, the default behavior may be overridden by adding
Expand All @@ -491,6 +493,13 @@ these cases, the default behavior may be overridden by adding
reaction("C8H18 + 12.5 O2 => 8 CO2 + 9 H2O", [4.6e11, 0.0, 30.0],
order="C8H18:-0.25 O2:1.75", options=['negative_orders'])

Some global reactions could have reactions orders for non-reactant species. One
should add ``nonreactant_orders`` to the reaction options to use this feature::

reaction("C8H18 + 12.5 O2 => 8 CO2 + 9 H2O", [4.6e11, 0.0, 30.0],
order="C8H18:-0.25 CO:0.15",
options=['negative_orders', 'nonreactant_orders'])


.. rubric:: References

Expand Down
13 changes: 9 additions & 4 deletions interfaces/cython/cantera/ctml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,8 @@ def __init__(self,
e.g. ``"CH4:0.25 O2:1.5"``.
:param options: Processing options, as described in
:ref:`sec-reaction-options`. May be one or more (as a list) of the
following: 'skip', 'duplicate', 'negative_A', 'negative_orders'.
following: 'skip', 'duplicate', 'negative_A', 'negative_orders',
'nonreactant_orders'.
"""
self._id = id
self._e = equation
Expand All @@ -1137,10 +1138,12 @@ def __init__(self,
if self._order:
order = getPairs(self._order)
for o in order.keys():
if o in self._rxnorder:
self._rxnorder[o] = order[o]
if (o not in self._rxnorder and
'nonreactant_orders' not in self._options):
raise CTI_Error("order specified for non-reactant: " + o +
" and no 'nonreactant_orders' option given")
else:
raise CTI_Error("order specified for non-reactant: "+o)
self._rxnorder[o] = order[o]

self._kf = kf
self._igspecies = []
Expand Down Expand Up @@ -1211,6 +1214,8 @@ def build(self, p):
r['negative_A'] = 'yes'
if 'negative_orders' in self._options:
r['negative_orders'] = 'yes'
if 'nonreactant_orders' in self._options:
r['nonreactant_orders'] = 'yes'

ee = self._e.replace('<','[').replace('>',']')
r.addChild('equation',ee)
Expand Down
3 changes: 3 additions & 0 deletions src/kinetics/Reaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ void setupElementaryReaction(ElementaryReaction& R, const XML_Node& rxn_node)
if (rxn_node["negative_orders"] == "yes") {
R.allow_negative_orders = true;
}
if (rxn_node["nonreactant_orders"] == "yes") {
R.allow_nonreactant_orders = true;
}
setupReaction(R, rxn_node);
}

Expand Down

0 comments on commit 7e71645

Please sign in to comment.