CalebBell / thermo

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

Thermodynamic Properties of Water and Steam #42

Closed jfkonecn closed 2 years ago

jfkonecn commented 4 years ago

Would you be interesting in me pull requesting a calculator for the thermodynamic properties of water and steam

I was thinking about basing the calculations on the following: http://www.iapws.org/relguide/IF97-Rev.html

CalebBell commented 4 years ago

Hi, This is a kind offer. IAPWS-97 is a great standard. I have dabbled in creating a version of it in Python myself a long time ago; there is also jjgomera's port (https://iapws.readthedocs.io/en/latest/iapws.iapws97.html), and CoolProp's IF97 in C++ (https://github.com/CoolProp/IF97). For sure I think there is lots of room for good implementations of IAPWS-97 in the Python ecosystem. What is your objective? If it is an exercise because coding is fun, go for it! I'm sure we could work something our, either inclusion in thermo or linking to it as a separate library in Python. If you just want to use it yourself, what is missing with one of the existing libraries? Can you improve them? In case you're looking to make a pure-python and very fast implementation, I have lots of suggestions if you would like them. Sincerely, Caleb

jfkonecn commented 4 years ago

I really want to contribute to an open source chemical engineering code base. I have a computer science and chemical engineering degree, but I work as a developer for a non-engineering company. I miss doing chemistry and engineering math problems so I figured this would be a good way to combine both of my interests.

I suggested the steam table because I've already done it in c# so I figured I could quickly turn it around. https://github.com/jfkonecn/EngineeringLookupTables/tree/master/EngineeringLookupTables

I'm always open to suggestions. The only thing I feel strongly about is performing all the internal calculations in SI units since that is the best way to avoid bugs.

I'm also willing to help refactor any code you're having trouble adding features to or debugging.

CalebBell commented 2 years ago

Hi John, Thank you very much for helping push this to happen. The IAPWS code is implemented in a way which is quite computationally efficient. The bulk of the code is in the Chemicals project, here: https://chemicals.readthedocs.io/chemicals.iapws.html

There are two samples of using this code through Thermo now: https://thermo.readthedocs.io/Examples/Chemical%20Thermodynamics%20for%20Process%20Simulation/Problem%2014.03%20Reversible%20and%20Isothermal%20Compression%20of%20Liquid%20Water.html https://thermo.readthedocs.io/tutorial_phases_and_flash.html#vapor-liquid-steam-example

There is also the API documentation for the IAPWS95Liquid and IAPWS95Gas objects. https://thermo.readthedocs.io/thermo.phases.html#thermo.phases.IAPWS95

Your effort was very much appreciated. Thermo is very big and regrettably complicated project. I hope you are well.

Sincerely, Caleb

jfkonecn commented 2 years ago

I'm glad to hear that!