Skip to content

Components & data

The curated open component database, the Component record, the helpers that turn component names into the constant arrays the rest of the engine consumes, and the physical constants.

Components

components

Pure-component model and a curated database of open reference constants.

A Component is an immutable bundle of the constants Fugacio needs to evaluate equations of state, ideal-gas properties, and saturation pressures for one chemical species. The values bundled in DATABASE are textbook reference data drawn from open sources:

  • critical constants and acentric factors: Poling, Prausnitz & O'Connell, The Properties of Gases and Liquids (5th ed.), Appendix A;
  • ideal-gas heat capacities: Smith, Van Ness & Abbott, Introduction to Chemical Engineering Thermodynamics (7th ed.), Table C.1, in the form Cp/R = a + b*T + c*T**2 + d/T**2;
  • Antoine vapour-pressure constants: NIST Chemistry WebBook, in the form log10(P/bar) = a - b / (T/K + c).

Component instances are deliberately static Python objects (not JAX pytrees): the differentiable numerical kernels in fugacio.thermo operate on plain arrays, which you extract with component_arrays. That keeps gradients flowing with respect to the physical parameters themselves (useful for parameter estimation) without entangling autodiff with database bookkeeping.

Classes:

Name Description
AntoineCoeffs

Antoine vapour-pressure constants in NIST form.

CpIdeal

Ideal-gas heat-capacity correlation Cp/R = a + b*T + c*T**2 + d/T**2 + e*T**3.

Component

Immutable pure-component constant record (SI units, except molar mass).

Functions:

Name Description
get

Return the Component for name (case-insensitive).

names

Return the sorted list of component names in the database.

component_arrays

Stack the core EOS constants of several components into JAX arrays.

AntoineCoeffs dataclass

AntoineCoeffs(
    a: float, b: float, c: float, t_min: float, t_max: float
)

Antoine vapour-pressure constants in NIST form.

log10(P/bar) = a - b / (T/K + c), valid on [t_min, t_max] kelvin.

CpIdeal dataclass

CpIdeal(
    a: float,
    b: float,
    c: float,
    d: float,
    e: float = 0.0,
    t_min: float = 0.0,
    t_max: float = float("inf"),
)

Ideal-gas heat-capacity correlation Cp/R = a + b*T + c*T**2 + d/T**2 + e*T**3.

The a, b, c, d form is the one tabulated by Smith, Van Ness & Abbott (at most three coefficients non-zero per species, e = 0). The extra cubic term e lets the same dataclass also hold Joback-style estimates (a + b*T + c*T**2 + e*T**3), keeping a single ideal-gas integrator for both. t_min and t_max bound the fitted temperature range in kelvin.

Component dataclass

Component(
    name: str,
    formula: str,
    cas: str | None,
    mw: float,
    tc: float,
    pc: float,
    omega: float,
    tb: float | None = None,
    vc: float | None = None,
    zc: float | None = None,
    antoine: AntoineCoeffs | None = None,
    cp_ig: CpIdeal | None = None,
    hform_ig: float | None = None,
    gform_ig: float | None = None,
    dipole: float | None = None,
    zra: float | None = None,
)

Immutable pure-component constant record (SI units, except molar mass).

Attributes:

Name Type Description
name str

Canonical lower-case identifier (the database key).

formula str

Molecular formula, e.g. "C2H6O".

cas str | None

CAS registry number as a string, or None if unassigned here.

mw float

Molar mass in g/mol.

tc float

Critical temperature in K.

pc float

Critical pressure in Pa.

omega float

Pitzer acentric factor (dimensionless).

tb float | None

Normal boiling point in K, or None.

vc float | None

Critical molar volume in m^3/mol, or None.

zc float | None

Critical compressibility factor, or None.

antoine AntoineCoeffs | None

AntoineCoeffs, or None if not tabulated.

cp_ig CpIdeal | None

CpIdeal, or None if not tabulated.

hform_ig float | None

Standard ideal-gas enthalpy of formation (J/mol at 298.15 K).

gform_ig float | None

Standard ideal-gas Gibbs energy of formation (J/mol at 298.15 K).

dipole float | None

Gas-phase dipole moment in debye, or None if not tabulated.

zra float | None

Spencer-Danner Rackett compressibility Z_RA, or None.

get

get(name: str) -> Component

Return the Component for name (case-insensitive).

Raises:

Type Description
KeyError

if name is not present in DATABASE.

names

names() -> list[str]

Return the sorted list of component names in the database.

component_arrays

component_arrays(
    components: list[str] | list[Component],
) -> dict[str, Array]

Stack the core EOS constants of several components into JAX arrays.

Parameters:

Name Type Description Default
components list[str] | list[Component]

A list of component names or Component objects.

required

Returns:

Type Description
dict[str, Array]

A dict with keys "tc", "pc", "omega" and "mw" mapping to

dict[str, Array]

1-D arrays aligned with the input order, ready to feed the equation-of-

dict[str, Array]

state kernels.

Binary interaction data

Lookups that pull stored binary-interaction parameters (cubic-EOS kij, NRTL, and UNIQUAC) out of the database for a set of components.

data

Curated parameter lookups: UNIQUAC r/q and binary NRTL / UNIQUAC.

