package to find tie-lines, binodals and spinodals in a three-component mixture with flory-huggins free energy.
Project description
samternary
floryhugginsternary
aids users in predicting phase diagrams for three component mixtures of small molecules. It does this by providing the equations of chemical equilibrium (i.e. equal chemical potentials) in a form which is fairly straightforward to implement into a numerical solver (e.g. scipy.optimize.root or similar).
For example, if I wanted to determine the binodal and spinodal lines of a three component mixture with two phases when the volume fraction of component one in phase A (phi_1A in the code below) is 0.07, with flory huggins parameters chi_11 = 1, chi_22 = 1, and chi_12 = 4, I would write
from floryhugginsternary.chemeq3 import ChemEq3_2phase
from scipy.optimize import root
ce = ChemEq3_2phase(phi_1A= 0.07,chi_12=3,chi_11=1,chi_22=-1)
phi_1B,phi_2A,phi_2B = 0.42,0.07,0.42 # a (good) guess for phi_2A, phi_1B, phi_2B
x0 = ce.phis_to_x(phi_1B,phi_2A,phi_2B)
solution = scipy.optimize.root(ce.rootfind_eqns,x0,jac=ch.rootfind_jacobian)
phi_1s,phi_2s = ce.get_phi1s_phi2s(solution.x) # get the volume fractions at phase coexistence
phi_1A,phi_1B = phi_1s[0],phi_1s[1]
phi_2A,phi_2B = phi_2s[0],phi_2s[1]
which would, if a solution existed, return the volume fractions of the two different phases for both components A and B (otherwise it would just return the trivial solution of component one being equal in both phases and component two being equal in both phases).
See the examples folder for a list of examples on how to use this package. Here is an example picture of a binodal curve at chi_12 = 4, chi_11 = chi_22 = 1, with tie-lines. Also shown is the spinodal curve. This picture was computed using this package along with matplotlib and scipy.optimize.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file floryhugginsternary-0.0.0.tar.gz
.
File metadata
- Download URL: floryhugginsternary-0.0.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b7ec726c85860f0e354f7bacd52a12ca9f56d829e0a94916e0cb8b7a9963bb5 |
|
MD5 | 1db0c9cb40f83acc88dc6de4077a2d9e |
|
BLAKE2b-256 | 7ca0f6f974a5643d5c102b3d7be281e8f060cd850ff6aed65b7c898e150a9788 |
File details
Details for the file floryhugginsternary-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: floryhugginsternary-0.0.0-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 147a67fb26f2b74cb880f4a676342731a8ad2bf9f916a43263408ff3d1c26b3d |
|
MD5 | 59de1d771732fb8d07c767457187951d |
|
BLAKE2b-256 | 5d3b3c25348481efee1e572980f3ee42e3a3cd987407e63abb61c40420675aec |