Cubic Equations of State for Mixtures (thermo.eos_mix)

This module contains implementations of most cubic equations of state for mixtures. This includes Peng-Robinson, SRK, Van der Waals, PRSV, TWU and many other variants.

For reporting bugs, adding feature requests, or submitting pull requests, please use the GitHub issue tracker.

Base Class

class thermo.eos_mix.GCEOSMIX[source]

Bases: thermo.eos.GCEOS

Class for solving a generic pressure-explicit three-parameter cubic equation of state for a mixture. Does not implement any parameters itself; must be subclassed by a mixture equation of state class which subclasses it.

P=RTVbaα(T)V2+δV+ϵP=\frac{RT}{V-b}-\frac{a\alpha(T)}{V^2 + \delta V + \epsilon}
Attributes
A_dep_g

Departure molar Helmholtz energy from ideal gas behavior for the gas phase, [J/mol].

A_dep_l

Departure molar Helmholtz energy from ideal gas behavior for the liquid phase, [J/mol].

Cp_minus_Cv_g

Cp - Cv for the gas phase, [J/mol/K].

Cp_minus_Cv_l

Cp - Cv for the liquid phase, [J/mol/K].

U_dep_g

Departure molar internal energy from ideal gas behavior for the gas phase, [J/mol].

U_dep_l

Departure molar internal energy from ideal gas behavior for the liquid phase, [J/mol].

V_dep_g

Departure molar volume from ideal gas behavior for the gas phase, [m^3/mol].

V_dep_l

Departure molar volume from ideal gas behavior for the liquid phase, [m^3/mol].

V_g_mpmath

The molar volume of the gas phase calculated with mpmath to a higher precision, [m^3/mol].

V_l_mpmath

The molar volume of the liquid phase calculated with mpmath to a higher precision, [m^3/mol].

Vc

Critical volume, [m^3/mol].

a_alpha_ijs

Calculate and return the matrix (aα)ij=(1kij)(aα)i(aα)j(a\alpha)_{ij} = (1-k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}.

beta_g

Isobaric (constant-pressure) expansion coefficient for the gas phase, [1/K].

beta_l

Isobaric (constant-pressure) expansion coefficient for the liquid phase, [1/K].

c1
c2
d2H_dep_dT2_g

Second temperature derivative of departure enthalpy with respect to temperature for the gas phase, [(J/mol)/K^2].

d2H_dep_dT2_g_P

Second temperature derivative of departure enthalpy with respect to temperature for the gas phase, [(J/mol)/K^2].

d2H_dep_dT2_g_V

Second temperature derivative of departure enthalpy with respect to temperature at constant volume for the gas phase, [(J/mol)/K^2].

d2H_dep_dT2_l

Second temperature derivative of departure enthalpy with respect to temperature for the liquid phase, [(J/mol)/K^2].

d2H_dep_dT2_l_P

Second temperature derivative of departure enthalpy with respect to temperature for the liquid phase, [(J/mol)/K^2].

d2H_dep_dT2_l_V

Second temperature derivative of departure enthalpy with respect to temperature at constant volume for the liquid phase, [(J/mol)/K^2].

d2H_dep_dTdP_g

Temperature and pressure derivative of departure enthalpy at constant pressure then temperature for the gas phase, [(J/mol)/K/Pa].

d2H_dep_dTdP_l

Temperature and pressure derivative of departure enthalpy at constant pressure then temperature for the liquid phase, [(J/mol)/K/Pa].

d2P_dT2_PV_g

Second derivative of pressure with respect to temperature twice, but with pressure held constant the first time and volume held constant the second time for the gas phase, [Pa/K^2].

d2P_dT2_PV_l

Second derivative of pressure with respect to temperature twice, but with pressure held constant the first time and volume held constant the second time for the liquid phase, [Pa/K^2].

d2P_dTdP_g

Second derivative of pressure with respect to temperature and, then pressure; and with volume held constant at first, then temperature, for the gas phase, [1/K].

d2P_dTdP_l

Second derivative of pressure with respect to temperature and, then pressure; and with volume held constant at first, then temperature, for the liquid phase, [1/K].

d2P_dTdrho_g

Derivative of pressure with respect to molar density, and temperature for the gas phase, [Pa/(K*mol/m^3)].

d2P_dTdrho_l

Derivative of pressure with respect to molar density, and temperature for the liquid phase, [Pa/(K*mol/m^3)].

d2P_dVdP_g

Second derivative of pressure with respect to molar volume and then pressure for the gas phase, [mol/m^3].

d2P_dVdP_l

Second derivative of pressure with respect to molar volume and then pressure for the liquid phase, [mol/m^3].

d2P_dVdT_TP_g

Second derivative of pressure with respect to molar volume and then temperature at constant temperature then pressure for the gas phase, [Pa*mol/m^3/K].

d2P_dVdT_TP_l

Second derivative of pressure with respect to molar volume and then temperature at constant temperature then pressure for the liquid phase, [Pa*mol/m^3/K].

d2P_dVdT_g

Alias of GCEOS.d2P_dTdV_g

d2P_dVdT_l

Alias of GCEOS.d2P_dTdV_l

d2P_drho2_g

Second derivative of pressure with respect to molar density for the gas phase, [Pa/(mol/m^3)^2].

d2P_drho2_l

Second derivative of pressure with respect to molar density for the liquid phase, [Pa/(mol/m^3)^2].

d2S_dep_dT2_g

Second temperature derivative of departure entropy with respect to temperature for the gas phase, [(J/mol)/K^3].

d2S_dep_dT2_g_V

Second temperature derivative of departure entropy with respect to temperature at constant volume for the gas phase, [(J/mol)/K^3].

d2S_dep_dT2_l

Second temperature derivative of departure entropy with respect to temperature for the liquid phase, [(J/mol)/K^3].

d2S_dep_dT2_l_V

Second temperature derivative of departure entropy with respect to temperature at constant volume for the liquid phase, [(J/mol)/K^3].

d2S_dep_dTdP_g

Temperature and pressure derivative of departure entropy at constant pressure then temperature for the gas phase, [(J/mol)/K^2/Pa].

d2S_dep_dTdP_l

Temperature and pressure derivative of departure entropy at constant pressure then temperature for the liquid phase, [(J/mol)/K^2/Pa].

d2T_dP2_g

Second partial derivative of temperature with respect to pressure (constant volume) for the gas phase, [K/Pa^2].

d2T_dP2_l

Second partial derivative of temperature with respect to pressure (constant temperature) for the liquid phase, [K/Pa^2].

d2T_dPdV_g

Second partial derivative of temperature with respect to pressure (constant volume) and then volume (constant pressure) for the gas phase, [K*mol/(Pa*m^3)].

d2T_dPdV_l

Second partial derivative of temperature with respect to pressure (constant volume) and then volume (constant pressure) for the liquid phase, [K*mol/(Pa*m^3)].

d2T_dPdrho_g

Derivative of temperature with respect to molar density, and pressure for the gas phase, [K/(Pa*mol/m^3)].

d2T_dPdrho_l

Derivative of temperature with respect to molar density, and pressure for the liquid phase, [K/(Pa*mol/m^3)].

d2T_dV2_g

Second partial derivative of temperature with respect to volume (constant pressure) for the gas phase, [K*mol^2/m^6].

d2T_dV2_l

Second partial derivative of temperature with respect to volume (constant pressure) for the liquid phase, [K*mol^2/m^6].

d2T_dVdP_g

Second partial derivative of temperature with respect to pressure (constant volume) and then volume (constant pressure) for the gas phase, [K*mol/(Pa*m^3)].

d2T_dVdP_l

Second partial derivative of temperature with respect to pressure (constant volume) and then volume (constant pressure) for the liquid phase, [K*mol/(Pa*m^3)].

d2T_drho2_g

Second derivative of temperature with respect to molar density for the gas phase, [K/(mol/m^3)^2].

d2T_drho2_l

Second derivative of temperature with respect to molar density for the liquid phase, [K/(mol/m^3)^2].

d2V_dP2_g

Second partial derivative of volume with respect to pressure (constant temperature) for the gas phase, [m^3/(Pa^2*mol)].

d2V_dP2_l

Second partial derivative of volume with respect to pressure (constant temperature) for the liquid phase, [m^3/(Pa^2*mol)].

d2V_dPdT_g

Second partial derivative of volume with respect to pressure (constant temperature) and then presssure (constant temperature) for the gas phase, [m^3/(K*Pa*mol)].

d2V_dPdT_l

Second partial derivative of volume with respect to pressure (constant temperature) and then presssure (constant temperature) for the liquid phase, [m^3/(K*Pa*mol)].

d2V_dT2_g

Second partial derivative of volume with respect to temperature (constant pressure) for the gas phase, [m^3/(mol*K^2)].

d2V_dT2_l

Second partial derivative of volume with respect to temperature (constant pressure) for the liquid phase, [m^3/(mol*K^2)].

d2V_dTdP_g

Second partial derivative of volume with respect to pressure (constant temperature) and then presssure (constant temperature) for the gas phase, [m^3/(K*Pa*mol)].

d2V_dTdP_l

Second partial derivative of volume with respect to pressure (constant temperature) and then presssure (constant temperature) for the liquid phase, [m^3/(K*Pa*mol)].

d2a_alpha_dT2_dns

Helper method for calculating the mole number derivatives of d2a_alpha_dT2.

d2a_alpha_dT2_dzs

Helper method for calculating the mole number derivatives of d2a_alpha_dT2.

d2a_alpha_dT2_ijs

Calculate and return the matrix of the second temperature derivatives of the alpha terms.

d2a_alpha_dTdP_g_V

Derivative of the temperature derivative of a_alpha with respect to pressure at constant volume (varying T) for the gas phase, [J^2/mol^2/Pa^2/K].

d2a_alpha_dTdP_l_V

Derivative of the temperature derivative of a_alpha with respect to pressure at constant volume (varying T) for the liquid phase, [J^2/mol^2/Pa^2/K].

d2a_alpha_dninjs

Helper method for calculating the second partial molar derivatives of a_alpha (hessian).

d2a_alpha_dzizjs

Helper method for calculating the second composition derivatives of a_alpha (hessian).

d2b_dninjs

Helper method for calculating the second partial mole number derivatives of b.

d2b_dzizjs

Helper method for calculating the second partial mole fraction derivatives of b.

d2rho_dP2_g

Second derivative of molar density with respect to pressure for the gas phase, [(mol/m^3)/Pa^2].

d2rho_dP2_l

Second derivative of molar density with respect to pressure for the liquid phase, [(mol/m^3)/Pa^2].

d2rho_dPdT_g

Second derivative of molar density with respect to pressure and temperature for the gas phase, [(mol/m^3)/(K*Pa)].

d2rho_dPdT_l

Second derivative of molar density with respect to pressure and temperature for the liquid phase, [(mol/m^3)/(K*Pa)].

d2rho_dT2_g

Second derivative of molar density with respect to temperature for the gas phase, [(mol/m^3)/K^2].

d2rho_dT2_l

Second derivative of molar density with respect to temperature for the liquid phase, [(mol/m^3)/K^2].

d3a_alpha_dT3

Method to calculate the third temperature derivative of aαa \alpha, [J^2/mol^2/Pa/K^3].

d3a_alpha_dninjnks

Helper method for calculating the third mole number derivatives of a_alpha.

d3a_alpha_dzizjzks

Helper method for calculating the third composition derivatives of a_alpha.

d3b_dninjnks

Helper method for calculating the third partial mole number derivatives of b.

d3b_dzizjzks

Helper method for calculating the third partial mole fraction derivatives of b.

d3delta_dzizjzks

Helper method for calculating the third composition derivatives of delta.

d3epsilon_dzizjzks

