Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Latest commit

 

History

History
182 lines (148 loc) · 8.52 KB

README.md

File metadata and controls

182 lines (148 loc) · 8.52 KB

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.

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 ([email protected])
Ailo Aasen ([email protected])
Øivind Wilhelmsen ([email protected])

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.