Python scipy.log() Examples

The following are 30 code examples of scipy.log(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module scipy , or try the search function .
Example #1
Source File: compuestos.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def _so(self, T):
        r"""Ideal gas entropy calculation from polinomial coefficient of
        specific heat saved in database
        Coefficient in database are in the form [A,B,C,D,E,F]
        Explained in procedure 7A1.1, pag 543

        .. math::
            So = A \ln T + BT + C/2T^2 + D/3T^3 + E/4T^4 + F/5T^5

        Parameters
        ----------
        T : float
            Temperature, [K]

        Notes
        -----
        The units in the calculate ideal enthalpy are in cal/mol·K, the
        reference state is set to T=298.15K
        """
        A, B, C, D, E, F = self.cp
        so = A*log(T) + B*T + C/2*T**2 + D/3*T**3 + E/4*T**4 + F/5*T**5
        return unidades.SpecificHeat(so/self.M, "calgK")

    # Physical properties 
Example #2
Source File: BWRS.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def _fug(self, Z, xi):
        rho=self.P.atm/Z/R_atml/self.T
        tita=[]
        for i in range(len(self.componente)):
            suma=0
            for j in range(len(self.componente)):
                suma+=xi[j]*(-self.Ao**0.5*self.Aoi[i]**0.5*(1-self.kij[i][j]) \
                                    -  self.Co**0.5*self.Coi[i]**0.5*(1-self.kij[i][j])**3/self.T**2 \
                                    + self.Do**0.5*self.Doi[i]**0.5*(1-self.kij[i][j])**4/self.T**3 \
                                    -  self.Eo**0.5*self.Eoi[i]**0.5*(1-self.kij[i][j])**5/self.T**4)
#                print suma
            lo=R_atml*self.T*log(rho*R_atml*self.T*xi[i]) \
                    + rho*(self.Bo+self.Boi[i])*R_atml*self.T \
                    + 2*rho*suma \
                    + rho**2/2*(3*(self.b**2*self.bi[i])**(1./3)*R_atml*self.T-3*(self.a**2*self.ai[i])**(1./3)-3*(self.d**2*self.di[i])**(1./3)/self.T) \
                    + self.alfa*rho**5/5*(3*(self.a**2*self.ai[i])**(1./3)+3*(self.d**2*self.di[i])**(1./3)/self.T) \
                    + 3*rho**5/5*(self.a+self.d/self.T)*(self.alfa**2*self.alfai[i])**(1./3) \
                    + 3*(self.c**2*self.ci[i])**(1./3)*rho**2/self.T**2*((1-exp(-self.gamma*rho**2))/self.gamma/rho**2-exp(-self.gamma*rho**2)/2) \
                    - (2*self.c*sqrt(self.gammai[i]/self.gamma)**0.5/self.gamma/self.T**2)*((1-exp(-self.gamma*rho**2))*(1+self.gamma*rho**2+self.gamma**2*rho**4/2))
            tita.append(exp(lo/R_atml/self.T))
        return tita 
Example #3
Source File: compuestos.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def MuL_Parametric(T, args):
    r"""Calculates liquid viscosity using a paremtric equation

    .. math::
        \log\mu = A\left(\frac{1}{T}-\frac{1}{B}\right)

    Parameters
    ----------
    T : float
        Temperature, [K]
    args : list
        Coefficients for equation

    Returns
    -------
    mu : float
        Liquid viscosity, [Pa·s]

    Notes
    -----
    The parameters for several compound are in database
    """
    A, B = args
    mu = 10**(A*(1/T-1/B))
    return unidades.Viscosity(mu, "cP") 
Example #4
Source File: cubic.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def _fugacity(self, Z, zi, A, B, Ai, Bi):
        """Fugacity for individual components in a mixture using the GEoS in
        the Schmidt-Wenzel formulation, so the subclass must define the
        parameters u and w in the EoS

        Any other subclass with different formulation must overwrite this
        method
        """
        # Precalculation of inner sum in equation
        aij = []
        for ai, kiji in zip(Ai, self.kij):
            suma = 0
            for xj, aj, kij in zip(zi, Ai, kiji):
                suma += xj*(1-kij)*(ai*aj)**0.5
            aij.append(suma)

        tita = []
        for bi, aai in zip(Bi, aij):
            rhs = bi/B*(Z-1) - log(Z-B) + A/B/(self.u-self.w)*(
                    bi/B-2/A*aai) * log((Z+self.u*B)/(Z+self.w*B))
            tita.append(exp(rhs))

        return tita 
Example #5
Source File: mezcla.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def _so(self, T):
        r"""
        Ideal gas entropy, referenced in API procedure 7F2.1, pag 741

        .. math::
            S_m^o = \sum_i x_wS_i^o - \frac{R}{M} x_i\lnx_i

        Parameters
        ----------
        T : float
            Temperature, [K]
        """
        s = 0
        for x, xw, cmp in zip(
                self.fraccion, self.fraccion_masica, self.componente):
            s += xw*cmp._So(T) + R/cmp.M*x*log(x)
        return unidades.SpecificHeat(s) 
Example #6
Source File: virial.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def _physics(self, T, P, mezcla):
        """Properties of Gases calculation. Explanation in [1]_ section 1.4"""
        B, B1, B2 = self.B(T)
        C, C1, C2 = self.C(T)

        self.Z = 1+B*(P/R/T)+(C-B**2)*(P/R/T)**2
        V = self.Z*R*T/P
        self.U_exc = -R*T*(B1/V+C1/2/V**2)
        self.H_exc = R*T*((B-B1)/V+(2*C-C1)/2/V**2)
        self.Cv_exc = -R*((2*B1+B2)/V+(2*C1+C2)/2/V**2)
        self.Cp_exc = -R*(B2/V-((B-B1)**2-(C-C1)-C2/2)/V**2)
        self.S_exc = -R*(log(P)+B1/V+(B**2-C+C1)/2/V**2)
        self.A_exc = R*T*(log(P)+(B**2-C/2/V**2))
        self.G_exc = R*T*(log(P)+B/V+(B**2+C)/2/V**2)

        self.fug = P*exp(B/V+(C+B**2)/2/V**2) 
Example #7
Source File: gerg.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def _phi0(self, tau, delta):
        """Contribución ideal de la energía libre de Helmholtz eq. 7.5"""
        fio = fiot = fiott = fiod = fiodd = fiodt = 0
        nfioni = []   # ðnao/ðni
        for i, componente in enumerate(self.comp):
            deltai = delta*self.rhoc/componente.rhoc
            taui = componente.Tc*tau/self.Tc
            fio_, fiot_, fiott_, fiod_, fiodd_, fiodt_ = componente._phi0(
                componente.GERG["cp"], taui, deltai)
            fio += self.xi[i]*(fio_+log(self.xi[i]))
            fiot += self.xi[i]*fiot_
            fiott += self.xi[i]*fiott_
            fiod += self.xi[i]*fiod_
            fiodd += self.xi[i]*fiodd_
            fiodt += self.xi[i]*fiodt_
            nfioni.append(fio_+1+log(self.xi[i]))
        return fio, fiot, fiott, fiod, fiodd, fiodt, nfioni 
Example #8
Source File: petro.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def Viscosidad_liquido_blend(self, T, fraccion_masica, petro1, petro2):
        """Método de cálculo de la viscosidad de líquidos en mezclas de fracciones petrolíferas, API procedure 11A4.5, pag 1066
        Los parámetros petro tienen la estructura [T1,T2,mu1,mu2]"""
        #TODO: de momoento el procedimiento requiere como parámetros petro1 y petro2, matrices con cuatro elementos, dos temperaturas y sus correspondientes viscosidades, cuando se defina correctamente las fracciones petroliferas estos parámetros serán sustituidos por un simple id de fracción petrolífera
        t=unidades.Temperature(T)
        T1=unidades.Temperature(petro1[0])
        T2=unidades.Temperature(petro1[1])

        ml=(log(log(petro1[3]+0.7))-log(log(petro1[2]+0.7)))/(log(T2.R)-log(T1.R))
        bl=log(log(petro1[2]+0.7))-ml*log(T1.R)
        mh=(log(log(petro2[3]+0.7))-log(log(petro2[2]+0.7)))/(log(T2.R)-log(T1.R))
        bh=log(log(petro2[2]+0.7))-mh*log(T1.R)

        Tl=exp((log(log(petro2[2]+0.7))-bl)/ml)
        Tx=exp(fraccion_masica[0]*log(Tl)+fraccion_masica[1]*log(T1.R))
        Th=exp((log(log(petro1[3]+0.7))-bh)/mh)
        Ty=exp(fraccion_masica[0]*log(T2.R)+fraccion_masica[1]*log(Th))

        m=(log(log(petro1[3]+0.7))-log(log(petro2[2]+0.7)))/(log(Ty)-log(Tx))
        b=log(log(petro2[2]+0.7))-m*log(Tx)

        return exp(exp(m*log(t.R)+b))-0.7 
Example #9
Source File: substation_matrix.py    From CityEnergyAnalyst with MIT License 6 votes vote down vote up
def calc_dTm_HEX(thi, tho, tci, tco):
    '''
    This function estimates the logarithmic temperature difference between two streams

    :param thi: in temperature hot stream
    :param tho: out temperature hot stream
    :param tci: in temperature cold stream
    :param tco: out temperature cold stream
    :param flag: heat: when using for the heating case, 'cool' otherwise
    :return:
        dtm = logaritimic temperature difference
    '''
    dT1 = thi - tco
    dT2 = tho - tci
    if dT1 == dT2:
        dTm = dT1
    else:
        dTm = (dT1 - dT2) / scipy.log(dT1 / dT2)
    return abs(dTm.real) 
Example #10
Source File: substation.py    From CityEnergyAnalyst with MIT License 6 votes vote down vote up
def calc_dTm_HEX(thi, tho, tci, tco):
    '''
    This function estimates the logarithmic temperature difference between two streams

    :param thi: in temperature hot stream
    :param tho: out temperature hot stream
    :param tci: in temperature cold stream
    :param tco: out temperature cold stream
    :return:
        - dtm = logaritimic temperature difference

    '''
    dT1 = thi - tco
    dT2 = tho - tci if not isclose(tho, tci) else 0.0001  # to avoid errors with temperature changes < 0.001

    try:
        dTm = (dT1 - dT2) / scipy.log(dT1 / dT2)
    except ZeroDivisionError:
        raise Exception(thi, tco, tho, tci,
                        "Check the emission_system database, there might be a problem with the selection of nominal temperatures")

    return abs(dTm.real) 
Example #11
Source File: petro.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def M_Goossens(Tb, d20):
    """Calculate petroleum fractions molecular weight with the Goossens
    (1971) correlation

    Parameters
    ------------
    Tb : float
        Normal boiling temperature, [K]
    d20 : float
        Liquid density at 20ºC and 1 atm, [g/cm³]

    Returns
    -------
    M: float
        Molecular weight, [-]

    Examples
    --------
    >>> "%.1f" % M_Goossens(306, 0.6258)["M"]
    '77.0'
    """
    b = 1.52869 + 0.06486*log(Tb/(1078-Tb))
    M = 0.01077*Tb**b/d20
    return {"M": unidades.Dimensionless(M)} 
Example #12
Source File: psycrometry.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def _height(P):
    """
    Inverted _Pbar function

    Parameters
    ------------
    P : float
        Standard barometric pressure, [Pa]

    Returns
    -------
    Z : float
        Altitude, [m]

    Examples
    --------
    Selected point from Table 1 in [1]_

    >>> "%0.0f" % _height(107478)
    '-500'
    """
    P_atm = P/101325.
    Z = 1/2.25577e-5*(1-exp(log(P_atm)/5.2559))
    return unidades.Length(Z) 
Example #13
Source File: UI_reactor.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def Regresion(self):
        t=array(self.KEq_Tab.getColumn(0)[:-1])
        k=array(self.KEq_Tab.getColumn(1)[:-1])
        if len(t)>=4:
            if 4<=len(t)<8:
                inicio=r_[0, 0, 0, 0]
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T)
                resto=lambda par, T, k: k-f(par, T)
            else:
                inicio=r_[0, 0, 0, 0, 0, 0, 0, 0]
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T+par[4]*T**2+par[5]*T**3+par[6]*T**4+par[7]*T**5)
                resto=lambda par, T, k: k-f(par, T)

            ajuste=leastsq(resto,inicio,args=(t, k))
            kcalc=f(ajuste[0], t)
            error=(k-kcalc)/k*100
            self.KEq_Dat.setColumn(0, ajuste[0])
            self.KEq_Tab.setColumn(2, kcalc)
            self.KEq_Tab.setColumn(3, error)

            if ajuste[1] in [1, 2, 3, 4]:
                self.ajuste=ajuste[0] 
