Git Product home page Git Product logo

Comments (3)

yoelcortes avatar yoelcortes commented on June 12, 2024

Hi Ben,

To include pure component excess energies, set thermo.mixture.include_excess_energies = True. Unfortunately, it looks like thermo fails to calculate excess enthalpy/entropy at P=350e5, T=298.15.

import thermosteam as tmo
thermo = tmo.Thermo(['H2'])
thermo.mixture.include_excess_energies = True
tmo.settings.set_thermo(thermo)
T = 298.15
feed = tmo.Stream(H2=1, T=T, P=20e5, phase='g')
S0 = feed.S # This works
H0 = feed.H # This works
feed.P = 350e5
feed.T = T
S = feed.S # This fails 
H = feed.H # This also fails

I think Caleb might be able to help you out further on this. You can post an issue in thermo that the following fails:

from thermo.eos import IG, PR 
PR(T=298.15, P=350e5, Tc=33.2, Pc=1296960.0, omega=-0.22).S_dep_g # AttributeError: 'PR' object has no attribute 'S_dep_g'

If you'd like to use coolprop for all thermodyamic properties, one potential solution is to create your own Mixture object that interfaces with coolprop (instead of the default one created by thermosteam):

https://biosteam.readthedocs.io/en/latest/API/thermosteam/mixture/Mixture.html

Hope this helps,
Thanks!

from thermosteam.

yoelcortes avatar yoelcortes commented on June 12, 2024

Hi Ben,

I saw the issue on CalebBell/thermo#118, thanks for posting! Here are the new results with the fallback when phase identification suggests another phase (which doesn't actually matter since it is supercritical).

import thermosteam as tmo
import thermo as tm
thermo = tmo.Thermo([tmo.Chemical('H2', eos=tm.SRK)])
thermo.mixture.include_excess_energies = True
tmo.settings.set_thermo(thermo)
T = 298.15
feed = tmo.Stream(H2=1, T=T, P=20e5, phase='g')
S0 = feed.S # This works
H0 = feed.H # This works
feed.P = 350e5
feed.T = T
S = feed.S 
H = feed.H 
power_cp = H-H0 - T*(S-S0) # 7596 kJ/hr in coolprop
print(f"T*dS: {T*(S-S0):.2f}, dH: {H-H0:.2f}, power_cp: {power_cp:.2f}") # T*dS: -7214.74, dH: 381.30 in coolprop

Output

T*dS: -7261.40, dH: 307.44, power_cp: 7568.85

Note that I'm using SRK, which is the closest we can get to coolprop's HEOS. I'm not sure which one is more accurate (you may need to check literature), but both seem quite close.
EDIT: The calculation of S and H also depends on the Cp model used, so that might also play a role if you see any deviations from literature.

Hope this helps!

from thermosteam.

BenPortner avatar BenPortner commented on June 12, 2024

Hi @yoelcortes,

I think they are close enough. Thank you very much for your help! 😃
I will now close this issue.

from thermosteam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.