CalebBell / thermo

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

Crazy values for Laliberte_heat_capacity_w at T < 250 due to chebval #99

Closed yoelcortes closed 2 years ago

yoelcortes commented 2 years ago

Describe the bug

Hope you are doing well! This is not a pressing issue because I have a workaround, but the Laliberte_heat_capacity_w gives crazy results at very low temperatures.

Minimal Reproducible Example

>>> from thermo import Laliberte_heat_capacity_w
>>> Laliberte_heat_capacity_w(250)
10015378.162082551

>>> tm.Laliberte_heat_capacity(250, [0.1], ['1310-58-3']) # KOH
9013411.660191655

Additional context I realize that the Cp approximation of water is probably given by Laliberte himself, so not sure how to solve this problem and still stick to the original model.

I am using Laliberte_heat_capacity for salt mixtures. Currently, my solution is to do the following:

>>> import thermo as tm
>>> tm.Laliberte_heat_capacity_w = tm.electrochem.Laliberte_heat_capacity_w = tm.iapws95_Cpl_mass_sat
>>> tm.Laliberte_heat_capacity(250, [0.1], ['1310-58-3']) # Returns 9013411.660191655 originally
3604.62694795166

I am happy to help implement whatever long term solution you can think of. Also, would it be a good idea to transfer the electrochem module to chemicals and use the iawps module there for Cpl?

Thanks again!

CalebBell commented 2 years ago

Hi Yoel!

I'm doing well. How are you?

This is really an open research challenge. I totally agree that this is a problem; with enough electrolytes water won't freeze for many many degrees of subcooling, but the heat capacity begins making no sense. I adjusted the model to use the IAPWS formulation for liquid water above ~92 C, because the model isn't valid for high temperatures either. This works OK, although the ion temperature dependence is also going to be poorly extrapolated.

The IAPWS-95 formulation is not valid below 273.15 K; this is a known problem with these type of EOSs. The high number of terms used makes extrapolation a pretty bad idea. I believe substantial progress has been made in this area, but am not aware of a revised equation of state for water at this time, although I hope Eric Lemmon decides to develop one!

One thing I know of is an IAPWS formulation for supercooled water: http://www.iapws.org/relguide/Supercooled.pdf . However, this formulation is only valid for water in the very high pressure region. This is usually not the case with electrolyte solutions. The Laliberte water heat capacity model is according to the author, not valid below -15 C. My preference is tending towards just limiting the temperature used in the correlation to this value. What do you think?

Sincerely, Caleb

yoelcortes commented 2 years ago

I'm doing well myself :)

Thanks for sharing your expertise on this. I agree, limiting the temperature for Laliberte_heat_capacity_w is best, especially for consistency with literature. If there is another model that works on really low temperatures then we should resort to those (and add them later).

Thanks!

CalebBell commented 2 years ago

Hi Yoel, I fixed this with the limiting temperature strategy we discussed. It is out in thermo 0.2.14 now. Cheers, Caleb

yoelcortes commented 2 years ago

Thank you!