Thermodynamic properties and phase equilibria with equations of state, in modern Fortran and Python.
Robust algorithms for phase diagrams and an easy framework for adding new models, with analytical derivatives or automatic differentiation.
Find us on…
Continuation methods trace PT, Px and Tx envelopes through critical points, including three-phase and multiphase boundaries, critical lines and binary global phase diagrams.
Write the residual Helmholtz or excess Gibbs energy and get fugacities, residual properties and every equilibrium routine for free. Derivatives can be analytical, hyperdual or generated with Tapenade.
A readable modern Fortran core built with fpm, wrapped as a
pip install yaeos package for notebooks, fitting and plotting.
The same calculation in both languages: build a Peng-Robinson model for methane + n-butane, evaluate a pressure, a bubble point and the full PT phase envelope. Units are K, bar, L and mol throughout.
program quickstart
use yaeos, only: pr, ArModel, PengRobinson76, EquilibriumState, PTEnvel2, &
saturation_pressure, pt_envelope_2ph
implicit none
class(ArModel), allocatable :: model
type(EquilibriumState) :: bubble
type(PTEnvel2) :: envelope
real(pr) :: z(2)
real(pr) :: P
! Methane + n-butane with Peng-Robinson (1976): Tc [K], Pc [bar], omega
model = PengRobinson76(tc=[190.564_pr, 425.12_pr], &
pc=[45.99_pr, 37.96_pr], w=[0.0115478_pr, 0.200164_pr])
z = [0.3_pr, 0.7_pr] ! mol
call model%pressure(z, V=1.0_pr, T=300.0_pr, P=P)
bubble = saturation_pressure(model, z, T=300.0_pr, kind="bubble")
envelope = pt_envelope_2ph(model, z, &
saturation_pressure(model, z, T=200.0_pr, kind="dew"))
print *, "P(1 L, 300 K) =", P, "bar"
print *, "Bubble P(300 K) =", bubble%P, "bar"
print *, "Critical point:", envelope%cps(1)%T, "K", envelope%cps(1)%P, "bar"
end program quickstart
import numpy as np
from yaeos import PengRobinson76
# Methane + n-butane with Peng-Robinson (1976)
model = PengRobinson76(
critical_temperatures=[190.564, 425.12], # K
critical_pressures=[45.99, 37.96], # bar
acentric_factors=[0.0115478, 0.200164],
)
z = np.array([0.3, 0.7]) # mol
P = model.pressure(z, volume=1.0, temperature=300.0)
bubble = model.saturation_pressure(z, temperature=300.0, kind="bubble")
envelope = model.phase_envelope_pt(z, kind="dew", t0=200.0, p0=1.0)
print(f"P(1 L, 300 K) = {P:.4f} bar")
print(f"Bubble P(300 K) = {bubble['P']:.4f} bar")
print("Critical point:", envelope.critical_temperatures, envelope.critical_pressures)
envelope.plot() # requires matplotlib
Both print a pressure of 15.91 bar, a bubble pressure of 57.37 bar and a critical point near 401.5 K and 68.1 bar. The guide walks through each step and explains how to read the results.
Fortran — add yaeos as an fpm
dependency (BLAS and LAPACK are required, e.g.
sudo apt install libblas-dev liblapack-dev):
[dependencies]
yaeos = {git="https://github.com/ipqa-research/yaeos"}
Python — binary wheels are published on PyPI:
pip install yaeos
| Residual Helmholtz () | Excess Gibbs () |
|---|---|
| Cubic EoS: SRK, PR76, PR78, RKPR, PSRK | NRTL and NRTL-HV |
| Alpha functions: Soave, RKPR, Mathias-Copeman | UNIQUAC |
| Mixing rules: QMR, QMRTD, CMR, CMRTD, MHV, HV, HV-NRTL, sDDLC | UNIFAC VLE, Dortmund and PSRK |
| GERG-2008 multifluid | |
| PC-SAFT |
Missing one? Add your own model by writing its energy function.
Equations of state, fugacity and phase equilibrium for programmers who are new to thermodynamics.
Volumes, pressures, fugacities and residual properties from \(A^r\) models.
Activity coefficients and excess properties from \(G^E\) models.
Flashes, saturation points, stability, envelopes and critical points.
Implement a model with analytical derivatives or automatic differentiation.
Architecture, numerics, the Python bridge, testing and workflow.
Reference for the yaeos Python package, with tutorials.
Every module, type and procedure, generated from the source.
How to report issues, propose changes and follow the style guide.
yaeos is developed by the research group of Prof. Martín Cismondi-Duarte at
IPQA (UNC-CONICET) and released under the
Mozilla Public License 2.0.
If yaeos is useful in your work, please cite it using the repository’s
CITATION.cff
(GitHub’s “Cite this repository” button exports BibTeX and APA). Questions,
bug reports and ideas are welcome on the
issue tracker.