ANN: Psychro

Hi Julia community. I have just written a package that calculates the thermodynamic properties of moist air. It uses correlations for real gases and works over a temperature range of 173.15 K < T < 473.15 K for pressures below 5 MPa.

It basically implements the equations found in ASHRAE’s Psychrometrics theory and practice handbook.

All methods are implemented in standard SI units but I used method overload to enable the use of the awesome Unitful package.

The package is located at and soon will be available using Pkg.add(“Psychro”)



Very interesting!
What is the phylosophy of the package?
Does it focus on performance?
Are the functions automatic-differentiable?
How does it compare with python iapws / others?

Many questions :slight_smile:
Thank you!!

I had a c++ version for years and used it extensively in a fluid flow metrology lab. Since I’ve been using julia more frequently, this was something that I would have to do sooner or later. Another reason is that my father has been nagging me to make psychrometric charts for a thermodynamics book he is writing. He has also been asking me to write something like EES (engineering equation solver) and at my lab people do crazy stuff with excel spreadsheets which I think is irresponsible (almost impossible to check/verify) and code reuse is very difficult. I have a few ideas and julia is a perfect medium to do it. I intend to write a fairly generic ideal gas code next using Burcat’s database. For real fluids, I will leave it to CoolProp and my father’s group.

In this context I am thinking about writing an AbstractThermodynamics package that would provide a generic interface that can be implemented using different models (ideal gas or iapws and this package as an example) or for specific fluids (aga 8 for natural gas for instance).

For now I am more concerned about correctness. For my day to day purpose the code is fast enough. If I was doing cfd? I might run into problems. This actually means I’ve not really benchmarked it before, not even against the old c++ code. But there is some iteration going on and in some places there is much room for improvement. In some places the samething might be calculated over and over again.

I am new to automatic differentiation but the code is entirely written in julia. I should probably check it out. It would be interesting for more generic and flexible thermodynamic properties calculation. In this code I use iterative procedures (some sort of newton raphson) and I should probably improve this. I am using simple finite differences to compute derivatives. It is kind of ugly…

As for iapws, there is very little water properties in the library, and the pressure/temperature ranges are fairly small so I just used the simple equations provided in the references. A full implementation of iapws would be very nice. That is some thing I should think about.