Ultra-high-resolution water and steam property calculation, based on IAPWS-IF 97
The thermophysical properties of water and steam are very important to researchers and engineers in various domains (energy, power, chemistry, materials …).
Usually, researchers and engineers rely on the NIST Refprop to calculate the properties. However, Refprop is commercial and not open-source. Therefore, I wrote this code to provide an alternative to the Refprop.
Program Name: Ultra-high-resolution Water and Steam Thermophysical Property Calculation
Purpose: Calculate the very-high-resolution thermophysical properties at given point(s)
License: MIT
Technical Reference: IAPWS IF97
You need a C compiler to build.
git
to clone this code: git clone https://github.com/zhenrong-wang/water-steam-if97.git
gcc *.c -o my-if97.exe -lm
Note: the -lm
may not be valid for Windows or macOS. It is necessary for GNU/Linux distros.
Suppose you have followed the steps above and built the my-if97.exe in the source code folder.
cd test
../my-if97.exe
(UNIX-like OS) or ..\my-if97.exe
(Microsoft Windows)If you see the output below, congrats, you’ve built the binary successfully.
...
1 25000000.00000000 873.00000000
1 23960000.00000000 811.00000000
1 6000000.00000000 811.00000000
1 6000000.00000000 573.00000000
# Calculation finished. Please check _properties.dat for results.
# Press any key to exit.
@ Any problems found, please contact the author.
@ Zhenrong Wang, [email protected].
Suppose the working directory is /home/amber/water-steam/
Suppose the absolute path of the executable is /home/amber/bin/my-if97.exe
$ cd /home/amber/water-steam/
$ vim _input.dat
# Create an input file named ‘_input.dat’ with some input data (See Section 3.3 below)$ /home/amber/bin/my-if97.exe
Suppose the working directory is C:\Users\amber\water-steam\
Suppose the absolute path of the executable is C:\Users\amber\bin\my-if97.exe
cd C:\Users\amber\water-steam\
notepad _input.dat
C:\Users\amber\bin\my-if97.exe
For the _input.dat file, you need to input the data in lines. A single line refers to a point. Strict format:
POINT_TYPE(int),PARAM1(float/double),PARAM2 (float/double)
Please separate the params by a comma ‘,’
POINT_TYPE:
Example: 1,100000,300
Example: 1,1e5,3e2
Units:
The program writes out a file named ‘_properties.dat’ in the working directory.
This code was written years ago, and I didn’t continuously develop it. Therefore, bugs may occur.
If you are interested in this project, please submit issues to this repo. I’d be glad to communicate on any issues.
Or, you can also email me: [email protected]