ReactionSystem#

class ReactionSystem(*reactions, basis=None)[source]#

Create a ReactionSystem object that can react a stream across a series of reactions.

Parameters:

*reactions (Reaction, ParallelReaction, or SeriesReaction) – All reactions within the reaction system.

Examples

Create a reaction system for cellulosic fermentation of biomass:

>>> from thermosteam import Rxn, RxnSys, PRxn, SRxn, settings, Chemical, Stream
>>> cal2joule = 4.184
>>> Glucan = Chemical('Glucan', search_db=False, formula='C6H10O5', Hf=-233200*cal2joule, phase='s', default=True)
>>> Glucose = Chemical('Glucose', phase='s')
>>> CO2 = Chemical('CO2', phase='g')
>>> HMF = Chemical('HMF', search_ID='Hydroxymethylfurfural', phase='l', default=True)
>>> Biomass = Glucose.copy(ID='Biomass')
>>> settings.set_thermo(['Water', 'Ethanol', 'LacticAcid', HMF, Glucose, Glucan, CO2, Biomass])
>>> saccharification = PRxn([
...     Rxn('Glucan + H2O -> Glucose', reactant='Glucan', X=0.9),
...     Rxn('Glucan -> HMF + 2H2O', reactant='Glucan', X=0.025)
... ])
>>> fermentation = SRxn([
...     Rxn('Glucose -> 2LacticAcid', reactant='Glucose', X=0.03),
...     Rxn('Glucose -> 2Ethanol + 2CO2', reactant='Glucose', X=0.95),
... ])
>>> cell_growth = Rxn('Glucose -> Biomass', reactant='Glucose', X=1.0)
>>> cellulosic_rxnsys = RxnSys(saccharification, fermentation, cell_growth)
>>> cellulosic_rxnsys.show()
ReactionSystem:
[0]  ParallelReaction (by mol):
     index  stoichiometry              reactant    X[%]
     [0]    Water + Glucan -> Glucose  Glucan     90.00
     [1]    Glucan -> 2 Water + HMF    Glucan      2.50
[1]  SeriesReaction (by mol):
     index  stoichiometry                 reactant    X[%]
     [0]    Glucose -> 2 LacticAcid       Glucose     3.00
     [1]    Glucose -> 2 Ethanol + 2 CO2  Glucose    95.00
[2]  Reaction (by mol):
     stoichiometry       reactant    X[%]
     Glucose -> Biomass  Glucose   100.00

Compute the flux of glucan through saccharification reactions:

>>> feed = Stream('feed', Glucan=1.0, Water=5.0)
>>> cellulosic_rxnsys.reactant_flux(feed, index=0)
0.925

Compute the flux of glucan through glucan to glucose saccharification:

>>> cellulosic_rxnsys.reactant_flux(feed, index=0, subindex=0)
0.9

Compute the flux of glucose through cell growth:

>>> cellulosic_rxnsys.reactant_flux(feed, index=2)
0.04365

Compute the flux of glucose through ethanol production:

>>> cellulosic_rxnsys.reactant_flux(feed, index=1, subindex=1)
0.8293

Notice how reacting the stream leads to ethanol production equivalent of 2x the glucose flux to that reaction:

>>> cellulosic_rxnsys(feed)
>>> feed.show()
Stream: feed
phase: 'l', T: 298.15 K, P: 101325 Pa
flow (kmol/hr): Water       4.15
                Ethanol     1.66
                LacticAcid  0.054
                HMF         0.025
                Glucan      0.075
                CO2         1.66
                Biomass     0.0437
force_reaction(material)#

React material ignoring feasibility checks.

adiabatic_reaction(stream)#

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

Examples

Note how the stream temperature changes after each reaction due to the heat of reaction. Adiabatic combustion of hydrogen:

>>> import thermosteam as tmo
>>> chemicals = tmo.Chemicals(['H2', 'O2', 'H2O'], cache=True)
>>> tmo.settings.set_thermo(chemicals)
>>> reaction = tmo.Reaction('2H2 + O2 -> 2H2O', reactant='H2', X=0.7)
>>> s1 = tmo.Stream('s1', H2=10, O2=20, H2O=1000, T=373.15, phase='g')
>>> s2 = tmo.Stream('s2')
>>> s2.copy_like(s1) # s1 and s2 are the same
>>> s1.show() # Before reaction
Stream: s1
phase: 'g', T: 373.15 K, P: 101325 Pa
flow (kmol/hr): H2   10
                O2   20
                H2O  1e+03
>>> reaction.show()
Reaction (by mol):
stoichiometry       reactant    X[%]
H2 + 0.5 O2 -> H2O  H2         70.00
>>> reaction(s1)
>>> s1.show() # After isothermal reaction
Stream: s1
phase: 'g', T: 373.15 K, P: 101325 Pa
flow (kmol/hr): H2   3
                O2   16.5
                H2O  1.01e+03
>>> reaction.adiabatic_reaction(s2)
>>> s2.show() # After adiabatic reaction
Stream: s2
phase: 'g', T: 421.6 K, P: 101325 Pa
flow (kmol/hr): H2   3
                O2   16.5
                H2O  1.01e+03

Adiabatic combustion of H2 and CH4:

>>> 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.38 K, P: 101325 Pa
flow (kmol/hr): H2   3
                CH4  4.5
                O2   96
                CO2  0.5
                H2O  108

Sequential combustion of CH4 and CO:

>>> import thermosteam as tmo
>>> chemicals = tmo.Chemicals(['CH4', 'CO','O2', 'CO2', 'H2O'], cache=True)
>>> tmo.settings.set_thermo(chemicals)
>>> reaction = tmo.SeriesReaction([
...     #            Reaction definition                 Reactant       Conversion
...     tmo.Reaction('2CH4 + 3O2 -> 2CO + 4H2O',       reactant='CH4',    X=0.7),
...     tmo.Reaction('2CO + O2 -> 2CO2',               reactant='CO',     X=0.1)
...     ])
>>> s1 = tmo.Stream('s1', CH4=5, O2=100, H2O=100, T=373.15, phase='g')
>>> s1.show() # Before reaction
Stream: s1
phase: 'g', T: 373.15 K, P: 101325 Pa
flow (kmol/hr): CH4  5
                O2   100
                H2O  100
>>> reaction.show()
SeriesReaction (by mol):
index  stoichiometry               reactant    X[%]
[0]    CH4 + 1.5 O2 -> CO + 2 H2O  CH4        70.00
[1]    CO + 0.5 O2 -> CO2          CO         10.00
>>> reaction.adiabatic_reaction(s1)
>>> s1.show() # After adiabatic reaction
Stream: s1
phase: 'g', T: 650.01 K, P: 101325 Pa
flow (kmol/hr): CH4  1.5
                CO   3.15
                O2   94.6
                CO2  0.35
                H2O  107
X_net(indexer=False)[source]#

Return net reaction conversion of reactants as a dictionary or a ChemicalIndexer if indexer is True.

reactant_flux(material, index, subindex=None)[source]#

Return the amount of reactant being reacted in a reaction.

Parameters:
  • material (Stream or array) – Material entering reaction system.

  • index (int) – Index of reaction to calculate reactant flux.

  • subindex (int, optional) – Subindex of reaction to calculate reactant flux.