Example #14
Source File: heatTransfer.py    From pychemqt with GNU General Public License v3.0 6 votes vote down vote up
def h_tube_Condensation_Traviss(fluid, Di, X):
    """ref Pag 558 Kakac: Boiler..."""
    G = fluid.caudalmasico*4/pi/Di**2
    Re = Di*G*(1-fluid.x)/fluid.Liquido.mu
    F1 = 0.15*(1/X+2.85*X**-0.476)
    if Re < 50:
        F2 = 0.707*fluid.Liquido.Prandt*Re
    elif Re < 1125:
        F2 = 5*fluid.Liquido.Prandt+5*log(1+fluid.Liquido.Prandt*(0.0964*Re**0.585-1))
    else:
        F2 = 5*fluid.Liquido.Prandt+5*log(1+5*fluid.Liquido.Prandt)+2.5*log(0.0031*Re**0.812)

    return fluid.Pr*Re**0.9*F1/F2


# Heat Exchanger design methods 
Example #15
Source File: compuestos.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def Henry(T, args):
    r"""Calculates Henry constant for gases in liquid at low pressure, also
    referenced in API procedure 9A7.1, pag 927

    .. math::
        lnH = A/T + BlnT + CT + D

    Parameters
    ----------
    T : float
        Temperature, [K]
    args : list
        Coefficients for equation

    Returns
    -------
    H : float
        Henry constant, [psi/xmole]

    Notes
    -----
    The parameters for several compound are in database:
        Hydrogen, Helium, Argon, Neon, Krypton, Xenon, Oxygen, Nitrogen,
        Hydrogen sulfide, Carbon monoxide, Carbon dioxide, Sulfur dioxide,
        Nitrous oxide, Chlorine,Bromine, Iodine, Methane, Ethane, Propane,
        Ethylene, Ammonia.
    The Henry constant is returned as unidades.Pressure instance

    Examples
    --------
    Example from 5_; Hydrogen sulfide in water at 77ºF

    >>> T = unidades.Temperature(77, "F")
    >>> "%0.0f" % Henry(T, [-65864.7, -215.127, 0.185874, 1384.15]).psi
    '8257'
    """
    T_R = unidades.K2R(T)
    B1, B2, B3, B4 = args
    H = exp(B1/T_R + B2*log(T_R) + B3*T_R + B4)
    return unidades.Pressure(H, "psi") 
