Skip to content

Thermopack is a thermodynamic model library for fluid properties and PVT calculations

License

Notifications You must be signed in to change notification settings

ibell/thermopack

 
 

Repository files navigation

Thermopack

Thermopack is a thermodynamics library for multi-component and multi-phase thermodynamics developed at SINTEF Energy Resarch. Through decades of research, we have developed a software that performs thermodynamic calculations. A large selection of equations of state has been implemented in this software. Most of these equations of state have been developed by other research groups around the world, but some of them have been developed by us. Thermopack has has been a much-appreciated in-house powerhouse.

With the slogan of SINTEF in mind - Technology for a better society - we want to share Thermopack with everybody, free of charge through the MIT open-source license. Thermopack is written in modern FORTRAN to handle heavy numerical computations associated with process and computational fluid dynamics (CFD) simulations. The thermodynamic framework is easily interfaced from C/C++ and also contains a flexible Python wrapper to make scripting easy. The Python interface is also a building block for the Thermopack graphical user interface, where it is possible to plot thermodynamic phase diagrams with the most frequently used equations of state. The graphical user interface is currently running on the Windows and Linux operating systems.

Table of contents

Setup

The following sections show how to fetch, compile and install Thermopack and the Python frontend pycThermopack. When things are properly installed, it may be useful to look into the examples provided in the addon/pyExamples.

Prerequisites

Thermopack source code can be compiled with the GNU Fortran compiler or Intel FORTRAN and is dependent on the LAPACK and BLAS libraries. On the Windows OS the code can be compiled using Microsoft Visual Studio. A solution file is found in thermopack/MSVStudio, assuming that the Intel Fortran compiler is integrated with Microsoft Visual Studio.

Linux setup

The Thermopack source code is downloaded by cloning the library to your local computer. The following commands assume that you have a local installation of Git, gfortran and Python 3 with pip. To compile using Intel FORTRAN, use make optim_ifort.

# Fetch and compile
git clone https://github.com/SINTEF/thermopack.git
cd thermopack
make optim

# Prepare and install pycThermopack, aka pyctp
# Remark: On some systems, Python 3 is installed as python, not python3. If so,
# you can replace "python3" with "python" and perhaps also "pip3" with "pip" in
# the below.
cd addon/pycThermopack
python3 makescript.py optim
pip3 install --user .

If you are working actively with the Thermopack code, either the Fortran backend or the Python frontend, then it may be useful to install in editable mode (aka develop mode). This will install a link to the develop files instead of copying the files when installing. This can be done with the -e option, i.e.:

pip3 install -e --user .

See also addon/pycThermopack/README.md for more details on pycThermopack.

MacOS setup

The easiest way to get started is via Homebrew. After following the instructions on their website to set it up, install gcc and make. Open a terminal (e.g. the default Terminal.app), and type:

brew install gcc make

Then follow the Linux instructions above, just replace make with gmake. Some additional packages like git and python can also be installed via Homebrew before you start, but if you use a recent version of MacOS (e.g. Catalina), then the versions installed by default should be sufficient.

Windows setup

Download and compile LAPACK and BLAS libraries (you will need CMake and a working compiler).

To be compatible with the current settings, you need to compile using Intel Fortran with Visual Studio, and configure as follows:

- Fortran/Data/Default Real KIND = 8
- Fortran/External Procedures/Calling Convention = cref
- Fortran/External Procedures/Name Case Interpretation = lowercase
- Fortran/External Procedures/String Length Argument Parsing = After All Arguments
- Fortran/External Procedures/Append Underscore to External Names = Yes
- Fortran/Floating Point/Floating Point Model = precise

Copy LAPACK and BLAS libraries to the paths:

  • thermopack\lapack\lib\Debug
  • thermopack\lapack\lib\Release

Open thermopack\MSVStudio\thermopack.sln using Visual Studio, and compile the wanted configuration.

See addon/pycThermopack/README.md for how to install pycThermopack.

MSYS2/Mingw-W64 setup

Thermopack can also be compiled using gfortran in the MSYS2 environment. Download MSYS2 from https://www.msys2.org, and install and update the package system following the instructions given. Avoid having spaces in the MSYS2 installation directory path, as the Makefile might not work. Having a working MSYS2 installation, thermopack can be compiled after installing the following packages:

pacman -S git
pacman -S mingw-w64-x86_64-gcc-fortran
pacman -S mingw-w64-x86_64-openblas
pacman -S mingw-w64-x86_64-make
pacman -S mingw-w64-x86_64-dlfcn

Open the MSYS2 MinGW 64-bit application, and enter the following in the terminal:

git clone https://github.com/SINTEF/thermopack.git
cd thermopack
mingw32-make.exe optim

See addon/pycThermopack/README.md for how to install pycThermopack for the MSYS2 environment.

File System

Brief description of file structure:

  • thermopack/: Main library folder containing make scripts etc.
  • thermopack/src/: Main path for Fortran source code
  • thermopack/unittest/: Test files written for pFUunit
  • thermopack/bin/: Compiled binaries and libraries
  • thermopack/doc/: Memos and doxygen documentation
  • thermopack/fluids/: Pure fluid files
  • thermopack/binaries/: Files containing binary interaction parameters etc.
  • thermopack/MSVStudio/: Microsoft Visual Studio project and solution files
  • thermopack/include/: C/C++ include file
  • thermopack/pyplot/: Example plot-scripts (Plotting text files generated by Thermopack)
  • thermopack/addon/: Add-on functionality
  • thermopack/addon/pycThermopack/: Python interface
  • thermopack/addon/pyUtils/: Python utilitties for generating fortran code and makefile input.
  • thermopack/addon/trend_interface/: Interface for working with the TREND/EOSCG library developed by Roland Span and Ruhr-Universität Bochum

Please cite

Thermopack has been developed through many projects, and have produced many articles. If you are writing academic publications, please cite one or more of the following articles:

Authors and contact persons

Morten Hammer (morten.hammer@sintef.no)
Ailo Aasen (ailo.aasen@sintef.no)
Øivind Wilhelmsen (oivind.wilhelmsen@sintef.no)

License

Thermopack is distributed under the MIT license.

Acknowledgments

A number of colleagues at SINTEF Energy Research have contributed to the development of thermopack. We gratefully acknowledge their contributions.

About

Thermopack is a thermodynamic model library for fluid properties and PVT calculations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Fortran 88.3%
  • Python 10.7%
  • C++ 0.7%
  • Makefile 0.2%
  • C 0.1%
  • HTML 0.0%