activity_coefficients
- class thermosteam.equilibrium.activity_coefficients.ActivityCoefficients[source]
Abstract class for the estimation of activity coefficients. Non-abstract subclasses should implement the following methods:
- __init__(self, chemicals: Iterable[Chemicals]):
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.
- class thermosteam.equilibrium.activity_coefficients.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 thermosteam.equilibrium.activity_coefficients.GroupActivityCoefficients(chemicals)[source]
Abstract class for the estimation of activity coefficients using group contribution methods.
- Parameters
chemicals (Iterable[Chemical]) –
- class thermosteam.equilibrium.activity_coefficients.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 thermosteam.equilibrium.activity_coefficients.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]) –