Example #16
Source File: crude.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def Z_Heidaryan_Salarabadi(Tr, Pr):
    """Calculate gas compressibility factor using the Heidaryan-Salarabadi-
    Moghadasi (2010) correlation

    Parameters
    ------------
    Tr : float
        Reduced temperature [-]
    Pr : float
        Reduced pressure [-]

    Returns
    -------
    Z : float
        Gas compressibility factor [-]

    Notes
    -----
    Raise :class:`NotImplementedError` if input pair isn't in limit:

        * 1.2 ≤ Tr ≤ 3
        * 0.2 ≤ Pr ≤ 15
    """
    # Check input in range of validity
    if Tr < 1.2 or Tr > 3 or Pr < 0.2 or Pr > 15:
        raise NotImplementedError("Incoming out of bound")

    # Table 1
    A = [0, 1.11532372699824, -.0790395208876, .01588138045027, .0088613449601,
         -2.16190792611599, 1.1575311867207, -0.05367780720737,
         0.01465569989618, -1.80997374923296, 0.95486038773032]

    # Eq 5
    num = A[1] + A[2]*log(Pr) + A[3]*log(Pr)**2 + A[4]*log(Pr)**3 + \
        A[5]/Tr + A[6]/Tr**2
    dem = 1 + A[7]*log(Pr) + A[8]*log(Pr)**2 + A[9]/Tr + A[10]/Tr**2
    Z = log(num/dem)
    return unidades.Dimensionless(Z) 
