[Python] Reactants and products can be specified in Reaction constructor
This commit is contained in:
parent
9824edcb86
commit
d470486bee
3 changed files with 20 additions and 15 deletions
|
|
@ -11,28 +11,28 @@ Reactions
|
|||
These classes contain the definition of a single reaction and its associated
|
||||
rate expression, indepenent of a specific `Kinetics` object.
|
||||
|
||||
.. autoclass:: Reaction
|
||||
.. autoclass:: Reaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: ElementaryReaction
|
||||
.. autoclass:: ElementaryReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: ThirdBodyReaction
|
||||
.. autoclass:: ThirdBodyReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: FalloffReaction
|
||||
.. autoclass:: FalloffReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: ChemicallyActivatedReaction
|
||||
.. autoclass:: ChemicallyActivatedReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: PlogReaction
|
||||
.. autoclass:: PlogReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: ChebyshevReaction
|
||||
.. autoclass:: ChebyshevReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
.. autoclass:: InterfaceReaction
|
||||
.. autoclass:: InterfaceReaction(reactants='', products='')
|
||||
:no-undoc-members:
|
||||
|
||||
Auxilliary Reaction Data
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@ cdef class Reaction:
|
|||
A class which stores data about a reaction and its rate parameterization so
|
||||
that it can be added to a `Kinetics` object.
|
||||
|
||||
:param reactants:
|
||||
Value used to set `reactants`
|
||||
:param products:
|
||||
Value used to set `products`
|
||||
|
||||
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
|
||||
|
|
@ -40,10 +45,14 @@ cdef class Reaction:
|
|||
"""
|
||||
reaction_type = 0
|
||||
|
||||
def __cinit__(self, *args, init=True, **kwargs):
|
||||
def __cinit__(self, reactants='', products='', init=True, **kwargs):
|
||||
if init:
|
||||
self._reaction.reset(newReaction(self.reaction_type))
|
||||
self.reaction = self._reaction.get()
|
||||
if reactants:
|
||||
self.reactants = reactants
|
||||
if products:
|
||||
self.products = products
|
||||
|
||||
cdef _assign(self, shared_ptr[CxxReaction] other):
|
||||
self._reaction = other
|
||||
|
|
|
|||
|
|
@ -645,9 +645,7 @@ class TestReaction(utilities.CanteraTest):
|
|||
self.assertEqual(eq1, eq2)
|
||||
|
||||
def test_elementary(self):
|
||||
r = ct.ElementaryReaction()
|
||||
r.reactants = {'O':1, 'H2':1}
|
||||
r.products = {'H':1, 'OH':1}
|
||||
r = ct.ElementaryReaction({'O':1, 'H2':1}, {'H':1, 'OH':1})
|
||||
r.rate = ct.Arrhenius(3.87e1, 2.7, 6260*1000*4.184)
|
||||
|
||||
gas2 = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
|
||||
|
|
@ -676,9 +674,7 @@ class TestReaction(utilities.CanteraTest):
|
|||
self.gas.net_rates_of_progress[1])
|
||||
|
||||
def test_falloff(self):
|
||||
r = ct.FalloffReaction()
|
||||
r.reactants = 'OH:2'
|
||||
r.products = 'H2O2:1'
|
||||
r = ct.FalloffReaction('OH:2', 'H2O2:1')
|
||||
r.high_rate = ct.Arrhenius(7.4e10, -0.37, 0.0)
|
||||
r.low_rate = ct.Arrhenius(2.3e12, -0.9, -1700*1000*4.184)
|
||||
r.falloff = ct.TroeFalloff((0.7346, 94, 1756, 5182))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue