CalebBell / thermo

Thermodynamics and Phase Equilibrium component of Chemical Engineering Design Library (ChEDL)
MIT License
594 stars 114 forks source link

Question regarding hydrogen `HeatCapacityGas.T_limits` for `COOLPROP` method #120

Closed BenPortner closed 1 year ago

BenPortner commented 1 year ago

Hi @CalebBell,

Thermo shows the following temperature limits for the HeatCapacityGas class using hydrogen (code below). For COOLPROP, a maximum temperature corresponding to T_crit = 33.145 K is given. However, in CoolProp's documentation, a limit of 1000 K is given. Is there a specific reason why the recommended range in thermo is smaller?

from thermo import HeatCapacityGas

c = HeatCapacityGas(CASRN="1333-74-0", MW=2.01588, similarity_variable=0.9921225469770025, extrapolation="nolimit", method="TRCIG")

c.T_limits
"""
{'WEBBOOK_SHOMATE': (298.0, 6000.0),
 'TRCIG': (50.0, 5000.0),
 'POLING_POLY': (50.0, 1000.0),
 'POLING_CONST': (248.14999999999998, 348.15),
 'CRCSTD': (248.14999999999998, 348.15),
 'VDI_TABULAR': (20.37, 32.0),
 'COOLPROP': (13.957, 33.145),
 'LASTOVKA_SHAW': (0.001, 100000.0)}
"""

Thank you! Ben

CalebBell commented 1 year ago

Hey Ben, The reason is that I needed to add logic which made it as likely as possible CoolProp would converge. When retrieving ideal gas heat capacity from CoolProp via the PropsSI interface, CoolProp will do a full flash; and sometimes it fails.

I have experimented with using the heat capacity coefficients from CoolProp directly, but there are quite a few terms CoolProp has implemented and have not implemented them all yet. You can see the progress here: https://github.com/CalebBell/thermo/blob/master/thermo/coolprop.py#L483

Sincerely, Caleb

CalebBell commented 1 year ago

I was able to add the H2 term to the pure-python implementation fairly easily because it was a different form of a term already implemented. The next thermo release will have the full temperature range. As a bonus, CH4 and N2 were added from the same code. Caleb

BenPortner commented 1 year ago

Hello @CalebBell,

Thank you so much for the quick implementation! Amazing work :) I will close this issue now.

Thanks again. Ben