Example #17
Source File: nC4.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def _mu0(self, T):
        """Special term for zero-density viscosity for Herrmann correlation"""
        tau = self.Tc/T

        # Eq 8
        no = [4.6147656002208, 4.574318591039e-1, 3.0851104723224e-2]
        suma = 0
        for i, n in enumerate(no):
            suma += n*log(tau)**i

        muo = 1.0546549635209e3/tau**0.5/exp(suma)
        return muo 
Example #18
Source File: crude.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def Z_Burnett(Tr, Pr):
    """Calculate gas compressibility factor using the Burnett (1979)
    correlation

    Parameters
    ------------
    Tr : float
        Reduced temperature [-]
    Pr : float
        Reduced pressure [-]

    Returns
    -------
    Z : float
        Gas compressibility factor [-]

    Notes
    -----
    The correlation is in cited reference, the parameters are least square
    fitting by Leung.

    Raise :class:`NotImplementedError` if input pair isn't in limit:

        * 1.3 ≤ Tr ≤ 3
        * 0.2 ≤ Pr ≤ 4
    """
    # FIXME: Don't work
    # Check input in range of validity
    if Tr < 1.1 or Tr > 2.6 or Pr < 0.5 or Pr > 11:
        raise NotImplementedError("Incoming out of bound")

    Zo = 0.3379*log(log(Tr)) + 1.091
    Po = 21.46*Zo - 11.9*Zo**2 - 5.9
    N = (1.1 + 0.26*Tr + (1.04-1.42*Tr)*Pr/Po)*exp(Pr/Po)/Tr
    Z = 1 + (Zo-1) * sin(pi/2*Pr/Po)**N
    return unidades.Dimensionless(Z) 
