activity_coefficients#
- class ActivityCoefficients[source]#
Abstract class for the estimation of activity coefficients. Non-abstract subclasses should implement the following methods:
- __init__(self, chemicals: Iterable[
Chemical
]): Should use pure component data from chemicals to setup future calculations of activity coefficients.
- __call__(self, x: 1d array, T: float):
Should accept an array of liquid molar compositions x, and temperature T (in Kelvin), and return an array of activity coefficients. Note that the molar compositions must be in the same order as the chemicals defined when creating the ActivityCoefficients object.
- property chemicals#
tuple[Chemical] All chemicals involved in the calculation of activity coefficients.
- __init__(self, chemicals: Iterable[
- class IdealActivityCoefficients(chemicals)[source]#
Create an IdealActivityCoefficients object that estimates all activity coefficients to be 1 when called with a composition and a temperature (K).
- Parameters:
chemicals (Iterable[
Chemical
])
- class GroupActivityCoefficients(chemicals)[source]#
Abstract class for the estimation of activity coefficients using group contribution methods.
- Parameters:
chemicals (Iterable[
Chemical
])
- class DortmundActivityCoefficients(chemicals)[source]#
Create a DortmundActivityCoefficients that estimates activity coefficients using the Dortmund UNIFAC group contribution method when called with a composition and a temperature (K).
- Parameters:
chemicals (Iterable[
Chemical
])
Examples
>>> import thermosteam as tmo >>> chemicals = tmo.Chemicals(['Water', 'Ethanol'], cache=True) >>> Gamma = tmo.equilibrium.DortmundActivityCoefficients(chemicals) >>> composition = [0.5, 0.5] >>> T = 350. >>> Gamma(composition, T) array([1.475, 1.242])
>>> chemicals = tmo.Chemicals(['Dodecane', 'Tridecane'], cache=True) >>> Gamma = tmo.equilibrium.DortmundActivityCoefficients(chemicals) >>> # Note how both hydrocarbons have similar lenghts and structure, >>> # so activities should be very close >>> Gamma([0.5, 0.5], 350.) array([1., 1.])
>>> chemicals = tmo.Chemicals(['Water', 'O2'], cache=True) >>> Gamma = tmo.equilibrium.DortmundActivityCoefficients(chemicals) >>> # The following warning is issued because O2 does not have Dortmund groups >>> # RuntimeWarning: O2 has no defined Dortmund groups; >>> # functional group interactions are ignored >>> Gamma([0.5, 0.5], 350.) array([1., 1.])
- class UNIFACActivityCoefficients(chemicals)[source]#
Create a UNIFACActivityCoefficients that estimates activity coefficients using the UNIFAC group contribution method when called with a composition and a temperature (K).
- Parameters:
chemicals (Iterable[
Chemical
])
- class NISTActivityCoefficients(chemicals)[source]#
Create a NISTActivityCoefficients that estimates activity coefficients using the NIST-modified UNIFAC group contribution method when called with a composition and a temperature (K).
- Parameters:
chemicals (Iterable[
Chemical
])
Examples
>>> import thermosteam as tmo >>> Water, Ethanol = chemicals = tmo.Chemicals(['Water', 'Ethanol'], cache=True) >>> Ethanol.NIST.set_group_counts_by_name({'CH3':1, 'CH2':1, 'OH prim':1}) >>> Water.NIST.set_group_counts_by_name({'H2O':1}) >>> Gamma = tmo.equilibrium.NISTActivityCoefficients(chemicals) >>> composition = [0.5, 0.5] >>> T = 350. >>> Gamma(composition, T) array([1.479, 1.238])
- class PRMIXTranslatedConsistActivityCoefficients(chemicals)#
- EOS#
alias of
PRMIXTranslatedConsistent
- class PRMIXTranslatedPActivityCoefficients(chemicals)#
- EOS#
alias of
PRMIXTranslatedPPJP
- class PRMIXTranslaActivityCoefficients(chemicals)#
- EOS#
alias of
PRMIXTranslated
- class SRKMIXTranslatedConsistActivityCoefficients(chemicals)#
- EOS#
alias of
SRKMIXTranslatedConsistent
- class MSRKMIXTranslaActivityCoefficients(chemicals)#
- EOS#
alias of
MSRKMIXTranslated
- class SRKMIXTranslaActivityCoefficients(chemicals)#
- EOS#
alias of
SRKMIXTranslated