ParallelReaction

class thermosteam.reaction.ParallelReaction(reactions)[source]

Create a ParallelReaction object from Reaction objects. When called, it returns the change in material due to all parallel reactions.

Parameters

reactions (Iterable[Reaction]) –

Examples

Run two reactions in parallel:

>>> import thermosteam as tmo
>>> chemicals = tmo.Chemicals(['H2', 'Ethanol', 'CH4', 'O2', 'CO2', 'H2O'], cache=True)
>>> tmo.settings.set_thermo(chemicals)
>>> kwargs = dict(phases='lg', correct_atomic_balance=True)
>>> reaction = tmo.ParallelReaction([
...    #            Reaction definition                    Reactant             Conversion
...    tmo.Reaction('H2,g + O2,g -> 2H2O,g',               reactant='H2',       X=0.7, **kwargs),
...    tmo.Reaction('Ethanol,l + O2,g -> CO2,g + 2H2O,g',  reactant='Ethanol',  X=0.1, **kwargs)
... ])
>>> reaction.reactants # Note that reactants are tuples of phase and ID pairs.
(('g', 'H2'), ('l', 'Ethanol'))
>>> reaction.show()
ParallelReaction (by mol):
index  stoichiometry                            reactant     X[%]
[0]    H2,g + 0.5 O2,g -> H2O,g                 H2,g        70.00
[1]    3 O2,g + Ethanol,l -> 2 CO2,g + 3 H2O,g  Ethanol,l   10.00
>>> s1 = tmo.MultiStream('s1', T=373.15,
...                      l=[('Ethanol', 10)],
...                      g=[('H2', 10), ('CH4', 5), ('O2', 100), ('H2O', 10)])
>>> s1.show() # Before reaction
MultiStream: s1
 phases: ('g', 'l'), T: 373.15 K, P: 101325 Pa
 flow (kmol/hr): (g) H2       10
                     CH4      5
                     O2       100
                     H2O      10
                 (l) Ethanol  10
>>> reaction(s1)
>>> s1.show() # After isothermal reaction
MultiStream: s1
 phases: ('g', 'l'), T: 373.15 K, P: 101325 Pa
 flow (kmol/hr): (g) H2       3
                     CH4      5
                     O2       93.5
                     CO2      2
                     H2O      20
                 (l) Ethanol  9

Reaction items are accessible:

>>> reaction[0].show()
ReactionItem (by mol):
 stoichiometry             reactant    X[%]
 H2,g + 0.5 O2,g -> H2O,g  H2,g       70.00

Note that changing the conversion of a reaction item changes the conversion of its parent reaction set:

>>> reaction[0].X = 0.5
>>> reaction.show()
ParallelReaction (by mol):
index  stoichiometry                            reactant     X[%]
[0]    H2,g + 0.5 O2,g -> H2O,g                 H2,g        50.00
[1]    3 O2,g + Ethanol,l -> 2 CO2,g + 3 H2O,g  Ethanol,l   10.00

Reactions subsets can be made as well:

>>> reaction[:1].show()
ParallelReaction (by mol):
index  stoichiometry             reactant    X[%]
[0]    H2,g + 0.5 O2,g -> H2O,g  H2,g       50.00

Get net reaction conversion of reactants as a material indexer:

>>> mi = reaction.X_net
>>> mi.show()
MaterialIndexer:
 (g) H2        0.5
 (l) Ethanol   0.1
>>> mi['g', 'H2']
0.5

If no phases are specified for a reaction set, the X_net property returns a ChemicalIndexer:

>>> kwargs = dict(correct_atomic_balance=True)
>>> reaction = tmo.ParallelReaction([
...    #            Reaction definition            Reactant             Conversion
...    tmo.Reaction('H2 + O2 -> 2H2O',             reactant='H2',       X=0.7, **kwargs),
...    tmo.Reaction('Ethanol + O2 -> CO2 + 2H2O',  reactant='Ethanol',  X=0.1, **kwargs)
... ])
>>> ci = reaction.X_net
>>> ci.show()
ChemicalIndexer:
 H2       0.7
 Ethanol  0.1
>>> ci['H2']
0.7
force_reaction(material)[source]

React material ignoring feasibility checks.

adiabatic_reaction(stream)[source]

React stream material adiabatically, accounting for the change in enthalpy due to the heat of reaction.

Examples

Note how the stream temperature changed after the reaction due to the heat of reaction:

>>> import thermosteam as tmo
>>> chemicals = tmo.Chemicals(['H2', 'CH4', 'O2', 'CO2', 'H2O'], cache=True)
>>> tmo.settings.set_thermo(chemicals)
>>> reaction = tmo.ParallelReaction([
...    #            Reaction definition          Reactant    Conversion
...    tmo.Reaction('2H2 + O2 -> 2H2O',        reactant='H2',  X=0.7),
...    tmo.Reaction('CH4 + O2 -> CO2 + 2H2O',  reactant='CH4', X=0.1)
... ])
>>> s1 = tmo.Stream('s1', H2=10, CH4=5, O2=100, H2O=100, T=373.15, phase='g')
>>> s2 = tmo.Stream('s2')
>>> s1.show() # Before reaction
Stream: s1
 phase: 'g', T: 373.15 K, P: 101325 Pa
 flow (kmol/hr): H2   10
                 CH4  5
                 O2   100
                 H2O  100
>>> reaction.show()
ParallelReaction (by mol):
index  stoichiometry            reactant    X[%]
[0]    H2 + 0.5 O2 -> H2O       H2         70.00
[1]    CH4 + O2 -> CO2 + 2 H2O  CH4        10.00
>>> reaction.adiabatic_reaction(s1)
>>> s1.show() # After adiabatic reaction
Stream: s1
 phase: 'g', T: 666.21 K, P: 101325 Pa
 flow (kmol/hr): H2   3
                 CH4  4.5
                 O2   96
                 CO2  0.5
                 H2O  108
reduce()[source]

Return a new Parallel reaction object that combines reaction with the same reactant together, reducing the number of reactions.

property X_net

[ChemicalIndexer] Net reaction conversion of reactants.