CalebBell / chemicals

chemicals: Chemical database of Chemical Engineering Design Library (ChEDL)
MIT License
186 stars 36 forks source link

Steam density calculations change significantly with new release #47

Closed njw37 closed 11 months ago

njw37 commented 1 year ago

Steam density calculations have changed in some cases by more than 7% between versions 1.1.1 and 1.1.4. Interestingly, version 1.1.1 matches the steam densities reported in coolprop. Is this behavior to be expected?

Attached is an excel table showing density calculations at 5 different pressures and 3 different temperatures between the two versions of chemical and coolprop.

I am very impressed with this package (and thermo and fluids). Thank you, Caleb, for all of your hard work.

steamDensityCalculationsChemical.xlsx

njw37 commented 1 year ago

There was an error in the attached excel spreadsheet. The table has been updated. The bug remains the same.

CalebBell commented 1 year ago

Hi njw37, I switched the default model for calculating the density of gases in the Mixture and Chemical object to the ideal gas law. I decided to do that because people seem to expect there to always be a gas density available at any given temperature or pressure, even if the phase equilibrium says it's not stable. For the other models - Helmholtz (CoolProp), virial, and cubic - in some {T, P} conditions each of them predict that no gas exists, and they can't return a gas solution.

See the following issues for discussion:

Neon density not evaluating #96 https://github.com/CalebBell/thermo/issues/96 BUG: Potential regression for thermal conductivity in pure components in latest update #89 https://github.com/CalebBell/thermo/issues/89 Molar volume calculations returning 'None' using 'Chemical' object with update to 0.2.10 #91 : https://github.com/CalebBell/thermo/issues/91 Certain properties missing from nitrogen gas #129 : https://github.com/CalebBell/thermo/issues/129

I encourage you to use the new flash interface - you can see the example for steam here: https://thermo.readthedocs.io/thermo.flash.html#thermo.flash.FlashPureVLS It is designed so that the user picks the models used, allowing for results that which won't change in the same way. It is more performant, has more features, and is what I am developing on at this time. The IAPWS95Liquid and IAPWS95Gas phase should still be returning almost bit-for-bit results in the year 2100. Trying to generally provide magic really good thermodynamic properties was too much in hindsight.

Sincerely, Caleb

njw37 commented 1 year ago

Hi Caleb,

Thank you for your quick and thorough response. We are in the process of learning the thermo.Flash object and will try to make this our new standard (instead of thermo.Mixture). Thank you for making these great tools available.

BR, Nick