Helper method for calculating the third composition derivatives of epsilon.

dH_dep_dP_g

Derivative of departure enthalpy with respect to pressure for the gas phase, [(J/mol)/Pa].

dH_dep_dP_g_V

Derivative of departure enthalpy with respect to pressure at constant volume for the liquid phase, [(J/mol)/Pa].

dH_dep_dP_l

Derivative of departure enthalpy with respect to pressure for the liquid phase, [(J/mol)/Pa].

dH_dep_dP_l_V

Derivative of departure enthalpy with respect to pressure at constant volume for the gas phase, [(J/mol)/Pa].

dH_dep_dT_g

Derivative of departure enthalpy with respect to temperature for the gas phase, [(J/mol)/K].

dH_dep_dT_g_V

Derivative of departure enthalpy with respect to temperature at constant volume for the gas phase, [(J/mol)/K].

dH_dep_dT_l

Derivative of departure enthalpy with respect to temperature for the liquid phase, [(J/mol)/K].

dH_dep_dT_l_V

Derivative of departure enthalpy with respect to temperature at constant volume for the liquid phase, [(J/mol)/K].

dH_dep_dV_g_P

Derivative of departure enthalpy with respect to volume at constant pressure for the gas phase, [J/m^3].

dH_dep_dV_g_T

Derivative of departure enthalpy with respect to volume at constant temperature for the gas phase, [J/m^3].

dH_dep_dV_l_P

Derivative of departure enthalpy with respect to volume at constant pressure for the liquid phase, [J/m^3].

dH_dep_dV_l_T

Derivative of departure enthalpy with respect to volume at constant temperature for the gas phase, [J/m^3].

dP_drho_g

Derivative of pressure with respect to molar density for the gas phase, [Pa/(mol/m^3)].

dP_drho_l

Derivative of pressure with respect to molar density for the liquid phase, [Pa/(mol/m^3)].

dS_dep_dP_g

Derivative of departure entropy with respect to pressure for the gas phase, [(J/mol)/K/Pa].

dS_dep_dP_g_V

Derivative of departure entropy with respect to pressure at constant volume for the gas phase, [(J/mol)/K/Pa].

dS_dep_dP_l

Derivative of departure entropy with respect to pressure for the liquid phase, [(J/mol)/K/Pa].

dS_dep_dP_l_V

Derivative of departure entropy with respect to pressure at constant volume for the liquid phase, [(J/mol)/K/Pa].

dS_dep_dT_g

Derivative of departure entropy with respect to temperature for the gas phase, [(J/mol)/K^2].

dS_dep_dT_g_V

Derivative of departure entropy with respect to temperature at constant volume for the gas phase, [(J/mol)/K^2].

dS_dep_dT_l

Derivative of departure entropy with respect to temperature for the liquid phase, [(J/mol)/K^2].

dS_dep_dT_l_V

Derivative of departure entropy with respect to temperature at constant volume for the liquid phase, [(J/mol)/K^2].

dS_dep_dV_g_P

Derivative of departure entropy with respect to volume at constant pressure for the gas phase, [J/K/m^3].

dS_dep_dV_g_T

Derivative of departure entropy with respect to volume at constant temperature for the gas phase, [J/K/m^3].

dS_dep_dV_l_P

Derivative of departure entropy with respect to volume at constant pressure for the liquid phase, [J/K/m^3].

dS_dep_dV_l_T

Derivative of departure entropy with respect to volume at constant temperature for the gas phase, [J/K/m^3].

dT_drho_g

Derivative of temperature with respect to molar density for the gas phase, [K/(mol/m^3)].

dT_drho_l

Derivative of temperature with respect to molar density for the liquid phase, [K/(mol/m^3)].

dZ_dP_g

Derivative of compressibility factor with respect to pressure for the gas phase, [1/Pa].

dZ_dP_l

Derivative of compressibility factor with respect to pressure for the liquid phase, [1/Pa].

dZ_dT_g

Derivative of compressibility factor with respect to temperature for the gas phase, [1/K].

dZ_dT_l

Derivative of compressibility factor with respect to temperature for the liquid phase, [1/K].

da_alpha_dP_g_V

Derivative of the a_alpha with respect to pressure at constant volume (varying T) for the gas phase, [J^2/mol^2/Pa^2].

da_alpha_dP_l_V

Derivative of the a_alpha with respect to pressure at constant volume (varying T) for the liquid phase, [J^2/mol^2/Pa^2].

da_alpha_dT_dns

Helper method for calculating the mole number derivatives of da_alpha_dT.

da_alpha_dT_dzs

Helper method for calculating the composition derivatives of da_alpha_dT.

da_alpha_dT_ijs

Calculate and return the matrix for the temperature derivatives of the alpha terms.

da_alpha_dns

Helper method for calculating the mole number derivatives of a_alpha.

da_alpha_dzs

Helper method for calculating the composition derivatives of a_alpha.

db_dns

Helper method for calculating the mole number derivatives of b.

db_dzs

Helper method for calculating the composition derivatives of b.

dbeta_dP_g

Derivative of isobaric expansion coefficient with respect to pressure for the gas phase, [1/(Pa*K)].

dbeta_dP_l

Derivative of isobaric expansion coefficient with respect to pressure for the liquid phase, [1/(Pa*K)].

dbeta_dT_g

Derivative of isobaric expansion coefficient with respect to temperature for the gas phase, [1/K^2].

dbeta_dT_l

Derivative of isobaric expansion coefficient with respect to temperature for the liquid phase, [1/K^2].

dfugacity_dP_g

Derivative of fugacity with respect to pressure for the gas phase, [-].

dfugacity_dP_l

Derivative of fugacity with respect to pressure for the liquid phase, [-].

dfugacity_dT_g

Derivative of fugacity with respect to temperature for the gas phase, [Pa/K].

dfugacity_dT_l

Derivative of fugacity with respect to temperature for the liquid phase, [Pa/K].

dna_alpha_dT_dns

Helper method for calculating the mole number derivatives of da_alpha_dT.

dna_alpha_dns

Helper method for calculating the partial molar derivatives of a_alpha.

dnb_dns

Helper method for calculating the partial molar derivative of b.

dphi_dP_g

Derivative of fugacity coefficient with respect to pressure for the gas phase, [1/Pa].

dphi_dP_l

Derivative of fugacity coefficient with respect to pressure for the liquid phase, [1/Pa].

dphi_dT_g

Derivative of fugacity coefficient with respect to temperature for the gas phase, [1/K].

dphi_dT_l

Derivative of fugacity coefficient with respect to temperature for the liquid phase, [1/K].

drho_dP_g

Derivative of molar density with respect to pressure for the gas phase, [(mol/m^3)/Pa].

drho_dP_l

Derivative of molar density with respect to pressure for the liquid phase, [(mol/m^3)/Pa].

drho_dT_g

Derivative of molar density with respect to temperature for the gas phase, [(mol/m^3)/K].

drho_dT_l

Derivative of molar density with respect to temperature for the liquid phase, [(mol/m^3)/K].

fugacity_g

Fugacity for the gas phase, [Pa].

fugacity_l

Fugacity for the liquid phase, [Pa].

kappa_g

Isothermal (constant-temperature) expansion coefficient for the gas phase, [1/Pa].

kappa_l

Isothermal (constant-temperature) expansion coefficient for the liquid phase, [1/Pa].

lnphi_g

The natural logarithm of the fugacity coefficient for the gas phase, [-].

lnphi_l

The natural logarithm of the fugacity coefficient for the liquid phase, [-].

more_stable_phase

Checks the Gibbs energy of each possible phase, and returns ‘l’ if the liquid-like phase is more stable, and ‘g’ if the vapor-like phase is more stable.

mpmath_volume_ratios

Method to compare, as ratios, the volumes of the implemented cubic solver versus those calculated using mpmath.

mpmath_volumes

Method to calculate to a high precision the exact roots to the cubic equation, using mpmath.

mpmath_volumes_float

Method to calculate real roots of a cubic equation, using mpmath, but returned as floats.

phi_g

Fugacity coefficient for the gas phase, [Pa].

phi_l

Fugacity coefficient for the liquid phase, [Pa].

pseudo_Pc

Apply a linear mole-fraction mixing rule to compute the average critical pressure, [Pa].

pseudo_Tc

Apply a linear mole-fraction mixing rule to compute the average critical temperature, [K].

pseudo_a

Apply a linear mole-fraction mixing rule to compute the average a coefficient, [-].

pseudo_omega

Apply a linear mole-fraction mixing rule to compute the average omega, [-].

rho_g

Gas molar density, [mol/m^3].

rho_l

Liquid molar density, [mol/m^3].

sorted_volumes

List of lexicographically-sorted molar volumes available from the root finding algorithm used to solve the PT point.

state_specs

Convenience method to return the two specified state specs (T, P, or V) as a dictionary.

Methods

Hvap(T)

Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration.

PT_surface_special([Tmin, Tmax, Pmin, Pmax, ...])

Method to create a plot of the special curves of a pure fluid - vapor pressure, determinant zeros, pseudo critical point, and mechanical critical point.

P_PIP_transition(T[, low_P_limit])

Method to calculate the pressure which makes the phase identification parameter exactly 1.

P_discriminant_zero_g()

Method to calculate the pressure which zero the discriminant function of the general cubic eos, and is likely to sit on a boundary between not having a vapor-like volume; and having a vapor-like volume.

P_discriminant_zero_l()

Method to calculate the pressure which zero the discriminant function of the general cubic eos, and is likely to sit on a boundary between not having a liquid-like volume; and having a liquid-like volume.

P_discriminant_zeros()

Method to calculate the pressures which zero the discriminant function of the general cubic eos, at the current temperature.

P_discriminant_zeros_analytical(T, b, delta, ...)

Method to calculate the pressures which zero the discriminant function of the general cubic eos.

P_max_at_V(V)

Dummy method.

Psat(T[, polish])

Generic method to calculate vapor pressure of a pure-component equation of state for a specified T.

Psat_errors([Tmin, Tmax, pts, plot, show, ...])

Method to create a plot of vapor pressure and the relative error of its calculation vs.

T_discriminant_zero_g([T_guess])

Method to calculate the temperature which zeros the discriminant function of the general cubic eos, and is likely to sit on a boundary between not having a vapor-like volume; and having a vapor-like volume.

T_discriminant_zero_l([T_guess])

Method to calculate the temperature which zeros the discriminant function of the general cubic eos, and is likely to sit on a boundary between not having a liquid-like volume; and having a liquid-like volume.

T_max_at_V(V[, Pmax])

Method to calculate the maximum temperature the EOS can create at a constant volume, if one exists; returns None otherwise.

T_min_at_V(V[, Pmin])

Returns the minimum temperature for the EOS to have the volume as specified.

Tsat(P[, polish])

Generic method to calculate the temperature for a specified vapor pressure of the pure fluid.

V_g_sat(T)

Method to calculate molar volume of the vapor phase along the saturation line.

V_l_sat(T)

Method to calculate molar volume of the liquid phase along the saturation line.

Vs_mpmath()

Method to calculate real roots of a cubic equation, using mpmath.

a_alpha_and_derivatives(T[, full, quick, ...])

Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules.

a_alpha_and_derivatives_pure(T)

Dummy method to calculate aαa \alpha and its first and second derivatives.

a_alpha_for_Psat(T, Psat[, a_alpha_guess])

Method to calculate which value of aαa \alpha is required for a given T, Psat pair.

a_alpha_for_V(T, P, V)

Method to calculate which value of aαa \alpha is required for a given T, P pair to match a specified V.

a_alpha_plot([Tmin, Tmax, pts, plot, show])

Method to create a plot of the aαa \alpha parameter and its first two derivatives.

as_json([cache, option])