This is the convenience layer over the generated tables in fugacio.thermo._binary_params. It turns component names into ready, fully populated NRTL / UNIQUAC model objects, handling the pair-ordering bookkeeping (the tables are keyed by alphabetically sorted name pairs) and assembling the n x n interaction matrices.

Pairs absent from the curated set default to athermal interaction (b = 0, so gamma -> 1 for that pair) unless strict=True is requested, in which case a missing pair raises. For systems with no curated parameters at all, fall back to predictive UNIFAC (fugacio.thermo.groupcontrib.unifac_activity) or fit parameters from data with fugacio.thermo.regression.

Functions:

Name Description
nrtl_params

Oriented binary NRTL params (b_ij, b_ji, alpha_ij) or None if absent.

uniquac_params

Oriented binary UNIQUAC params (b_ij, b_ji) or None if absent.

pr_kij

Curated Peng-Robinson binary interaction coefficient k_ij or None.

kij_from_database

Assemble the symmetric Peng-Robinson k_ij matrix from curated pairs.

uniquac_rq

Return the UNIQUAC (r, q) arrays for named components.

nrtl_from_database

Build an NRTL model for components from curated binaries.

uniquac_from_database

Build a UNIQUAC model for components from curated data.

has_nrtl

Whether every binary pair in components has curated NRTL parameters.

has_uniquac

Whether components have curated UNIQUAC r/q and all pair params.

nrtl_params

nrtl_params(
    name_i: str, name_j: str
) -> tuple[float, float, float] | None

Oriented binary NRTL params (b_ij, b_ji, alpha_ij) or None if absent.

tau_ij = b_ij / T. Lookup is order-insensitive; the result is oriented so that b_ij is the coefficient acting on the i -> j direction.

uniquac_params

uniquac_params(
    name_i: str, name_j: str
) -> tuple[float, float] | None

Oriented binary UNIQUAC params (b_ij, b_ji) or None if absent.

tau_ij = exp(b_ij / T); lookup is order-insensitive (see nrtl_params).

pr_kij

pr_kij(name_i: str, name_j: str) -> float | None

Curated Peng-Robinson binary interaction coefficient k_ij or None.

Order-insensitive (k_ij is symmetric for the standard one-fluid rule).

kij_from_database

kij_from_database(components: list[str]) -> Array

Assemble the symmetric Peng-Robinson k_ij matrix from curated pairs.

Pairs without a curated value default to 0 (ideal van der Waals mixing). The result is an (n, n) array suitable for fugacio.thermo.eos_model / fugacio.sim.eos_model_for.

uniquac_rq

uniquac_rq(components: list[str]) -> tuple[Array, Array]

Return the UNIQUAC (r, q) arrays for named components.

Raises:

Type Description
KeyError

if any component lacks curated r/q data.

nrtl_from_database

nrtl_from_database(
    components: list[str],
    *,
    strict: bool = False,
    alpha_default: float = 0.3,
) -> NRTL

Build an NRTL model for components from curated binaries.

Parameters:

Name Type Description Default
components list[str]

Component names (any length >= 2).

required
strict bool

If True, raise when a pair has no curated parameters; otherwise that pair defaults to athermal (b = 0).

False
alpha_default float

Non-randomness used for pairs without curated parameters.

0.3

Returns:

Type Description
NRTL

A fully populated NRTL whose b and alpha matrices are the

NRTL

curated coefficients (a = e = 0).

uniquac_from_database

uniquac_from_database(
    components: list[str], *, strict: bool = False
) -> UNIQUAC

Build a UNIQUAC model for components from curated data.

Uses curated r/q and binary b coefficients. Pairs without data default to b = 0 (tau = 1) unless strict=True.

Raises:

Type Description
KeyError

if any component lacks r/q (always), or any pair lacks interaction parameters (only when strict=True).

has_nrtl

has_nrtl(components: list[str]) -> bool

Whether every binary pair in components has curated NRTL parameters.

has_uniquac

has_uniquac(components: list[str]) -> bool

Whether components have curated UNIQUAC r/q and all pair params.

Constants

constants

Physical constants and unit conversions used across fugacio.thermo.

Fugacio works in SI internally:

  • temperature T in kelvin (K),
  • pressure P in pascal (Pa),
  • amount in mole (mol),
  • molar energy in joule per mole (J/mol),
  • molar volume in cubic metre per mole (m^3/mol).

Molar mass is the one deliberate exception: it is stored in the conventional gram-per-mole (g/mol), matching how component data are tabulated. Convert to kg/mol with G_PER_MOL_TO_KG_PER_MOL when you need mass in SI.

The numerical values follow the 2018 CODATA recommended values, so they match the constants used by the open reference codes Fugacio is graded against.

Functions:

Name Description
celsius_to_kelvin

Convert a temperature from degrees Celsius to kelvin.

kelvin_to_celsius

Convert a temperature from kelvin to degrees Celsius.

celsius_to_kelvin

celsius_to_kelvin(t_celsius: float) -> float

Convert a temperature from degrees Celsius to kelvin.

kelvin_to_celsius

kelvin_to_celsius(t_kelvin: float) -> float

Convert a temperature from kelvin to degrees Celsius.