Skip to content

Latest commit

 

History

History
132 lines (106 loc) · 6.04 KB

README.md

File metadata and controls

132 lines (106 loc) · 6.04 KB

ePC-SAFT

release documentation licence DOI

A C++ implementation of the PC-SAFT and electrolyte PC-SAFT (ePC-SAFT) equations of state with a Python interface. It computes fluid properties, phase and reaction equilibrium, exact derivatives of solved states, and parameter estimates. Every density root, equilibrium iteration and fit runs in the native Engine; Python declares the calculation and reads the results.

from epcsaft import Mixture, Parameters

# Water and ion parameters of Held, Cameretti and Sadowski (2008),
# read from data/packets in the source archive
parameters = Parameters.from_packets(
    "data/packets",
    [("held-cameretti-sadowski-2008/4", ["water", "sodium-cation", "chloride-anion"])],
)
brine = Mixture(parameters)
reference = brine.reference(
    298.15, 1.0e5,                          # T / K, P / Pa
    solvent_fractions=(1.0, 0.0, 0.0),      # pure water solvent
    ions=("sodium-cation", "chloride-anion"),
    stoichiometry=(1, 1),
)
for molality in (0.1, 1.0, 2.0):            # mol NaCl per kg water
    activity = reference.activity(molality)
    print(f"{molality:4.1f} mol/kg  gamma± = {activity.mean_ionic_molality_scale:.4f}"
          f"  phi = {activity.osmotic_coefficient:.4f}")
 0.1 mol/kg  gamma± = 0.7631  phi = 0.9251
 1.0 mol/kg  gamma± = 0.6553  phi = 0.9528
 2.0 mol/kg  gamma± = 0.7046  phi = 1.0335

These are the model's mean ionic activity and osmotic coefficients of aqueous NaCl at 298.15 K and 1 bar; the example makes no comparison with measurements.

Models

The equation registry gives every implemented equation with its source equation number.

Capabilities

  • Properties: density on a declared branch, pressure, fugacity and activity coefficients, molality-scale mean ionic activity and osmotic coefficients, residual properties, and total calorics when ideal-gas records are supplied.
  • Phase and reaction equilibrium: flashes, bubble and dew points, saturation, liquid–liquid splits, chemical reactions and pure solids; phase-envelope tracing; tangent-plane stability tests and finite phase discovery (not a global stability proof).
  • Derivatives: exact first and second derivatives of properties and solved equilibrium states with respect to conditions and parameters.
  • Parameter fitting: least squares, errors-in-variables and guarded minimax, with local covariance.
  • Process models: Pyomo/IDAES external functions with exact derivatives.

The limits page states what each capability does not cover. The examples are numerical verification unless they say they compare with measurements.

Installation

Install release 1.3.1 from the tannerwpolley conda channel. Linux (linux-64) supports Python 3.12, 3.13 and 3.14; Windows (win-64) supports Python 3.13 only. There is no published macOS package.

On Linux, replace python=3.13 below with python=3.12 or python=3.14 to choose another supported version:

conda create -n epcsaft -c conda-forge -c tannerwpolley python=3.13 epcsaft=1.3.1

Try first saturation and flash from any directory using the installed packets.

The conda package includes the FeOs Gross–Sadowski 2001 and 2002 packets. Download the matching release source archive for other packets and example inputs; load packets from its data/packets directory with Parameters.from_packets. Each packet states its use terms. To build from source, see installation.

Documentation

The documentation has a quickstart, a user guide, the theory and the Python reference. The examples are executed notebooks: water, methane, methane/ethane, aqueous NaCl, halite solubility, ammonia synthesis, water/isobutanol phase discovery, propane parameter estimation and an IDAES settler.

Citing

Please cite the software with the metadata in CITATION.cff (DOI 10.5281/zenodo.23634228), and cite the model and parameter sources you use.

Licence

GPLv3 with an additional permission for linking with EPL-licensed Ipopt (LICENSE); retained third-party data have their own terms (NOTICE).

Contributing

See the contributing guide.