Method to create a JSON-friendly serialization of the eos which can be stored, and reloaded later.

check_sufficient_inputs()

Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given.

d2G_dep_dninjs(Z)

Calculates the molar departure Gibbs energy mole number derivatives (where the mole fractions sum to 1).

d2G_dep_dzizjs(Z)

Calculates the molar departure Gibbs energy second composition derivative (where the mole fractions do not sum to 1).

d2V_dninjs(Z)

Calculates the molar volume second mole number derivatives (where the mole fractions sum to 1).

d2V_dzizjs(Z)

Calculates the molar volume second composition derivative (where the mole fractions do not sum to 1).

d2lnphi_dninjs(Z)

Calculates the mixture log fugacity coefficient second mole number derivatives (where the mole fraction sum to 1).

d2lnphi_dzizjs(Z)

Calculates the mixture log fugacity coefficient second mole fraction derivatives (where the mole fractions do not sum to 1).

d2phi_sat_dT2(T[, polish])

Method to calculate the second temperature derivative of saturation fugacity coefficient of the compound.

dG_dep_dns(Z)

Calculates the molar departure Gibbs energy mole number derivatives (where the mole fractions sum to 1).

dG_dep_dzs(Z)

Calculates the molar departure Gibbs energy composition derivative (where the mole fractions do not sum to 1).

dH_dep_dT_sat_g(T[, polish])

Method to calculate and return the temperature derivative of saturation vapor excess enthalpy.

dH_dep_dT_sat_l(T[, polish])

Method to calculate and return the temperature derivative of saturation liquid excess enthalpy.

dH_dep_dns(Z)

Calculates the molar departure enthalpy mole number derivatives (where the mole fractions sum to 1).

dH_dep_dzs(Z)

Calculates the molar departure enthalpy composition derivative (where the mole fractions do not sum to 1).

dPsat_dT(T[, polish, also_Psat])

Generic method to calculate the temperature derivative of vapor pressure for a specified T.

dS_dep_dT_sat_g(T[, polish])

Method to calculate and return the temperature derivative of saturation vapor excess entropy.

dS_dep_dT_sat_l(T[, polish])

Method to calculate and return the temperature derivative of saturation liquid excess entropy.

dS_dep_dns(Z)

Calculates the molar departure entropy mole number derivatives (where the mole fractions sum to 1).

dS_dep_dzs(Z)

Calculates the molar departure entropy composition derivative (where the mole fractions do not sum to 1).

dV_dns(Z)

Calculates the molar volume mole number derivatives (where the mole fractions sum to 1).

dV_dzs(Z)

Calculates the molar volume composition derivative (where the mole fractions do not sum to 1).

dZ_dns(Z)

Calculates the compressibility mole number derivatives (where the mole fractions sum to 1).

dZ_dzs(Z)

Calculates the compressibility composition derivatives (where the mole fractions do not sum to 1).

dfugacities_dns(phase)

Generic formula for calculating the mole number derivaitves of fugacities for each species in a mixture.

discriminant([T, P])

Method to compute the discriminant of the cubic volume solution with the current EOS parameters, optionally at the same (assumed) T, and P or at different ones, if values are specified.

dlnfugacities_dns(phase)

Generic formula for calculating the mole number derivaitves of log fugacities for each species in a mixture.

dlnphi_dns(Z)

Calculates the mixture log fugacity coefficient mole number derivatives (where the mole fractions sum to 1).

dlnphi_dzs(Z)

Calculates the mixture log fugacity coefficient mole fraction derivatives (where the mole fractions do not sum to 1).

dlnphis_dP(phase)

Generic formula for calculating the pressure derivaitve of log fugacity coefficients for each species in a mixture.

dlnphis_dT(phase)

Generic formula for calculating the temperature derivaitve of log fugacity coefficients for each species in a mixture.

dlnphis_dns(Z)

Generic formula for calculating the mole number derivaitves of log fugacity coefficients for each species in a mixture.

dlnphis_dzs(Z)

Generic formula for calculating the mole fraction derivaitves of log fugacity coefficients for each species in a mixture.

dnG_dep_dns(Z)

Calculates the partial molar departure Gibbs energy.

dnH_dep_dns(Z)

Calculates the partial molar departure enthalpy.

dnV_dns(Z)

Calculates the partial molar volume of the specified phase No specific formula is implemented for this property - it is calculated from the molar volume mole fraction derivative.

dnZ_dns(Z)

Calculates the partial compressibility of the specified phase No specific formula is implemented for this property - it is calculated from the compressibility mole fraction derivative.

dphi_sat_dT(T[, polish])

Method to calculate the temperature derivative of saturation fugacity coefficient of the compound.

exact_hash()

Method to calculate and return a hash representing the exact state of the object.

from_json(json_repr[, cache])

Method to create a mixture cubic equation of state from a JSON friendly serialization of another mixture cubic equation of state.

fugacities([only_l, only_g])

Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase.

fugacity_coefficients(Z)

Generic formula for calculating log fugacity coefficients for each species in a mixture.

mechanical_critical_point()

Method to calculate the mechanical critical point of a mixture of defined composition.

model_hash()

Basic method to calculate a hash of the non-state parts of the model This is useful for comparing to models to determine if they are the same, i.e. in a VLL flash it is important to know if both liquids have the same model.

phi_sat(T[, polish])

Method to calculate the saturation fugacity coefficient of the compound.

pures()

Helper method which returns a list of pure EOSs at the same T and P and base EOS as the mixture.

resolve_full_alphas()

Generic method to resolve the eos with fully calculated alpha derviatives.

saturation_prop_plot(prop[, Tmin, Tmax, ...])

Method to create a plot of a specified property of the EOS along the (pure component) saturation line.

set_dnzs_derivatives_and_departures([n, x, ...])

Sets a number of mole number and/or composition partial derivatives of thermodynamic partial derivatives.

set_from_PT(Vs[, only_l, only_g])

Counts the number of real volumes in Vs, and determines what to do.

set_properties_from_solution(T, P, V, b, ...)

Sets all interesting properties which can be calculated from an EOS alone.

solve([pure_a_alphas, only_l, only_g, ...])

First EOS-generic method; should be called by all specific EOSs.

solve_T(P, V[, quick, solution])

Generic method to calculate T from a specified P and V.

solve_missing_volumes()

Generic method to ensure both volumes, if solutions are physical, have calculated properties.

state_hash()

Basic method to calculate a hash of the state of the model and its model parameters.

subset(idxs, **state_specs)

Method to construct a new GCEOSMIX that removes all components not specified in the idxs argument.

to([zs, T, P, V, fugacities])

Method to construct a new GCEOSMIX object at two of T, P or V with the specified composition.

to_PV(P, V)

Method to construct a new GCEOSMIX object at the spcified P and V with the current composition.

to_PV_zs(P, V, zs[, fugacities, only_l, only_g])

Method to construct a new GCEOSMIX instance at P, V, and zs with the same parameters as the existing object.

to_TP(T, P)

Method to construct a new GCEOSMIX object at the spcified T and P with the current composition.

to_TPV_pure(i[, T, P, V])

Helper method which returns a pure EOSs at the specs (two of T, P and V) and base EOS as the mixture for a particular index.

to_TP_zs(T, P, zs[, fugacities, only_l, only_g])

Method to construct a new GCEOSMIX instance at T, P, and zs with the same parameters as the existing object.

to_TP_zs_fast(T, P, zs[, only_l, only_g, ...])

Method to construct a new GCEOSMIX instance with the same parameters as the existing object.

to_TV(T, V)

Method to construct a new GCEOSMIX object at the spcified T and V with the current composition.

to_mechanical_critical_point()

Method to construct a new GCEOSMIX object at the current object's properties and composition, but which is at the mechanical critical point.

volume_error()

Method to calculate the relative absolute error in the calculated molar volumes.

volume_errors([Tmin, Tmax, Pmin, Pmax, pts, ...])

Method to create a plot of the relative absolute error in the cubic volume solution as compared to a higher-precision calculation.

volume_solutions(T, P, b, delta, epsilon, ...)

Halley's method based solver for cubic EOS volumes based on the idea of initializing from a single liquid-like guess which is solved precisely, deflating the cubic analytically, solving the quadratic equation for the next two volumes, and then performing two halley steps on each of them to obtain the final solutions.

volume_solutions_full(T, P, b, delta, ...[, ...])

Newton-Raphson based solver for cubic EOS volumes based on the idea of initializing from an analytical solver.

volume_solutions_mp(T, P, b, delta, epsilon, ...)

Solution of this form of the cubic EOS in terms of volumes, using the mpmath arbitrary precision library.

stabiliy_iteration_Michelsen

Psat(T, polish=False)[source]

Generic method to calculate vapor pressure of a pure-component equation of state for a specified T. An explicit solution is used unless polish is True.

The result of this function has no physical meaning for multicomponent mixtures, and does not represent either a dew point or a bubble point!

Parameters
Tfloat

Temperature, [K]

polishbool, optional

Whether to attempt to use a numerical solver to make the solution more precise or not

Returns
Psatfloat

Vapor pressure using the pure-component approach, [Pa]

Notes

For multicomponent mixtures this may serve as a useful guess for the dew and the bubble pressure.

a_alpha_and_derivatives(T, full=True, quick=True, pure_a_alphas=True)[source]

Method to calculate a_alpha and its first and second derivatives for an EOS with the Van der Waals mixing rules. Uses the parent class’s interface to compute pure component values. Returns a_alpha, da_alpha_dT, and d2a_alpha_dT2.

For use in solve_T this returns only a_alpha if full is False.

aα=ijzizj(aα)ija \alpha = \sum_i \sum_j z_i z_j {(a\alpha)}_{ij}
(aα)ij=(1kij)(aα)i(aα)j(a\alpha)_{ij} = (1-k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}
Parameters
Tfloat

Temperature, [K]

fullbool, optional

If False, calculates and returns only a_alpha

quickbool, optional

Only the quick variant is implemented; it is little faster anyhow

pure_a_alphasbool, optional

Whether or not to recalculate the a_alpha terms of pure components (for the case of mixtures only) which stay the same as the composition changes (i.e in a PT flash), [-]

Returns
a_alphafloat

Coefficient calculated by EOS-specific method, [J^2/mol^2/Pa]

da_alpha_dTfloat

Temperature derivative of coefficient calculated by EOS-specific method, [J^2/mol^2/Pa/K]

d2a_alpha_dT2float

Second temperature derivative of coefficient calculated by EOS-specific method, [J^2/mol^2/Pa/K**2]

Notes

The exact expressions can be obtained with the following SymPy expression below, commented out for brevity.

>>> from sympy import *  
>>> kij, T = symbols('kij, T ')  
>>> a_alpha_i, a_alpha_j = symbols('a_alpha_i, a_alpha_j', cls=Function)  
>>> a_alpha_ij = (1-kij)*sqrt(a_alpha_i(T)*a_alpha_j(T))  
>>> diff(a_alpha_ij, T)  
>>> diff(a_alpha_ij, T, T)  
property a_alpha_ijs

Calculate and return the matrix (aα)ij=(1kij)(aα)i(aα)j(a\alpha)_{ij} = (1-k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}.

Returns
a_alpha_ijslist[list[float]]

a_alpha terms for each component with every other component, [J^2/mol^2/Pa]

Notes

In an earlier implementation this matrix was stored each EOS solve; however, allocating that much memory becomes quite expensive for large number of component cases and this is now calculated on-demand only.

d2G_dep_dninjs(Z)[source]

