Methods in the thermo class
ThermoPack - Latest (beta)
The thermo
class, found in addon/pycThermopack/thermopack/thermo.py
, is the core of the ThermoPack Python interface. All equation of state classes inherit from thermo
. This is the class that contains the interface to all practical calculations that can be done from the python-side of ThermoPack. Derived classes only implement specific functions for parameter handling etc.
Table of contents
- TV-property interfaces
- Tp-property interfaces
- TVp-property interfaces
- Other property interfaces
- Flash interfaces
- Saturation interfaces
- _property_index_from_string
- binary_triple_point_pressure
- bubble_pressure
- bubble_temperature
- dew_pressure
- dew_temperature
- envelope_isentrope_cross
- get_binary_pxy
- get_binary_txy
- get_bp_term
- get_envelope_twophase
- get_pure_fluid_saturation_curve
- global_binary_plot
- melting_pressure_correlation
- saturation_point_from_property_bracket_search
- saturation_points_from_property
- solid_envelope_plot
- sublimation_pressure_correlation
- Isolines
- Stability interfaces
- Virial interfaces
- Joule-Thompson interface
- Utility methods
- acentric_factor
- compmoleweight
- get_comp_name
- get_comp_structure
- get_enthalpy_of_formation
- get_ideal_cp
- get_numerical_robustness_level
- get_phase_flags
- get_phase_type
- get_pmax
- get_pmin
- get_standard_entropy
- get_tmax
- get_tmin
- getcompindex
- moleweight
- redefine_critical_parameters
- set_enthalpy_of_formation
- set_ideal_cp
- set_numerical_robustness_level
- set_pmax
- set_pmin
- set_standard_entropy
- set_tmax
- set_tmin
- Internal methods
TV-property interfaces
Computing properties as a function of temperature and volume. Derivatives returned by methods in this section are computed as functions of (T, V, n).
Table of contents
chemical_potential_tv(self, temp, volume, n, dmudt=None, dmudv=None, dmudn=None, property_flag='IR')
Calculate chemical potential given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dmudt (No type, optional):
Flag to activate calculation. Defaults to None.
dmudv (No type, optional):
Flag to activate calculation. Defaults to None.
dmudn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (integer, optional):
Calculate residual (R) and/or ideal (I) entropy. Defaults to IR.
Returns:
float:
Chemical potential (J/mol)
Optionally chemical potential differentials
enthalpy_tv(self, temp, volume, n, dhdt=None, dhdv=None, dhdn=None, property_flag='IR')
Calculate enthalpy given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dhdt (No type, optional):
Flag to activate calculation. Defaults to None.
dhdv (No type, optional):
Flag to activate calculation. Defaults to None.
dhdn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (integer, optional):
Calculate residual (R) and/or ideal (I) entropy. Defaults to IR.
Returns:
float:
Enthalpy (J)
Optionally enthalpy differentials
entropy_tv(self, temp, volume, n, dsdt=None, dsdv=None, dsdn=None, property_flag='IR')
Calculate entropy given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dsdt (No type, optional):
Flag to activate calculation. Defaults to None.
dsdv (No type, optional):
Flag to activate calculation. Defaults to None.
dsdn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (integer, optional):
Calculate residual (R) and/or ideal (I) entropy. Defaults to IR.
Returns:
float:
Entropy (J/K)
Optionally entropy differentials
fugacity_tv(self, temp, volume, n, dlnphidt=None, dlnphidv=None, dlnphidn=None)
Calculate natural logarithm of fugacity given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dlnphidt (No type, optional):
Flag to activate calculation. Defaults to None.
dlnphidv (No type, optional):
Flag to activate calculation. Defaults to None.
dlnphidn (No type, optional):
Flag to activate calculation. Defaults to None.
Returns:
ndarry:
Natural logarithm of fugacity
Optionally differentials
helmholtz_tv(self, temp, volume, n, dadt=None, dadv=None, dadn=None, property_flag='IR')
Calculate Helmholtz energy given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dadt (No type, optional):
Flag to activate calculation. Defaults to None.
dadv (No type, optional):
Flag to activate calculation. Defaults to None.
dadn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (integer, optional):
Calculate residual (R) and/or ideal (I) entropy. Defaults to IR.
Returns:
float:
Helmholtz energy (J)
Optionally energy differentials
internal_energy_tv(self, temp, volume, n, dedt=None, dedv=None, dedn=None, property_flag='IR')
Calculate internal energy given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dedt (No type, optional):
Flag to activate calculation. Defaults to None.
dedv (No type, optional):
Flag to activate calculation. Defaults to None.
dedn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (str, optional):
Calculate residual (‘R’), ideal (‘I’) or total (‘IR’) internal energy. Defaults to ‘IR’.
Returns:
float:
Energy (J)
Optionally energy differentials
pressure_tv(self, temp, volume, n, dpdt=None, dpdv=None, dpdn=None, property_flag='IR')
Calculate pressure given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dpdt (No type, optional):
Flag to activate calculation. Defaults to None.
dpdv (No type, optional):
Flag to activate calculation. Defaults to None.
dpdn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (str, optional):
Calculate residual (‘R’), ideal (‘I’) or total (‘IR’) pressure. Defaults to ‘IR’.
Returns:
float:
Pressure (Pa)
Optionally pressure differentials
speed_of_sound_tv(self, temp, volume, n)
Calculate speed of sound for single phase fluid
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
Returns:
float:
Speed of sound (m/s)
Tp-property interfaces
Computing properties as a function of temperature and pressure. Derivatives returned by methods in this section are computed as functions of (T, p, n).
Table of contents
enthalpy(self, temp, press, x, phase, dhdt=None, dhdp=None, dhdn=None, residual=False)
Calculate specific single-phase enthalpy Note that the order of the output match the default order of input for the differentials. Note further that dhdt, dhdp and dhdn only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition
phase (int):
Calculate root for specified phase
dhdt (logical, optional):
Calculate enthalpy differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dhdp (logical, optional):
Calculate enthalpy differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
dhdn (logical, optional):
Calculate enthalpy differentials with respect to mol numbers while pressure and temperature are held constant. Defaults to None.
residual (logical, optional):
Calculate residual enthalpy. Defaults to False.
Returns:
float:
Specific enthalpy (J/mol), and optionally differentials
entropy(self, temp, press, x, phase, dsdt=None, dsdp=None, dsdn=None, residual=False)
Calculate specific single-phase entropy Note that the order of the output match the default order of input for the differentials. Note further that dsdt, dhsp and dsdn only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition
phase (int):
Calculate root for specified phase
dsdt (logical, optional):
Calculate entropy differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dsdp (logical, optional):
Calculate entropy differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
dsdn (logical, optional):
Calculate entropy differentials with respect to mol numbers while pressure and temperature are held constant. Defaults to None.
residual (logical, optional):
Calculate residual entropy. Defaults to False.
Returns:
float:
Specific entropy (J/mol/K), and optionally differentials
idealenthalpysingle(self, temp, j, dhdt=None)
Calculate specific ideal enthalpy Note that the order of the output match the default order of input for the differentials. Note further that dhdt only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
j (int):
Component index (FORTRAN)
dhdt (logical, optional):
Calculate ideal enthalpy differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
Returns:
float:
Specific ideal enthalpy (J/mol), and optionally differentials
idealentropysingle(self, temp, press, j, dsdt=None, dsdp=None)
Calculate specific ideal entropy Note that the order of the output match the default order of input for the differentials. Note further that dhdt, and dhdp only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
j (int):
Component index (FORTRAN)
dsdt (logical, optional):
Calculate ideal entropy differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dsdp (logical, optional):
Calculate ideal entropy differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
Returns:
float:
Specific ideal entropy (J/mol/K), and optionally differentials
solid_enthalpy(self, temp, press, x, dhdt=None, dhdp=None)
Calculate specific solid-phase enthalpy Note that the order of the output match the default order of input for the differentials. Note further that dhdt, dhdp only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition
dhdt (logical, optional):
Calculate enthalpy differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dhdp (logical, optional):
Calculate enthalpy differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
Returns:
float:
Specific enthalpy (J/mol), and optionally differentials
solid_entropy(self, temp, press, x, dsdt=None, dsdp=None)
Calculate specific solid-phase entropy Note that the order of the output match the default order of input for the differentials. Note further that dsdt, dsdp only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition
dsdt (logical, optional):
Calculate entropy differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dsdp (logical, optional):
Calculate entropy differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
Returns:
float:
Specific entropy (J/mol.K), and optionally differentials
solid_volume(self, temp, press, x, dvdt=None, dvdp=None)
Calculate specific solid-phase volume Note that the order of the output match the default order of input for the differentials. Note further that dsdt, dsdp only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition
dvdt (logical, optional):
Calculate volume differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dvdp (logical, optional):
Calculate volume differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
Returns:
float:
Specific volume (m3/mol), and optionally differentials
specific_volume(self, temp, press, x, phase, dvdt=None, dvdp=None, dvdn=None)
Calculate single-phase specific volume Note that the order of the output match the default order of input for the differentials. Note further that dvdt, dvdp and dvdn only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition
phase (int):
Calculate root for specified phase
dvdt (logical, optional):
Calculate molar volume differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dvdp (logical, optional):
Calculate molar volume differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
dvdn (logical, optional):
Calculate molar volume differentials with respect to mol numbers while pressure and temperature are held constant. Defaults to None.
Returns:
float:
Specific volume (m3/mol), and optionally differentials
speed_of_sound(self, temp, press, x, y, z, betaV, betaL, phase)
Calculate speed of sound for single phase or two phase mixture assuming mechanical, thermal and chemical equilibrium.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Liquid molar composition
y (array_like):
Gas molar composition
z (array_like):
Overall molar composition
betaV (float):
Molar gas phase fraction
betaL (float):
Molar liquid phase fraction
phase (int):
Calculate root for specified phase
Returns:
float:
Speed of sound (m/s)
thermo(self, temp, press, x, phase, dlnfugdt=None, dlnfugdp=None, dlnfugdn=None, ophase=None, v=None)
Calculate logarithm of fugacity coefficient given composition, temperature and pressure. Note that the order of the output match the default order of input for the differentials. Note further that dlnfugdt, dlnfugdp, dlnfugdn and ophase only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition (.)
phase (int):
Calculate root for specified phase
dlnfugdt (logical, optional):
Calculate fugacity coefficient differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dlnfugdp (logical, optional):
Calculate fugacity coefficient differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
dlnfugdn (logical, optional):
Calculate fugacity coefficient differentials with respect to mol numbers while pressure and temperature are held constant. Defaults to None.
ophase (int, optional):
Phase flag. Only set when phase=MINGIBBSPH.
v (float, optional):
Specific volume (m3/mol)
Returns:
ndarray:
fugacity coefficient (-), and optionally differentials
zfac(self, temp, press, x, phase, dzdt=None, dzdp=None, dzdn=None)
Calculate single-phase compressibility Note that the order of the output match the default order of input for the differentials. Note further that dzdt, dzdp and dzdn only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
x (array_like):
Molar composition
phase (int):
Calculate root for specified phase
dzdt (logical, optional):
Calculate compressibility differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dzdp (logical, optional):
Calculate compressibility differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
dzdn (logical, optional):
Calculate compressibility differentials with respect to mol numbers while pressure and temperature are held constant. Defaults to None.
Returns:
float:
Compressibility (-), and optionally differentials
TVp-property interfaces
Computing properties given Temperature, volume and mole numbers, but evaluate derivatives as functions of (T, p, n). See Advanced Usage => The different property interfaces for further explanation.
Table of contents
enthalpy_tvp(self, temp, volume, n, dhdt=None, dhdp=None, dhdn=None, property_flag='IR')
Calculate enthalpy given temperature, volume and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dhdt (No type, optional):
Flag to activate calculation. Defaults to None.
dhdp (No type, optional):
Flag to activate calculation. Defaults to None.
dhdn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (integer, optional):
Calculate residual (R) and/or ideal (I) entropy. Defaults to IR.
Returns:
float:
Enthalpy (J)
Optionally enthalpy differentials
entropy_tvp(self, temp, volume, n, dsdt=None, dsdp=None, dsdn=None, property_flag='IR')
Calculate entropy given temperature, pressure and mol numbers.
Args:
temp (float):
Temperature (K)
volume (float):
Volume (m3)
n (array_like):
Mol numbers (mol)
dsdt (No type, optional):
Flag to activate calculation. Defaults to None.
dsdp (No type, optional):
Flag to activate calculation. Defaults to None.
dsdn (No type, optional):
Flag to activate calculation. Defaults to None.
property_flag (integer, optional):
Calculate residual (R) and/or ideal (I) entropy. Defaults to IR.
Returns:
float:
Entropy (J/K)
Optionally entropy differentials
thermo_tvp(self, temp, v, n, phase=None, dlnfugdt=None, dlnfugdp=None, dlnfugdn=None)
Calculate logarithm of fugacity coefficient given molar numbers, temperature and pressure. Note that the order of the output match the default order of input for the differentials. Note further that dlnfugdt, dlnfugdp, dlnfugdn and ophase only are flags to enable calculation.
Args:
temp (float):
Temperature (K)
v (float):
Volume (m3)
n (array_like):
Molar numbers (mol)
phase (Any) :
Not in use, may be removed in the future.
dlnfugdt (logical, optional):
Calculate fugacity coefficient differentials with respect to temperature while pressure and composition are held constant. Defaults to None.
dlnfugdp (logical, optional):
Calculate fugacity coefficient differentials with respect to pressure while temperature and composition are held constant. Defaults to None.
dlnfugdn (logical, optional):
Calculate fugacity coefficient differentials with respect to mol numbers while pressure and temperature are held constant. Defaults to None.
Returns:
ndarray:
fugacity coefficient (-), and optionally differentials
Other property interfaces
Property interfaces in other variables than $TV$ or $Tp$, for example computing density given $\mu - T$.
Table of contents
density_lnf_t(self, temp, lnf, rho_initial)
Solve densities (lnf=lnf(T,rho)) given temperature and fugcaity coefficients.
Args:
temp (float):
Temperature (K)
lnf (array_like):
Logaritm of fugacity coefficients.
rho_initial (array_like):
Initial guess for component densities (mol/m3).
Returns:
rho (array_like):
Array of component densities (mol/m3).
density_mu_t(self, temp, mu, rho_initial)
Solve for densities (mu=mu(T,rho)) given temperature and chemical potential.
Args:
temp (float):
Temperature (K)
mu (array_like):
Flag to activate calculation.
rho_initial (array_like):
Initial guess for component densities (mol/m3).
Returns:
rho (array_like):
Array of component densities (mol/m3).
tv_meta_ps(self, pressure, entropy, n, volume_initial, temp_initial)
Solve for temperature and volume given pressure and entropy. A fair initial guess is required. No phase stability is tested, and stable/meta-stable states will be returned depending on input.
Args:
pressure (float):
Pressure (Pa).
entropy (float):
Entropy (J/K).
n (array_like):
Mol numbers (mol)
volume_initial (float):
Initial guess for volume (m3).
temp_initial (float):
Initial guess for temperature (K)
Returns:
float:
Temperature (K)
float:
Volume (m3).
Flash interfaces
Methods for flash calculations.
Table of contents
guess_phase(self, temp, press, z)
If only one root exsist for the equation of state the phase type can be determined from either the psedo-critical volume or a volume ratio to the co-volume
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
Returns:
int:
Phase int (VAPPH or LIQPH)
set_ph_tolerance(self, tol)
Set tolerance of isobaric-isentalpic (PH) flash
Args:
tol (float):
Tolerance
two_phase_phflash(self, press, z, enthalpy, temp=None)
Do isenthalpic-isobaric (HP) flash
Args:
press (float):
Pressure (Pa)
z (array_like):
Overall molar composition
enthalpy (float):
Specific enthalpy (J/mol)
temp (float, optional):
Initial guess for temperature (K)
Returns:
FlashResult :
Struct holding the result of the flash (Temperature, phase fractions,
phase compositions and phase identifier)
two_phase_psflash(self, press, z, entropy, temp=None)
Do isentropic-isobaric (SP) flash
Args:
press (float):
Pressure (Pa)
z (array_like):
Overall molar composition
entropy (float):
Specific entropy (J/mol/K)
temp (float, optional):
Initial guess for temperature (K)
Returns:
FlashResult :
Struct holding the result of the flash (Temperature, phase fractions,
phase compositions and phase identifier)
two_phase_tpflash(self, temp, press, z)
Do isothermal-isobaric (TP) flash
Args:
temp (float):
Temperature (K)
press (float):
Pressure (Pa)
z (array_like):
Overall molar composition
Returns:
FlashResult :
Struct holding the result of the flash (phase fractions, phase compositions and phase identifier)
two_phase_uvflash(self, z, specific_energy, specific_volume, temp=None, press=None)
Do isoenergetic-isochoric (UV) flash
Args:
press (float):
Pressure (Pa)
z (array_like):
Overall molar composition
specific_energy (float):
Specific energy (J/mol)
specific_volume (float):
Specific volume (m3/mol)
temp (float, optional):
Initial guess for temperature (K)
press (float, optional):
Initial guess for pressure (Pa)
Returns:
FlashResult :
Struct holding the result of the flash (Temperature, pressure, phase fractions,
phase compositions and phase identifier)
Saturation interfaces
Bubble- and dew point calculations and phase envelopes.
Table of contents
- Saturation interfaces
- _property_index_from_string
- binary_triple_point_pressure
- bubble_pressure
- bubble_temperature
- dew_pressure
- dew_temperature
- envelope_isentrope_cross
- get_binary_pxy
- get_binary_txy
- get_bp_term
- get_envelope_twophase
- get_pure_fluid_saturation_curve
- global_binary_plot
- melting_pressure_correlation
- saturation_point_from_property_bracket_search
- saturation_points_from_property
- solid_envelope_plot
- sublimation_pressure_correlation
_property_index_from_string(self, prop: str)
Get integer index corresponding to property string
Args:
prop (str):
Property (Entropy, Enthalpy, Volume, Pressure, Temperature, Joule-Thompson)
Raises:
Exception:
Wrong property specified
Returns:
Index of property
binary_triple_point_pressure(self, temp, maximum_pressure=15000000.0, minimum_pressure=10000.0)
Calculate triple point for binary mixture at specified temperature
Args:
temp (float):
Temperature (K)
maximum_pressure (float, optional):
Exit on maximum pressure (Pa). Defaults to 1.5e7.
minimum_pressure (float, optional):
Exit on minimum pressure (Pa). Defaults to 1.0e4.
Returns:
has_triple_point (boolean):
Does the mixture have a triple point?
x (np.ndarray):
Liquid 1 composition
y (np.ndarray):
Gas composition
w (np.ndarray):
Liquid 2 composition
P (float):
Pressure (Pa)
bubble_pressure(self, temp, z)
Calculate bubble pressure given temperature and composition
Args:
temp (float):
Temperature (K)
z (array_like):
Composition (-)
Raises:
Exception:
Faild to calculate
Returns:
float:
Pressure (Pa)
ndarray:
Incipient phase composition
bubble_temperature(self, press, z)
Calculate bubble temperature given pressure and composition
Args:
press (float):
Pressure (Pa)
z (array_like):
Composition (-)
Raises:
Exception:
Faild to calculate
Returns:
float:
Temperature (K)
ndarray:
Incipient phase composition
dew_pressure(self, temp, z)
Calculate dew pressure given temperature and composition
Args:
temp (float):
Temperature (K)
z (float):
Composition (-)
Raises:
Exception:
Not able to solve for dew point
Returns:
float :
Pressure (Pa)
ndarray :
Incipient phase composition (-)
dew_temperature(self, press, z)
Calculate dew temperature given pressure and composition
Args:
press (float):
Pressure (Pa)
z (float):
Composition (-)
Raises:
Exception:
Not able to solve for dew point
Returns:
float :
Temperature (K)
ndarray :
Incipient phase composition (-)
envelope_isentrope_cross(self, entropy, initial_pressure, z, maximum_pressure=15000000.0, minimum_temperature=None, step_size=None, initial_temperature=None)
Get saturated phase having given entropy. Searches the binodal by tracing it upwards in pressure from the dew point at initial_pressure. Args: entropy (float): Entropy (J/mol/K). initial_pressure (float): Start search from dew point at initial pressure (Pa). z (array_like): Composition (-) maximum_pressure (float , optional): Stop envelope tracking at maximum pressure (Pa). Defaults to 1.5e7. minimum_temperature (float , optional): Exit envelope tracking minimumtemperature (K). Defaults to None. step_size (float , optional): Set maximum step size for envelope trace. Defaults to None. minimum_temperature (float, optional): Not in use initial_temperature (float, optional): Start search from dew point at initial temperature. Overrides initial pressure. Defaults to None (K). Returns: float: Temperature values (K) foat: Pressure values (Pa) float: Specific volume (m3/mol) int: Phase flag for main phase ndarray: Incipient composition (mol/mol)
get_binary_pxy(self, temp, maximum_pressure=15000000.0, minimum_pressure=1.0, maximum_dz=0.003, maximum_dlns=0.01)
Calculate binary three phase envelope
Args:
temp (float):
Temperature (K)
maximum_pressure (float, optional):
Exit on maximum pressure (Pa). Defaults to 1.5e7.
minimum_pressure (float, optional):
Exit on minimum pressure (Pa). Defaults to 1.0.
maximum_dz (float, optional):
Maximum composition step. Defaults to 0.003.
maximum_dlns (float, optional):
Maximum step in most sensitive envelope variable (the specification variable), see doc/memo/binaryxy
for details on usage. Defaults to 0.01.
Returns:
(XYDiagram) :
Structure with the attributes
lle :
Liquid 1 - Liquid 2 Equilibrium (PxyEquilibrium) with the attributes
x1 -> Liquid 1 composition (mole fraction of component 1)
x2 -> Liquid 2 composition (mole fraction of component 1)
p -> Pressure [Pa]
l1ve :
Liquid 1 - Vapour Equilibrium (PxyEquilibrium) with the attributes
x -> Bubble line composition (mole fraction of component 1)
y -> Dew line composition (mole fraction of component 1)
p -> Pressure [Pa]
l2ve :
Liquid 2 - Vapour Equilibrium (PxyEquilibrium) with the attributes
x -> Bubble line composition (mole fraction of component 1)
y -> Dew line composition (mole fraction of component 1)
p -> Pressure [Pa]
If one or more of the equilibria are not found the corresponding arrays are empty
get_binary_txy(self, pressure, minimum_temperature=0.0, maximum_dz=0.003, maximum_dlns=0.005)
Calculate binary isobaric three phase envelope
Args:
pressure (float):
Pressure (Pa)
minimum_temperature (float, optional):
Exit on minimum temperature (K).
maximum_dz (float, optional):
Maximum composition step. Defaults to 0.003.
maximum_dlns (float, optional):
Maximum step in most sensitive envelope variable (the specification variable), see doc/memo/binaryxy
for details on usage. Defaults to 0.01.
Returns:
(XYDiagram) :
Structure with the attributes
lle :
Liquid 1 - Liquid 2 Equilibrium (TxyEquilibrium) with the attributes
x1 -> Liquid 1 composition (mole fraction of component 1)
x2 -> Liquid 2 composition (mole fraction of component 1)
T -> Temperature [K]
l1ve :
Liquid 1 - Vapour Equilibrium (TxyEquilibrium) with the attributes
x -> Bubble line composition (mole fraction of component 1)
y -> Dew line composition (mole fraction of component 1)
T -> Temperature [K]
l2ve :
Liquid 2 - Vapour Equilibrium (TxyEquilibrium) with the attributes
x -> Bubble line composition (mole fraction of component 1)
y -> Dew line composition (mole fraction of component 1)
T -> Temperature [K]
If one or more of the equilibria are not found the corresponding arrays are empty
get_bp_term(self, i_term)
Get error description for binary plot error
Args:
i_term (int):
binary plot error identifier
Returns:
str:
Error message
get_envelope_twophase(self, initial_pressure, z, maximum_pressure=15000000.0, minimum_temperature=None, step_size_factor=1.0, step_size=None, calc_v=False, initial_temperature=None, calc_criconden=False)
Get the phase-envelope at a given composition
Args:
initial_pressure (float):
Start mapping form dew point at initial pressure (Pa).
z (array_like):
Composition (-)
maximum_pressure (float , optional):
Exit on maximum pressure (Pa). Defaults to 1.5e7.
minimum_temperature (float , optional):
Exit on minimum temperature (K). Defaults to None.
step_size_factor (float , optional):
Scale default step size for envelope trace. Defaults to 1.0. Reducing step_size_factor will give a denser grid.
step_size (float , optional):
Set maximum step size for envelope trace. Overrides step_size_factor. Defaults to None.
calc_v (bool, optional):
Calculate specific volume of saturated phase? Defaults to False
initial_temperature (float, optional):
Start mapping form dew point at initial temperature.
Overrides initial pressure. Defaults to None (K).
calc_criconden (bool, optional):
Calculate cricondenbar and cricondentherm?
Returns:
ndarray:
Temperature values (K)
ndarray:
Pressure values (Pa)
ndarray (optional, if calc_v=True
):
Specific volume (m3/mol)
ndarray (optional, if calc_criconden=True
):
Cricondenbar followed by cricondentherm (T (K), P (Pa), T (K), P (Pa))
get_pure_fluid_saturation_curve(self, initial_pressure, initial_temperature=None, i=None, max_delta_press=20000.0, nmax=100, log_linear_grid=False)
Get the pure fluid saturation line
To start mapping from and initial temperature, use:
get_pure_fluid_saturation_curve(None, initial_temperature=
Args:
initial_pressure (float):
Start mapping form dew point at initial pressure (Pa).
initial_temperature (float, optional):
Start mapping form dew point at initial temperature (K). Default None.
i (int, optional):
FORTRAN component index. Default None. Must be given if self.nc > 1.
max_delta_press (float , optional):
Maximum delta pressure between points (Pa). Defaults to 0.2e5.
nmax (int, optional):
Maximum number of points on envelope. Defaults to 100.
log_linear_grid (logical, optional):
Use log-linear grid?. Defaults to False.
Returns:
ndarray:
Temperature values (K)
ndarray:
Pressure values (Pa)
ndarray:
Specific liquid volume (m3/mol)
ndarray:
Specific gas volume (m3/mol)
global_binary_plot(self, maximum_pressure=15000000.0, minimum_pressure=100000.0, minimum_temperature=150.0, maximum_temperature=500.0, include_azeotropes=False)
Calculate global binary phase envelope
Args:
maximum_pressure (float, optional):
Exit on maximum pressure (Pa). Defaults to 1.5e7.
minimum_pressure (float, optional):
Exit on minimum pressure (Pa). Defaults to 1.0e5.
minimum_temperature (float, optional):
Terminate phase line traceing at minimum temperature. Defaults to 150.0 K.
maximum_temperature (float, optional):
Terminate phase line traceing at maximum temperature. Defaults to 500.0 K.
include_azeotropes (bool, optional):
Include azeotropic lines. Defaults to False.
Returns:
tuple of arrays
melting_pressure_correlation(self, i, maximum_temperature=None, nmax=100, scale_to_eos=True)
Calculate melting line form correlation
Args:
i (int):
component FORTRAN index (first index is 1)
maximum_temperature (float, optional):
Get values up to maximum_temperature. Defaults to correlation limit.
nmax (int):
Number of points in equidistant grid. Defaults to 100.
scale_to_eos (bool, optional):
Scale pressures to match triple point pressure? Defaults to True
Returns:
T_melt (ndarray):
Melting temperature (K)
p_melt (ndarray):
Melting pressure (Pa)
saturation_point_from_property_bracket_search(self, z, prop_val, prop, temp_1, press_1, x_1, y_1, temp_2, press_2, x_2, y_2)
Get saturated point intersecting with property given as input. Point 1 and 2 are saturation states bracketing the solution.
Args:
z (array_like):
Composition (-)
prop_val (float):
Property value where intersect is needed
prop (str):
Property (Entropy, Enthalpy, Volume, Pressure, Temperature, Joule-Thompson)
temp_1 (float):
Temperature of point 1 (K).
press_1 (float):
Pressure of point 1 (Pa).
x_1 (float):
Liquid compozition of point 1 (mol/mol).
y_1 (float):
Vapour compozition of point 1 (mol/mol).
temp_2 (float):
Temperature of point 2 (K).
press_2 (float):
Pressure of point 2 (Pa).
x_2 (float):
Liquid compozition of point 2 (mol/mol).
y_2 (float):
Vapour compozition of point 2 (mol/mol).
Raises:
Exception:
Not able to solve for property
Returns:
float:
Temperature values (K)
float:
Pressure values (Pa)
ndarray:
Liquid composition (mol/mol)
ndarray:
Vapour composition (mol/mol)
saturation_points_from_property(self, initial_pressure, z, prop_grid, prop, maximum_pressure=15000000.0, minimum_temperature=None, step_size=None)
Get saturated points intersecting with properties given as input. Args: initial_pressure (float): Start search from dew point at initial pressure (Pa). z (array_like): Composition (-) prop_grid (array like): Property values where intersect is needed prop (str): Property (Entropy, Enthalpy, Volume, Pressure, Temperature, Joule-Thompson) maximum_pressure (float , optional): Stop envelope tracking at maximum pressure (Pa). Defaults to 1.5e7. minimum_temperature (float , optional): Exit envelope tracking minimumtemperature (K). Defaults to None. step_size (float , optional): Set maximum step size for envelope trace. Defaults to None.
Returns:
float:
Temperature values (K)
foat:
Pressure values (Pa)
float:
Specific volume (m3/mol)
int:
Phase flag for main phase
ndarray:
Incipient composition (mol/mol)
solid_envelope_plot(self, initial_pressure, z, maximum_pressure=15000000.0, minimum_temperature=170.0, calc_esv=False)
Calculate phase envelope including solid lines
Args:
initial_pressure (float):
Start mapping from initial pressure (Pa).
z (array_like):
Composition (-)
maximum_pressure (float , optional):
Exit on maximum pressure (Pa). Defaults to 1.5e7.
calc_esv (bool, optional):
Calculate specific volume of saturated phase? Defaults to False
Returns:
tuple of arrays
sublimation_pressure_correlation(self, i, minimum_temperature=None, nmax=100, scale_to_eos=True)
Calculate melting line form correlation
Args:
i (int):
component FORTRAN index (first index is 1)
minimum_temperature (float, optional):
Get values from minimum_temperature. Defaults to correlation limit.
nmax (int):
Number of points in equidistant grid. Defaults to 100.
scale_to_eos (bool, optional):
Scale pressures to match triple point pressure? Defaults to True
Returns:
T_subl (ndarray):
Sublimation temperature (K)
p_subl (ndarray):
Sublimation pressure (Pa)
Isolines
Computing isolines.
Table of contents
get_isenthalp(self, enthalpy, z, minimum_pressure=100000.0, maximum_pressure=15000000.0, minimum_temperature=200.0, maximum_temperature=500.0, nmax=100)
Get isenthalpic line at specified enthalpy. Use as T, p, v, s = get_isenthalp(h, z)
, where (T, p, v, s)
is the temperature, pressure, specific volume and specific entropy along the isenthalp with specific enthalpy h
and molar composition z
.
Args:
enthalpy (float):
Enthalpy (J/mol)
z (array_like):
Composition (-)
minimum_pressure (float, optional):
Minimum pressure. Defaults to 1.0e5. (Pa)
maximum_pressure (float, optional):
Maximum pressure. Defaults to 1.5e7. (Pa)
minimum_temperature (float, optional):
Minimum temperature. Defaults to 200.0. (K)
maximum_temperature (float, optional):
Maximum temperature. Defaults to 500.0. (K)
nmax (int, optional):
Maximum number of points on isenthalp. Defaults to 100.
Returns:
(tuple of arrays) :
Corresponding to (temperature, pressure, specific volume, specific entropy) along the
isenthalp.
get_isentrope(self, entropy, z, minimum_pressure=100000.0, maximum_pressure=15000000.0, minimum_temperature=200.0, maximum_temperature=500.0, nmax=100)
Get isentrope at specified entropy. Use as T, p, v, h = get_isenthalp(s, z)
, where (T, p, v, h)
is the temperature, pressure, specific volume and specific enthalpy along the isentrope with specific entropy s
and molar composition z
.
Args:
entropy (float):
Entropy (J/mol/K)
z (array_like):
Composition (-)
minimum_pressure (float, optional):
Minimum pressure. Defaults to 1.0e5. (Pa)
maximum_pressure (float, optional):
Maximum pressure. Defaults to 1.5e7. (Pa)
minimum_temperature (float, optional):
Minimum temperature. Defaults to 200.0. (K)
maximum_temperature (float, optional):
Maximum temperature. Defaults to 500.0. (K)
nmax (int, optional):
Maximum number of points on isentrope. Defaults to 100.
Returns:
(tuple of arrays) :
Corresponding to (temperature, pressure, specific volume, specific enthalpy) along the
isentrope.
get_isobar(self, press, z, minimum_temperature=200.0, maximum_temperature=500.0, nmax=100)
Get isobar at specified pressure. Use as T, v, s, h = get_isobar(p, z)
, where (T, v, s, h)
is the temperature, specific volume, specific entropy and specific enthalpy along the isobar with pressure p
and molar composition z
.
Args:
press (float):
Pressure (Pa)
z (array_like):
Composition (-)
minimum_temperature (float, optional):
Minimum temperature. Defaults to 200.0. (K)
maximum_temperature (float, optional):
Maximum temperature. Defaults to 500.0. (K)
nmax (int, optional):
Maximum number of points on iso-bar. Defaults to 100.
Returns:
(tuple of arrays) :
Corresponding to (temperature, specific volume, specific entropy, specific enthalpy)
along the isobar.
get_isotherm(self, temp, z, minimum_pressure=100000.0, maximum_pressure=15000000.0, nmax=100)
Get iso-therm at specified temperature
Args:
temp (float):
Temperature (K)
z (array_like):
Composition (-)
minimum_pressure (float, optional):
Map to minimum pressure. Defaults to 1.0e5. (Pa)
maximum_pressure (float, optional):
Map to maximum pressure. Defaults to 1.5e7. (Pa)
nmax (int, optional):
Maximum number of points on iso-therm. Defaults to 100.
Returns:
Multiple numpy arrays.
map_meta_isentrope(self, z, initial_pressure, entropy, minimum_pressure, n_max=50)
Trace isentrope into meta-stable region. Trace from pressure to minimum_pressure
Args:
z (array_like):
Composition (-)
initial_pressure (float):
Initial pressure (Pa)
entropy (float):
Entropy (J/mol/K).
minimum_pressure (float):
Minimum pressure (Pa).
n_max (int):
Number of points on curve. Default 50.
Raises:
Exception:
Failure to map isentrope
Returns:
np.ndarray:
Temperature (K)
np.ndarray:
Volume (m3/mol)
np.ndarray:
Pressure (Pa)
map_meta_isotherm(self, temperature, z, phase, n=50)
Trace isotherm from saturation line to spinodal. Solve for phase in chemical and thermal equilibrium with a phase defined by z anf phase flag..
Args:
temperature (float):
Temperature (K)
z (array_like):
Composition (-)
phase (float):
Phase with composition z (LIQPH or VAPPH)
n (int):
Number of points on curve. Default 50.
Raises:
Exception:
Failure to map isotherm
Returns:
np.ndarray:
Volume of meta-stable phase (m3/mol)
np.ndarray:
Density (mol/m3) of equilibrium phase in each point, dimension (n,nc).
Stability interfaces
Critical point solver.
Table of contents
critical(self, n, temp=0.0, v=0.0, tol=1e-07, v_min=None)
Calculate critical point in variables T and V
Args:
n (array_like):
Mol numbers (mol)
temp (float, optional):
Initial guess for temperature (K). Defaults to 0.0.
v (float, optional):
Initial guess for volume (m3/mol). Defaults to 0.0.
tol (float, optional):
Error tolerance (-). Defaults to 1.0e-8.
v_min (float, optional):
Minimum volume for search (m3/mol). Defaults to None.
Raises:
Exception:
Failure to solve for critical point
Returns:
float:
Temperature (K)
float:
Volume (m3/mol)
float:
Pressure (Pa)
critical_pressure(self, i)
Get critical pressure of component i
Args:
i (int):
component FORTRAN index (first index is 1)
returns:
float:
critical pressure (Pa)
critical_temperature(self, i)
Get critical temperature of component i
Args:
i (int):
component FORTRAN index (first index is 1)
returns:
float:
critical temperature (K)
critical_volume(self, i)
Get specific critical volume of component i Args: i (int) component FORTRAN index returns: float: specific critical volume
density_lnf_t(self, temp, lnf, rho_initial)
Solve densities (lnf=lnf(T,rho)) given temperature and fugcaity coefficients.
Args:
temp (float):
Temperature (K)
lnf (array_like):
Logaritm of fugacity coefficients.
rho_initial (array_like):
Initial guess for component densities (mol/m3).
Returns:
rho (array_like):
Array of component densities (mol/m3).
density_mu_t(self, temp, mu, rho_initial)
Solve for densities (mu=mu(T,rho)) given temperature and chemical potential.
Args:
temp (float):
Temperature (K)
mu (array_like):
Flag to activate calculation.
rho_initial (array_like):
Initial guess for component densities (mol/m3).
Returns:
rho (array_like):
Array of component densities (mol/m3).
get_critical_parameters(self, i)
Get critical temperature, volume and pressure of component i
Args:
i (int):
component FORTRAN index (first index is 1)
returns:
float:
critical temperature (K)
float:
critical volume (m3/mol)
float:
critical pressure (Pa)
map_meta_isentrope(self, z, initial_pressure, entropy, minimum_pressure, n_max=50)
Trace isentrope into meta-stable region. Trace from pressure to minimum_pressure
Args:
z (array_like):
Composition (-)
initial_pressure (float):
Initial pressure (Pa)
entropy (float):
Entropy (J/mol/K).
minimum_pressure (float):
Minimum pressure (Pa).
n_max (int):
Number of points on curve. Default 50.
Raises:
Exception:
Failure to map isentrope
Returns:
np.ndarray:
Temperature (K)
np.ndarray:
Volume (m3/mol)
np.ndarray:
Pressure (Pa)
map_meta_isotherm(self, temperature, z, phase, n=50)
Trace isotherm from saturation line to spinodal. Solve for phase in chemical and thermal equilibrium with a phase defined by z anf phase flag..
Args:
temperature (float):
Temperature (K)
z (array_like):
Composition (-)
phase (float):
Phase with composition z (LIQPH or VAPPH)
n (int):
Number of points on curve. Default 50.
Raises:
Exception:
Failure to map isotherm
Returns:
np.ndarray:
Volume of meta-stable phase (m3/mol)
np.ndarray:
Density (mol/m3) of equilibrium phase in each point, dimension (n,nc).
spinodal(self, z, initial_pressure=100000.0, initial_liquid_temperature=None, dlnv=None, min_temperature_vapor=None)
Trace spinodal curve
Args:
z (array_like):
Composition (-)
initial_pressure (float):
Initial pressure (Pa). Defaults to 1.0e5.
initial_liquid_temperature (float, optional):
Initial temperature on liquid spinodal (K).
dlnv (float, optional):
Override step size (-).
min_vapor_temperature (float, optional):
Minimum temperature on vapor spinodal (K).
Raises:
Exception:
Failure to trace spinodal
Returns:
np.ndarray:
Temperature (K)
np.ndarray:
Volume (m3/mol)
np.ndarray:
Pressure (Pa)
spinodal_point(self, z, pressure, phase, temperature=None)
Solve for spinodal curve point. Not able to solve for points close to critical point. Solve for temperature if given, otherwise solve for pressure.
Args:
z (array_like):
Composition (-)
pressure (float):
Pressure (Pa)
phase (int):
Phase flag (VAPPH/LIQPH)
temperature (float, optional):
Temperature (K). Solve for temperature if given.
Raises:
Exception:
Failure to solve for spinodal curve point
Returns:
float:
Temperature (K)
float:
Volume (m3/mol)
tv_meta_ps(self, pressure, entropy, n, volume_initial, temp_initial)
Solve for temperature and volume given pressure and entropy. A fair initial guess is required. No phase stability is tested, and stable/meta-stable states will be returned depending on input.
Args:
pressure (float):
Pressure (Pa).
entropy (float):
Entropy (J/K).
n (array_like):
Mol numbers (mol)
volume_initial (float):
Initial guess for volume (m3).
temp_initial (float):
Initial guess for temperature (K)
Returns:
float:
Temperature (K)
float:
Volume (m3).
Virial interfaces
Retrieve various virial coefficients.
Table of contents
binary_third_virial_matrix(self, temp)
Calculate composition-independent virial coefficients C, defined as P = RTrho + Brho2 + C*rho3 + O(rho**4) as rho->0. Including cross coefficients Currently the code only support binary mixtures
Args:
temp (float):
Temperature (K)
Returns:
ndarray:
C - Third virial coefficient matrix (m6/mol2)
second_virial_matrix(self, temp)
Calculate composition-independent virial coefficients B, defined as P = RTrho + Brho2 + C*rho3 + O(rho**4) as rho->0. Including cross coefficients.
Args:
temp (float):
Temperature (K)
Returns:
ndarray:
B - Second virial coefficient matrix (m3/mol)
virial_coeffcients(self, temp, n)
Calculate (composition-dependent) virial coefficients B and C, defined as P/RT = rho + B*rho2 + C*rho3 + O(rho**4) as rho->0.
Args:
temp (float):
Temperature
n (array_like):
Mol numbers (mol)
Returns:
float:
B (m3/mol)
float:
C (m6/mol2)
Joule-Thompson interface
Joule-Thompson inversion curves.
Table of contents
joule_thompson_inversion(self, z, nmax=1000)
Calculate Joule-Thompson inversion curve
Args:
z (array like):
Compozition
nmax (int):
Array size
Returns:
ndarray:
temp - Temperature (K)
ndarray:
press - Pressure (Pa)
ndarray:
vol - Volume (m3/mol)
Utility methods
Methods for setting … and getting …
Table of contents
- Utility methods
- acentric_factor
- compmoleweight
- get_comp_name
- get_comp_structure
- get_enthalpy_of_formation
- get_ideal_cp
- get_numerical_robustness_level
- get_phase_flags
- get_phase_type
- get_pmax
- get_pmin
- get_standard_entropy
- get_tmax
- get_tmin
- getcompindex
- moleweight
- redefine_critical_parameters
- set_enthalpy_of_formation
- set_ideal_cp
- set_numerical_robustness_level
- set_pmax
- set_pmin
- set_standard_entropy
- set_tmax
- set_tmin
acentric_factor(self, i)
Get acentric factor of component i Args: i (int) component FORTRAN index returns: float: acentric factor
compmoleweight(self, comp, si_units=False)
Get component mole weight (g/mol)
Args:
comp (int):
Component FORTRAN index
si_units (bool, optional) :
true for output in kg/mol, false for g/mol
Returns:
float:
Component mole weight (g/mol)
get_comp_name(self, index, get_comp_identifier=False)
Get component name/identifier
Args:
index (int):
Component FORTRAN index
get_comp_identifier (bool):
Get component identifier instead of full name? Default False.
Returns:
comp (str):
Component name/identifier
get_comp_structure(self, comp_name)
Get component atom structure
Args:
comp_name (str):
Component name
Returns:
(dict):
Dict with atom as key names and number of atoms as values
get_enthalpy_of_formation(self, j)
Get specific enthalpy of formation
Args:
j (integer):
Component index
Returns:
float:
Specific enthalpy of formation (J/mol)
get_ideal_cp(self, j)
Get correlation parameters for ideal gas Cp
Args:
j (integer):
Component index
Returns:
integer:
Ideal Cp correlation identifier
ndarray:
Parameters
get_numerical_robustness_level(self)
Get numerical robustness level in Thermopack, where 0 is the default and higher levels increase robustness.
Returns:
level (integer):
robustness_level
get_phase_flags(self)
Get phase identifiers used by thermopack
Returns:
int:
Phase int identifiers
get_phase_type(self, i_phase)
Get phase type
Args:
i_phase (int):
Phase flag returned by thermopack
Returns:
str:
Phase type
get_pmax(self)
Get minimum pressure in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 100 MPa.
Args:
press (float):
Pressure (Pa)
get_pmin(self)
Get minimum pressure in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 10 Pa.
Args:
press (float):
Pressure (Pa)
get_standard_entropy(self, j)
Get standard entropy at 1bar
Args:
j (integer):
Component index
Returns:
float:
Specific standard entropy (J/mol/K)
get_tmax(self)
Get maximum temperature in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 999 K.
Returns:
float:
Temperature (K)
get_tmin(self)
Get minimum temperature in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 80 K.
Returns:
float:
Temperature (K)
getcompindex(self, comp)
Get component index
Args:
comp (str):
Component name
Returns:
int:
Component FORTRAN index
moleweight(self, z, si_units=True)
Get mole weight (kg/mol)
Args:
z (array_like):
Molar composition
si_units (bool, optional) :
true for output in kg/mol, false for g/mol
Returns:
float:
mixture mole weight (kg/mol)
redefine_critical_parameters(self, silent=True, Tc_initials=None, vc_initials=None)
Recalculate critical properties of pure fluids
Args:
silent (bool):
Ignore warnings? Defaults to True
Tc_initials (array_like):
Initial value for pure fluid critical temperatures (K). Negative values will trigger use of SRK values from data base.
vc_initials (array_like):
Initial value for pure fluid critical volumes (m3/mol). Negative values will trigger use of SRK values from data base.
set_enthalpy_of_formation(self, j, h0)
Set specific enthalpy of formation
Args:
j (int):
Component index
h0 (float):
Enthalpy of formation (J/mol)
set_ideal_cp(self, j, cp_correlation_type, parameters)
Set correlation parameters for ideal gas Cp To set a constant Cp value of 2.5*Rgas, simply use: set_ideal_cp(j, 8, [2.5])
Args:
j (int):
Component index
cp_correlation_type (int):
Ideal Cp correlation identifier
parameters (array like):
Parameters (Maximum 21 parameters used)
set_numerical_robustness_level(self, level)
Set numerical robustness level in Thermopack, where 0 is the default and higher levels increase robustness.
Args:
level (integer):
robustness_level
set_pmax(self, press)
Set minimum pressure in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 100 MPa.
Args:
press (float):
Pressure (Pa)
set_pmin(self, press)
Set minimum pressure in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 10 Pa.
Args:
press (float):
Pressure (Pa)
set_standard_entropy(self, j, s0, reference_pressure='1BAR')
Set standard entropy
Args:
j (int):
Component index
s0 (float):
Ideal entropy reference (J/mol/K)
reference_pressure (str):
Reference pressure (1BAR or 1ATM)
set_tmax(self, temp)
Set maximum temperature in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 999 K.
Args:
temp (float):
Temperature (K)
set_tmin(self, temp)
Set minimum temperature in Thermopack. Used to limit search domain for numerical solvers. Default value set on init is 80 K.
Args:
temp (float):
Temperature (K)
Internal methods
Methods for handling communication with the Fortran library.
Table of contents
__del__(self)
Delete FORTRAN memory allocated for this instance
__init__(self)
Initialize function pointers
__new__(cls, *args, **kwargs)
Get platform specifics and Load libthermopack.(so/dll/dylib)
_get_true_int_value(self)
Intel FORTRAN uses True=-1, while gfortran uses True=1 Returns: int: Integer representing True of the logical value
activate(self)
Activate this instance of thermopack parameters for calculation
add_eos(self)
Allocate FORTRAN memory for this class instance
delete_eos(self)
de-allocate FORTRAN memory for this class instance
disable_volume_translation(self)
Disable volume translations
get_export_name(self, module, method)
Generate library export name based on module and method name
Args:
module (str):
Name of module
method (str):
Name of method
Returns:
str:
Library export name
get_model_id(self)
Get model identification
Returns:
str:
Eos name
init_peneloux_volume_translation(self, parameter_reference='Default')
Initialize Peneloux volume translations
Args:
parameter_reference (str):
String defining parameter set, Defaults to “Default”
init_solid(self, scomp)
Initialize pure solid
Args:
scomp (str):
Component name
init_thermo(self, eos, mixing, alpha, comps, nphases, liq_vap_discr_method=None, csp_eos=None, csp_ref_comp=None, kij_ref='Default', alpha_ref='Default', saft_ref='Default', b_exponent=None, TrendEosForCp=None, cptype=None, silent=None)
Initialize thermopack
Args:
eos (str):
Equation of state
mixing (str):
Mixture model for cubic eos
alpha (str):
Alpha formulations for cubic EOS
comps (string):
Comma separated list of components
nphases (int):
Maximum number of phases considered during multi-phase flash calculations
liq_vap_discr_method (int, optional):
Method to discriminate between liquid and vapor in case of an undefined single phase. Defaults to None.
csp_eos (str, optional):
Corresponding state equation. Defaults to None.
csp_ref_comp (str, optional):
CSP reference component. Defaults to None.
kij_ref (str, optional):
Data set identifiers. Defaults to “Default”.
alpha_ref (str, optional):
Data set identifiers. Defaults to “Default”.
saft_ref (str, optional):
Data set identifiers. Defaults to “Default”.
b_exponent (float, optional):
Exponent used in co-volume mixing. Defaults to None.
TrendEosForCp (str, optional):
Option to init trend for ideal gas properties. Defaults to None.
cptype (int array, optional):
Equation type number for Cp. Defaults to None.
silent (bool, optional):
Suppress messages during init?. Defaults to None.