Example #19
Source File: Grayson_Streed.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def _gi(self, xi, T):
        """Liquid activity coefficient"""
        Vm = 0
        for x, cmp in zip(xi, self.componente):
            Vm += x*cmp.wilson.m3mol

        phi = []
        for cmp in self.componente:
            phi.append(cmp.wilson.m3mol/Vm)

        sum1 = 0
        sum2 = 0
        for x, cmp in zip(xi, self.componente):
            sum1 += x*cmp.wilson.m3mol*cmp.SolubilityParameter
            sum2 += x*cmp.wilson.m3mol
        d_ = sum1/sum2

        # Eq 5
        gi = []
        for cmp, phii in zip(self.componente, phi):
            # Scatchard-Hildebrand regular solution activity-coefficient
            g = cmp.wilson.m3mol*(cmp.SolubilityParameter-d_)**2/R/T

            # Flory-Huggins extension
            if self.kwargs.get("flory", 0):
                g += log(phii) + 1 - phii

            gi.append(exp(g))

        return gi 
Example #20
Source File: NH3.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def _ThCondCritical(self, rho, T, fase):
        # Custom Critical enhancement

        # The paper use a diferent rhoc value to the EoS
        rhoc = 235

        t = abs(T-405.4)/405.4
        dPT = 1e5*(2.18-0.12/exp(17.8*t))
        nb = 1e-5*(2.6+1.6*t)

        DL = 1.2*Boltzmann*T**2/6/pi/nb/(1.34e-10/t**0.63*(1+t**0.5)) * \
            dPT**2 * 0.423e-8/t**1.24*(1+t**0.5/0.7)

        # Add correction for entire range of temperature, Eq 10
        DL *= exp(-36*t**2)

        X = 0.61*rhoc+16.5*log(t)
        if rho > 0.6*rhoc:
            # Eq 11
            DL *= X**2/(X**2+(rho-0.96*rhoc)**2)
        else:
            # Eq 14
            DL = X**2/(X**2+(0.6*rhoc-0.96*rhoc)**2)
            DL *= rho**2/(0.6*rhoc)**2

        return DL 
