Package: pcsaft
IntroductionThis package implements the PC-SAFT equation of state. In addition to the hard chain and dispersion terms, these functions also include dipole, association and ion terms for use with these types of compounds. When the ion term is included it is also called electrolyte PC-SAFT (ePC-SAFT).DocumentationDocumentation for the package is available onRead the Docs.Exampleimportnumpyasnpfrompcsaftimportpcsaft_den# Toluenex=np.asarray([1.])m=np.asarray([2.8149])s=np.asarray([3.7169])e=np.asarray([285.69])pyargs={'m':m,'s':s,'e':e}t=320# Kp=101325# Paden=pcsaft_den(t,p,x,pyargs,phase='liq')print('Density of toluene at{}K:{}mol m^-3'.format(t,den))# Water using default 2B association schemex=np.asarray([1.])m=np.asarray([1.2047])e=np.asarray([353.95])volAB=np.asarray([0.0451])eAB=np.asarray([2425.67])t=274p=101325s=np.asarray([2.7927+10.11*np.exp(-0.01775*t)-1.417*np.exp(-0.01146*t)])# temperature dependent sigma is used for better accuracypyargs={'m':m,'s':s,'e':e,'e_assoc':eAB,'vol_a':volAB}den=pcsaft_den(t,p,x,pyargs,phase='liq')print('Density of water at{}K:{}mol m^-3'.format(t,den))# Water using 4C association schemex=np.asarray([1.])m=np.asarray([1.2047])e=np.asarray([353.95])volAB=np.asarray([0.0451])eAB=np.asarray([2425.67])assoc_schemes=['4c']t=274p=101325s=np.asarray([2.7927+10.11*np.exp(-0.01775*t)-1.417*np.exp(-0.01146*t)])# temperature dependent sigma is used for better accuracypyargs={'m':m,'s':s,'e':e,'e_assoc':eAB,'vol_a':volAB,'assoc_scheme':assoc_schemes}den=pcsaft_den(t,p,x,pyargs,phase='liq')print('Density of water at{}K:{}mol m^-3'.format(t,den))DependenciesThe Numpy and Scipy packages are required. The core functions have been written in C++ to improve calculation speed, soCythonis needed, along with theEigenpackage for linear algebra. For unit testing pytest is used.Python packageTo make it easier to use this code, it has been added as a package to PyPi (pcsaft), which means it can be installed using pip. This allows you to use the code without needing to compile the Cython code yourself. Binaries might not be available for all platforms or Python versions.Compiling with CythonTo speed up the original Python code the core functions have been rewritten in C++. These are then connected with the remaining Python code using Cython. This gave a significant improvement in speed. The Cython code needs to be compiled before use. To do so install Cython. Then run the following command from the directory containing the PC-SAFT codepython setup.py build_ext --inplaceMake sure that the Eigen header files are somewhere on your path. More about the Cython build process can be found from theCython documentation.The original Python-only code has been removed from the repository. If you still want to use the original Python-only functions, go back to anearlier versionof the repository. Note that the Python-only code is no longer maintained, so it may not be as reliable as the Cython code.AuthorZach Baird-zmeriLicenseThis project is licensed under the GNU General Public License v3.0AcknowledgmentsWhen developing these functions the code from two other groups was used as referencesCode from Joachim Gross (https://www.th.bci.tu-dortmund.de/cms/de/Forschung/PC-SAFT/Download/index.html)The MATLAB/Octave program written by Angel Martin and others (http://hpp.uva.es/open-source-software-eos/)