Cubic Equations of State (thermo.eos)¶
This module contains implementations of most cubic equations of state for pure components. 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.GCEOS[source]¶
Bases:
object
Class for solving a generic Pressure-explicit three-parameter cubic equation of state. Does not implement any parameters itself; must be subclassed by an equation of state class which uses it. Works for mixtures or pure species for all properties except fugacity. All properties are derived with the CAS SymPy, not relying on any derivations previously published.
$P=\frac{RT}{V-b}-\frac{a\alpha(T)}{V^2 + \delta V + \epsilon}$The main methods (in order they are called) are
GCEOS.solve
,GCEOS.set_from_PT
,GCEOS.volume_solutions
, andGCEOS.set_properties_from_solution
.GCEOS.solve
callsGCEOS.check_sufficient_inputs
, which checks if two of T, P, and V were set. It then solves for the remaining variable. If T is missing, methodGCEOS.solve_T
is used; it is parameter specific, and so must be implemented in each specific EOS. If P is missing, it is directly calculated. If V is missing, it is calculated with the methodGCEOS.volume_solutions
. At this point, either three possible volumes or one user specified volume are known. The value of a_alpha, and its first and second temperature derivative are calculated with the EOS-specific methodGCEOS.a_alpha_and_derivatives
.If V is not provided,
GCEOS.volume_solutions
calculates the three possible molar volumes which are solutions to the EOS; in the single-phase region, only one solution is real and correct. In the two-phase region, all volumes are real, but only the largest and smallest solution are physically meaningful, with the largest being that of the gas and the smallest that of the liquid.GCEOS.set_from_PT
is called to sort out the possible molar volumes. For the case of a user-specified V, the possibility of there existing another solution is ignored for speed. If there is only one real volume, the methodGCEOS.set_properties_from_solution
is called with it. If there are two real volumes,GCEOS.set_properties_from_solution
is called once with each volume. The phase is returned byGCEOS.set_properties_from_solution
, and the volumes is set to eitherGCEOS.V_l
orGCEOS.V_g
as appropriate.GCEOS.set_properties_from_solution
is a large function which calculates all relevant partial derivatives and properties of the EOS. 17 derivatives and excess enthalpy and entropy are calculated first. Finally, it sets all these properties as attibutes for either the liquid or gas phase with the convention of adding on _l or _g to the variable names, respectively.- Attributes
- T
float
Temperature of cubic EOS state, [K]
- P
float
Pressure of cubic EOS state, [Pa]
- a
float
a parameter of cubic EOS; formulas vary with the EOS, [Pa*m^6/mol^2]
- b
float
b parameter of cubic EOS; formulas vary with the EOS, [m^3/mol]
- delta
float
Coefficient calculated by EOS-specific method, [m^3/mol]
- epsilon
float
Coefficient calculated by EOS-specific method, [m^6/mol^2]
- a_alpha
float
Coefficient calculated by EOS-specific method, [J^2/mol^2/Pa]
- da_alpha_dT
float
Temperature derivative of $a \alpha$ calculated by EOS-specific method, [J^2/mol^2/Pa/K]
- d2a_alpha_dT2
float
Second temperature derivative of $a \alpha$ calculated by EOS-specific method, [J^2/mol^2/Pa/K**2]
- Zc
float
Critical compressibility of cubic EOS state, [-]
- phase
str
One of ‘l’, ‘g’, or ‘l/g’ to represent whether or not there is a liquid-like solution, vapor-like solution, or both available, [-]
- raw_volumes
list
[(float
,complex
), 3] Calculated molar volumes from the volume solver; depending on the state and selected volume solver, imaginary volumes may be represented by 0 or -1j to save the time of actually calculating them, [m^3/mol]
- V_l
float
Liquid phase molar volume, [m^3/mol]
- V_g
float
Vapor phase molar volume, [m^3/mol]
- V
float
orNone
Molar volume specified as input; otherwise None, [m^3/mol]
- Z_l
float
Liquid phase compressibility, [-]
- Z_g
float
Vapor phase compressibility, [-]
- PIP_l
float
Liquid phase phase identification parameter, [-]
- PIP_g
float
Vapor phase phase identification parameter, [-]
- dP_dT_l
float
Liquid phase temperature derivative of pressure at constant volume, [Pa/K].
$\left(\frac{\partial P}{\partial T}\right)_V = \frac{R}{V - b} - \frac{a \frac{d \alpha{\left (T \right )}}{d T}}{V^{2} + V \delta + \epsilon}$- dP_dT_g
float
Vapor phase temperature derivative of pressure at constant volume, [Pa/K].
$\left(\frac{\partial P}{\partial T}\right)_V = \frac{R}{V - b} - \frac{a \frac{d \alpha{\left (T \right )}}{d T}}{V^{2} + V \delta + \epsilon}$- dP_dV_l
float
Liquid phase volume derivative of pressure at constant temperature, [Pa*mol/m^3].
$\left(\frac{\partial P}{\partial V}\right)_T = - \frac{R T}{\left( V - b\right)^{2}} - \frac{a \left(- 2 V - \delta\right) \alpha{ \left (T \right )}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}$- dP_dV_g
float
Gas phase volume derivative of pressure at constant temperature, [Pa*mol/m^3].
$\left(\frac{\partial P}{\partial V}\right)_T = - \frac{R T}{\left( V - b\right)^{2}} - \frac{a \left(- 2 V - \delta\right) \alpha{ \left (T \right )}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}$- dV_dT_l
float
Liquid phase temperature derivative of volume at constant pressure, [m^3/(mol*K)].
$\left(\frac{\partial V}{\partial T}\right)_P =-\frac{ \left(\frac{\partial P}{\partial T}\right)_V}{ \left(\frac{\partial P}{\partial V}\right)_T}$- dV_dT_g
float
Gas phase temperature derivative of volume at constant pressure, [m^3/(mol*K)].
$\left(\frac{\partial V}{\partial T}\right)_P =-\frac{ \left(\frac{\partial P}{\partial T}\right)_V}{ \left(\frac{\partial P}{\partial V}\right)_T}$- dV_dP_l
float
Liquid phase pressure derivative of volume at constant temperature, [m^3/(mol*Pa)].
$\left(\frac{\partial V}{\partial P}\right)_T =-\frac{ \left(\frac{\partial V}{\partial T}\right)_P}{ \left(\frac{\partial P}{\partial T}\right)_V}$- dV_dP_g
float
Gas phase pressure derivative of volume at constant temperature, [m^3/(mol*Pa)].
$\left(\frac{\partial V}{\partial P}\right)_T =-\frac{ \left(\frac{\partial V}{\partial T}\right)_P}{ \left(\frac{\partial P}{\partial T}\right)_V}$- dT_dV_l
float
Liquid phase volume derivative of temperature at constant pressure, [K*mol/m^3].
$\left(\frac{\partial T}{\partial V}\right)_P = \frac{1} {\left(\frac{\partial V}{\partial T}\right)_P}$- dT_dV_g
float
Gas phase volume derivative of temperature at constant pressure, [K*mol/m^3]. See
GCEOS.set_properties_from_solution
for the formula.- dT_dP_l
float
Liquid phase pressure derivative of temperature at constant volume, [K/Pa].
$\left(\frac{\partial T}{\partial P}\right)_V = \frac{1} {\left(\frac{\partial P}{\partial T}\right)_V}$- dT_dP_g
float
Gas phase pressure derivative of temperature at constant volume, [K/Pa].
$\left(\frac{\partial T}{\partial P}\right)_V = \frac{1} {\left(\frac{\partial P}{\partial T}\right)_V}$- d2P_dT2_l
float
Liquid phase second derivative of pressure with respect to temperature at constant volume, [Pa/K^2].
$\left(\frac{\partial^2 P}{\partial T^2}\right)_V = - \frac{a \frac{d^{2} \alpha{\left (T \right )}}{d T^{2}}}{V^{2} + V \delta + \epsilon}$- d2P_dT2_g
float
Gas phase second derivative of pressure with respect to temperature at constant volume, [Pa/K^2].
$\left(\frac{\partial^2 P}{\partial T^2}\right)_V = - \frac{a \frac{d^{2} \alpha{\left (T \right )}}{d T^{2}}}{V^{2} + V \delta + \epsilon}$- d2P_dV2_l
float
Liquid phase second derivative of pressure with respect to volume at constant temperature, [Pa*mol^2/m^6].
$\left(\frac{\partial^2 P}{\partial V^2}\right)_T = 2 \left(\frac{ R T}{\left(V - b\right)^{3}} - \frac{a \left(2 V + \delta\right)^{ 2} \alpha{\left (T \right )}}{\left(V^{2} + V \delta + \epsilon \right)^{3}} + \frac{a \alpha{\left (T \right )}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}\right)$- d2P_dTdV_l
float
Liquid phase second derivative of pressure with respect to volume and then temperature, [Pa*mol/(K*m^3)].
$\left(\frac{\partial^2 P}{\partial T \partial V}\right) = - \frac{ R}{\left(V - b\right)^{2}} + \frac{a \left(2 V + \delta\right) \frac{d \alpha{\left (T \right )}}{d T}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}$- d2P_dTdV_g
float
Gas phase second derivative of pressure with respect to volume and then temperature, [Pa*mol/(K*m^3)].
$\left(\frac{\partial^2 P}{\partial T \partial V}\right) = - \frac{ R}{\left(V - b\right)^{2}} + \frac{a \left(2 V + \delta\right) \frac{d \alpha{\left (T \right )}}{d T}}{\left(V^{2} + V \delta + \epsilon\right)^{2}}$- H_dep_l
float
Liquid phase departure enthalpy, [J/mol]. See
GCEOS.set_properties_from_solution
for the formula.- H_dep_g
float
Gas phase departure enthalpy, [J/mol]. See
GCEOS.set_properties_from_solution
for the formula.- S_dep_l
float
Liquid phase departure entropy, [J/(mol*K)]. See
GCEOS.set_properties_from_solution
for the formula.- S_dep_g
float
Gas phase departure entropy, [J/(mol*K)]. See
GCEOS.set_properties_from_solution
for the formula.- G_dep_l
float
Liquid phase departure Gibbs energy, [J/mol].
$G_{dep} = H_{dep} - T S_{dep}$- G_dep_g
float
Gas phase departure Gibbs energy, [J/mol].
$G_{dep} = H_{dep} - T S_{dep}$- Cp_dep_l
float
Liquid phase departure heat capacity, [J/(mol*K)]
$C_{p, dep} = (C_p-C_v)_{\text{from EOS}} + C_{v, dep} - R$- Cp_dep_g
float
Gas phase departure heat capacity, [J/(mol*K)]
$C_{p, dep} = (C_p-C_v)_{\text{from EOS}} + C_{v, dep} - R$- Cv_dep_l
float
Liquid phase departure constant volume heat capacity, [J/(mol*K)]. See
GCEOS.set_properties_from_solution
for the formula.- Cv_dep_g
float
Gas phase departure constant volume heat capacity, [J/(mol*K)]. See
GCEOS.set_properties_from_solution
for the formula.- c1
float
Full value of the constant in the a parameter, set in some EOSs, [-]
- c2
float
Full value of the constant in the b parameter, set in some EOSs, [-]
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].
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].
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].
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].
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_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].
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_g
Alias of
GCEOS.d2P_dTdV_g
d2P_dVdT_l
Alias of
GCEOS.d2P_dTdV_l
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].
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].
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_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_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_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].
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)].
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)].
d3a_alpha_dT3
Method to calculate the third temperature derivative of $a \alpha$, [J^2/mol^2/Pa/K^3].
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].
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].
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)].
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].
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].
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].
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.
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].
Vc
Critical volume, [m^3/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].
- T
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.
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.
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.
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, guess])Generic method to calculate vapor pressure 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.
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.
Dummy method to calculate $a \alpha$ and its first and second derivatives.
a_alpha_for_Psat
(T, Psat[, a_alpha_guess])Method to calculate which value of $a \alpha$ is required for a given T, Psat pair.
a_alpha_for_V
(T, P, V)Method to calculate which value of $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 \alpha$ parameter and its first two derivatives.
as_json
()Method to create a JSON-friendly serialization of the eos which can be stored, and reloaded later.
Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given.
d2phi_sat_dT2
(T[, polish])Method to calculate the second temperature derivative of saturation fugacity coefficient of the compound.
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.
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.
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.
dphi_sat_dT
(T[, polish])Method to calculate the temperature derivative of saturation fugacity coefficient of the compound.
from_json
(json_repr)Method to create a eos from a JSON serialization of another eos.
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.
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_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[, solution])Generic method to calculate T from a specified P and V.
Generic method to ensure both volumes, if solutions are physical, have calculated properties.
Basic method to calculate a hash of the state of the model and its model parameters.
to
([T, P, V])Method to construct a new EOS object at two of T, P or V.
to_PV
(P, V)Method to construct a new EOS object at the spcified P and V.
to_TP
(T, P)Method to construct a new EOS object at the spcified T and P.
to_TV
(T, V)Method to construct a new EOS object at the spcified T and V.
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.
- property A_dep_g¶
Departure molar Helmholtz energy from ideal gas behavior for the gas phase, [J/mol].
$A_{dep} = U_{dep} - T S_{dep}$
- property A_dep_l¶
Departure molar Helmholtz energy from ideal gas behavior for the liquid phase, [J/mol].
$A_{dep} = U_{dep} - T S_{dep}$
- property Cp_minus_Cv_g¶
Cp - Cv for the gas phase, [J/mol/K].
$C_p - C_v = -T\left(\frac{\partial P}{\partial T}\right)_V^2/ \left(\frac{\partial P}{\partial V}\right)_T$
- property Cp_minus_Cv_l¶
Cp - Cv for the liquid phase, [J/mol/K].
$C_p - C_v = -T\left(\frac{\partial P}{\partial T}\right)_V^2/ \left(\frac{\partial P}{\partial V}\right)_T$
- Hvap(T)[source]¶
Method to calculate enthalpy of vaporization for a pure fluid from an equation of state, without iteration.
$\frac{dP^{sat}}{dT}=\frac{\Delta H_{vap}}{T(V_g - V_l)}$Results above the critical temperature are meaningless. A first-order polynomial is used to extrapolate under 0.32 Tc; however, there is normally not a volume solution to the EOS which can produce that low of a pressure.
- Parameters
- T
float
Temperature, [K]
- T
- Returns
- Hvap
float
Increase in enthalpy needed for vaporization of liquid phase along the saturation line, [J/mol]
- Hvap
Notes
Calculates vapor pressure and its derivative with Psat and dPsat_dT as well as molar volumes of the saturation liquid and vapor phase in the process.
Very near the critical point this provides unrealistic results due to Psat’s polynomials being insufficiently accurate.
References
- 1
Walas, Stanley M. Phase Equilibria in Chemical Engineering. Butterworth-Heinemann, 1985.
- N = 1¶
The number of components in the EOS
- PT_surface_special(Tmin=0.0001, Tmax=10000.0, Pmin=0.01, Pmax=1000000000.0, pts=50, show=False, color_map=None, mechanical=True, pseudo_critical=True, Psat=True, determinant_zeros=True, phase_ID_transition=True, base_property='V', base_min=None, base_max=None, base_selection='Gmin')[source]¶
Method to create a plot of the special curves of a pure fluid - vapor pressure, determinant zeros, pseudo critical point, and mechanical critical point.
The color background is a plot of the molar volume (by default) which has the minimum Gibbs energy (by default). If shown with a sufficient number of points, the curve between vapor and liquid should be shown smoothly.
When called on a mixture, this method does not have physical significance for the Psat term.
- Parameters
- Tmin
float
,optional
Minimum temperature of calculation, [K]
- Tmax
float
,optional
Maximum temperature of calculation, [K]
- Pmin
float
,optional
Minimum pressure of calculation, [Pa]
- Pmax
float
,optional
Maximum pressure of calculation, [Pa]
- pts
int
,optional
The number of points to include in both the x and y axis [-]
- showbool,
optional
Whether or not the plot should be rendered and shown; a handle to it is returned if plot is True for other purposes such as saving the plot to a file, [-]
- color_map
matplotlib.cm.ListedColormap
,optional
Matplotlib colormap object, [-]
- mechanicalbool,
optional
Whether or not to include the mechanical critical point; this is the same as the critical point for a pure compound but not for a mixture, [-]
- pseudo_criticalbool,
optional
Whether or not to include the pseudo critical point; this is the same as the critical point for a pure compound but not for a mixture, [-]
- Psatbool,
optional
Whether or not to include the vapor pressure curve; for mixtures this is neither the bubble nor dew curve, but rather a hypothetical one which uses the same equation as the pure components, [-]
- determinant_zerosbool,
optional
Whether or not to include a curve showing when the EOS’s determinant hits zero, [-]
- phase_ID_transitionbool,
optional
Whether or not to show a curve of where the PIP hits 1 exactly, [-]
- base_property
str
,optional
The property which should be plotted; ‘_l’ and ‘_g’ are added automatically according to the selected phase, [-]
- base_min
float
,optional
If specified, the base property will values will be limited to this value at the minimum, [-]
- base_max
float
,optional
If specified, the base property will values will be limited to this value at the maximum, [-]
- base_selection
str
,optional
For the base property, there are often two possible phases and but only one value can be plotted; use ‘l’ to pefer liquid-like values, ‘g’ to prefer gas-like values, and ‘Gmin’ to prefer values of the phase with the lowest Gibbs energy, [-]
- Tmin
- Returns
- fig
matplotlib.figure.Figure
Plotted figure, only returned if plot is True, [-]
- fig
- P_PIP_transition(T, low_P_limit=0.0)[source]¶
Method to calculate the pressure which makes the phase identification parameter exactly 1. There are three regions for this calculation:
subcritical - PIP = 1 for the gas-like phase at P = 0
initially supercritical - PIP = 1 on a curve starting at the critical point, increasing for a while, decreasing for a while, and then curving sharply back to a zero pressure.
later supercritical - PIP = 1 for the liquid-like phase at P = 0
- Parameters
- Returns
- P
float
Pressure which makes the PIP = 1, [Pa]
- P
Notes
The transition between the region where this function returns values and the high temperature region that doesn’t is the Joule-Thomson inversion point at a pressure of zero and can be directly solved for.
Examples
>>> eos = PRTranslatedConsistent(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> eos.P_PIP_transition(100) 0.0 >>> low_T = eos.to(T=100.0, P=eos.P_PIP_transition(100, low_P_limit=1e-5)) >>> low_T.PIP_l, low_T.PIP_g (45.778088191, 0.9999999997903) >>> initial_super = eos.to(T=600.0, P=eos.P_PIP_transition(600)) >>> initial_super.P, initial_super.PIP_g (6456282.17132, 0.999999999999) >>> high_T = eos.to(T=900.0, P=eos.P_PIP_transition(900, low_P_limit=1e-5)) >>> high_T.P, high_T.PIP_g (12536704.763, 0.9999999999)
- P_discriminant_zero_g()[source]¶
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.
- Returns
- P_discriminant_zero_g
float
Pressure which make the discriminants zero at the right condition, [Pa]
- P_discriminant_zero_g
Examples
>>> eos = PRTranslatedConsistent(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> P_trans = eos.P_discriminant_zero_g() >>> P_trans 149960391.7
In this case, the discriminant transition does not reveal a transition to two roots being available, only negative roots becoming negative and imaginary.
>>> eos.to(T=eos.T, P=P_trans*.99999999).mpmath_volumes_float ((-0.0001037013146195082-1.5043987866732543e-08j), (-0.0001037013146195082+1.5043987866732543e-08j), (0.00011799201928619508+0j)) >>> eos.to(T=eos.T, P=P_trans*1.0000001).mpmath_volumes_float ((-0.00010374888853182635+0j), (-0.00010365374200380354+0j), (0.00011799201875924273+0j))
- P_discriminant_zero_l()[source]¶
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.
- Returns
- P_discriminant_zero_l
float
Pressure which make the discriminants zero at the right condition, [Pa]
- P_discriminant_zero_l
Examples
>>> eos = PRTranslatedConsistent(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> P_trans = eos.P_discriminant_zero_l() >>> P_trans 478346.37289
In this case, the discriminant transition shows the change in roots:
>>> eos.to(T=eos.T, P=P_trans*.99999999).mpmath_volumes_float ((0.00013117994140177062+0j), (0.002479717165903531+0j), (0.002480236178570793+0j)) >>> eos.to(T=eos.T, P=P_trans*1.0000001).mpmath_volumes_float ((0.0001311799413872173+0j), (0.002479976386402769-8.206310112063695e-07j), (0.002479976386402769+8.206310112063695e-07j))
- P_discriminant_zeros()[source]¶
Method to calculate the pressures which zero the discriminant function of the general cubic eos, at the current temperature.
Examples
>>> eos = PRTranslatedConsistent(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> eos.P_discriminant_zeros() [478346.3, 149960391.7]
- static P_discriminant_zeros_analytical(T, b, delta, epsilon, a_alpha, valid=False)[source]¶
Method to calculate the pressures which zero the discriminant function of the general cubic eos. This is a quartic function solved analytically.
- Parameters
- T
float
Temperature, [K]
- b
float
Coefficient calculated by EOS-specific method, [m^3/mol]
- delta
float
Coefficient calculated by EOS-specific method, [m^3/mol]
- epsilon
float
Coefficient calculated by EOS-specific method, [m^6/mol^2]
- a_alpha
float
Coefficient calculated by EOS-specific method, [J^2/mol^2/Pa]
- validbool
Whether to filter the calculated pressures so that they are all real, and positive only, [-]
- T
- Returns
- P_discriminant_zeros
float
Pressures which make the discriminants zero, [Pa]
- P_discriminant_zeros
Notes
Calculated analytically. Derived as follows.
>>> from sympy import * >>> P, T, V, R, b, a, delta, epsilon = symbols('P, T, V, R, b, a, delta, epsilon') >>> eta = b >>> B = b*P/(R*T) >>> deltas = delta*P/(R*T) >>> thetas = a*P/(R*T)**2 >>> epsilons = epsilon*(P/(R*T))**2 >>> etas = eta*P/(R*T) >>> a_coeff = 1 >>> b_coeff = (deltas - B - 1) >>> c = (thetas + epsilons - deltas*(B+1)) >>> d = -(epsilons*(B+1) + thetas*etas) >>> disc = b_coeff*b_coeff*c*c - 4*a_coeff*c*c*c - 4*b_coeff*b_coeff*b_coeff*d - 27*a_coeff*a_coeff*d*d + 18*a_coeff*b_coeff*c*d >>> base = -(expand(disc/P**2*R**3*T**3)) >>> sln = collect(base, P)
- P_max_at_V(V)[source]¶
Dummy method. The idea behind this method, which is implemented by some subclasses, is to calculate the maximum pressure the EOS can create at a constant volume, if one exists; returns None otherwise. This method, as a dummy method, always returns None.
- P_zero_g_cheb_limits = (0.0, 0.0)¶
- P_zero_l_cheb_limits = (0.0, 0.0)¶
- Psat(T, polish=False, guess=None)[source]¶
Generic method to calculate vapor pressure for a specified T.
From Tc to 0.32Tc, uses a 10th order polynomial of the following form:
$\ln\frac{P_r}{T_r} = \sum_{k=0}^{10} C_k\left(\frac{\alpha}{T_r} -1\right)^{k}$If polish is True, SciPy’s newton solver is launched with the calculated vapor pressure as an initial guess in an attempt to get more accuracy. This may not converge however.
Results above the critical temperature are meaningless. A first-order polynomial is used to extrapolate under 0.32 Tc; however, there is normally not a volume solution to the EOS which can produce that low of a pressure.
- Parameters
- Returns
- Psat
float
Vapor pressure, [Pa]
- Psat
Notes
EOSs sharing the same b, delta, and epsilon have the same coefficient sets.
Form for the regression is inspired from [1].
No volume solution is needed when polish=False; the only external call is for the value of a_alpha.
References
- 1
Soave, G. “Direct Calculation of Pure-Compound Vapour Pressures through Cubic Equations of State.” Fluid Phase Equilibria 31, no. 2 (January 1, 1986): 203-7. doi:10.1016/0378-3812(86)90013-0.
- Psat_cheb_range = (0.0, 0.0)¶
- Psat_errors(Tmin=None, Tmax=None, pts=50, plot=False, show=False, trunc_err_low=1e-18, trunc_err_high=1.0, Pmin=1e-100)[source]¶
Method to create a plot of vapor pressure and the relative error of its calculation vs. the iterative polish approach.
- Parameters
- Tmin
float
Minimum temperature of calculation; if this is too low the saturation routines will stop converging, [K]
- Tmax
float
Maximum temperature of calculation; cannot be above the critical temperature, [K]
- pts
int
,optional
The number of temperature points to include [-]
- plotbool
If False, the solution is returned without plotting the data, [-]
- showbool
Whether or not the plot should be rendered and shown; a handle to it is returned if plot is True for other purposes such as saving the plot to a file, [-]
- trunc_err_low
float
Minimum plotted error; values under this are rounded to 0, [-]
- trunc_err_high
float
Maximum plotted error; values above this are rounded to 1, [-]
- Pmin
float
Minimum pressure for the solution to work on, [Pa]
- Tmin
- Returns
- T_discriminant_zero_g(T_guess=None)[source]¶
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.
- Parameters
- T_guess
float
,optional
Temperature guess, [K]
- T_guess
- Returns
- T_discriminant_zero_g
float
Temperature which make the discriminants zero at the right condition, [K]
- T_discriminant_zero_g
Notes
Significant numerical issues remain in improving this method.
Examples
>>> eos = PRTranslatedConsistent(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> T_trans = eos.T_discriminant_zero_g() >>> T_trans 644.3023307
In this case, the discriminant transition does not reveal a transition to two roots being available, only to there being a double (imaginary) root.
>>> eos.to(P=eos.P, T=T_trans).mpmath_volumes_float ((9.309597822372529e-05-0.00015876248805149625j), (9.309597822372529e-05+0.00015876248805149625j), (0.005064847204219234+0j))
- T_discriminant_zero_l(T_guess=None)[source]¶
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.
- Parameters
- T_guess
float
,optional
Temperature guess, [K]
- T_guess
- Returns
- T_discriminant_zero_l
float
Temperature which make the discriminants zero at the right condition, [K]
- T_discriminant_zero_l
Notes
Significant numerical issues remain in improving this method.
Examples
>>> eos = PRTranslatedConsistent(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> T_trans = eos.T_discriminant_zero_l() >>> T_trans 644.3023307
In this case, the discriminant transition does not reveal a transition to two roots being available, only to there being a double (imaginary) root.
>>> eos.to(P=eos.P, T=T_trans).mpmath_volumes_float ((9.309597822372529e-05-0.00015876248805149625j), (9.309597822372529e-05+0.00015876248805149625j), (0.005064847204219234+0j))
- T_max_at_V(V, Pmax=None)[source]¶
Method to calculate the maximum temperature the EOS can create at a constant volume, if one exists; returns None otherwise.
- Parameters
- Returns
- T
float
Maximum possible temperature, [K]
- T
Examples
>>> e = PR(P=1e5, V=0.0001437, Tc=512.5, Pc=8084000.0, omega=0.559) >>> e.T_max_at_V(e.V) 431155.5
- T_min_at_V(V, Pmin=1e-15)[source]¶
Returns the minimum temperature for the EOS to have the volume as specified. Under this temperature, the pressure will go negative (and the EOS will not solve).
- Tsat(P, polish=False)[source]¶
Generic method to calculate the temperature for a specified vapor pressure of the pure fluid. This is simply a bounded solver running between 0.2Tc and Tc on the Psat method.
- Parameters
- Returns
- Tsat
float
Temperature of saturation, [K]
- Tsat
Notes
It is recommended not to run with polish=True, as that will make the calculation much slower.
- property U_dep_g¶
Departure molar internal energy from ideal gas behavior for the gas phase, [J/mol].
$U_{dep} = H_{dep} - P V_{dep}$
- property U_dep_l¶
Departure molar internal energy from ideal gas behavior for the liquid phase, [J/mol].
$U_{dep} = H_{dep} - P V_{dep}$
- property V_dep_g¶
Departure molar volume from ideal gas behavior for the gas phase, [m^3/mol].
$V_{dep} = V - \frac{RT}{P}$
- property V_dep_l¶
Departure molar volume from ideal gas behavior for the liquid phase, [m^3/mol].
$V_{dep} = V - \frac{RT}{P}$
- property V_g_mpmath¶
The molar volume of the gas phase calculated with mpmath to a higher precision, [m^3/mol]. This is useful for validating the cubic root solver(s). It is not quite a true arbitrary solution to the EOS, because the constants b,`epsilon`, delta and a_alpha as well as the input arguments T and P are not calculated with arbitrary precision. This is a feature when comparing the volume solution algorithms however as they work with the same finite-precision variables.
- V_g_sat(T)[source]¶
Method to calculate molar volume of the vapor phase along the saturation line.
- Parameters
- T
float
Temperature, [K]
- T
- Returns
- V_g_sat
float
Gas molar volume along the saturation line, [m^3/mol]
- V_g_sat
Notes
Computes Psat, and then uses volume_solutions to obtain the three possible molar volumes. The highest value is returned.
- property V_l_mpmath¶
The molar volume of the liquid phase calculated with mpmath to a higher precision, [m^3/mol]. This is useful for validating the cubic root solver(s). It is not quite a true arbitrary solution to the EOS, because the constants b,`epsilon`, delta and a_alpha as well as the input arguments T and P are not calculated with arbitrary precision. This is a feature when comparing the volume solution algorithms however as they work with the same finite-precision variables.
- V_l_sat(T)[source]¶
Method to calculate molar volume of the liquid phase along the saturation line.
- Parameters
- T
float
Temperature, [K]
- T
- Returns
- V_l_sat
float
Liquid molar volume along the saturation line, [m^3/mol]
- V_l_sat
Notes
Computes Psat, and then uses volume_solutions to obtain the three possible molar volumes. The lowest value is returned.
- property Vc¶
Critical volume, [m^3/mol].
$V_c = \frac{Z_c R T_c}{P_c}$
- Vs_mpmath()[source]¶
Method to calculate real roots of a cubic equation, using mpmath.
- Returns
- Vs
list
[mpf
] Either 1 or 3 real volumes as calculated by mpmath, [m^3/mol]
- Vs
Examples
>>> eos = PRTranslatedTwu(T=300, P=1e5, Tc=512.5, Pc=8084000.0, omega=0.559, alpha_coeffs=(0.694911, 0.9199, 1.7), c=-1e-6) >>> eos.Vs_mpmath() [mpf('0.0000489261705320261435106226558966745'), mpf('0.000541508154451321441068958547812526'), mpf('0.0243149463942697410611501615357228')]
- __repr__()[source]¶
Create a string representation of the EOS - by default, include all parameters so as to make it easy to construct new instances from states. Includes the two specified state variables, Tc, Pc, omega and any kwargs.
- Returns
- recreation
str
String which is valid Python and recreates the current state of the object if ran, [-]
- recreation
Examples
>>> eos = PR(Tc=507.6, Pc=3025000.0, omega=0.2975, T=400.0, P=1e6) >>> eos PR(Tc=507.6, Pc=3025000.0, omega=0.2975, T=400.0, P=1000000.0)
- 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.
- Parameters
- T
float
Temperature, [K]
- fullbool,
optional
If False, calculates and returns only a_alpha, [-]
- quickbool,
optional
Legary parameter being phased out [-]
- 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); does nothing in the case of pure EOSs [-]
- T
- Returns
- a_alpha_and_derivatives_pure(T)[source]¶
Dummy method to calculate $a \alpha$ and its first and second derivatives. Should be implemented with the same function signature in each EOS variant; this only raises a NotImplemented Exception. Should return ‘a_alpha’, ‘da_alpha_dT’, and ‘d2a_alpha_dT2’.
- Parameters
- T
float
Temperature, [K]
- T
- Returns
- a_alpha_for_Psat(T, Psat, a_alpha_guess=None)[source]¶
Method to calculate which value of $a \alpha$ is required for a given T, Psat pair. This is a numerical solution, but not a very complicated one.
- Parameters
- Returns
- a_alpha
float
Value calculated to match specified volume for the current EOS, [J^2/mol^2/Pa]
- a_alpha
Notes
The implementation of this function is a direct calculation of departure gibbs energy, which is equal in both phases at saturation.
Examples
>>> eos = PR(Tc=507.6, Pc=3025000, omega=0.2975, T=299., P=1E6) >>> eos.a_alpha_for_Psat(T=400, Psat=5e5) 3.1565798926
- a_alpha_for_V(T, P, V)[source]¶
Method to calculate which value of $a \alpha$ is required for a given T, P pair to match a specified V. This is a straightforward analytical equation.
- Parameters
- Returns
- a_alpha
float
Value calculated to match specified volume for the current EOS, [J^2/mol^2/Pa]
- a_alpha
Notes
The derivation of the solution is as follows:
>>> from sympy import * >>> P, T, V, R, b, a, delta, epsilon = symbols('P, T, V, R, b, a, delta, epsilon') >>> a_alpha = symbols('a_alpha') >>> CUBIC = R*T/(V-b) - a_alpha/(V*V + delta*V + epsilon) >>> solve(Eq(CUBIC, P), a_alpha) [(-P*V**3 + P*V**2*b - P*V**2*delta + P*V*b*delta - P*V*epsilon + P*b*epsilon + R*T*V**2 + R*T*V*delta + R*T*epsilon)/(V - b)]
- a_alpha_plot(Tmin=0.0001, Tmax=None, pts=1000, plot=True, show=True)[source]¶
Method to create a plot of the $a \alpha$ parameter and its first two derivatives. This easily allows identification of EOSs which are displaying inconsistent behavior.
- Parameters
- Tmin
float
Minimum temperature of calculation, [K]
- Tmax
float
Maximum temperature of calculation, [K]
- pts
int
,optional
The number of temperature points to include [-]
- plotbool
If False, the calculated values and temperatures are returned without plotting the data, [-]
- showbool
Whether or not the plot should be rendered and shown; a handle to it is returned if plot is True for other purposes such as saving the plot to a file, [-]
- Tmin
- Returns
- Ts
list
[float
] Logarithmically spaced temperatures in specified range, [K]
- a_alpha
list
[float
] Coefficient calculated by EOS-specific method, [J^2/mol^2/Pa]
- da_alpha_dT
list
[float
] Temperature derivative of coefficient calculated by EOS-specific method, [J^2/mol^2/Pa/K]
- d2a_alpha_dT2
list
[float
] Second temperature derivative of coefficient calculated by EOS-specific method, [J^2/mol^2/Pa/K^2]
- fig
matplotlib.figure.Figure
Plotted figure, only returned if plot is True, [-]
- Ts
- as_json()[source]¶
Method to create a JSON-friendly serialization of the eos which can be stored, and reloaded later.
- Returns
- json_repr
dict
JSON-friendly representation, [-]
- json_repr
Examples
>>> import json >>> eos = MSRKTranslated(Tc=507.6, Pc=3025000, omega=0.2975, c=22.0561E-6, M=0.7446, N=0.2476, T=250., P=1E6) >>> assert eos == MSRKTranslated.from_json(json.loads(json.dumps(eos.as_json())))
- property beta_g¶
Isobaric (constant-pressure) expansion coefficient for the gas phase, [1/K].
$\beta = \frac{1}{V}\frac{\partial V}{\partial T}$
- property beta_l¶
Isobaric (constant-pressure) expansion coefficient for the liquid phase, [1/K].
$\beta = \frac{1}{V}\frac{\partial V}{\partial T}$
- c1 = None¶
Parameter used by some equations of state in the a calculation
- c2 = None¶
Parameter used by some equations of state in the b calculation
- check_sufficient_inputs()[source]¶
Method to an exception if none of the pairs (T, P), (T, V), or (P, V) are given.
- property d2H_dep_dT2_g¶
Second temperature derivative of departure enthalpy with respect to temperature for the gas phase, [(J/mol)/K^2].
$\frac{\partial^2 H_{dep, g}}{\partial T^2} = P \frac{d^{2}}{d T^{2}} V{\left(T \right)} - \frac{8 T \frac{d}{d T} V{\left(T \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha} {\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{ \left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 T \operatorname{atanh}{\left( \frac{\delta + 2 V{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{3}}{d T^{3}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} + \frac{16 \left(\delta + 2 V{\left(T \right)} \right) \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \left( \frac{d}{d T} V{\left(T \right)}\right)^{2}}{\left(\delta^{2} - 4 \epsilon\right)^{2} \left(\frac{\left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)^{2}} - \frac{4 \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \frac{d^{2}}{d T^{2}} V{\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T \right)} \right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 \operatorname{atanh}{\left(\frac{\delta + 2 V{\left(T \right)}} {\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}}$
- property d2H_dep_dT2_g_P¶
Second temperature derivative of departure enthalpy with respect to temperature for the gas phase, [(J/mol)/K^2].
$\frac{\partial^2 H_{dep, g}}{\partial T^2} = P \frac{d^{2}}{d T^{2}} V{\left(T \right)} - \frac{8 T \frac{d}{d T} V{\left(T \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha} {\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{ \left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 T \operatorname{atanh}{\left( \frac{\delta + 2 V{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{3}}{d T^{3}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} + \frac{16 \left(\delta + 2 V{\left(T \right)} \right) \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \left( \frac{d}{d T} V{\left(T \right)}\right)^{2}}{\left(\delta^{2} - 4 \epsilon\right)^{2} \left(\frac{\left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)^{2}} - \frac{4 \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \frac{d^{2}}{d T^{2}} V{\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T \right)} \right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 \operatorname{atanh}{\left(\frac{\delta + 2 V{\left(T \right)}} {\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}}$
- property 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].
$\left(\frac{\partial^2 H_{dep, g}}{\partial T^2}\right)_V = \frac{2 T \operatorname{atanh}{\left(\frac{2 V + \delta}{\sqrt{ \delta^{2} - 4 \epsilon}} \right)} \frac{d^{3}}{d T^{3}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} + V \frac{\partial^{2}}{\partial T^{2}} P{\left(V,T \right)} + \frac{2 \operatorname{atanh}{\left(\frac{ 2 V + \delta}{\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{2}} {d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}}$
- property d2H_dep_dT2_l¶
Second temperature derivative of departure enthalpy with respect to temperature for the liquid phase, [(J/mol)/K^2].
$\frac{\partial^2 H_{dep, l}}{\partial T^2} = P \frac{d^{2}}{d T^{2}} V{\left(T \right)} - \frac{8 T \frac{d}{d T} V{\left(T \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha} {\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{ \left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 T \operatorname{atanh}{\left( \frac{\delta + 2 V{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{3}}{d T^{3}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} + \frac{16 \left(\delta + 2 V{\left(T \right)} \right) \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \left( \frac{d}{d T} V{\left(T \right)}\right)^{2}}{\left(\delta^{2} - 4 \epsilon\right)^{2} \left(\frac{\left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)^{2}} - \frac{4 \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \frac{d^{2}}{d T^{2}} V{\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T \right)} \right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 \operatorname{atanh}{\left(\frac{\delta + 2 V{\left(T \right)}} {\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}}$
- property d2H_dep_dT2_l_P¶
Second temperature derivative of departure enthalpy with respect to temperature for the liquid phase, [(J/mol)/K^2].
$\frac{\partial^2 H_{dep, l}}{\partial T^2} = P \frac{d^{2}}{d T^{2}} V{\left(T \right)} - \frac{8 T \frac{d}{d T} V{\left(T \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha} {\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{ \left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 T \operatorname{atanh}{\left( \frac{\delta + 2 V{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{3}}{d T^{3}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} + \frac{16 \left(\delta + 2 V{\left(T \right)} \right) \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \left( \frac{d}{d T} V{\left(T \right)}\right)^{2}}{\left(\delta^{2} - 4 \epsilon\right)^{2} \left(\frac{\left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)^{2}} - \frac{4 \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \frac{d^{2}}{d T^{2}} V{\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T \right)} \right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 \operatorname{atanh}{\left(\frac{\delta + 2 V{\left(T \right)}} {\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}}$
- property 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].
$\left(\frac{\partial^2 H_{dep, l}}{\partial T^2}\right)_V = \frac{2 T \operatorname{atanh}{\left(\frac{2 V + \delta}{\sqrt{ \delta^{2} - 4 \epsilon}} \right)} \frac{d^{3}}{d T^{3}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} + V \frac{\partial^{2}}{\partial T^{2}} P{\left(V,T \right)} + \frac{2 \operatorname{atanh}{\left(\frac{ 2 V + \delta}{\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{2}} {d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}}$
- property d2H_dep_dTdP_g¶
Temperature and pressure derivative of departure enthalpy at constant pressure then temperature for the gas phase, [(J/mol)/K/Pa].
$\left(\frac{\partial^2 H_{dep, g}}{\partial T \partial P}\right)_{T, P} = P \frac{\partial^{2}}{\partial T\partial P} V{\left(T,P \right)} - \frac{4 T \frac{\partial}{\partial P} V{\left(T,P \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}} {\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T,P \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{16 \left(\delta + 2 V{\left(T,P \right)}\right) \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \frac{\partial} {\partial P} V{\left(T,P \right)} \frac{\partial}{\partial T} V{\left(T,P \right)}}{\left(\delta^{2} - 4 \epsilon\right)^{2} \left(\frac{\left(\delta + 2 V{\left(T,P \right)}\right)^{2}} {\delta^{2} - 4 \epsilon} - 1\right)^{2}} + \frac{\partial} {\partial T} V{\left(T,P \right)} - \frac{4 \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha} {\left(T \right)}\right) \frac{\partial^{2}}{\partial T\partial P} V{\left(T,P \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T,P \right)}\right)^{2}} {\delta^{2} - 4 \epsilon} - 1\right)}$
- property d2H_dep_dTdP_l¶
Temperature and pressure derivative of departure enthalpy at constant pressure then temperature for the liquid phase, [(J/mol)/K/Pa].
$\left(\frac{\partial^2 H_{dep, l}}{\partial T \partial P}\right)_V = P \frac{\partial^{2}}{\partial T\partial P} V{\left(T,P \right)} - \frac{4 T \frac{\partial}{\partial P} V{\left(T,P \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}} {\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T,P \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{16 \left(\delta + 2 V{\left(T,P \right)}\right) \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha}{\left(T \right)}\right) \frac{\partial} {\partial P} V{\left(T,P \right)} \frac{\partial}{\partial T} V{\left(T,P \right)}}{\left(\delta^{2} - 4 \epsilon\right)^{2} \left(\frac{\left(\delta + 2 V{\left(T,P \right)}\right)^{2}} {\delta^{2} - 4 \epsilon} - 1\right)^{2}} + \frac{\partial} {\partial T} V{\left(T,P \right)} - \frac{4 \left(T \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)} - \operatorname{a\alpha} {\left(T \right)}\right) \frac{\partial^{2}}{\partial T\partial P} V{\left(T,P \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T,P \right)}\right)^{2}} {\delta^{2} - 4 \epsilon} - 1\right)}$
- property 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].
$\left(\frac{\partial^2 P}{\partial T \partial T}\right)_{P,V} = - \frac{R \frac{d}{d T} V{\left(T \right)}}{\left(- b + V{\left(T \right)}\right)^{2}} - \frac{\left(- \delta \frac{d}{d T} V{\left(T \right)} - 2 V{\left(T \right)} \frac{d}{d T} V{\left(T \right)} \right) \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)}} {\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}\right)^{2}} - \frac{\frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}}$
- property 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].
$\left(\frac{\partial^2 P}{\partial T \partial T}\right)_{P,V} = - \frac{R \frac{d}{d T} V{\left(T \right)}}{\left(- b + V{\left(T \right)}\right)^{2}} - \frac{\left(- \delta \frac{d}{d T} V{\left(T \right)} - 2 V{\left(T \right)} \frac{d}{d T} V{\left(T \right)} \right) \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)}} {\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}\right)^{2}} - \frac{\frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}}$
- property 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].
$\left(\frac{\partial^2 P}{\partial T \partial P}\right)_{V, T} = - \frac{R \frac{d}{d P} V{\left(P \right)}}{\left(- b + V{\left(P \right)}\right)^{2}} - \frac{\left(- \delta \frac{d}{d P} V{\left(P \right)} - 2 V{\left(P \right)} \frac{d}{d P} V{\left(P \right)} \right) \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)}} {\left(\delta V{\left(P \right)} + \epsilon + V^{2}{\left(P \right)}\right)^{2}}$
- property 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].
$\left(\frac{\partial^2 P}{\partial T \partial P}\right)_{V, T} = - \frac{R \frac{d}{d P} V{\left(P \right)}}{\left(- b + V{\left(P \right)}\right)^{2}} - \frac{\left(- \delta \frac{d}{d P} V{\left(P \right)} - 2 V{\left(P \right)} \frac{d}{d P} V{\left(P \right)} \right) \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)}} {\left(\delta V{\left(P \right)} + \epsilon + V^{2}{\left(P \right)}\right)^{2}}$
- property d2P_dTdrho_g¶
Derivative of pressure with respect to molar density, and temperature for the gas phase, [Pa/(K*mol/m^3)].
$\frac{\partial^2 P}{\partial \rho\partial T} = -V^2 \frac{\partial^2 P}{\partial T \partial V}$
- property d2P_dTdrho_l¶
Derivative of pressure with respect to molar density, and temperature for the liquid phase, [Pa/(K*mol/m^3)].
$\frac{\partial^2 P}{\partial \rho\partial T} = -V^2 \frac{\partial^2 P}{\partial T \partial V}$
- property d2P_dVdP_g¶
Second derivative of pressure with respect to molar volume and then pressure for the gas phase, [mol/m^3].
$\frac{\partial^2 P}{\partial V \partial P} = \frac{2 R T \frac{d}{d P} V{\left(P \right)}}{\left(- b + V{\left(P \right)}\right)^{3}} - \frac{\left(- \delta - 2 V{\left(P \right)} \right) \left(- 2 \delta \frac{d}{d P} V{\left(P \right)} - 4 V{\left(P \right)} \frac{d}{d P} V{\left(P \right)}\right) \operatorname{a\alpha}{\left(T \right)}}{\left(\delta V{\left(P \right)} + \epsilon + V^{2}{\left(P \right)}\right)^{3}} + \frac{2 \operatorname{a\alpha}{\left(T \right)} \frac{d}{d P} V{\left(P \right)}}{\left(\delta V{\left(P \right)} + \epsilon + V^{2} {\left(P \right)}\right)^{2}}$
- property d2P_dVdP_l¶
Second derivative of pressure with respect to molar volume and then pressure for the liquid phase, [mol/m^3].
$\frac{\partial^2 P}{\partial V \partial P} = \frac{2 R T \frac{d}{d P} V{\left(P \right)}}{\left(- b + V{\left(P \right)}\right)^{3}} - \frac{\left(- \delta - 2 V{\left(P \right)} \right) \left(- 2 \delta \frac{d}{d P} V{\left(P \right)} - 4 V{\left(P \right)} \frac{d}{d P} V{\left(P \right)}\right) \operatorname{a\alpha}{\left(T \right)}}{\left(\delta V{\left(P \right)} + \epsilon + V^{2}{\left(P \right)}\right)^{3}} + \frac{2 \operatorname{a\alpha}{\left(T \right)} \frac{d}{d P} V{\left(P \right)}}{\left(\delta V{\left(P \right)} + \epsilon + V^{2} {\left(P \right)}\right)^{2}}$
- property 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].
$\left(\frac{\partial^2 P}{\partial V \partial T}\right)_{T,P} = \frac{2 R T \frac{d}{d T} V{\left(T \right)}}{\left(- b + V{\left(T \right)}\right)^{3}} - \frac{R}{\left(- b + V{\left(T \right)} \right)^{2}} - \frac{\left(- \delta - 2 V{\left(T \right)}\right) \left(- 2 \delta \frac{d}{d T} V{\left(T \right)} - 4 V{\left(T \right)} \frac{d}{d T} V{\left(T \right)}\right) \operatorname{ a\alpha}{\left(T \right)}}{\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}\right)^{3}} - \frac{\left( - \delta - 2 V{\left(T \right)}\right) \frac{d}{d T} \operatorname{ a\alpha}{\left(T \right)}}{\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}\right)^{2}} + \frac{2 \operatorname{a\alpha}{\left(T \right)} \frac{d}{d T} V{\left(T \right)}}{\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left( T \right)}\right)^{2}}$
- property 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].
$\left(\frac{\partial^2 P}{\partial V \partial T}\right)_{T,P} = \frac{2 R T \frac{d}{d T} V{\left(T \right)}}{\left(- b + V{\left(T \right)}\right)^{3}} - \frac{R}{\left(- b + V{\left(T \right)} \right)^{2}} - \frac{\left(- \delta - 2 V{\left(T \right)}\right) \left(- 2 \delta \frac{d}{d T} V{\left(T \right)} - 4 V{\left(T \right)} \frac{d}{d T} V{\left(T \right)}\right) \operatorname{ a\alpha}{\left(T \right)}}{\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}\right)^{3}} - \frac{\left( - \delta - 2 V{\left(T \right)}\right) \frac{d}{d T} \operatorname{ a\alpha}{\left(T \right)}}{\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left(T \right)}\right)^{2}} + \frac{2 \operatorname{a\alpha}{\left(T \right)} \frac{d}{d T} V{\left(T \right)}}{\left(\delta V{\left(T \right)} + \epsilon + V^{2}{\left( T \right)}\right)^{2}}$
- property d2P_dVdT_g¶
Alias of
GCEOS.d2P_dTdV_g
- property d2P_dVdT_l¶
Alias of
GCEOS.d2P_dTdV_l
- property d2P_drho2_g¶
Second derivative of pressure with respect to molar density for the gas phase, [Pa/(mol/m^3)^2].
$\frac{\partial^2 P}{\partial \rho^2} = -V^2\left( -V^2\frac{\partial^2 P}{\partial V^2} - 2V \frac{\partial P}{\partial V} \right)$
- property d2P_drho2_l¶
Second derivative of pressure with respect to molar density for the liquid phase, [Pa/(mol/m^3)^2].
$\frac{\partial^2 P}{\partial \rho^2} = -V^2\left( -V^2\frac{\partial^2 P}{\partial V^2} - 2V \frac{\partial P}{\partial V} \right)$
- property d2S_dep_dT2_g¶
Second temperature derivative of departure entropy with respect to temperature for the gas phase, [(J/mol)/K^3].
$\frac{\partial^2 S_{dep, g}}{\partial T^2} = - \frac{R \left( \frac{d}{d T} V{\left(T \right)} - \frac{V{\left(T \right)}}{T} \right) \frac{d}{d T} V{\left(T \right)}}{V^{2}{\left(T \right)}} + \frac{R \left(\frac{d^{2}}{d T^{2}} V{\left(T \right)} - \frac{2 \frac{d}{d T} V{\left(T \right)}}{T} + \frac{2 V{\left(T \right)}}{T^{2}}\right)}{V{\left(T \right)}} - \frac{R \frac{d^{2}}{d T^{2}} V{\left(T \right)}}{V{\left(T \right)}} + \frac{R \left(\frac{d}{d T} V{\left(T \right)} \right)^{2}}{V^{2}{\left(T \right)}} - \frac{R \frac{d^{2}}{dT^{2}} V{\left(T \right)}}{b - V{\left(T \right)}} - \frac{R \left( \frac{d}{d T} V{\left(T \right)}\right)^{2}}{\left(b - V{\left(T \right)}\right)^{2}} + \frac{R \left(\frac{d}{d T} V{\left(T \right)} - \frac{V{\left(T \right)}}{T}\right)}{T V{\left(T \right)}} + \frac{16 \left(\delta + 2 V{\left(T \right)}\right) \left(\frac{d}{d T} V{\left(T \right)}\right)^{2} \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right)^{2} \left(\frac{\left(\delta + 2 V{\left(T \right)}\right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)^{2}} - \frac{8 \frac{d}{d T} V{\left(T \right)} \frac{d^{2}}{d T^{2}} \operatorname{a\alpha}{\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T \right)} \right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} - \frac{4 \frac{d^{2}}{d T^{2}} V{\left(T \right)} \frac{d}{d T} \operatorname{a\alpha}{\left(T \right)}}{\left(\delta^{2} - 4 \epsilon\right) \left(\frac{\left(\delta + 2 V{\left(T \right)} \right)^{2}}{\delta^{2} - 4 \epsilon} - 1\right)} + \frac{2 \operatorname{atanh}{\left(\frac{\delta + 2 V{\left(T \right)}}{\sqrt{\delta^{2} - 4 \epsilon}} \right)} \frac{d^{3}} {d T^{3}} \operatorname{a\alpha}{\left(T \right)}} {\sqrt{\delta^{2} - 4 \epsilon}}$