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 |
Component |
Immutable pure-component constant record (SI units, except molar mass). |
Functions:
| Name | Description |
|---|---|
get |
Return the |
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
¶
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. |
cas |
str | None
|
CAS registry number as a string, or |
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 |
vc |
float | None
|
Critical molar volume in m^3/mol, or |
zc |
float | None
|
Critical compressibility factor, or |
antoine |
AntoineCoeffs | None
|
|
cp_ig |
CpIdeal | None
|
|
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 |
zra |
float | None
|
Spencer-Danner Rackett compressibility |
get
¶
Return the Component for name (case-insensitive).
Raises:
| Type | Description |
|---|---|
KeyError
|
if |
component_arrays
¶
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 |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
A dict with keys |
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 |
uniquac_params |
Oriented binary UNIQUAC params |
pr_kij |
Curated Peng-Robinson binary interaction coefficient |
kij_from_database |
Assemble the symmetric Peng-Robinson |
uniquac_rq |
Return the UNIQUAC |
nrtl_from_database |
Build an |
uniquac_from_database |
Build a |
has_nrtl |
Whether every binary pair in |
has_uniquac |
Whether |
nrtl_params
¶
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
¶
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
¶
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
¶
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
¶
Return the UNIQUAC (r, q) arrays for named components.
Raises:
| Type | Description |
|---|---|
KeyError
|
if any component lacks curated |
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 |
required |
strict
|
bool
|
If |
False
|
alpha_default
|
float
|
Non-randomness used for pairs without curated parameters. |
0.3
|
Returns:
| Type | Description |
|---|---|
NRTL
|
A fully populated |
NRTL
|
curated coefficients ( |
uniquac_from_database
¶
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 |
has_nrtl
¶
Whether every binary pair in components has curated NRTL parameters.
Constants¶
constants
¶
Physical constants and unit conversions used across fugacio.thermo.
Fugacio works in SI internally:
- temperature
Tin kelvin (K), - pressure
Pin 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. |