[CTI/CTML] Add 'nonreactant_orders' option to allow non-reactant orders

The flag 'allow_nonreactant_orders' in class Reaction is set to 'true' when
using this option in cti/ctml.

Resolves #317
Resolves #321
This commit is contained in:
imitrichev 2016-02-05 00:06:05 +04:00 committed by Ray Speth
parent f0e6d090dc
commit 7e71645efb
3 changed files with 21 additions and 4 deletions

View file

@ -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
@ -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

View file

@ -1110,7 +1110,8 @@ class reaction(object):
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
@ -1137,10 +1138,12 @@ class reaction(object):
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 = []
@ -1211,6 +1214,8 @@ class reaction(object):
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)

View file

@ -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);
}