Support for Numba (chemicals.numba)

Basic module which wraps most of chemicals functions and classes to be compatible with the Numba dynamic Python compiler. Numba is only supported on Python 3, and may require the latest version of Numba. Numba is rapidly evolving, and hopefully in the future it will support more of the functionality of fluids.

Using the numba-accelerated version of chemicals is easy; simply call functions and classes from the chemicals.numba namespace. The chemicals.numba module must be imported separately on Python < 3.7; it is not loaded automatically as part of chemicals.

>>> import chemicals
>>> import chemicals.numba
>>> chemicals.numba.Antoine(180, A=8.95894, B=510.595, C=-15.95)
702271.05185795

There is a delay while the code is compiled when using Numba; the speed is not quite free.

Some parts of chemicals are not supported in the Numba interface. Any data lookup function like Tc() and omega_methods() are not numba compatible. These functions could not be speed up anyway though as they are memory-bound and numba helps with things that are compute-bound.

Today, the list of things known not to work is as follows:

All of the regular Numba-compiled functions are built with the nogil flag, which means you can use Python’s threading mechanism effectively to get the speed of parallel processing.