Code Monkey home page Code Monkey logo

phasepy's Introduction

phasepy

Introduction

Phasepy is an open-source scientific Python package for calculation of physical properties of phases at thermodynamic equilibrium. Main application areas include computation of fluid phase equilibria and interfacial properties.

Phasepy includes routines for calculation of vapor-liquid equilibrium (VLE), liquid-liquid equilibrium (LLE) and vapor-liquid-liquid equilibrium (VLLE). Phase equilibrium can be modelled either with the continous approach, using a combination of a cubic equation of state (EoS, e.g. Van der Waals, Peng-Robinson, Redlich-Kwong, or their derivatives) model and a mixing rule (Quadratic, Modified Huron-Vidal or Wong-Sandler) for all phases, or the discontinuous approach using a virial equation for the vapor phase and an activity coefficient model (NRTL, Wilson, Redlich-Kister, UNIQUAC or Dortmund Modified UNIFAC) for the liquid phase(s).

Interfacial property estimation using the continuous phase equilibrium approach allows calculation of density profiles and interfacial tension using the Square Gradient Theory (SGT).

Phasepy supports fitting of model parameter values from experimental data.

Installation Prerequisites

  • numpy
  • scipy
  • pandas
  • openpyxl
  • C/C++ Compiler for Cython extension modules

Installation

Get the latest version of phasepy from https://pypi.python.org/pypi/phasepy/

An easy installation option is to use Python pip:

$ pip install phasepy

Alternatively, you can build phasepy yourself using latest source files:

$ git clone https://github.com/gustavochm/phasepy

Note for Apple Silicon users: It is recommended to install python and phasepy dependencies (numpy, scipy, cython, pandas) through conda miniforge, then you can install phasepy running pip install phasepy.

Documentation

Phasepy's documentation is available on the web:

https://phasepy.readthedocs.io/en/latest/

Getting Started

Base input variables include temperature [K], pressure [bar] and molar volume [cm^3/mol]. Specification of a mixture starts with specification of pure components:

>>> from phasepy import component, mixture
>>> water = component(name='water', Tc=647.13, Pc=220.55, Zc=0.229, Vc=55.948,
                      w=0.344861, GC={'H2O':1})
>>> ethanol = component(name='ethanol', Tc=514.0, Pc=61.37, Zc=0.241, Vc=168.0,
                        w=0.643558, GC={'CH3':1, 'CH2':1, 'OH(P)':1})
>>> mix = mixture(ethanol, water)

Here is an example how to calculate the bubble point vapor composition and pressure of saturated 50 mol-% ethanol - 50 mol-% water liquid mixture at temperature 320 K using Peng Robinson EoS. In this example the Modified Huron Vidal mixing rule utilizes the Dortmund Modified UNIFAC activity coefficient model for the solution of the mixture EoS.

>>> mix.unifac()
>>> from phasepy import preos
>>> eos = preos(mix, 'mhv_unifac')
>>> from phasepy.equilibrium import bubblePy
>>> y_guess, P_guess = [0.2, 0.8], 1.0
>>> bubblePy(y_guess, P_guess, X=[0.5, 0.5], T=320.0, model=eos)
(array([0.70761727, 0.29238273]), 0.23248584919691206)

For more examples, please have a look at the Jupyter Notebook files located in the examples folder of the sources or view examples in github.

Bug reports

To report bugs, please use the phasepy's Bug Tracker at:

https://github.com/gustavochm/phasepy/issues

License information

See LICENSE.txt for information on the terms & conditions for usage of this software, and a DISCLAIMER OF ALL WARRANTIES.

Although not required by the phasepy license, if it is convenient for you, please cite phasepy if used in your work. Please also consider contributing any changes you make back, and benefit the community.

Chaparro, G., Mejía, A. Phasepy: A Python based framework for fluid phase equilibria and interfacial properties computation. J Comput Chem. 2020, 41, 29, 2504-2526. https://doi.org/10.1002/jcc.26405.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.