prometheus_equilibrium.equilibrium.mixture

Mixture — a collection of Species with associated mole amounts.

This is the central thermodynamic state object passed between the equilibrium solver components. It holds the current estimate of the equilibrium composition and computes weighted-sum mixture properties needed at each Newton iteration.

Species ordering convention

Gas-phase species are stored first (indices 0 … n_gas-1), followed by condensed-phase species (indices n_gas … n_species-1). This matches the block structure of the Jacobian in the Gordon-McBride method (RP-1311 §2).

Units

  • Temperature : K

  • Pressure : Pa (standard reference P° = 1e5 Pa = 1 bar)

  • Enthalpy : J/mol

  • Entropy : J/(mol·K)

  • Moles : mol

Classes

Mixture(species, moles)

A collection of thermodynamic species and their mole amounts.

class prometheus_equilibrium.equilibrium.mixture.Mixture(species: List[Species], moles: ndarray)

Bases: object

A collection of thermodynamic species and their mole amounts.

Parameters

specieslist of Species

All species in the mixture, ordered gas-first then condensed. The ordering must be consistent with the moles array.

molesarray-like, shape (n_species,)

Mole amounts nⱼ [mol] for each species. Must be non-negative.

Notes

moles is stored as a mutable NumPy array so the solver can update it in-place during the Newton iteration without constructing new objects. Use copy() to take a snapshot of the current state.

classmethod from_dict(species_moles: Dict[Species, float]) Mixture

Construct from a {Species: moles} mapping.

The dict can be in any order; gas species are automatically placed before condensed species in the internal representation.

copy() Mixture

Return a deep copy with an independent moles array.

property species: List[Species]

All species in gas-first order.

property moles: ndarray

Mole amounts nⱼ [mol], shape (n_species,). Mutable.

property n_species: int
property n_gas: int

Number of gas-phase species.

property n_condensed: int

Number of condensed-phase species.

property gas_species: List[Species]

Gas-phase species (condensed == 0).

property condensed_species: List[Species]

Condensed-phase species (condensed != 0).

gas_moles() ndarray

Mole amounts for gas-phase species only.

condensed_moles() ndarray

Mole amounts for condensed-phase species only.

property total_moles: float

Total moles n = Σⱼ nⱼ.

property total_gas_moles: float

Total gas-phase moles n_gas = Σⱼ∈gas nⱼ.

property mole_fractions: ndarray

Mole fraction xⱼ = nⱼ / Σⱼ nⱼ, shape (n_species,).

Returns zeros if total_moles is zero (avoids divide-by-zero).

property mean_molar_mass: float

Mean molar mass of the total mixture M̄ = Σⱼ xⱼ·Mⱼ [kg/mol].

Uses mole fractions over all species (gas + condensed). For solid rocket motors where condensed products (e.g. Al₂O₃) are present, use gas_mean_molar_mass for performance calculations.

property gas_mean_molar_mass: float

Gas-phase mean molar mass M̄_gas = Σⱼ∈gas xⱼ·Mⱼ [kg/mol].

Uses gas-phase mole fractions only (xⱼ = nⱼ / n_gas).

For solid rocket motors with condensed products (e.g. Al₂O₃ from aluminised propellants), the condensed phase does not contribute to the pressure-generating gas and must be excluded when computing the speed of sound, specific impulse, and nozzle flow properties. Returns 0.0 if there are no gas-phase species.

property mass_fractions: ndarray

Mass fraction Yⱼ = nⱼ·Mⱼ / Σₖ nₖ·Mₖ, shape (n_species,).

Requires Species.molar_mass() to be implemented.

cp(T: float) float

Mixture molar heat capacity at constant pressure [J/(mol·K)].

Computed as the mole-fraction–weighted sum over all species:

Cp_mix(T) = Σⱼ xⱼ · Cpⱼ(T)

where xⱼ is the mole fraction and Cpⱼ(T) is the molar heat capacity of species j from its Species object.

For condensed species Cp is included directly (no pressure-mixing term).

enthalpy(T: float) float

Mixture molar enthalpy [J/mol].

H_mix(T) = Σⱼ xⱼ · Hⱼ°(T)

Note: Hⱼ°(T) must be the absolute standard enthalpy (formation + sensible), not the sensible-only H−H(298.15) stored in JANAF data. See Prometheus.chemical.JANAF for the current limitation.

entropy(T: float, P: float = 100000.0) float

Mixture molar entropy [J/(mol·K)] at temperature T and pressure P.

For a two-phase (gas + condensed) mixture the total entropy is:

S_total(T, P) = Σⱼ∈gas nⱼ · [Sⱼ°(T) − R·ln(xⱼ) − R·ln(P/P°)]
              + Σⱼ∈cnd nⱼ · Sⱼ°(T)

where xⱼ = nⱼ / n_gas is the gas-phase mole fraction (condensed species do not contribute to partial pressure and have no mixing or pressure term).

The returned intensive quantity is S_total / n_total, i.e. entropy per mole of total mixture (gas + condensed). For solid rocket motor performance calculations that are based on the gas phase only, use gas_entropy() instead.

gibbs(T: float, P: float = 100000.0) float

Mixture Gibbs free energy G = H − T·S [J/mol].

At thermodynamic equilibrium this is minimised subject to the element-balance constraints.

gas_entropy(T: float, P: float = 100000.0) float

Gas-phase molar entropy [J/(mol·K)] at temperature T and pressure P.

Computes the entropy per mole of gas-phase species only:

S_gas(T, P) = Σⱼ∈gas xⱼ · [Sⱼ°(T) − R·ln(xⱼ) − R·ln(P/P°)]

where xⱼ = nⱼ / n_gas is the gas-phase mole fraction. Condensed species are excluded entirely.

This is the quantity needed for nozzle performance calculations (e.g. frozen or shifting isentropic expansion) where only the gas phase produces thrust. Returns 0.0 if there are no gas-phase species.

total_enthalpy(T: float) float

Total mixture enthalpy H_total = Σⱼ nⱼ·Hⱼ°(T) [J].

total_entropy(T: float, P: float = 100000.0) float

Total mixture entropy S_total = Σⱼ nⱼ·Sⱼ_mix(T,P) [J/K].

total_cp(T: float) float

Total mixture heat capacity Cp_total = Σⱼ nⱼ·Cpⱼ(T) [J/K].

Used in the energy constraint row of the Jacobian (RP-1311 eq. 2.27).

log_moles() ndarray

Natural logarithm of mole amounts ln(nⱼ), shape (n_species,).

Species with nⱼ ≤ 0 are given ln(nⱼ) = -∞ (represented as a very large negative number) and are treated as trace/inactive.

set_from_log_moles(ln_n: ndarray) None

Update mole amounts from a log-space array.

Inverse of log_moles(). Called after each Newton step to convert the updated ln(nⱼ) back to physical moles.