Skip to content

Latest commit

 

History

History
108 lines (78 loc) · 2.77 KB

README.md

File metadata and controls

108 lines (78 loc) · 2.77 KB

Introduction

pycThermopack: Python interface for Thermopack

For examples on how to use, see ../pyExamples/.

Note that the files ../../libthermopack_export.version (Linux) and ../../MSVStudio/thermopack.def (Windows) define which symbols are exported from the dynamic thermopack library.

Prerequisites

Before you build (and possibly install) pycThermopack, make sure that you have compiled thermopack using the provides Makefiles or Visual Studio solution files. Compiling using GNU/Intel (Linux) or Intel (Windows) FORTRAN should be straight forward. If you prefer another compiler, you will need to tweake the get_platform_specifics method in thermo.py to get the module exports correct. These exports are compiler dependent.

To use pycThermopack you need to have numpy available. It is also recommended to install matploblib.

Installation

Linux

To prepare pycThermopack, a libthermopack.so file must be copied to the pyctp folder. This is done as follows:

# Either
make optim

# or
./makescript.py optim

# or
python makescript.py optim

# or, if Python 3 is available as python3
python3 makescript.py optim

One may also, optionally, install pyctp on a user or system level, which allwos one to import pycThermopack from anywhere. If this is desired, one can either install at system level or at user level with pip. Use pip3 for Python 3, as pip often defaults to pip for Python 2.

# System level
sudo pip3 install .

# User level
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, e.g.:

pip3 install -e --user .

Windows:

Compile using Microsoft Visual Studio solution file (requires Intel Fortran license) in ../../MSVStudio, and libthermopack.dll will be copied to the pyctp folder.

MSYS2/Mingw-W64 setup

Having compiled thermopack for MSYS2, you can get pycThermopack up and running, using the MSYS2 MinGW 64-bit application, as follows:

pacman -S mingw-w64-x86_64-python
pacman -S mingw-w64-x86_64-python-numpy
pacman -S mingw-w64-x86_64-python-matplotlib
cp bin/bin/dynamic/libthermopack_debug_gfortran_MSYS.so addon/pycThermopack/pyctp/thermopack.dll
cd addon/pyExamples
python cpa.py

Testing

To test pycThermopack, run one of

python3 -m pytest

Thermopack GUI

To run the GUI application:

python thermopack_gui.py

The GUI application requires the following Python packages:

  • pyqt5 for the GUI framework
  • pint for managing units
  • matplotlib
  • numpy