Example #21
Source File: petro.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def prop_Sancet(M):
    """Calculate petroleum fractions properties with the Sancet (2007)
    correlations using only the molecular weight as input parameter

    Parameters
    ------------
    M: float
        Molecular weight, [-]

    Returns
    -------
    prop : dict
        A dict with the calculated properties:

            * Tc: Critic temperature, [ºR]
            * Pc: Critic pressure, [psi]
            * Tb: Boiling temperature, [ºR]

    Examples
    --------
    Example 2.1 from [9]_: C7+ fraction with M=150 and SG=0.78

    >>> p = prop_Sancet(150)
    >>> "%.0f %.0f %.0f" % (p["Tc"].R, p["Pc"].psi, p["Tb"].R)
    '1133 297 828'
    """
    Pc = 82.82 + 653*exp(-0.007427*M)                                   # Eq 16
    Tc = -778.5 + 383.5*log(M-4.075)                                    # Eq 17
    Tb = 194 + 0.001241*Tc**1.869                                       # Eq 18

    prop = {}
    prop["M"] = unidades.Dimensionless(M)
    prop["Pc"] = unidades.Pressure(Pc, "psi")
    prop["Tc"] = unidades.Temperature(Tc, "R")
    prop["Tb"] = unidades.Temperature(Tb, "R")
    return prop 
Example #22
Source File: psycrometry.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def _Psat(T):
    """
    Water vapor saturation pressure calculation as explain in [1]_
    pag 1.2, Eq 5-6

    Parameters
    ------------
    T : float
        Temperature, [K]

    Returns
    -------
    P : float
        Saturation pressure, [Pa]
    """
    if 173.15 <= T < 273.15:
        # Saturation pressure over ice, Eq 5
        C = [-5674.5359, 6.3925247, -0.009677843, 0.00000062215701,
             2.0747825E-09, -9.484024E-13, 4.1635019]
        pws = exp(C[0]/T + C[1] + C[2]*T + C[3]*T**2 + C[4]*T**3 + C[5]*T**4 +
                  C[6]*log(T))
    elif 273.15 <= T <= 473.15:
        # Saturation pressure over liquid water, Eq 6
        C = [-5800.2206, 1.3914993, -0.048640239, 0.000041764768,
             -0.000000014452093, 6.5459673]
        pws = exp(C[0]/T + C[1] + C[2]*T + C[3]*T**2 + C[4]*T**3 + C[5]*log(T))
    else:
        raise NotImplementedError("Incoming out of bound")

    return unidades.Pressure(pws) 
Example #23
Source File: heatTransfer.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def Fi(P, R, flujo, **kwargs):
    F = CorrectionFactor(P, R, flujo, **kwargs)
    if R == 1:
        Fi = F*(1-P)
    else:
        Fi = F*P*(1-R)/log((1-R*P)/(1-P))
    return Fi 
Example #24
Source File: compuestos.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def facent_AmbroseWalton(Pvr):
    """Calculates acentric factor of a fluid using the Ambrose-Walton
    corresponding-states correlation

    Parameters
    ----------
    Pvr : float
        Reduced vapor pressure of compound at 0.7Tc, [-]

    Returns
    -------
    w : float
        Acentric factor [-]
    """
    Tr = 0.7
    t = 1-Tr
    f0 = (-5.97616*t + 1.29874*t**1.5 - 0.60394*t**2.5 - 1.06841*t**5)/Tr
    f1 = (-5.03365*t + 1.11505*t**1.5 - 5.41217*t**2.5 - 7.46628*t**5)/Tr
    f2 = (-0.64771*t + 2.41539*t**1.5 - 4.26979*t**2.5 + 3.25259*t**5)/Tr
    coef = roots([f2, f1, f0-log(Pvr)])

    if absolute(coef[0]) < absolute(coef[1]):
        return coef[0]
    else:
        return coef[1]