Calculates the molar departure Gibbs energy mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(2Gdepnjni)T,P,ni,jk=f((2Gdepxjxi)T,P,xi,jk)\left(\frac{\partial^2 G_{dep}}{\partial n_j \partial n_i}\right)_{T, P, n_{i,j\ne k}} = f\left( \left(\frac{\partial^2 G_{dep}}{\partial x_j \partial x_i}\right)_{T, P, x_{i,j\ne k}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
d2G_dep_dninjsfloat

Departure Gibbs energy second mole number derivatives, [J/mol^3]

d2G_dep_dzizjs(Z)[source]

Calculates the molar departure Gibbs energy second composition derivative (where the mole fractions do not sum to 1). Verified numerically. Useful in solving for gibbs minimization calculations or for solving for the true critical point. Also forms the basis for the molar departure Gibbs energy mole second number derivative.

(2Gdepxjxi)T,P,xi,jk=run SymPy code to obtain - very long!\left(\frac{\partial^2 G_{dep}}{\partial x_j \partial x_i}\right)_{T, P, x_{i,j\ne k}} = \text{run SymPy code to obtain - very long!}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
d2G_dep_dzizjsfloat

Departure Gibbs free energy second composition derivatives, [J/mol]

Notes

The derivation for the derivative is performed as follows using SymPy. The function source code is an optimized variant created with the cse SymPy function, and hand optimized further.

>>> from sympy import * 
>>> P, T, R, x1, x2 = symbols('P, T, R, x1, x2') 
>>> a_alpha, delta, epsilon, V, b = symbols('a\ \\alpha, delta, epsilon, V, b', cls=Function) 
>>> da_alpha_dT, d2a_alpha_dT2 = symbols('da_alpha_dT, d2a_alpha_dT2', cls=Function) 
>>> S_dep = R*log(P*V(x1, x2)/(R*T)) + R*log(V(x1, x2)-b(x1, x2))+2*da_alpha_dT(x1, x2)*atanh((2*V(x1, x2)+delta(x1, x2))/sqrt(delta(x1, x2)**2-4*epsilon(x1, x2)))/sqrt(delta(x1, x2)**2-4*epsilon(x1, x2))-R*log(V(x1, x2)) 
>>> H_dep = P*V(x1, x2) - R*T + 2*atanh((2*V(x1, x2)+delta(x1, x2))/sqrt(delta(x1, x2)**2-4*epsilon(x1, x2)))*(da_alpha_dT(x1, x2)*T-a_alpha(x1, x2))/sqrt(delta(x1, x2)**2-4*epsilon(x1, x2)) 
>>> G_dep = simplify(H_dep - T*S_dep) 
>>> diff(G_dep, x1, x2) 
d2V_dninjs(Z)[source]

Calculates the molar volume second mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the second mole fraction derivatives.

(2Vninj)T,P,nki,j=f((2Vxixj)T,P,xki,j)\left(\frac{\partial^2 V}{\partial n_i \partial n_j}\right)_{T, P, n_{k\ne i,j}} = f\left( \left(\frac{\partial^2 V}{\partial x_i\partial x_j}\right)_{T, P, x_{k\ne i,j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
d2V_dninjsfloat

Molar volume second mole number derivatives, [m^3/mol^3]

d2V_dzizjs(Z)[source]

Calculates the molar volume second composition derivative (where the mole fractions do not sum to 1). Verified numerically. Used in many other derivatives, and for the molar volume second mole number derivative.

(2Vxixj)T,P,xki,j=run SymPy code to obtain - very long!\left(\frac{\partial^2 V}{\partial x_i \partial x_j}\right)_{T, P, x_{k \ne i,j}} = \text{run SymPy code to obtain - very long!}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
d2V_dzizjsfloat

Molar volume second composition derivatives, [m^3/mol]

Notes

The derivation for the derivative is performed as follows using SymPy. The function source code is an optimized variant created with the cse SymPy function, and hand optimized further.

>>> from sympy import * 
>>> P, T, R, x1, x2 = symbols('P, T, R, x1, x2') 
>>> V, delta, epsilon, a_alpha, b = symbols('V, delta, epsilon, a\ \\alpha, b', cls=Function) 
>>> CUBIC = R*T/(V(x1, x2) - b(x1, x2)) - a_alpha(x1, x2)/(V(x1, x2)*V(x1, x2) + delta(x1, x2)*V(x1, x2) + epsilon(x1, x2)) - P 
>>> solve(diff(CUBIC, x1, x2), Derivative(V(x1, x2), x1, x2)) 
property d2a_alpha_dT2_dns

Helper method for calculating the mole number derivatives of d2a_alpha_dT2. Note this is independent of the phase.

(3aαniT2)P,nij=f((3aαziT2)P,zij)\left(\frac{\partial^3 a \alpha}{\partial n_i \partial T^2} \right)_{P, n_{i\ne j}} = f\left(\left(\frac{\partial^3 a\alpha}{\partial z_i \partial T^2} \right)_{P, z_{i\ne j}} \right)
Returns
d2a_alpha_dT2_dnslist[float]

Mole number derivative of d2a_alpha_dT2 of each component, [kg*m^5/(mol^3*s^2*K^2)]

Notes

This derivative is checked numerically.

property d2a_alpha_dT2_dzs

Helper method for calculating the mole number derivatives of d2a_alpha_dT2. Note this is independent of the phase.

(3aαziT2)P,zij=large expression\left(\frac{\partial^3 a \alpha}{\partial z_i \partial T^2} \right)_{P, z_{i\ne j}} = \text{large expression}
Returns
d2a_alpha_dT2_dzslist[float]

Composition derivative of d2a_alpha_dT2 of each component, [kg*m^5/(mol^2*s^2*K^2)]

Notes

This derivative is checked numerically.

property d2a_alpha_dT2_ijs

Calculate and return the matrix of the second temperature derivatives of the alpha terms.

2(aα)ijT2=aαi(T)aαj(T)(kij1)((aαi(T)ddTaαj(T)+aαj(T)ddTaαi(T))24aαi(T)aαj(T)(aαi(T)ddTaαj(T)+aαj(T)ddTaαi(T))ddTaαj(T)2aαj(T)(aαi(T)ddTaαj(T)+aαj(T)ddTaαi(T))ddTaαi(T)2aαi(T)+aαi(T)d2dT2aαj(T)2+aαj(T)d2dT2aαi(T)2+ddTaαi(T)ddTaαj(T))aαi(T)aαj(T)\frac{\partial^2 (a\alpha)_{ij}}{\partial T^2} = - \frac{\sqrt{\operatorname{a\alpha_{i}}{\left(T \right)} \operatorname{a\alpha_{j}} {\left(T \right)}} \left(k_{ij} - 1\right) \left(\frac{\left(\operatorname{ a\alpha_{i}}{\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{j}}{\left(T \right)} + \operatorname{a\alpha_{j}}{\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{i}} {\left(T \right)}\right)^{2}}{4 \operatorname{a\alpha_{i}}{\left(T \right)} \operatorname{a\alpha_{j}}{\left(T \right)}} - \frac{\left(\operatorname{a\alpha_{i}} {\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{j}}{\left(T \right)} + \operatorname{a\alpha_{j}}{\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{i}}{\left(T \right)}\right) \frac{d}{d T} \operatorname{a\alpha_{j}}{\left(T \right)}}{2 \operatorname{a\alpha_{j}} {\left(T \right)}} - \frac{\left(\operatorname{a\alpha_{i}}{\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{j}}{\left(T \right)} + \operatorname{a\alpha_{j}}{\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{i}}{\left(T \right)}\right) \frac{d}{d T} \operatorname{a\alpha_{i}}{\left(T \right)}}{2 \operatorname{a\alpha_{i}} {\left(T \right)}} + \frac{\operatorname{a\alpha_{i}}{\left(T \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha_{j}}{\left(T \right)}}{2} + \frac{\operatorname{a\alpha_{j}}{\left(T \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha_{i}}{\left(T \right)}}{2} + \frac{d}{d T} \operatorname{a\alpha_{i}}{\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{j}}{\left(T \right)}\right)} {\operatorname{a\alpha_{i}}{\left(T \right)} \operatorname{a\alpha_{j}} {\left(T \right)}}
Returns
d2a_alpha_dT2_ijslist[list[float]]

Second temperature derivative of a_alpha terms for each component with every other component, [J^2/mol^2/Pa/K^2]

Notes

In an earlier implementation this matrix was stored each EOS solve; however, allocating that much memory becomes quite expensive for large number of component cases and this is now calculated on-demand only.

property d2a_alpha_dninjs

Helper method for calculating the second partial molar derivatives of a_alpha (hessian). Note this is independent of the phase.

(2aαninj)T,P,nki,j=2[3(aα)+(aα)ij2(termi,j)]\left(\frac{\partial^2 a \alpha}{\partial n_i \partial n_j }\right)_{T, P, n_{k\ne i,j}} = 2\left[3(a \alpha) + (a\alpha)_{ij} -2 (\text{term}_{i,j}) \right]
termi,j=kzk((aα)ik+(aα)jk)\text{term}_{i,j} = \sum_k z_k\left((a\alpha)_{ik} + (a\alpha)_{jk} \right)
(aα)ij=(1kij)(aα)i(aα)j(a\alpha)_{ij} = (1-k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}
Returns
d2a_alpha_dninjslist[float]

Second partial molar derivative of alpha of each component, [kg*m^5/(mol^4*s^2)]

Notes

This derivative is checked numerically.

property d2a_alpha_dzizjs

Helper method for calculating the second composition derivatives of a_alpha (hessian). Note this is independent of the phase.

(2aαxixj)T,P,xki,j=2(1kij)(aα)i(aα)j\left(\frac{\partial^2 a \alpha}{\partial x_i \partial x_j}\right)_{T, P, x_{k\ne i,j}} = 2 (1-k_{ij})\sqrt{(a\alpha)_{i}(a\alpha)_{j}}
Returns
d2a_alpha_dzizjslist[float]

Second composition derivative of alpha of each component, [kg*m^5/(mol^2*s^2)]

Notes

This derivative is checked numerically.

property d2b_dninjs

Helper method for calculating the second partial mole number derivatives of b. Note this is independent of the phase.

(2bninj)T,P,nki,k=2bbibj\left(\frac{\partial^2 b}{\partial n_i \partial n_j}\right)_{T, P, n_{k\ne i,k}} = 2b - b_i - b_j
Returns
d2b_dninjslist[list[float]]

Second Composition derivative of b of each component, [m^3/mol^3]

Notes

This derivative is checked numerically.

property d2b_dzizjs

Helper method for calculating the second partial mole fraction derivatives of b. Note this is independent of the phase.

(2bxixj)T,P,nki,j=0\left(\frac{\partial^2 b}{\partial x_i \partial x_j} \right)_{T, P, n_{k \ne i,j}} = 0
Returns
d2b_dzizjslist[list[float]]

Second mole fraction derivatives of b of each component, [m^3/mol]

Notes

This derivative is checked numerically.

d2lnphi_dninjs(Z)[source]

Calculates the mixture log fugacity coefficient second mole number derivatives (where the mole fraction sum to 1). No specific formula is implemented for this property - it is calculated from the second mole fraction derivative of Gibbs free energy.

(2lnϕninj)T,P,ni,jkf((2Gdepxjxi)T,P,xi,jk)\left(\frac{\partial^2 \ln \phi }{\partial n_i\partial n_j}\right)_{T, P, n_{i,j\ne k}} f\left( \left(\frac{\partial^2 G_{dep}} {\partial x_j \partial x_i}\right)_{T, P, x_{i,j\ne k}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
d2lnphi_dninjsfloat

Mixture log fugacity coefficient second mole number derivatives, [-]

d2lnphi_dzizjs(Z)[source]

Calculates the mixture log fugacity coefficient second mole fraction derivatives (where the mole fractions do not sum to 1). No specific formula is implemented for this property - it is calculated from the second mole fraction derivative of Gibbs free energy.

(2lnϕxixj)T,P,xi,jk=1RT((2Gdepxjxi)T,P,xi,jk)\left(\frac{\partial^2 \ln \phi }{\partial x_i\partial x_j}\right)_{T, P, x_{i,j\ne k}} = \frac{1}{RT}\left( \left(\frac{\partial^2 G_{dep}} {\partial x_j \partial x_i}\right)_{T, P, x_{i,j\ne k}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
d2lnphi_dzizjsfloat

Mixture log fugacity coefficient second mole fraction derivatives, [-]

property d3a_alpha_dninjnks

Helper method for calculating the third mole number derivatives of a_alpha. Note this is independent of the phase.

(3aαninjnk)T,P,nmi,j,k=4(6(aα)[(aα)i,j+(aα)i,k+(aα)j,k]+3mzm[(aα)i,m+(aα)j,m+(aα)k,m])\left(\frac{\partial^3 a \alpha}{\partial n_i \partial n_j \partial n_k}\right)_{T, P, n_{m\ne i,j,k}} = 4\left(-6 (a \alpha) - [(a \alpha)_{i,j} + (a \alpha)_{i,k} + (a \alpha)_{j,k}] + 3\sum_m z_m[(a \alpha)_{i,m} + (a \alpha)_{j,m} + (a \alpha)_{k,m}]\right)
Returns
d3a_alpha_dninjnkslist[float]

Third mole number derivative of alpha of each component, [kg*m^5/(mol^5*s^2)]

Notes

This derivative is checked numerically.

property d3a_alpha_dzizjzks

Helper method for calculating the third composition derivatives of a_alpha. Note this is independent of the phase.

(3aαxixjxk)T,P,xmi,j,k=0\left(\frac{\partial^3 a \alpha}{\partial x_i \partial x_j \partial x_k}\right)_{T, P, x_{m\ne i,j,k}} = 0
Returns
d3a_alpha_dzizjzkslist[float]

Third composition derivative of alpha of each component, [kg*m^5/(mol^2*s^2)]

Notes

This derivative is checked numerically.

property d3b_dninjnks

Helper method for calculating the third partial mole number derivatives of b. Note this is independent of the phase.

(3bninjnk)T,P,nmi,j,k=2(3b+bi+bj+bk)\left(\frac{\partial^3 b}{\partial n_i \partial n_j \partial n_k } \right)_{T, P, n_{m \ne i,j,k}} = 2(-3b + b_i + b_j + b_k)
Returns
d3b_dninjnkslist[list[list[float]]]

Third mole number derivative of b of each component, [m^3/mol^4]

Notes

This derivative is checked numerically.

property d3b_dzizjzks

Helper method for calculating the third partial mole fraction derivatives of b. Note this is independent of the phase.

(3bxixjxk)T,P,nki,j,k=0\left(\frac{\partial^3 b}{\partial x_i \partial x_j \partial x_k} \right)_{T, P, n_{k \ne i,j,k}} = 0
Returns
d3b_dzizjzkslist[list[list[float]]]

Third mole fraction derivatives of b of each component, [m^3/mol]

Notes

This derivative is checked numerically.

property d3delta_dzizjzks

Helper method for calculating the third composition derivatives of delta. Note this is independent of the phase.

(3δxixjxk)T,P,xmi,j,k=0\left(\frac{\partial^3 \delta}{\partial x_i \partial x_j \partial x_k }\right)_{T, P, x_{m\ne i,j,k}} = 0
Returns
d3delta_dzizjzkslist[list[list[float]]]

Third composition derivative of epsilon of each component, [m^6/mol^5]

Notes

This derivative is checked numerically.

property d3epsilon_dzizjzks

Helper method for calculating the third composition derivatives of epsilon. Note this is independent of the phase.

(3ϵxixjxk)T,P,xmi,j,k=0\left(\frac{\partial^3 \epsilon}{\partial x_i \partial x_j \partial x_k }\right)_{T, P, x_{m\ne i,j,k}} = 0
Returns
d2epsilon_dzizjzkslist[list[list[float]]]

Composition derivative of epsilon of each component, [m^6/mol^2]

Notes

This derivative is checked numerically.

dG_dep_dns(Z)[source]

Calculates the molar departure Gibbs energy mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(Gdepni)T,P,nij=f((Gdepxi)T,P,xij)\left(\frac{\partial G_{dep}}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial G_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)

Apart from the ideal term, this is the formulation for chemical potential.

Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dG_dep_dnsfloat

Departure Gibbs energy mole number derivatives, [J/mol^2]

dG_dep_dzs(Z)[source]

Calculates the molar departure Gibbs energy composition derivative (where the mole fractions do not sum to 1). Verified numerically. Useful in solving for gibbs minimization calculations or for solving for the true critical point. Also forms the basis for the molar departure Gibbs energy mole number derivative and molar partial departure Gibbs energy.

(Gdepxi)T,P,xij=PddxV(x)RT(ddxV(x)ddxb(x))V(x)b(x)2(δ(x)ddxδ(x)+2ddxϵ(x))(x)atanh(2V(x)δ2(x)4ϵ(x)+δ(x)δ2(x)4ϵ(x))(δ2(x)4ϵ(x))322atanh(2V(x)δ2(x)4ϵ(x)+δ(x)δ2(x)4ϵ(x))ddx(x)δ2(x)4ϵ(x)2(2(δ(x)ddxδ(x)+2ddxϵ(x))V(x)(δ2(x)4ϵ(x))32+(δ(x)ddxδ(x)+2ddxϵ(x))δ(x)(δ2(x)4ϵ(x))32+2ddxV(x)δ2(x)4ϵ(x)+ddxδ(x)δ2(x)4ϵ(x))(x)(1(2V(x)δ2(x)4ϵ(x)+δ(x)δ2(x)4ϵ(x))2)δ2(x)4ϵ(x)\left(\frac{\partial G_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} = P \frac{d}{d x} V{\left(x \right)} - \frac{R T \left(\frac{d}{d x} V{\left(x \right)} - \frac{d}{d x} b{\left(x \right)}\right)}{ V{\left(x \right)} - b{\left(x \right)}} - \frac{2 \left(- \delta{ \left(x \right)} \frac{d}{d x} \delta{\left(x \right)} + 2 \frac{d} {d x} \epsilon{\left(x \right)}\right) \operatorname{a \alpha}{ \left(x \right)} \operatorname{atanh}{\left(\frac{2 V{\left(x \right)}}{\sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}} + \frac{\delta{\left(x \right)}}{\sqrt{\delta^{2}{\left( x \right)} - 4 \epsilon{\left(x \right)}}} \right)}}{\left( \delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}\right)^{ \frac{3}{2}}} - \frac{2 \operatorname{atanh}{\left(\frac{2 V{\left( x \right)}}{\sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}} + \frac{\delta{\left(x \right)}}{\sqrt{\delta^{2}{\left( x \right)} - 4 \epsilon{\left(x \right)}}} \right)} \frac{d}{d x} \operatorname{a \alpha}{\left(x \right)}}{\sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}} - \frac{2 \left(\frac{2 \left(- \delta{\left(x \right)} \frac{d}{d x} \delta{\left(x \right)} + 2 \frac{d}{d x} \epsilon{\left(x \right)}\right) V{\left(x \right)}}{\left(\delta^{2}{\left(x \right)} - 4 \epsilon{ \left(x \right)}\right)^{\frac{3}{2}}} + \frac{\left(- \delta{\left (x \right)} \frac{d}{d x} \delta{\left(x \right)} + 2 \frac{d}{d x} \epsilon{\left(x \right)}\right) \delta{\left(x \right)}}{\left( \delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}\right)^{ \frac{3}{2}}} + \frac{2 \frac{d}{d x} V{\left(x \right)}}{\sqrt{ \delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}} + \frac{\frac{d}{d x} \delta{\left(x \right)}}{\sqrt{\delta^{2}{ \left(x \right)} - 4 \epsilon{\left(x \right)}}}\right) \operatorname{a \alpha}{\left(x \right)}}{\left(1 - \left(\frac{2 V{\left(x \right)}}{\sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{ \left(x \right)}}} + \frac{\delta{\left(x \right)}}{\sqrt{ \delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}}\right )^{2}\right) \sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dG_dep_dzsfloat

Departure Gibbs free energy composition derivatives, [J/mol]

Notes

The derivation for the derivative is performed as follows using SymPy. The function source code is an optimized variant created with the cse SymPy function, and hand optimized further.

>>> from sympy import * 
>>> P, T, R, x = symbols('P, T, R, x') 
>>> a_alpha, a, delta, epsilon, V, b, da_alpha_dT = symbols('a\ \\alpha, a, delta, epsilon, V, b, da_alpha_dT', cls=Function) 
>>> S_dep = R*log(P*V(x)/(R*T)) + R*log(V(x)-b(x))+2*da_alpha_dT(x)*atanh((2*V(x)+delta(x))/sqrt(delta(x)**2-4*epsilon(x)))/sqrt(delta(x)**2-4*epsilon(x))-R*log(V(x)) 
>>> H_dep = P*V(x) - R*T + 2*atanh((2*V(x)+delta(x))/sqrt(delta(x)**2-4*epsilon(x)))*(da_alpha_dT(x)*T-a_alpha(x))/sqrt(delta(x)**2-4*epsilon(x)) 
>>> G_dep = simplify(H_dep - T*S_dep) 
>>> diff(G_dep, x) 
P*Derivative(V(x), x) - R*T*(Derivative(V(x), x) - Derivative(b(x), x))/(V(x) - b(x)) - 2*(-delta(x)*Derivative(delta(x), x) + 2*Derivative(epsilon(x), x))*a \alpha(x)*atanh(2*V(x)/sqrt(delta(x)**2 - 4*epsilon(x)) + delta(x)/sqrt(delta(x)**2 - 4*epsilon(x)))/(delta(x)**2 - 4*epsilon(x))**(3/2) - 2*atanh(2*V(x)/sqrt(delta(x)**2 - 4*epsilon(x)) + delta(x)/sqrt(delta(x)**2 - 4*epsilon(x)))*Derivative(a \alpha(x), x)/sqrt(delta(x)**2 - 4*epsilon(x)) - 2*(2*(-delta(x)*Derivative(delta(x), x) + 2*Derivative(epsilon(x), x))*V(x)/(delta(x)**2 - 4*epsilon(x))**(3/2) + (-delta(x)*Derivative(delta(x), x) + 2*Derivative(epsilon(x), x))*delta(x)/(delta(x)**2 - 4*epsilon(x))**(3/2) + 2*Derivative(V(x), x)/sqrt(delta(x)**2 - 4*epsilon(x)) + Derivative(delta(x), x)/sqrt(delta(x)**2 - 4*epsilon(x)))*a \alpha(x)/((1 - (2*V(x)/sqrt(delta(x)**2 - 4*epsilon(x)) + delta(x)/sqrt(delta(x)**2 - 4*epsilon(x)))**2)*sqrt(delta(x)**2 - 4*epsilon(x)))
dH_dep_dns(Z)[source]

Calculates the molar departure enthalpy mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(Hdepni)T,P,nij=f((Hdepxi)T,P,xij)\left(\frac{\partial H_{dep}}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial H_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dH_dep_dnsfloat

Departure enthalpy mole number derivatives, [J/mol^2]

dH_dep_dzs(Z)[source]

Calculates the molar departure enthalpy composition derivative (where the mole fractions do not sum to 1). Verified numerically. Useful in solving for enthalpy specifications in newton-type methods, and forms the basis for the molar departure enthalpy mole number derivative and molar partial departure enthalpy.

(Hdepxi)T,P,xij=PddxV(x)+2(TT(T,x)(x))(δ(x)ddxδ(x)+2ddxϵ(x))atanh(2V(x)+δ(x)δ2(x)4ϵ(x))(δ2(x)4ϵ(x))32+2(TT(T,x)(x))((δ(x)ddxδ(x)+2ddxϵ(x))(2V(x)+δ(x))(δ2(x)4ϵ(x))32+2ddxV(x)+ddxδ(x)δ2(x)4ϵ(x))((2V(x)+δ(x))2δ2(x)4ϵ(x)+1)δ2(x)4ϵ(x)+2(T2xT(T,x)ddx(x))atanh(2V(x)+δ(x)δ2(x)4ϵ(x))δ2(x)4ϵ(x)\left(\frac{\partial H_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} = P \frac{d}{d x} V{\left(x \right)} + \frac{2 \left(T \frac{\partial}{\partial T} \operatorname{a \alpha}{\left(T,x \right)} - \operatorname{a \alpha}{\left(x \right)}\right) \left(- \delta{\left(x \right)} \frac{d}{d x} \delta{\left(x \right)} + 2 \frac{d}{d x} \epsilon{\left(x \right)}\right) \operatorname{atanh} {\left(\frac{2 V{\left(x \right)} + \delta{\left(x \right)}}{\sqrt{\delta^{2} {\left(x \right)} - 4 \epsilon{\left(x \right)}}} \right)}}{\left(\delta^{2} {\left(x \right)} - 4 \epsilon{\left(x \right)}\right)^{\frac{3}{2}}} + \frac{2 \left(T \frac{\partial}{\partial T} \operatorname{a \alpha} {\left(T,x \right)} - \operatorname{a \alpha}{\left(x \right)}\right) \left(\frac{\left(- \delta{\left(x \right)} \frac{d}{d x} \delta{\left(x \right)} + 2 \frac{d}{d x} \epsilon{\left(x \right)}\right) \left(2 V{\left(x \right)} + \delta{\left(x \right)}\right)}{\left(\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}\right)^{\frac{3}{2}}} + \frac{2 \frac{d}{d x} V{\left(x \right)} + \frac{d}{d x} \delta{\left(x \right)}} {\sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}}\right)}{\left( - \frac{\left(2 V{\left(x \right)} + \delta{\left(x \right)}\right)^{2}}{ \delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}} + 1\right) \sqrt{ \delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}} + \frac{2 \left(T \frac{\partial^{2}}{\partial x\partial T} \operatorname{a \alpha} {\left(T,x \right)} - \frac{d}{d x} \operatorname{a \alpha}{\left(x \right)} \right) \operatorname{atanh}{\left(\frac{2 V{\left(x \right)} + \delta{\left(x \right)}}{\sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}} \right)}}{\sqrt{\delta^{2}{\left(x \right)} - 4 \epsilon{\left(x \right)}}}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dH_dep_dzsfloat

Departure enthalpy composition derivatives, [J/mol]

Notes

The derivation for the derivative is performed as follows using SymPy. The function source code is an optimized variant created with the cse SymPy function, and hand optimized further.

>>> from sympy import * 
>>> P, T, V, R, b, a, delta, epsilon, x = symbols('P, T, V, R, b, a, delta, epsilon, x') 
>>> V, delta, epsilon, a_alpha, b = symbols('V, delta, epsilon, a_alpha, b', cls=Function) 
>>> H_dep = (P*V(x) - R*T + 2/sqrt(delta(x)**2 - 4*epsilon(x))*(T*Derivative(a_alpha(T, x), T) 
... - a_alpha(x))*atanh((2*V(x)+delta(x))/sqrt(delta(x)**2-4*epsilon(x))))
>>> diff(H_dep, x) 
P*Derivative(V(x), x) + 2*(T*Derivative(a \alpha(T, x), T) - a \alpha(x))*(-delta(x)*Derivative(delta(x), x) + 2*Derivative(epsilon(x), x))*atanh((2*V(x) + delta(x))/sqrt(delta(x)**2 - 4*epsilon(x)))/(delta(x)**2 - 4*epsilon(x))**(3/2) + 2*(T*Derivative(a \alpha(T, x), T) - a \alpha(x))*((-delta(x)*Derivative(delta(x), x) + 2*Derivative(epsilon(x), x))*(2*V(x) + delta(x))/(delta(x)**2 - 4*epsilon(x))**(3/2) + (2*Derivative(V(x), x) + Derivative(delta(x), x))/sqrt(delta(x)**2 - 4*epsilon(x)))/((-(2*V(x) + delta(x))**2/(delta(x)**2 - 4*epsilon(x)) + 1)*sqrt(delta(x)**2 - 4*epsilon(x))) + 2*(T*Derivative(a \alpha(T, x), T, x) - Derivative(a \alpha(x), x))*atanh((2*V(x) + delta(x))/sqrt(delta(x)**2 - 4*epsilon(x)))/sqrt(delta(x)**2 - 4*epsilon(x))
dS_dep_dns(Z)[source]

Calculates the molar departure entropy mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(Sdepni)T,P,nij=f((Sdepxi)T,P,xij)\left(\frac{\partial S_{dep}}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial S_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dS_dep_dnsfloat

Departure entropy mole number derivatives, [J/mol^2/K]

dS_dep_dzs(Z)[source]

Calculates the molar departure entropy composition derivative (where the mole fractions do not sum to 1). Verified numerically. Useful in solving for entropy specifications in newton-type methods, and forms the basis for the molar departure entropy mole number derivative and molar partial departure entropy.

(Sdepxi)T,P,xij=1T((Hdepxi)T,P,xij(Gdepxi)T,P,xij)\left(\frac{\partial S_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} = \frac{1}{T}\left( \left(\frac{\partial H_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} - \left(\frac{\partial G_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dS_dep_dzsfloat

Departure entropy composition derivatives, [J/mol/K]

dV_dns(Z)[source]

Calculates the molar volume mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(Vni)T,P,nij=f((Vxi)T,P,xij)\left(\frac{\partial V}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial V}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dV_dnsfloat

Molar volume mole number derivatives, [m^3/mol^2]

dV_dzs(Z)[source]

Calculates the molar volume composition derivative (where the mole fractions do not sum to 1). Verified numerically. Used in many other derivatives, and for the molar volume mole number derivative and partial molar volume calculation.

(Vxi)T,P,xij=RT(V2(x)+V(x)δ(x)+ϵ(x))3ddxb(x)+(V(x)b(x))2(V2(x)+V(x)δ(x)+ϵ(x))2ddx(x)(V(x)b(x))2V3(x)(x)ddxδ(x)(V(x)b(x))2V2(x)(x)δ(x)ddxδ(x)(V(x)b(x))2V2(x)(x)ddxϵ(x)(V(x)b(x))2V(x)(x)δ(x)ddxϵ(x)(V(x)b(x))2V(x)(x)ϵ(x)ddxδ(x)(V(x)b(x))2(x)ϵ(x)ddxϵ(x)RT(V2(x)+V(x)δ(x)+ϵ(x))3+2(V(x)b(x))2V3(x)(x)+3(V(x)b(x))2V2(x)(x)δ(x)+(V(x)b(x))2V(x)(x)δ2(x)+2(V(x)b(x))2V(x)(x)ϵ(x)+(V(x)b(x))2(x)δ(x)ϵ(x)\left(\frac{\partial V}{\partial x_i}\right)_{T, P, x_{i\ne j}} = \frac{- R T \left(V^{2}{\left(x \right)} + V{\left(x \right)} \delta{\left(x \right)} + \epsilon{\left(x \right)}\right)^{3} \frac{d}{d x} b{\left(x \right)} + \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} \left(V^{2}{\left(x \right)} + V{\left(x \right)} \delta{\left(x \right)} + \epsilon{\left(x \right)}\right)^{2} \frac{d}{d x} \operatorname{a \alpha}{\left(x \right)} - \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V^{3}{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \frac{d}{d x} \delta{\left(x \right)} - \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V^{2}{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \delta{\left(x \right)} \frac{d}{d x} \delta{\left(x \right)} - \left(V{\left(x \right)} - b{\left(x \right)} \right)^{2} V^{2}{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \frac{d}{d x} \epsilon{ \left(x \right)} - \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \delta{\left(x \right)} \frac{d}{d x} \epsilon{\left(x \right)} - \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \epsilon{\left(x \right)} \frac{d}{d x} \delta{\left(x \right)} - \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} \operatorname{a \alpha}{\left(x \right)} \epsilon{\left(x \right)} \frac{d}{d x} \epsilon{\left(x \right)}}{- R T \left(V^{2}{\left(x \right)} + V{\left(x \right)} \delta{\left(x \right)} + \epsilon{\left(x \right)}\right)^{3} + 2 \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V^{3}{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} + 3 \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V^{2}{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \delta{\left(x \right)} + \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \delta^{2}{\left(x \right)} + 2 \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} V{\left(x \right)} \operatorname{a \alpha}{\left(x \right)} \epsilon{\left(x \right)} + \left(V{\left(x \right)} - b{\left(x \right)}\right)^{2} \operatorname{a \alpha}{\left(x \right)} \delta{\left(x \right)} \epsilon{\left(x \right)}}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dV_dzsfloat

Molar volume composition derivatives, [m^3/mol]

Notes

The derivation for the derivative is performed as follows using SymPy. The function source code is an optimized variant created with the cse SymPy function, and hand optimized further.

>>> from sympy import * 
>>> P, T, R, x = symbols('P, T, R, x') 
>>> V, delta, epsilon, a_alpha, b = symbols('V, delta, epsilon, a\ \\alpha, b', cls=Function) 
>>> CUBIC = R*T/(V(x) - b(x)) - a_alpha(x)/(V(x)*V(x) + delta(x)*V(x) + epsilon(x)) - P 
>>> solve(diff(CUBIC, x), Derivative(V(x), x)) 
[(-R*T*(V(x)**2 + V(x)*delta(x) + epsilon(x))**3*Derivative(b(x), x) + (V(x) - b(x))**2*(V(x)**2 + V(x)*delta(x) + epsilon(x))**2*Derivative(a \alpha(x), x) - (V(x) - b(x))**2*V(x)**3*a \alpha(x)*Derivative(delta(x), x) - (V(x) - b(x))**2*V(x)**2*a \alpha(x)*delta(x)*Derivative(delta(x), x) - (V(x) - b(x))**2*V(x)**2*a \alpha(x)*Derivative(epsilon(x), x) - (V(x) - b(x))**2*V(x)*a \alpha(x)*delta(x)*Derivative(epsilon(x), x) - (V(x) - b(x))**2*V(x)*a \alpha(x)*epsilon(x)*Derivative(delta(x), x) - (V(x) - b(x))**2*a \alpha(x)*epsilon(x)*Derivative(epsilon(x), x))/(-R*T*(V(x)**2 + V(x)*delta(x) + epsilon(x))**3 + 2*(V(x) - b(x))**2*V(x)**3*a \alpha(x) + 3*(V(x) - b(x))**2*V(x)**2*a \alpha(x)*delta(x) + (V(x) - b(x))**2*V(x)*a \alpha(x)*delta(x)**2 + 2*(V(x) - b(x))**2*V(x)*a \alpha(x)*epsilon(x) + (V(x) - b(x))**2*a \alpha(x)*delta(x)*epsilon(x))]
dZ_dns(Z)[source]

Calculates the compressibility mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(Zni)T,P,nij=f((Zxi)T,P,xij)\left(\frac{\partial Z}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial Z}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dZ_dnsfloat

Compressibility number derivatives, [1/mol]

dZ_dzs(Z)[source]

Calculates the compressibility composition derivatives (where the mole fractions do not sum to 1). No specific formula is implemented for this property - it is calculated from the composition derivative of molar volume, which does have its formula implemented.

(Zxi)T,P,xij=PRT(Vxi)T,P,xij\left(\frac{\partial Z}{\partial x_i}\right)_{T, P, x_{i\ne j}} = \frac{P }{RT} \left(\frac{\partial V}{\partial x_i}\right)_{T, P, x_{i\ne j}}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dZ_dzsfloat

Compressibility composition derivative, [-]

property da_alpha_dT_dns

Helper method for calculating the mole number derivatives of da_alpha_dT. Note this is independent of the phase.

(2aαniT)P,nij=2[jzj(kij1)(aα)i(aα)j(aα)iT(aα)jT((aα)i(aα)j)0.5aαT]\left(\frac{\partial^2 a \alpha}{\partial n_i \partial T} \right)_{P, n_{i\ne j}} = 2 \left[\sum_j -z_{j} (k_{ij} - 1) (a \alpha)_i (a \alpha)_j \frac{\partial (a \alpha)_i}{\partial T} \frac{\partial (a \alpha)_j}{\partial T} \left({ (a \alpha)_i (a \alpha)_j}\right)^{-0.5} - \frac{\partial a \alpha}{\partial T} \right]
Returns
da_alpha_dT_dnslist[float]

Composition derivative of da_alpha_dT of each component, [kg*m^5/(mol^3*s^2*K)]

Notes

This derivative is checked numerically.

property da_alpha_dT_dzs

Helper method for calculating the composition derivatives of da_alpha_dT. Note this is independent of the phase.

(2aαxiT)P,xij=2jzj(kij1)(aα)i(aα)j(aα)iT(aα)jT((aα)i(aα)j)0.5\left(\frac{\partial^2 a \alpha}{\partial x_i \partial T} \right)_{P, x_{i\ne j}} = 2 \sum_j -z_{j} (k_{ij} - 1) (a \alpha)_i (a \alpha)_j \frac{\partial (a \alpha)_i}{\partial T} \frac{\partial (a \alpha)_j}{\partial T} \left({ (a \alpha)_i (a \alpha)_j}\right)^{-0.5}
Returns
da_alpha_dT_dzslist[float]

Composition derivative of da_alpha_dT of each component, [kg*m^5/(mol^2*s^2*K)]

Notes

This derivative is checked numerically.

property da_alpha_dT_ijs

Calculate and return the matrix for the temperature derivatives of the alpha terms.

(aα)ijT=aαi(T)aαj(T)(1kij)(aαi(T)ddTaαj(T)2+aαj(T)ddTaαi(T)2)aαi(T)aαj(T)\frac{\partial (a\alpha)_{ij}}{\partial T} = \frac{\sqrt{\operatorname{a\alpha_{i}}{\left(T \right)} \operatorname{a\alpha_{j}} {\left(T \right)}} \left(1 - k_{ij}\right) \left(\frac{\operatorname{a\alpha_{i}} {\left(T \right)} \frac{d}{d T} \operatorname{a\alpha_{j}}{\left(T \right)}}{2} + \frac{\operatorname{a\alpha_{j}}{\left(T \right)} \frac{d}{d T} \operatorname{ a\alpha_{i}}{\left(T \right)}}{2}\right)}{\operatorname{a\alpha_{i}}{\left(T \right)} \operatorname{a\alpha_{j}}{\left(T \right)}}
Returns
da_alpha_dT_ijslist[list[float]]

First temperature derivative of a_alpha terms for each component with every other component, [J^2/mol^2/Pa/K]

Notes

In an earlier implementation this matrix was stored each EOS solve; however, allocating that much memory becomes quite expensive for large number of component cases and this is now calculated on-demand only.

property da_alpha_dns

Helper method for calculating the mole number derivatives of a_alpha. Note this is independent of the phase.

(aαni)T,P,nij=2(aα+jzj(1kij)(aα)i(aα)j)\left(\frac{\partial a \alpha}{\partial n_i}\right)_{T, P, n_{i\ne j}} = 2 (-a\alpha + \sum_j z_{j} (1 - k_{ij}) \sqrt{ (a \alpha)_i (a \alpha)_j})
Returns
da_alpha_dnslist[float]

Mole number derivative of alpha of each component, [kg*m^5/(mol^3*s^2)]

Notes

This derivative is checked numerically.

property da_alpha_dzs

Helper method for calculating the composition derivatives of a_alpha. Note this is independent of the phase.

(aαxi)T,P,xij=2jzj(1kij)(aα)i(aα)j\left(\frac{\partial a \alpha}{\partial x_i}\right)_{T, P, x_{i\ne j}} = 2 \cdot \sum_j z_{j} (1 - k_{ij}) \sqrt{ (a \alpha)_i (a \alpha)_j}
Returns
da_alpha_dzslist[float]

Composition derivative of alpha of each component, [kg*m^5/(mol^2*s^2)]

Notes

This derivative is checked numerically.

property db_dns

Helper method for calculating the mole number derivatives of b. Note this is independent of the phase.

(bni)T,P,nij=bib\left(\frac{\partial b}{\partial n_i}\right)_{T, P, n_{i\ne j}} = b_i - b
Returns
db_dnslist[float]

Composition derivative of b of each component, [m^3/mol^2]

Notes

This derivative is checked numerically.

property db_dzs

Helper method for calculating the composition derivatives of b. Note this is independent of the phase.

(bxi)T,P,xij=bi\left(\frac{\partial b}{\partial x_i}\right)_{T, P, x_{i\ne j}} = b_i
Returns
db_dzslist[float]

Composition derivative of b of each component, [m^3/mol]

Notes

This derivative is checked numerically.

dfugacities_dns(phase)[source]

Generic formula for calculating the mole number derivaitves of fugacities for each species in a mixture. Verified numerically. Applicable to all cubic equations of state which can be cast in the form used here.

(fini)P,nji\left(\frac{\partial f_i}{\partial n_i}\right)_{P, n_{j \ne i}}
Parameters
phasestr

One of ‘l’ or ‘g’, [-]

Returns
dfugacities_dnslist[list[float]]

Mole number derivatives of fugacities for each species, [-]

dlnfugacities_dns(phase)[source]

Generic formula for calculating the mole number derivaitves of log fugacities for each species in a mixture. Verified numerically. Applicable to all cubic equations of state which can be cast in the form used here.

(lnfini)P,nji\left(\frac{\partial \ln f_i}{\partial n_i}\right)_{P, n_{j \ne i}}
Parameters
phasestr

One of ‘l’ or ‘g’, [-]

Returns
dlnfugacities_dnslist[list[float]]

Mole number derivatives of log fugacities for each species, [-]

dlnphi_dns(Z)[source]

Calculates the mixture log fugacity coefficient mole number derivatives (where the mole fractions sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative of Gibbs free energy.

(lnϕni)T,P,nij=f((Gdepxi)T,P,xij)\left(\frac{\partial \ln \phi }{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial G_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)

This property can be converted into a partial molar property to obtain the individual fugacity coefficients.

Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dlnphi_dnsfloat

Mixture log fugacity coefficient mole number derivatives, [1/mol]

dlnphi_dzs(Z)[source]

Calculates the mixture log fugacity coefficient mole fraction derivatives (where the mole fractions do not sum to 1). No specific formula is implemented for this property - it is calculated from the mole fraction derivative of Gibbs free energy.

(lnϕxi)T,P,xij=1RT((Gdepxi)T,P,xij)\left(\frac{\partial \ln \phi }{\partial x_i}\right)_{T, P, x_{i\ne j}} = \frac{1}{RT}\left( \left(\frac{\partial G_{dep}} {\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dlnphi_dzsfloat

Mixture log fugacity coefficient mole fraction derivatives, [-]

dlnphis_dP(phase)[source]

Generic formula for calculating the pressure derivaitve of log fugacity coefficients for each species in a mixture. Verified numerically. Applicable to all cubic equations of state which can be cast in the form used here.

Normally this routine is slower than EOS-specific ones, as it does not make assumptions that certain parameters are zero or equal to other parameters.

(lnϕiP)T,nji=GdepPT,n+(2lnϕPni)T,P,nji\left(\frac{\partial \ln \phi_i}{\partial P}\right)_{T, nj \ne i} = \frac{G_{dep}}{\partial P}_{T, n} + \left(\frac{\partial^2 \ln \phi}{\partial P \partial n_i} \right)_{T, P, n_{j \ne i}}
Parameters
phasestr

One of ‘l’ or ‘g’, [-]

Returns
dlnphis_dPfloat

Pressure derivatives of log fugacity coefficient for each species, [1/Pa]

Notes

This expression for the partial derivative of the mixture lnphi with respect to pressure and mole number can be derived as follows; to convert to the partial molar lnphi pressure and temperature derivative, add ::math::frac{G_{dep}/(RT)}{partial P}_{T, n}.

>>> from sympy import * 
>>> P, T, R, n = symbols('P, T, R, n') 
>>> a_alpha, a, delta, epsilon, V, b, da_alpha_dT, d2a_alpha_dT2 = symbols('a_alpha, a, delta, epsilon, V, b, da_alpha_dT, d2a_alpha_dT2', cls=Function) 
>>> S_dep = R*log(P*V(n, P)/(R*T)) + R*log(V(n, P)-b(n))+2*da_alpha_dT(n, T)*atanh((2*V(n, P)+delta(n))/sqrt(delta(n)**2-4*epsilon(n)))/sqrt(delta(n)**2-4*epsilon(n))-R*log(V(n, P)) 
>>> H_dep = P*V(n, P) - R*T + 2*atanh((2*V(n, P)+delta(n))/sqrt(delta(n)**2-4*epsilon(n)))*(da_alpha_dT(n, T)*T-a_alpha(n, T))/sqrt(delta(n)**2-4*epsilon(n)) 
>>> G_dep = H_dep - T*S_dep 
>>> lnphi = simplify(G_dep/(R*T)) 
>>> diff(diff(lnphi, P), n) 
P*Derivative(V(n, P), P, n)/(R*T) + Derivative(V(n, P), P, n)/V(n, P) - Derivative(V(n, P), P)*Derivative(V(n, P), n)/V(n, P)**2 - Derivative(V(n, P), P, n)/(V(n, P) - b(n)) - (-Derivative(V(n, P), n) + Derivative(b(n), n))*Derivative(V(n, P), P)/(V(n, P) - b(n))**2 + Derivative(V(n, P), n)/(R*T) - 4*(-2*delta(n)*Derivative(delta(n), n) + 4*Derivative(epsilon(n), n))*a_alpha(n, T)*Derivative(V(n, P), P)/(R*T*(1 - (2*V(n, P)/sqrt(delta(n)**2 - 4*epsilon(n)) + delta(n)/sqrt(delta(n)**2 - 4*epsilon(n)))**2)*(delta(n)**2 - 4*epsilon(n))**2) - 4*a_alpha(n, T)*Derivative(V(n, P), P, n)/(R*T*(1 - (2*V(n, P)/sqrt(delta(n)**2 - 4*epsilon(n)) + delta(n)/sqrt(delta(n)**2 - 4*epsilon(n)))**2)*(delta(n)**2 - 4*epsilon(n))) - 4*Derivative(V(n, P), P)*Derivative(a_alpha(n, T), n)/(R*T*(1 - (2*V(n, P)/sqrt(delta(n)**2 - 4*epsilon(n)) + delta(n)/sqrt(delta(n)**2 - 4*epsilon(n)))**2)*(delta(n)**2 - 4*epsilon(n))) - 4*(2*V(n, P)/sqrt(delta(n)**2 - 4*epsilon(n)) + delta(n)/sqrt(delta(n)**2 - 4*epsilon(n)))*(4*(-delta(n)*Derivative(delta(n), n) + 2*Derivative(epsilon(n), n))*V(n, P)/(delta(n)**2 - 4*epsilon(n))**(3/2) + 2*(-delta(n)*Derivative(delta(n), n) + 2*Derivative(epsilon(n), n))*delta(n)/(delta(n)**2 - 4*epsilon(n))**(3/2) + 4*Derivative(V(n, P), n)/sqrt(delta(n)**2 - 4*epsilon(n)) + 2*Derivative(delta(n), n)/sqrt(delta(n)**2 - 4*epsilon(n)))*a_alpha(n, T)*Derivative(V(n, P), P)/(R*T*(1 - (2*V(n, P)/sqrt(delta(n)**2 - 4*epsilon(n)) + delta(n)/sqrt(delta(n)**2 - 4*epsilon(n)))**2)**2*(delta(n)**2 - 4*epsilon(n))) + R*T*(P*Derivative(V(n, P), P)/(R*T) + V(n, P)/(R*T))*Derivative(V(n, P), n)/(P*V(n, P)**2) - R*T*(P*Derivative(V(n, P), P, n)/(R*T) + Derivative(V(n, P), n)/(R*T))/(P*V(n, P))
dlnphis_dT(phase)[source]

Generic formula for calculating the temperature derivaitve of log fugacity coefficients for each species in a mixture. Verified numerically. Applicable to all cubic equations of state which can be cast in the form used here.

Normally this routine is slower than EOS-specific ones, as it does not make assumptions that certain parameters are zero or equal to other parameters.

(lnϕiT)P,nji=GdepRTTP,n+(2lnϕTni)P,nji\left(\frac{\partial \ln \phi_i}{\partial T}\right)_{P, nj \ne i} = \frac{\frac{G_{dep}}{RT}}{\partial T}_{P, n} + \left(\frac{\partial^2 \ln \phi}{\partial T \partial n_i} \right)_{P, n_{j \ne i}}
Parameters
phasestr

One of ‘l’ or ‘g’, [-]

Returns
dlnphis_dTfloat

Temperature derivatives of log fugacity coefficient for each species, [1/K]

Notes

This expression for the partial derivative of the mixture lnphi with respect to pressure and mole number can be derived as follows; to convert to the partial molar lnphi pressure and temperature derivative, add ::math::frac{G_{dep}/(RT)}{partial T}_{P, n}.

>>> from sympy import * 
>>> P, T, R, n = symbols('P, T, R, n') 
>>> a_alpha, a, delta, epsilon, V, b, da_alpha_dT, d2a_alpha_dT2 = symbols('a_alpha, a, delta, epsilon, V, b, da_alpha_dT, d2a_alpha_dT2', cls=Function) 
>>> S_dep = R*log(P*V(n, T)/(R*T)) + R*log(V(n, T)-b(n))+2*da_alpha_dT(n, T)*atanh((2*V(n, T)+delta(n))/sqrt(delta(n)**2-4*epsilon(n)))/sqrt(delta(n)**2-4*epsilon(n))-R*log(V(n, T)) 
>>> H_dep = P*V(n, T) - R*T + 2*atanh((2*V(n, T)+delta(n))/sqrt(delta(n)**2-4*epsilon(n)))*(da_alpha_dT(n, T)*T-a_alpha(n, T))/sqrt(delta(n)**2-4*epsilon(n)) 
>>> G_dep = H_dep - T*S_dep 
>>> lnphi = simplify(G_dep/(R*T)) 
>>> diff(diff(lnphi, T), n) 
dlnphis_dns(Z)[source]

Generic formula for calculating the mole number derivaitves of log fugacity coefficients for each species in a mixture. Verified numerically. Applicable to all cubic equations of state which can be cast in the form used here.

(lnϕini)P,nji\left(\frac{\partial \ln \phi_i}{\partial n_i}\right)_{P, n_{j \ne i}}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dlnphis_dnslist[list[float]]

Mole number derivatives of log fugacity coefficient for each species, [-]

dlnphis_dzs(Z)[source]

Generic formula for calculating the mole fraction derivaitves of log fugacity coefficients for each species in a mixture. Verified numerically. Applicable to all cubic equations of state which can be cast in the form used here.

(lnϕizi)P,zji\left(\frac{\partial \ln \phi_i}{\partial z_i}\right)_{P, z_{j \ne i}}
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dlnphis_dzslist[list[float]]

Mole fraction derivatives of log fugacity coefficient for each species (such that the mole fractions do not sum to 1), [-]

dnG_dep_dns(Z)[source]

Calculates the partial molar departure Gibbs energy. No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(nGdepni)T,P,nij=f((Gdepxi)T,P,xij)\left(\frac{\partial n G_{dep}}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial G_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dnG_dep_dnsfloat

Partial molar departure Gibbs energy of the phase, [J/mol]

dnH_dep_dns(Z)[source]

Calculates the partial molar departure enthalpy. No specific formula is implemented for this property - it is calculated from the mole fraction derivative.

(nHdepni)T,P,nij=f((Hdepxi)T,P,xij)\left(\frac{\partial n H_{dep}}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial H_{dep}}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dnH_dep_dnsfloat

Partial molar departure enthalpies of the phase, [J/mol]

dnV_dns(Z)[source]

Calculates the partial molar volume of the specified phase No specific formula is implemented for this property - it is calculated from the molar volume mole fraction derivative.

(nVni)T,P,nij=f((Vxi)T,P,xij)\left(\frac{\partial n V}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial V}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dnV_dnsfloat

Partial molar volume of the mixture of the specified phase, [m^3/mol]

dnZ_dns(Z)[source]

Calculates the partial compressibility of the specified phase No specific formula is implemented for this property - it is calculated from the compressibility mole fraction derivative.

(nZni)T,P,nij=f((Zxi)T,P,xij)\left(\frac{\partial n Z}{\partial n_i}\right)_{T, P, n_{i\ne j}} = f\left( \left(\frac{\partial Z}{\partial x_i}\right)_{T, P, x_{i\ne j}} \right)
Parameters
Zfloat

Compressibility of the mixture for a desired phase, [-]

Returns
dnZ_dnsfloat

Partial compressibility of the mixture of the specified phase, [-]

property dna_alpha_dT_dns

Helper method for calculating the mole number derivatives of da_alpha_dT. Note this is independent of the phase.

(2naαniT)P,nij=2[jzj(kij1)(aα)i(aα)j(aα)iT(aα)jT((aα)i(aα)j)0.50.5aαT]\left(\frac{\partial^2 n a \alpha}{\partial n_i \partial T} \right)_{P, n_{i\ne j}} = 2 \left[\sum_j -z_{j} (k_{ij} - 1) (a \alpha)_i (a \alpha)_j \frac{\partial (a \alpha)_i}{\partial T} \frac{\partial (a \alpha)_j}{\partial T} \left({ (a \alpha)_i (a \alpha)_j}\right)^{-0.5} - 0.5 \frac{\partial a \alpha}{\partial T} \right]
Returns
dna_alpha_dT_dnslist[float]

Composition derivative of da_alpha_dT of each component, [kg*m^5/(mol^2*s^2*K)]

Notes

This derivative is checked numerically.

property dna_alpha_dns

Helper method for calculating the partial molar derivatives of a_alpha. Note this is independent of the phase.

(aαni)T,P,nij=2(0.5aα+jzj(1kij)(aα)i(aα)j)\left(\frac{\partial a \alpha}{\partial n_i}\right)_{T, P, n_{i\ne j}} = 2 (-0.5 a\alpha + \sum_j z_{j} (1 - k_{ij}) \sqrt{ (a \alpha)_i (a \alpha)_j})
Returns
dna_alpha_dnslist[float]

Partial molar derivative of alpha of each component, [kg*m^5/(mol^2*s^2)]

Notes

This derivative is checked numerically.

property dnb_dns

Helper method for calculating the partial molar derivative of b. Note this is independent of the phase.

(nbni)T,P,nij=bi\left(\frac{\partial n \cdot b}{\partial n_i}\right)_{T, P, n_{i\ne j}} = b_i
Returns
dnb_dnslist[float]

Partial molar derivative of b of each component, [m^3/mol]

Notes

This derivative is checked numerically.

classmethod from_json(json_repr, cache=None)[source]

Method to create a mixture cubic equation of state from a JSON friendly serialization of another mixture cubic equation of state.

Parameters
json_reprdict

Json representation, [-]

Returns
eos_mixGCEOSMIX

Newly created object from the json serialization, [-]

Notes

It is important that the input string be in the same format as that created by GCEOS.as_json.

Examples

>>> import pickle
>>> eos = PRSV2MIX(Tcs=[507.6], Pcs=[3025000], omegas=[0.2975], zs=[1], T=299., P=1E6, kappa1s=[0.05104], kappa2s=[0.8634], kappa3s=[0.460])
>>> json_stuff = pickle.dumps(eos.as_json())
>>> new_eos = GCEOSMIX.from_json(pickle.loads(json_stuff))
>>> assert new_eos == eos
fugacities(only_l=False, only_g=False)[source]

Helper method for calculating fugacity coefficients for any phases present, using either the overall mole fractions for both phases or using specified mole fractions for each phase.

Requires fugacity_coefficients to be implemented by each subclassing EOS.

In addition to setting fugacities_l and/or fugacities_g, this also sets the fugacity coefficients phis_l and/or phis_g.

ϕ^ig=f^igyiP\hat \phi_i^g = \frac{\hat f_i^g}{y_i P}
ϕ^il=f^ilxiP\hat \phi_i^l = \frac{\hat f_i^l}{x_i P}

Note that in a flash calculation, each phase requires their own EOS object.

Parameters
only_lbool

When true, if there is a liquid and a vapor root, only the liquid root (and properties) will be set.

only_gbool

When true, if there is a liquid and a vapor root, only the vapor root (and properties) will be set.

Notes

It is helpful to check that fugacity_coefficients has been implemented correctly using the following expression, from [1].

lnϕ^i=[(nlnϕ)ni]T,P,nj,Vt\ln \hat \phi_i = \left[\frac{\partial (n\ln \phi)}{\partial n_i}\right]_{T,P,n_j,V_t}

For reference, several expressions for fugacity of a component are as follows, shown in [1] and [2].

lnϕ^i=0P(V^iRT1P)dP\ln \hat \phi_i = \int_{0}^P\left(\frac{\hat V_i} {RT} - \frac{1}{P}\right)dP
lnϕ^i=V[1RTPni1V]dVlnZ\ln \hat \phi_i = \int_V^\infty \left[ \frac{1}{RT}\frac{\partial P}{ \partial n_i} - \frac{1}{V}\right] d V - \ln Z

References

1(1,2)

Hu, Jiawen, Rong Wang, and Shide Mao. “Some Useful Expressions for Deriving Component Fugacity Coefficients from Mixture Fugacity Coefficient.” Fluid Phase Equilibria 268, no. 1-2 (June 25, 2008): 7-13. doi:10.1016/j.fluid.2008.03.007.

2

Walas, Stanley M. Phase Equilibria in Chemical Engineering. Butterworth-Heinemann, 1985.

fugacity_coefficients(Z)[source]

Generic formula for calculating log fugacity coefficients for each species in a mixture. Verified numerically. Applicable to all cubic equations of state which can be cast in the form used here. Normally this routine is slower than EOS-specific ones, as it does not make assumptions that certain parameters are zero or equal to other parameters.

(nlnϕni)nki=lnϕi=lnϕ+n(lnϕni)nki\left(\frac{\partial n \ln \phi}{\partial n_i} \right)_{n_{k \ne i}} = \ln \phi _i = \ln \phi + n \left(\frac{\partial \ln \phi}{\partial n_i} \right)_{n_{k\ne i}}