How to use the thermo.utils.mixing_simple function in thermo

To help you get started, we’ve selected a few thermo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CalebBell / thermo / thermo / viscosity.py View on Github external
Pressure at which to calculate the property, [Pa]
        zs : list[float]
            Mole fractions of all species in the mixture, [-]
        ws : list[float]
            Weight fractions of all species in the mixture, [-]
        method : str
            Name of the method to use

        Returns
        -------
        mu : float
            Viscosity of gas mixture, [Pa*s]
        '''
        if method == SIMPLE:
            mus = [i(T, P) for i in self.ViscosityGases]
            return mixing_simple(zs, mus)
        elif method == HERNING_ZIPPERER:
            mus = [i(T, P) for i in self.ViscosityGases]
            return Herning_Zipperer(zs, mus, self.MWs)
        elif method == WILKE:
            mus = [i(T, P) for i in self.ViscosityGases]
            return Wilke(zs, mus, self.MWs)
        elif method == BROKAW:
            mus = [i(T, P) for i in self.ViscosityGases]
            return Brokaw(T, zs, mus, self.MWs, self.molecular_diameters, self.Stockmayers)
        else:
            raise Exception('Method not valid')
github CalebBell / thermo / thermo / volume.py View on Github external
References
    ----------
    .. [1] Hankinson, Risdon W., and George H. Thomson. "A New Correlation for
       Saturated Densities of Liquids and Their Mixtures." AIChE Journal
       25, no. 4 (1979): 653-663. doi:10.1002/aic.690250412
    '''
    cmps = range(len(xs))
    if not none_and_length_check([xs, Tcs, Vcs, omegas]):
        raise Exception('Function inputs are incorrect format')
    sum1 = sum([xi*Vci for xi, Vci in zip(xs, Vcs)])
    sum2 = sum([xi*Vci**(2/3.) for xi, Vci in zip(xs, Vcs)])
    sum3 = sum([xi*Vci**(1/3.) for xi, Vci in zip(xs, Vcs)])
    Vm = 0.25*(sum1 + 3.*sum2*sum3)
    VijTcij = [[(Tcs[i]*Tcs[j]*Vcs[i]*Vcs[j])**0.5 for j in cmps] for i in cmps]
    omega = mixing_simple(xs, omegas)
    Tcm = sum([xs[i]*xs[j]*VijTcij[i][j]/Vm for j in cmps for i in cmps])
    return COSTALD(T, Tcm, Vm, omega)
github CalebBell / thermo / thermo / interface.py View on Github external
0.025716823875045505

    References
    ----------
    .. [1] Diguilio, Ralph, and Amyn S. Teja. "Correlation and Prediction of
       the Surface Tensions of Mixtures." The Chemical Engineering Journal 38,
       no. 3 (July 1988): 205-8. doi:10.1016/0300-9467(88)80079-0.
    '''
    if not none_and_length_check([xs, sigmas_Tb, Tbs, Tcs]):
        raise Exception('Function inputs are incorrect format')

    Tc = mixing_simple(xs, Tcs)
    if T > Tc:
        raise ValueError('T > Tc according to Kays rule - model is not valid in this range.')
    Tb = mixing_simple(xs, Tbs)
    sigmar = mixing_simple(xs, sigmas_Tb)
    Tst = (Tc/T - 1.)/(Tc/Tb - 1)
    return 1.002855*Tst**1.118091*(T/Tb)*sigmar
github CalebBell / thermo / thermo / critical.py View on Github external
>>> Tc_mixture([400, 550], [0.3, 0.7])
    505.0
    '''
    def list_methods():
        methods = []
        if none_and_length_check([Tcs]):
            methods.append('Simple')
        methods.append('None')
        return methods
    if AvailableMethods:
        return list_methods()
    if not Method:
        Method = list_methods()[0]
    # This is the calculate, given the method section
    if Method == 'Simple':
        return mixing_simple(zs, Tcs)
    elif Method == 'None':
        return None
    else:
        raise Exception('Failure in in function')
github CalebBell / thermo / thermo / volume.py View on Github external
Mixture liquid volume [m^3/mol]

    Notes
    -----
    Units are that of the given volumes.
    It has been suggested to use this equation with weight fractions,
    but the results have been less accurate.

    Examples
    --------
    >>> Amgat([0.5, 0.5], [4.057e-05, 5.861e-05])
    4.9590000000000005e-05
    '''
    if not none_and_length_check([xs, Vms]):
        raise Exception('Function inputs are incorrect format')
    return mixing_simple(xs, Vms)
github CalebBell / thermo / thermo / critical.py View on Github external
>>> Pc_mixture([2.2E7, 1.1E7], [0.3, 0.7])
    14300000.0
    '''
    def list_methods():
        methods = []
        if none_and_length_check([Pcs]):
            methods.append('Simple')
        methods.append('None')
        return methods
    if AvailableMethods:
        return list_methods()
    if not Method:
        Method = list_methods()[0]
    # This is the calculate, given the method section
    if Method == 'Simple':
        return mixing_simple(zs, Pcs)
    elif Method == 'None':
        return None
    else:
        raise Exception('Failure in in function')
github CalebBell / thermo / thermo / heat_capacity.py View on Github external
zs : list[float]
            Mole fractions of all species in the mixture, [-]
        ws : list[float]
            Weight fractions of all species in the mixture, [-]
        method : str
            Name of the method to use

        Returns
        -------
        Cpgm : float
            Molar heat capacity of the gas mixture at the given conditions,
            [J/mol]
        '''
        if method == SIMPLE:
            Cpgms = [i(T) for i in self.HeatCapacityGases]
            return mixing_simple(zs, Cpgms)
        else:
            raise Exception('Method not valid')
github CalebBell / thermo / thermo / volume.py View on Github external
>>> Rackett_mixture(T=298., xs=[0.4576, 0.5424], MWs=[32.04, 18.01], Tcs=[512.58, 647.29], Pcs=[8.096E6, 2.209E7], Zrs=[0.2332, 0.2374])
    2.625288603174508e-05

    References
    ----------
    .. [1] Rackett, Harold G. "Equation of State for Saturated Liquids."
       Journal of Chemical & Engineering Data 15, no. 4 (1970): 514-517.
       doi:10.1021/je60047a012
    .. [2] Danner, Ronald P, and Design Institute for Physical Property Data.
       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.
    '''
    if not none_and_length_check([xs, MWs, Tcs, Pcs, Zrs]):
        raise Exception('Function inputs are incorrect format')
    Tc = mixing_simple(xs, Tcs)
    Zr = mixing_simple(xs, Zrs)
    MW = mixing_simple(xs, MWs)
    Tr = T/Tc
    bigsum = sum(xs[i]*Tcs[i]/Pcs[i]/MWs[i] for i in range(len(xs)))
    return (R*bigsum*Zr**(1. + (1. - Tr)**(2/7.)))*MW
github CalebBell / thermo / thermo / phase_change.py View on Github external
def list_methods():
        methods = []
        if none_and_length_check([Tms]):
            methods.append('Maximum')
            methods.append('Simple')
        methods.append('None')
        return methods
    if AvailableMethods:
        return list_methods()
    if not Method:
        Method = list_methods()[0]
    # This is the calculate, given the method section
    if Method == 'Maximum':
        _Tliq = max(Tms)
    elif Method == 'Simple':
        _Tliq = mixing_simple(xs, Tms)
    elif Method == 'None':
        return None
    else:
        raise Exception('Failure in in function')
    return _Tliq