# Other properties 
Example #25
Source File: heatTransfer.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def NTU_fPR(P, R, flujo, **kwargs):
    """Calculo de la factor de correccion
    Flujo vendra definido por su acronimo
        CF: Counter flow
        PF: Parallel flow
        CrFMix: Crossflow, both fluids mixed
        CrFSMix: Crossflow, one fluid mixed, other unmixed
        CrFunMix: Crossflow, both fluids unmixed
        1-2TEMAE: 1-2 pass shell and tube exchanger

    kwargs: Opciones adicionales:
        mixed: corriente mezclada para CrFSMix
            Cmin, Cmax
    """

    if flujo == "1-2TEMAE":
        if R == 1:
            NTU = log((1-P)/2-3*P)
        else:
            E = (1+R**2)**0.5
            NTU = log((2-P*(1+R-E))/(2-P*(1+R+E)))/E

    else:
        if R == 1:
            NTU = P/(1-P)
        else:
            NTU = log((1-R/P)/(1-P))/(1-R)

    return NTU 
Example #26
Source File: petro.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def Pv_Tsonopoulos(self, T):
        """Tsonopoulos, C., Heidman, J. L., and Hwang, S.-C.,Thermodynamic and Transport Properties of Coal Liquids, An Exxon Monograph, Wiley, New York, 1986."""
        Tr=T/self.tpc
        A=5.671485+12.439604*self.f_acent
        B=5.809839+12.755971*self.f_acent
        C=0.867513+9.654169*self.f_acent
        D=0.1383536+0.316367*self.f_acent
        pr=exp(A-B/Tr-C*log(Tr)+D*Tr**6)
        return unidades.Pressure(pr, "bar") 
Example #27
Source File: heatTransfer.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def h_anulli_Turbulent(Re, Pr, a, dhL=0, boundary=0):
    """VDI Heat Atlas G2 Pag.703"""
    if boundary == 0:         #Inner surface heated
        Fann = 0.75*a**-0.17
    elif boundary == 1:       #Outer surface heated
        Fann = (0.9-0.15*a**0.6)
    elif boundary == 2:       #Both surfaces heated
        Fann = (0.75*a**-0.17+(0.9-0.15*a**0.6))/(1+a)

    Re_ = Re*((1+a**2)*log(a)+(1-a**2))/((1-a)**2*log(a))
    Xann = (1.8*log10(Re_)-1.5)**-2
    k1 = 1.07+900/Re-0.63/(1+10*Pr)
    Nu = Xann/8*Re*Pr/(k1+12.7*(Xann/8)**0.5*(Pr**(2./3.)-1))*(1+dhL**(2./3.))*Fann
    return Nu 
Example #28
Source File: heatTransfer.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def h_tubeside_turbulent_Gnielinski(Re, Pr, D, L):
    """Coeficiente de transferencia de calor por calor sensible en el interior de tubos horizontales en regimen turbulento y de transición
    3000<Re<5e6
    0.5<Pr<2000
    Serth - Process heat transfer_ principles and applications pag 63"""
    f = (0.782*log(Re-1.51))**-2
    return f/8*(Re-1000.)*Pr/(1+12.7*(f/8)**0.5*(Pr**(2./3)-1))*(1+(D/L)**(2./3)) 
Example #29
Source File: heatTransfer.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def h_tubeside_turbulent_ESDU(Re, Pr):
    """Coeficiente de transferencia de calor por calor sensible en el interior de tubos horizontales en regimen turbulento
    40000<Re<1e6
    0.3<Pr<300
    L/D>60"""
    return 0.0225*Re**0.795*Pr**0.495*exp(-0.0225*log(Pr)**2) 
Example #30
Source File: petro.py    From pychemqt with GNU General Public License v3.0 5 votes vote down vote up
def _Tb_Predicted(par, x):
    """Calculate a specific point in the distillation curve"""
    return par[0]+par[0]*(par[1]/par[2]*log(1/(1-x)))**(1./par[2])


# Others properties