thermosteam icon indicating copy to clipboard operation
thermosteam copied to clipboard

Account for phase changes in adiabatic reactions

Open BenPortner opened this issue 2 years ago • 1 comments

Dear @yoelcortes,

It seems that thermosteam does currently not or incorrectly account for phase changes during adiabatic reactions. Using electrolysis of steam as an example:

import thermosteam as tmo

tmo.settings.set_thermo(["H2O", "O2", "H2"])
electrolysis = tmo.Reaction(
    'H2O -> O2 + H2', # Reaction
    correct_atomic_balance=True,
    reactant='H2O',
    X=0.13,
)
feed = tmo.Stream(H2O=1, T=900+273.15, P=1e5, units='kg/s', phase='g') # H2O is gaseous here
electrolysis.adiabatic_reaction(feed)
feed.show() # H2O should be liquid here

"""
Stream: s2
 phase: 'g', T: 79.243 degC, P: 1 bar
 flow (kg/s): H2O  0.87
              O2   0.115
              H2   0.0145
"""

Expected behavior

Water is liquid at 79°C and 1 bar. After the reaction, feed should be a MultiStream with water in the liquid phase and oxygen and hydrogen in the gas phase.

Current behavior

Water remains in gaseous state.

Similar issues

The issue is loosely related to https://github.com/BioSTEAMDevelopmentGroup/thermosteam/issues/29 and https://github.com/BioSTEAMDevelopmentGroup/thermosteam/issues/62.

BenPortner avatar Jul 19 '22 14:07 BenPortner

Hi Ben,

Thanks for posting this issue! Thermosteam reaction objects do not perform phase equilibrium (yet). You can perform phase equilibrium with just adding one line:

import thermosteam as tmo

tmo.settings.set_thermo(["H2O", "O2", "H2"])
electrolysis = tmo.Reaction(
    'H2O -> O2 + H2', 
    correct_atomic_balance=True,
    reactant='H2O',
    X=0.13,
)
feed = tmo.Stream(H2O=1, T=900+273.15, P=1e5, units='kg/s', phase='g')
electrolysis.adiabatic_reaction(feed)
feed.vle(H=feed.H, P=feed.P) # ADD THIS LINE!
feed.show()

Output:

MultiStream: s2
 phases: ('g', 'l'), T: 367.13 K, P: 100000 Pa
 flow (kmol/hr): (g) H2O  171
                     O2   13
                     H2   26
                 (l) H2O  2.53
                     O2   1.34e-05
                     H2   3.58e-08

I'd be happy to add a note/warning on this in the documentation. It may be a good idea to add a phase equilibrium feature as an optional argument just like Stream objects, but it may take me a while due to:

  • Reaction objects would need to handle when phases are given (ignore given phases and perform vlle or raise error).
  • It cannot be used if solids are present.
  • Reaction objects are designed to work with arrays too (not just stream objects).
  • Require optional P argument.
  • VLLE is still clunky with supercritical mixtures.
  • Additional documentation required.

I'll leave this issue open so that I can remember to get to it, Thanks!

yoelcortes avatar Jul 19 '22 15:07 yoelcortes