Example #1
0
    def fill(self, fase, flash, thermo, mol, transport, dielec, thermo0):
        fase.update(Fluid(thermo))
        fase.fraccion = flash["xliq"]
        fase.M = unidades.Dimensionless(mol["wmix"])
        fase.rho = unidades.Density(flash["Dliq"] * fase.M)

        fase.u = unidades.Enthalpy(fase["e"] / fase.M, "Jg")
        fase.cv = unidades.SpecificHeat(fase["cv"] / fase.M, "JgK")
        fase.cp = unidades.SpecificHeat(fase["cp"] / fase.M, "JgK")
        fase.h = unidades.Enthalpy(fase["h"] / fase.M, "Jg")
        fase.s = unidades.SpecificHeat(fase["s"] / fase.M, "JgK")
        fase.w = unidades.Speed(fase["w"])
        fase.joule = unidades.TemperaturePressure(fase["hjt"], "KkPa")
        fase.Z = unidades.Dimensionless(fase["Z"])
        fase.A = unidades.Enthalpy(fase["A"] / fase.M, "Jg")
        fase.G = unidades.Enthalpy(fase["G"] / fase.M, "Jg")
        fase.xkappa = unidades.InvPressure(fase["xkappa"], "kPa")
        fase.alfav = unidades.InvTemperature(fase["beta"])
        #            fase.dpdD = fase["dpdD"]      #derivative dP/dD [kPa-L/mol]
        #            fase.d2pdD2 = fase["d2pdD2"]  #derivative d^2p/dD^2 [kPa-L^2/mol^2]
        #            fase.dpdt = unidades.PressureTemperature(fase["dpdt"], "kPaK")
        #            fase.dDdt = fase["dDdt"]      #derivative dD/dt [mol/(L-K)]
        #            fase.dDdp = fase["dDdp"]      #derivative dD/dp [mol/(L-kPa)]
        #
        #            fluido2=refprop.therm3(flash["t"], flash["Dliq"], flash["xliq"])
        #            fase.xisenk = fluido2["xisenk"]
        #            fase.xkt = fluido2["xkt"]
        #            fase.betas = fluido2["betas"]
        #            fase.bs = fluido2["bs"]
        #            fase.xkkt = fluido2["xkkt"]
        #            fase.thrott = fluido2["thrott"]
        #            fase.pint = fluido2["pint"]
        #            fase.spht = fluido2["spht"]

        #            fase.fpv = refprop.fpv(flash["t"], flash["Dliq"], flash["p"], flash["xliq"])
        #            fase.chempot = refprop.chempot(flash["t"], flash["Dliq"], flash["xliq"])
        #            fase.fgcty = refprop.fgcty(flash["t"], flash["Dliq"], flash["xliq"])
        #            fase.fugcof = refprop.fugcof(flash["t"], flash["Dliq"], flash["xliq"])

        #            fase.virb = refprop.virb(flash["t"], flash["xliq"])["b"]
        #            fase.virc = refprop.virc(flash["t"], flash["xliq"])["c"]
        #            fase.vird = refprop.vird(flash["t"], flash["xliq"])["d"]
        #            fase.virba = refprop.virba(flash["t"], flash["xliq"])["ba"]
        #            fase.virca = refprop.virca(flash["t"], flash["xliq"])["ca"]

        if transport:
            fase.mu = unidades.Viscosity(transport["eta"], "muPas")
            fase.k = unidades.ThermalConductivity(transport["tcx"])
            fase.Prandt = unidades.Dimensionless(fase.mu * fase.cp / fase.k)
        else:
            fase.mu = unidades.Viscosity(None)
            fase.k = unidades.ThermalConductivity(None)
            fase.Prandt = unidades.Dimensionless(None)

        fase.dielec = unidades.Dimensionless(dielec["de"])
        fase.cp0 = unidades.SpecificHeat(thermo0["cp"] / fase.M)
        fase.cp0_cv = unidades.Dimensionless(fase.cp0 / fase.cv)
Example #2
0
    def _visco0(self, rho, T, fase=None):

        ek = 103.3
        sigma = 0.36
        rhoc = 10.4477 * self.M
        tau = self.Tc / T
        delta = rho / rhoc

        n_poly = [10.72, 1.122, 0.002019, -8.876, -0.02916]
        t_poly = [.2, .05, 2.4, .6, 3.6]
        d_poly = [1, 4, 9, 1, 8]
        l_poly = [0, 0, 0, 1, 1]
        g_poly = [0, 0, 0, 1, 1]

        b = [0.431, -0.4623, 0.08406, 0.005341, -0.00331]
        T_ = log(T / ek)
        suma = 0
        for i, bi in enumerate(b):
            suma += bi * T_**i
        omega = exp(suma)

        Nchapman = 0.0266958
        muo = Nchapman * (self.M * T)**0.5 / (sigma**2 * omega)

        mur = 0
        for n, t, d, l, g in zip(n_poly, t_poly, d_poly, l_poly, g_poly):
            mur += n * tau**t * delta**d * exp(-g * delta**l)

        return unidades.Viscosity(muo + mur, "muPas")
Example #3
0
    def _visco0(self, rho, T, fase=None, coef=False):

        Visco0 = lambda T: -0.135311743/log(T) + 1.00347841 + \
            1.20654649*log(T) - 0.149564551*log(T)**2 + 0.0125208416*log(T)**3

        def ViscoE(T, rho):
            x = log(T)
            B = -47.5295259/x+87.6799309-42.0741589*x+8.33128289*x**2-0.589252385*x**3
            C = 547.309267/x-904.870586+431.404928*x-81.4504854*x**2+5.37005733*x**3
            D = -1684.39324/x+3331.08630-1632.19172*x+308.804413*x**2-20.2936367*x**3
            return rho.gcc*B+rho.gcc**2*C+rho.gcc**3*D


        if T < 100:
            # Section 4.2.1 for 3.5 < T < 100
            no = Visco0(T)
            ne = ViscoE(T, rho)
            n = exp(no+ne)
        else:
            # Section 4.2.1 for T > 100
            no = 196*T**0.71938*exp(12.451/T-295.67/T**2-4.1249)
            ne = exp(Visco0(T)+ViscoE(T, rho))-exp(Visco0(T)+ViscoE(T, unidades.Density(0)))
            n = no+ne

        if coef:
            return ne
        else:
            return unidades.Viscosity(n*1e-6, "P")
Example #4
0
 def _visco0(self, rho, T, fase):
     sigma = 0.297
     ek = 30.41
     
     # Zero-Density Limit, Eq. 3-4
     T_ = T/ek
     ai = [2.0963e-1, -4.55274e-1, 1.43602e-1, -3.35325e-2, 2.76981e-3]
     suma = 0
     for i, a in enumerate(ai):
         suma += a*log(T_)**i
     S = exp(suma)
     no=0.021357*(self.M*T)**0.5/sigma/S
     
     # Excess Contribution, Eq. 5-7
     bi = [-0.187, 2.4871, 3.7151, -11.0972, 9.0965, -3.8292, 0.5166]
     B_ = 0
     for i, b in enumerate(bi):
         B_ += b/T**i
     B = B_*sigma**3
     n1=B*no
     
     # Simbolic Regression, Eq. 9
     rhor = rho/90.5
     Tr = T/self.Tc
     c = [6.43449673, 4.56334068e-2, 2.32797868e-1, 9.5832612e-1,
          1.27941189e-1, 3.63576595e-1]
     nc=c[0]*rhor**2*exp(c[1]*Tr+c[2]/Tr+c[3]*rhor**2/(c[4]+Tr)+c[5]*rhor**6)
     
     return unidades.Viscosity(no+n1+nc, "muPas")
Example #5
0
    def _visco0(self, rho, T, fase=None):
        Tr = T / 643.847
        rhor = rho / 358.0

        no = [1.0, 0.940695, 0.578377, -0.202044]
        fi0 = Tr**0.5 / sum([n / Tr**i for i, n in enumerate(no)])

        Li = [
            0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 0, 1, 2, 5, 0, 1, 2, 3, 0, 1, 3, 5,
            0, 1, 5, 3
        ]
        Lj = [
            0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4,
            5, 5, 5, 6
        ]
        Lij = [
            0.4864192, -0.2448372, -0.8702035, 0.8716056, -1.051126, 0.3458395,
            0.3509007, 1.315436, 1.297752, 1.353448, -0.2847572, -1.037026,
            -1.287846, -0.02148229, 0.07013759, 0.4660127, 0.2292075,
            -0.4857462, 0.01641220, -0.02884911, 0.1607171, -0.009603846,
            -0.01163815, -0.008239587, 0.004559914, -0.003886659
        ]

        array = [
            lij * (1. / Tr - 1)**i * (rhor - 1)**j
            for i, j, lij in zip(Li, Lj, Lij)
        ]
        fi1 = exp(rhor * sum(array))

        return unidades.Viscosity(55.2651 * fi0 * fi1, "muPas")
Example #6
0
    def _visco3(self, rho, T, fase=None):

        # Zero-Density viscosity
        muo = self._Visco0(T)

        # Gas-phase viscosity
        # Table 8
        ti = [1, 2, 7]
        ei = [3.6350734e-3, 7.209997e-5, 3.00306e-20]
        mug = 0
        for t, e in zip(ti, ei):
            mug += e * rho**t  # Eq 67

        # Liquid-phase viscosity
        B = 18.56 + 0.014 * T  # Eq 71
        Vo = 7.41e-4 - 3.3e-7 * T  # Eq 72
        mul = 1 / B / (1 / rho - Vo)  # Eq 70

        # Critical enhancement Not implemented
        muc = 0

        # Eq 74, parameters
        rhos = 467.689
        Ts = 302
        Z = 1

        # Eq 76
        mu = muo + mug/(1+exp(-Z*(T-Ts))) + \
            mug/(1+exp(Z*(T-Ts)))/(1+exp(Z*(rho-rhos))) + \
            (mul-muo)/(1+exp(Z*(T-Ts)))/(1+exp(-Z*(rho-rhos))) + muc

        return unidades.Viscosity(mu, "muPas")
Example #7
0
 def readStatefromJSON(self, state):
     """Load instance parameter from saved file"""
     self.L = unidades.Length(state["L"])
     self.rho = unidades.Density(state["rho"])
     self.mu = unidades.Viscosity(state["mu"])
     self.material = state["material"]
     self.Dn = state["Dn"]
     self.rugosidad = unidades.Length(state["rugosidad"])
     self.De = unidades.Length(state["De"])
     self.w = unidades.Length(state["w"])
     self.Di = unidades.Length(state["Di"])
     self.eD = unidades.Dimensionless(state["eD"])
     self.seccion = unidades.Area(state["seccion"])
     self.A = unidades.Area(state["A"])
     self.V = unidades.Speed(state["V"])
     self.Re = unidades.Dimensionless(state["Re"])
     self.K = unidades.Dimensionless(state["K"])
     self.DeltaP_h = unidades.DeltaP(state["DeltaP_h"])
     self.DeltaP_ac = unidades.DeltaP(state["DeltaP_ac"])
     self.f = unidades.Dimensionless(state["f"])
     self.DeltaP_f = unidades.DeltaP(state["DeltaP_f"])
     self.DeltaP_v = unidades.DeltaP(state["DeltaP_v"])
     self.DeltaP = unidades.DeltaP(state["DeltaP"])
     self.DeltaP_100ft = unidades.Dimensionless(state["DeltaP_100ft"])
     self.Tout = unidades.Temperature(state["Tout"])
     self.Heat = unidades.Power(state["Heat"])
     self.Pin = unidades.Pressure(state["Pin"])
     self.Pout = unidades.Pressure(state["Pout"])
     self.statusCoste = state["statusCoste"]
     if self.statusCoste:
         self.C_adq = unidades.Currency(state["C_adq"])
         self.C_inst = unidades.Currency(state["C_inst"])
     self.salida = [None]
Example #8
0
    def _visco0(self, rho, T, fase):
        DELV = lambda rho1, T1, rho2, T2: DILV(T1)+EXCESV(rho1, T2)-DILV(T2)-EXCESV(rho2, T2)

        def EXVDIL(rho, T):
            A = exp(5.7694+log(rho.gcc)+0.65e2*rho.gcc**1.5-6e-6*exp(127.2*rho.gcc))
            B = 10+7.2*((rho.gcc/0.07)**6-(rho.gcc/0.07)**1.5)-17.63*exp(-58.75*(rho.gcc/0.07)**3)
            return A*exp(B/T)*0.1

        def DILV(T):
            b = [-0.1841091042788e2, 0.3185762039455e2, -0.2308233586574e2,
                 0.9129812714730e1, -0.2163626387630e1, 0.3175128582601,
                 -0.2773173035271e-1, 0.1347359367871e-2, -0.2775671778154e-4]
            suma = 0
            for i, b in enumerate(b):
                suma += b*T**((-3.+i)/3)
            return suma*100

        def EXCESV(rho, T):
            c = [-0.1099981128e2, 0.1895876508e2, -0.3813005056e3,
                 0.5950473265e2, 0.1099399458e1, 0.8987269839e1,
                 0.1231422148e4, 0.311]
            R2 = rho.gcc**0.5*(rho.gcc-c[7])/c[7]
            A = c[0]+c[1]*R2+c[2]*rho.gcc**0.1+c[3]*R2/T**2+c[4]*rho.gcc**0.1/T**1.5+c[5]/T+c[6]*R2/T
            B = c[0]+c[5]/T
            return 0.1*(exp(A)-exp(B))

        if T > 100:
            n = DILV(100)+EXVDIL(rho, 100)+DELV(rho, T, rho, 100)
        else:
            n = DILV(T)+EXVDIL(rho, T)
        return unidades.Viscosity(n, "muPas")
Example #9
0
    def _visco1(self, rho, T, fase):
        def muo(T):
            b = [-0.1841091042788e2, 0.3185762039455e2, -0.2308233586574e2,
                 0.9129812714730e1, -0.2163626387630e1, 0.3175128582601,
                 -0.2773173035271e-1, 0.1347359367871e-2, -0.2775671778154e-4]
            suma = 0
            for i, b in enumerate(b):
                suma += b*T**((-3.+i)/3)
            return suma*100

        def mu1(rho, T):
            A = exp(5.7694 + log(rho.gcc) + 0.65e2*rho.gcc**1.5 -
                    6e-6*exp(127.2*rho.gcc))
            B = 10 + 7.2*((rho.gcc/0.07)**6-(rho.gcc/0.07)**1.5) - \
                17.63*exp(-58.75*(rho.gcc/0.07)**3)
            return A*exp(B/T)*0.1

        def mu2(rho, T):
            c = [-0.1324266117873e2, 0.1895048470537e2, 0.2184151514282e2,
                 0.9771827164811e5, -0.1157010275059e4, 0.1911147702539e3,
                 -0.3186427506942e4, 0.0705565000000]
            R2 = rho.gcc**0.5*(rho.gcc-c[7])/c[7]
            A = c[0] + c[1]*R2 + c[2]*rho.gcc**0.1 + c[3]*R2/T**2 + \
                c[4]*rho.gcc**0.1/T**1.5 + c[5]/T + c[6]*R2/T
            B = c[0]+c[5]/T
            return 0.1*(exp(A)-exp(B))

        def mur(rho1, T1, rho2, T2):
            return muo(T1) + mu2(rho1, T2) - muo(T2) - mu2(rho2, T2)

        if T > 100:
            mu = muo(100) + mu1(rho, 100) + mur(rho, T, rho, 100)
        else:
            mu = muo(T)+mu1(rho, T)
        return unidades.Viscosity(mu, "muPas")
Example #10
0
    def fill(self, fase, estado):
        fase._bool = True
        fase.M = self.M
        fase.rho = unidades.Density(estado.rho)
        fase.v = unidades.SpecificVolume(estado.v)
        fase.Z = unidades.Dimensionless(self.P * estado.v / R / 1000 * self.M /
                                        self.T)

        fase.h = unidades.Enthalpy(estado.h)
        fase.s = unidades.SpecificHeat(estado.s)
        fase.u = unidades.Enthalpy(estado.u)
        fase.a = unidades.Enthalpy(fase.u - self.T * fase.s)
        fase.g = unidades.Enthalpy(fase.h - self.T * fase.s)
        fi = exp((fase.g - self.g0) / 1000 / R * self.M / self.T)
        fase.fi = [unidades.Pressure(fi)]
        fase.f = [unidades.Pressure(self.P * f) for f in fase.fi]

        fase.cv = unidades.SpecificHeat(estado.cv)
        fase.cp = unidades.SpecificHeat(estado.cp)
        fase.cp_cv = unidades.Dimensionless(fase.cp / fase.cv)
        fase.gamma = fase.cp_cv
        fase.w = unidades.Speed(estado.w)

        fase.rhoM = unidades.MolarDensity(fase.rho / self.M)
        fase.hM = unidades.MolarEnthalpy(fase.h * self.M)
        fase.sM = unidades.MolarSpecificHeat(fase.s * self.M)
        fase.uM = unidades.MolarEnthalpy(fase.u * self.M)
        fase.aM = unidades.MolarEnthalpy(fase.a * self.M)
        fase.gM = unidades.MolarEnthalpy(fase.g * self.M)
        fase.cvM = unidades.MolarSpecificHeat(fase.cv * self.M)
        fase.cpM = unidades.MolarSpecificHeat(fase.cp * self.M)

        fase.mu = unidades.Viscosity(estado.mu)
        fase.nu = unidades.Diffusivity(fase.mu / fase.rho)
        fase.k = unidades.ThermalConductivity(estado.k)
        fase.alfa = unidades.Diffusivity(fase.k / fase.rho / fase.cp)
        fase.epsilon = unidades.Dimensionless(
            iapws._Dielectric(estado.rho, self.T))
        fase.Prandt = unidades.Dimensionless(estado.mu * estado.cp / estado.k)
        fase.n = unidades.Dimensionless(
            iapws._Refractive(fase.rho, self.T, self.kwargs["l"]))

        fase.alfav = unidades.InvTemperature(estado.deriv("Tpv") / fase.v)
        fase.kappa = unidades.InvPressure(-estado.deriv("pTv") / fase.v)
        fase.kappas = unidades.InvPressure(
            -1 / fase.v * self.derivative("v", "P", "s", fase))

        fase.joule = unidades.TemperaturePressure(estado.deriv("Tph"))
        fase.deltat = unidades.EnthalpyPressure(estado.deriv("pTh"))

        fase.alfap = unidades.Density(fase.alfav / self.P / fase.kappa)
        fase.betap = unidades.Density(-1 / self.P * estado.deriv("vTp"))
        fase.fraccion = [1]
        fase.fraccion_masica = [1]
Example #11
0
    def _visco0(self, rho, T, fase):
        # FIXME: No sale
        rhoc = 273.
        ek = 577.87
        sigma0 = 0.3408e-9
        delta = 0.4575
        sigmac = 0.7193422e-9
        a = [
            1.16145, -0.14874, 0.52487, -0.77320, 2.16178, -2.43787,
            0.95976e-3, 0.10225, -0.97346, 0.10657, -0.34528, -0.44557,
            -2.58055
        ]
        b = [
            -19.572881, 219.73999, -1015.3226, 2471.0125, -3375.1717,
            2491.6597, -787.26086, 14.085455, -0.34664158
        ]
        d = [
            -1.181909, 0.5031030, -0.6268461, 0.5169312, -0.2351349,
            5.3980235e-2, -4.9069617e-3
        ]
        e = [
            0, 4.018368, -4.239180, 2.245110, -0.5750698, 2.3021026e-2,
            2.5696775e-2, -6.8372749e-3, 7.2707189e-4, -2.9255711e-5
        ]

        T_ = self.T / ek
        OmegaLJ = a[0] * T_**a[1] + a[2] * exp(a[3] * T_) + a[4] * exp(
            a[5] * T_)
        OmegaD = a[7] * T_**a[8] + a[9] * exp(a[10] * T_) + a[11] * exp(
            a[12] * T_)
        OmegaSM = OmegaLJ * (1 + delta**2 * OmegaD / (1 + a[6] * delta**6))
        no = 5. * (self.M / Avogadro * Boltzmann * self.T /
                   pi)**0.5 / (16 * sigma0**2 * OmegaSM)
        B = (sum([b[i] / T_**(0.25 * i) for i in range(7)]) + b[7] / T_**2.5 +
             b[8] / T_**5.5) * Avogadro * sigma0**3
        C = 1.86222085e-3 * T_**3 * exp(
            9.990338 / T_**0.5) * (Avogadro * sigma0**3)**2
        ng = 1 + B * rho / self.M * 1000 + C * (rho / self.M * 1000)**2

        Tr = self.T / self.Tc
        rhor = rho / rhoc
        sigmaHS = sigmac * (sum([d[i] / Tr**i for i in range(7)]) +
                            sum([e[i] * rhor**(i) for i in range(1, 10)]))
        b = 2 * pi * Avogadro * sigmaHS**3 / 3
        Xi = b * rho / self.M * 1000 / 4
        g = (1 - 0.5 * Xi) / (1 - Xi)**3
        ne = 1. / g + 0.8 * b * rho / self.M * 1000 + 0.761 * g * sigmaHS * b**2 * (
            rho / self.M * 1000)**2

        f = 1 / (1 + exp(5 * (rhor - 1)))
        n = no * (f * ng + (1 - f) * ne)
        return unidades.Viscosity(n)
Example #12
0
    def fill(self, fase, st):
        """Fill phase properties"""
        fase._bool = True
        fase.M = self.M
        fase.v = unidades.SpecificVolume(st.v)
        fase.rho = unidades.Density(st.rho)
        fase.Z = unidades.Dimensionless(st.Z)

        fase.h = unidades.Enthalpy(st.h, "kJkg")
        fase.s = unidades.SpecificHeat(st.s, "kJkgK")
        fase.u = unidades.Enthalpy(st.u, "kJkg")
        fase.a = unidades.Enthalpy(st.a, "kJkg")
        fase.g = unidades.Enthalpy(st.g, "kJkg")
        fase.fi = [unidades.Dimensionless(st.fi)]
        fase.f = [unidades.Pressure(st.f, "MPa")]

        fase.cv = unidades.SpecificHeat(st.cv, "kJkgK")
        fase.cp = unidades.SpecificHeat(st.cp, "kJkgK")
        fase.cp_cv = unidades.Dimensionless(st.cp_cv)
        fase.gamma = fase.cp_cv
        fase.w = unidades.Speed(st.w)

        fase.rhoM = unidades.MolarDensity(fase.rho / self.M)
        fase.hM = unidades.MolarEnthalpy(fase.h * self.M)
        fase.sM = unidades.MolarSpecificHeat(fase.s * self.M)
        fase.uM = unidades.MolarEnthalpy(fase.u * self.M)
        fase.aM = unidades.MolarEnthalpy(fase.a * self.M)
        fase.gM = unidades.MolarEnthalpy(fase.g * self.M)
        fase.cvM = unidades.MolarSpecificHeat(fase.cv * self.M)
        fase.cpM = unidades.MolarSpecificHeat(fase.cp * self.M)

        fase.alfav = unidades.InvTemperature(st.alfav)
        fase.kappa = unidades.InvPressure(st.xkappa, "MPa")
        fase.kappas = unidades.InvPressure(st.kappas, "MPa")

        fase.mu = unidades.Viscosity(st.mu)
        fase.nu = unidades.Diffusivity(st.nu)
        fase.k = unidades.ThermalConductivity(st.k)
        fase.alfa = unidades.Diffusivity(st.alfa)
        fase.epsilon = unidades.Dimensionless(st.epsilon)
        fase.Prandt = unidades.Dimensionless(st.Prandt)
        fase.n = unidades.Dimensionless(st.n)

        fase.joule = unidades.TemperaturePressure(st.joule)
        fase.deltat = unidades.EnthalpyPressure(st.deltat)

        fase.betap = unidades.Density(st.betap)
        fase.alfap = unidades.Density(st.alfap)
        fase.fraccion = [1]
        fase.fraccion_masica = [1]
Example #13
0
    def _visco0(self, rho, T, fase):
        GV = [-3.5098225018e6, 2.5008406184e6, -5.8365540744e5, 4.5549146583e3,
              2.2881683403e4, -4.7318682077e3, 4.5022249258e2, -2.1490688088e1,
              4.1649263233e-1]
        muo = 0
        for i in range(-3, 6):
            muo += GV[i+3]*T**(i/3.)

        mu1 = 0
        tita = (rho-self.rhoc)/self.rhoc
        j = [0, -4.8544486732, 1.3033585236e1, 2.7808928908e4, -1.8241971308e3,
             1.5913024509, -2.0513573927e2, -3.9478454708e4]
        deltamu = exp(j[1]+j[4]/T)*(exp(rho.gcc**0.1*(j[2]+j[3]/T**1.5)+tita*rho.gcc**0.5*(j[5]+j[6]/T+j[7]/T**2))-1.)

        return unidades.Viscosity((muo+mu1+deltamu)*1e-7, "Pas")
Example #14
0
    def _visco0(self):
        rhol = 32.174
        C1 = 1.3163
        C2 = 0.1832
        deltaG = 771.23
        nmax = 3.967

        Drho = rhol-self.rho/self.M
        delta = self.rho/self.M-7.5114
        tau = self.T-299.28

        no = self._Visco0()
        ng = no*(Drho/rhol)**C1
        nr = (self.rho/self.M/rhol)**C1*C2*rhol**2/Drho*self.T**0.5*exp(self.rho/self.M/Drho*deltaG/self.R.kJkgK/self.M/self.T)
        nc = 4*nmax/(exp(delta)+exp(-delta))/(exp(tau)+exp(-tau))
        return unidades.Viscosity(ng+nr+nc, "muPas")
Example #15
0
    def _visco0(self, rho, T, fase):
        ref = H2O()
        ref._ref(False)
        estado = ref._eq(rho, 1.5*self.Tc)
        delta = estado["delta"]
        fird = estado["fird"]
        firdd = estado["firdd"]
        dpdrho = self.R*estado["T"]*(1+2*delta*fird+delta**2*firdd)
        drho = 1/dpdrho*1e6

        # convert ∂ρ/∂P]τ to IAPWS units, [kg/m³·MPa]
        if fase:
            fase = copy(fase)
            fase.drhodP_T *= 1e6

        mu = _Viscosity(rho, T, fase=fase, drho=drho)
        return unidades.Viscosity(mu)
Example #16
0
    def _visco0(self, rho, T, fase=None):
        """Equation for the Viscosity

        Parameters
        ----------
        rho : float
            Density [kg/m³]
        T : float
            Temperature [K]

        Returns
        -------
        mu : float
            Viscosity [Pa·s]
        """
        ek = 103.3
        sigma = 0.36
        M = 28.9586
        rhoc = 10.4477 * M
        tau = 132.6312 / T
        delta = rho / rhoc

        b = [0.431, -0.4623, 0.08406, 0.005341, -0.00331]
        T_ = log(T / ek)
        suma = 0
        for i, bi in enumerate(b):
            suma += bi * T_**i
        omega = exp(suma)

        # Eq 2
        muo = 0.0266958 * (M * T)**0.5 / (sigma**2 * omega)

        n_poly = [10.72, 1.122, 0.002019, -8.876, -0.02916]
        t_poly = [.2, .05, 2.4, .6, 3.6]
        d_poly = [1, 4, 9, 1, 8]
        l_poly = [0, 0, 0, 1, 1]
        g_poly = [0, 0, 0, 1, 1]

        # Eq 3
        mur = 0
        for n, t, d, l, g in zip(n_poly, t_poly, d_poly, l_poly, g_poly):
            mur += n * tau**t * delta**d * exp(-g * delta**l)

        # Eq 1
        mu = muo + mur
        return unidades.Viscosity(mu, "muPas")
Example #17
0
    def _visco0(self, rho, T, fase):
        rhol = 32.174
        C1 = 1.3163
        C2 = 0.1832
        deltaG = 771.23
        nmax = 3.967
        R = 8.31451 / self.M

        Drho = rhol - rho / self.M
        delta = rho / self.M - 7.5114
        tau = T - 299.28

        muo = self._Visco0(T)
        mug = muo * (Drho / rhol)**C1
        mur = (rho / self.M / rhol)**C1 * C2 * rhol**2 / Drho * T**0.5 * exp(
            rho / self.M / Drho * deltaG / R / self.M / T)
        muc = 4 * nmax / (exp(delta) + exp(-delta)) / (exp(tau) + exp(-tau))
        return unidades.Viscosity(mug + mur + muc, "muPas")
Example #18
0
    def _visco0(self, rho, T, fase=None):
        """Hardcoded method for viscosity correlation by McCarty"""
        def muo(T):
            # Eq 16
            x = log(T)
            muo = -0.135311743/x + 1.00347841 + 1.20654649*x - \
                0.149564551*x**2 + 0.0125208416*x**3
            return muo

        def mue(T, rho):
            # Section 3.5, for T > 300 evaluate at T = 300
            if T > 300:
                T = 300

            # Density g/cm³
            rho_gcc = rho * 1e-3

            x = log(T)
            # Eq 18
            B = -47.5295259/x + 87.6799309 - 42.0741589*x + 8.33128289*x**2 - \
                0.589252385*x**3
            # Eq 19
            C = 547.309267/x - 904.870586 + 431.404928*x - 81.4504854*x**2 + \
                5.37005733*x**3
            # Eq 20
            D = -1684.39324/x + 3331.08630 - 1632.19172*x + 308.804413*x**2 - \
                20.2936367*x**3
            return rho_gcc * B + rho_gcc**2 * C + rho_gcc**3 * D  # Eq 17

        if T < 100:
            # Section 3.5 for 3.5 < T < 100
            no = muo(T)
            ne = mue(T, rho)
            mu = exp(no + ne)  # Eq 15
        else:
            # Section 3.4 for T > 100
            no = 196 * T**0.71938 * exp(
                12.451 / T - 295.67 / T**2 - 4.1249)  # Eq 22
            ne = exp(muo(T) + mue(T, rho)) - exp(muo(T) + mue(T, 0))  # Eq 23
            mu = no + ne  # Eq 21

        return unidades.Viscosity(mu, "microP")
Example #19
0
 def _visco0(self, rho, T, fase=None):
     a = [
         17.67484, -2.78751, 311498.7, -48826500, 3938774000, -1.654629e11,
         2.86561e12
     ]
     Tr = T / 0.29944
     y = 0.68321 * (a[0] + a[1] * log10(Tr) + a[2] / Tr**2 + a[3] / Tr**3 +
                    a[4] / Tr**4 + a[5] / Tr**5 + a[6] / Tr**6)
     nt = 266.93 * (T * self.M)**0.5 / y
     om = rho / 1673.0
     c = [1.03010, -0.99175, 2.47127, -3.11864, 1.57066]
     b = [0.48148, -1.18732, 2.80277, -5.41058, 7.04779, -3.76608]
     sum1 = sum([ci * om**i for i, ci in enumerate(c)])
     sum2 = sum([bi * om**i for i, bi in enumerate(b)])
     sigma = 3.05e-10 * (sum1 - sum2 * log10(T / 122.1))
     br = 2.0 / 3.0 * pi * Avogadro * sigma**3
     brho = rho / self.M * 1000 * br
     d = [1, 0.27676, 0.014355, 2.6480, -1.9643, 0.89161]
     nd = sum([di * brho**i for i, di in enumerate(d)])
     return unidades.Viscosity(nd * nt / 100, "muPas")
Example #20
0
    def fill(self, fase, estado):
        fase.M = self.M
        fase.rho = unidades.Density(estado.rho)
        fase.v = unidades.SpecificVolume(estado.v)
        fase.Z = unidades.Dimensionless(self.P*estado.v/R/1000*self.M/self.T)

        fase.h = unidades.Enthalpy(estado.h)
        fase.s = unidades.SpecificHeat(estado.s)
        fase.u = unidades.Enthalpy(estado.u)
        fase.a = unidades.Enthalpy(fase.u-self.T*fase.s)
        fase.g = unidades.Enthalpy(fase.h-self.T*fase.s)

        fase.cv = unidades.SpecificHeat(estado.cv)
        fase.cp = unidades.SpecificHeat(estado.cp)
        fase.cp_cv = unidades.Dimensionless(fase.cp/fase.cv)
        fase.w = unidades.Speed(estado.w)

        fase.mu = unidades.Viscosity(estado.mu)
        fase.k = unidades.ThermalConductivity(estado.k)
        fase.nu = unidades.Diffusivity(fase.mu/fase.rho)
        fase.dielec = unidades.Dimensionless(iapws._Dielectric(estado.rho, self.T))
        fase.Prandt = unidades.Dimensionless(estado.mu*estado.cp/estado.k)

#            fase.joule=unidades.TemperaturePressure(self.Liquido["hjt"], "KkPa")
#        fase.xkappa=unidades.InvPressure(DerivTerms("IsothermalCompressibility", self.T, fase.rho, self.name), "kPa")
#        fase.alfav=unidades.InvTemperature(-estado.PFC.drhodT_constp()/estado.rho)

        cp0 = iapws.prop0(self.T, self.P)
        fase.v0 = unidades.SpecificVolume(cp0.v)
        fase.h0 = unidades.Enthalpy(cp0.h)
        fase.u0 = unidades.Enthalpy(fase.h0-self.P*1000*fase.v0)
        fase.s0 = unidades.SpecificHeat(cp0.s)
        fase.a0 = unidades.Enthalpy(fase.u0-self.T*fase.s0)
        fase.g0 = unidades.Enthalpy(fase.h0-self.T*fase.s0)
        fase.cp0 = unidades.SpecificHeat(cp0.cp)
        fase.cv0 = unidades.SpecificHeat(cp0.cv)
        fase.cp0_cv = unidades.Dimensionless(fase.cp0/fase.cv0)
        fase.w0 = cp0.w
#        fase.gamma0 = cp0.gamma
        fase.f = unidades.Pressure(self.P*exp((fase.g-fase.g0)/R/self.T))
Example #21
0
 def _visco0(self):
     # FIXME: Da buenos resultados, pero los resultados difierente en la tercera cifra significativa.
     a = [
         17.67484, -2.78751, 311498.7, -48826500, 3938774000, -1.654629e11,
         2.86561e12
     ]
     Tr = self.T / 0.29944
     y = 0.68321 * (a[0] + a[1] * log10(Tr) + a[2] / Tr**2 + a[3] / Tr**3 +
                    a[4] / Tr**4 + a[5] / Tr**5 + a[6] / Tr**6)
     nt = 266.93 * (self.T * self.M)**0.5 / y
     om = self.rho / 1673.0
     c = [1.03010, -0.99175, 2.47127, -3.11864, 1.57066]
     b = [0.48148, -1.18732, 2.80277, -5.41058, 7.04779, -3.76608]
     sigma = 0.000000000305 * (
         sum([ci * om**i for i, ci in enumerate(c)]) -
         sum([bi * om**i
              for i, bi in enumerate(b)]) * log10(self.T / 122.1))
     br = 2.0 / 3.0 * pi * Avogadro * sigma**3
     brho = self.rho / self.M * 1000 * br
     d = [1, 0.27676, 0.014355, 2.6480, -1.9643, 0.89161]
     nd = sum([di * brho**i for i, di in enumerate(d)])
     return unidades.Viscosity(nd * nt / 100, "muPas")
Example #22
0
    def fill(self, fase, estado):
        fase._bool = True
        fase.M = unidades.Dimensionless(estado.molar_mass()*1000)
        fase.rho = unidades.Density(estado.rhomass())
        fase.v = unidades.SpecificVolume(1./fase.rho)
        fase.Z = unidades.Dimensionless(estado.keyed_output(CP.iZ))

        fase.h = unidades.Enthalpy(estado.hmass())
        fase.s = unidades.SpecificHeat(estado.smass())
        fase.u = unidades.Enthalpy(estado.umass())
        fase.a = unidades.Enthalpy(fase.u-self.T*fase.s)
        fase.g = unidades.Enthalpy(fase.h-self.T*fase.s)
        if self._multicomponent:
            fase.fi = []
            fase.f = []
            for i in range(len(self.kwargs["ids"])):
                fase.fi.append(unidades.Dimensionless(
                    estado.fugacity_coefficient(i)))
                fase.f.append(unidades.Pressure(estado.fugacity(i)))
        else:
            fase.fi = [unidades.Dimensionless(
                exp(estado.alphar()+estado.delta()*estado.dalphar_dDelta() -
                    log(1+estado.delta()*estado.dalphar_dDelta())))]
            fase.f = [unidades.Pressure(self.P*f) for f in fase.fi]

        fase.cv = unidades.SpecificHeat(estado.cvmass())
        fase.cp = unidades.SpecificHeat(estado.cpmass())
        fase.cp_cv = unidades.Dimensionless(fase.cp/fase.cv)
        fase.gamma = fase.cp_cv
        fase.w = unidades.Speed(estado.speed_sound())

        fase.rhoM = unidades.MolarDensity(estado.rhomolar(), "molm3")
        fase.hM = unidades.MolarEnthalpy(estado.hmolar(), "Jmol")
        fase.sM = unidades.MolarSpecificHeat(estado.smolar(), "JmolK")
        fase.uM = unidades.MolarEnthalpy(estado.umolar(), "Jmol")
        fase.aM = unidades.MolarEnthalpy(fase.a*self.M)
        fase.gM = unidades.MolarEnthalpy(fase.g*self.M)
        fase.cvM = unidades.MolarSpecificHeat(estado.cvmolar(), "JmolK")
        fase.cpM = unidades.MolarSpecificHeat(estado.cpmolar(), "JmolK")

        fase.joule = unidades.TemperaturePressure(
            estado.first_partial_deriv(CP.iT, CP.iP, CP.iHmass))
        fase.Gruneisen = unidades.Dimensionless(
            fase.v/fase.cv*estado.first_partial_deriv(CP.iP, CP.iT, CP.iDmass))
        fase.alfav = unidades.InvTemperature(
            estado.isobaric_expansion_coefficient())
        fase.kappa = unidades.InvPressure(estado.isothermal_compressibility())
        fase.kappas = unidades.InvPressure(
            -1/fase.v*self.derivative("v", "P", "s", fase))
        fase.alfap = unidades.Density(fase.alfav/self.P/fase.kappa)
        fase.betap = unidades.Density(
            -1/self.P*self.derivative("P", "v", "T", fase))
        fase.betas = unidades.TemperaturePressure(
            estado.first_partial_deriv(CP.iT, CP.iP, CP.iSmass))

        fase.kt = unidades.Dimensionless(
            fase.rho/self.P*estado.first_partial_deriv(
                CP.iP, CP.iDmass, CP.iT))
        fase.Ks = unidades.Pressure(
            fase.rho*estado.first_partial_deriv(CP.iP, CP.iDmass, CP.iSmass))
        fase.Kt = unidades.Pressure(
            fase.rho*estado.first_partial_deriv(CP.iP, CP.iDmass, CP.iT))
        fase.ks = unidades.Dimensionless(
            fase.rho/self.P*estado.first_partial_deriv(
                CP.iP, CP.iDmass, CP.iSmass))
        fase.dhdT_rho = unidades.SpecificHeat(
            estado.first_partial_deriv(CP.iHmass, CP.iT, CP.iDmass))
        fase.dhdT_P = unidades.SpecificHeat(
            estado.first_partial_deriv(CP.iHmass, CP.iT, CP.iP))
        fase.dhdP_T = unidades.EnthalpyPressure(
            estado.first_partial_deriv(CP.iHmass, CP.iP, CP.iT))  # deltat
        fase.deltat = fase.dhdP_T
        fase.dhdP_rho = unidades.EnthalpyPressure(
            estado.first_partial_deriv(CP.iHmass, CP.iP, CP.iDmass))
        fase.dhdrho_T = unidades.EnthalpyDensity(
            estado.first_partial_deriv(CP.iHmass, CP.iDmass, CP.iT))
        fase.dhdrho_P = unidades.EnthalpyDensity(
            estado.first_partial_deriv(CP.iHmass, CP.iDmass, CP.iP))
        fase.dpdT_rho = unidades.PressureTemperature(
            estado.first_partial_deriv(CP.iP, CP.iT, CP.iDmass))
        fase.dpdrho_T = unidades.PressureDensity(
            estado.first_partial_deriv(CP.iP, CP.iDmass, CP.iT))
        fase.drhodP_T = unidades.DensityPressure(
            estado.first_partial_deriv(CP.iDmass, CP.iP, CP.iT))
        fase.drhodT_P = unidades.DensityTemperature(
            estado.first_partial_deriv(CP.iDmass, CP.iT, CP.iP))

        fase.Z_rho = unidades.SpecificVolume((fase.Z-1)/fase.rho)
        fase.IntP = unidades.Pressure(
            self.T*estado.first_partial_deriv(CP.iP, CP.iT, CP.iDmass)-self.P)
        fase.hInput = unidades.Enthalpy(
            -fase.rho*estado.first_partial_deriv(CP.iHmass, CP.iDmass, CP.iP))

        fase.virialB = unidades.SpecificVolume(estado.Bvirial())
        fase.virialC = unidades.SpecificVolume_square(estado.Cvirial())
        fase.invT = unidades.InvTemperature(-1/self.T)

        fase.mu = unidades.Viscosity(estado.viscosity())
        fase.nu = unidades.Diffusivity(fase.mu/fase.rho)
        fase.k = unidades.ThermalConductivity(estado.conductivity())
        fase.alfa = unidades.Diffusivity(fase.k/fase.rho/fase.cp)
        fase.Prandt = unidades.Dimensionless(estado.Prandtl())
        fase.fraccion = estado.get_mole_fractions()
        fase.fraccion_masica = estado.get_mass_fractions()
        fase.epsilon = unidades.Dimensionless(None)
Example #23
0
    def readStatefromJSON(self, fluid):
        if fluid:
            self._bool = True

            self.M = unidades.Dimensionless(fluid["M"])
            self.v = unidades.SpecificVolume(fluid["v"])
            self.rho = unidades.Density(1 / self.v)

            self.h = unidades.Enthalpy(fluid["h"])
            self.s = unidades.SpecificHeat(fluid["s"])
            self.u = unidades.Enthalpy(fluid["u"])
            self.a = unidades.Enthalpy(fluid["a"])
            self.g = unidades.Enthalpy(fluid["g"])

            self.cv = unidades.SpecificHeat(fluid["cv"])
            self.cp = unidades.SpecificHeat(fluid["cp"])
            self.cp_cv = unidades.Dimensionless(fluid["cp/cv"])
            self.w = unidades.Speed(fluid["w"])

            self.Z = unidades.Dimensionless(fluid["Z"])
            self.alfav = unidades.InvTemperature(fluid["alfav"])
            self.kappa = unidades.InvPressure(fluid["kappa"])
            self.kappas = unidades.InvPressure(fluid["kappas"])

            self.mu = unidades.Viscosity(fluid["mu"])
            self.k = unidades.ThermalConductivity(fluid["k"])
            self.nu = unidades.Diffusivity(fluid["nu"])
            self.Prandt = unidades.Dimensionless(fluid["Prandt"])

            self.alfa = unidades.Diffusivity(fluid["alfa"])
            self.joule = unidades.TemperaturePressure(fluid["joule"])
            self.deltat = unidades.EnthalpyPressure(fluid["deltat"])
            self.gamma = unidades.Dimensionless(fluid["gamma"])

            self.alfap = unidades.Dimensionless(fluid["alfap"])
            self.betap = unidades.Dimensionless(fluid["betap"])
            self.fi = [unidades.Dimensionless(f) for f in fluid["fi"]]
            self.f = [unidades.Pressure(f) for f in fluid["f"]]

            self.Q = unidades.VolFlow(fluid["volFlow"])
            self.caudalmasico = unidades.MassFlow(fluid["massFlow"])
            self.caudalmolar = unidades.MolarFlow(fluid["molarFlow"])
            self.fraccion = [
                unidades.Dimensionless(x) for x in fluid["fraction"]
            ]
            self.fraccion_masica = [
                unidades.Dimensionless(x) for x in fluid["massFraction"]
            ]
            self.caudalunitariomasico = [
                unidades.MassFlow(x) for x in fluid["massUnitFlow"]
            ]
            self.caudalunitariomolar = [
                unidades.MolarFlow(x) for x in fluid["molarUnitFlow"]
            ]

            self.rhoM = unidades.MolarDensity(self.rho / self.M)
            self.hM = unidades.MolarEnthalpy(self.h / self.M)
            self.sM = unidades.MolarSpecificHeat(self.s / self.M)
            self.uM = unidades.MolarEnthalpy(self.u / self.M)
            self.aM = unidades.MolarEnthalpy(self.a / self.M)
            self.gM = unidades.MolarEnthalpy(self.g / self.M)
            self.cvM = unidades.MolarSpecificHeat(self.cv / self.M)
            self.cpM = unidades.MolarSpecificHeat(self.cp / self.M)
Example #24
0
    def _visco0(self, rho, T, fase):
        # FIXME: Good values, but tiny desviation

        # Correlation parameters, Table 3
        rhoc = 273.
        sigma0 = 0.3408e-9
        sigmac = 0.7193422e-9

        rhom = rho / self.M * 1000
        T_ = T / self._viscosity["ek"]
        Tr = T / self.Tc
        rhor = rho / rhoc

        # Zero-density limit viscosity, Eq 3
        muo = self._Visco0(T)

        # Second viscosity virial coefficient, Eq 13
        bi = [
            -19.572881, 219.73999, -1015.3226, 2471.0125, -3375.1717,
            2491.6597, -787.26086, 14.085455, -0.34664158
        ]
        ti = [0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2.5, 5.5]
        B_ = 0
        for t, b in zip(ti, bi):
            B_ += b / T_**t
        B = B_ * Avogadro * sigma0**3

        # Third viscosity virial coefficient, Eq 14
        C = 1.86222085e-3 * T_**3 * exp(
            9.990338 / T_**0.5) * (Avogadro * sigma0**3)**2

        # Gas phase viscosity, Eq 12
        mug = 1 + B * rhom + C * rhom**2

        # High-density region
        di = [
            -1.181909, 0.5031030, -0.6268461, 0.5169312, -0.2351349,
            0.053980235, -4.9069617e-3
        ]
        ei = [
            0, 4.018368, -4.239180, 2.245110, -0.5750698, 2.3021026e-2,
            2.5696775e-2, -6.8372749e-3, 7.2707189e-4, -2.9255711e-5
        ]
        suma = 0
        for i, d in enumerate(di):
            suma += d / Tr**i
        for j, e in enumerate(ei):
            suma += e * rhor**j

        Shs = sigmac * suma  # Eq 17
        b = 2 * pi * Avogadro * Shs**3 / 3  # Close-packed volume
        Xi = b * rhom / 4  # Packing fraction
        g = (1 - 0.5 * Xi) / (1 - Xi)**3  # Radial distribution function

        # Eq 15
        mue = 1 / g + 0.8 * b * rhom + 0.761 * g * (b * rhom)**2

        # Eq 18
        f = 1 / (1 + exp(5 * (rhor - 1)))
        mu = muo * 1e-6 * (f * mug + (1 - f) * mue)
        return unidades.Viscosity(mu, "Pas")
Example #25
0
    def fill(self, fase, T, rho, x):
        if sum(x) != 1:
            x = [round(xi, 10) for xi in x]
        mol = refprop.wmol(x)
        thermo = refprop.therm2(T, rho, x)
        thermo3 = refprop.therm3(T, rho, x)

        fase._bool = True
        fase.M = unidades.Dimensionless(mol["wmix"])
        fase.rho = unidades.Density(rho*fase.M)
        fase.v = unidades.SpecificVolume(1./fase.rho)
        fase.Z = unidades.Dimensionless(thermo["Z"])

        fase.u = unidades.Enthalpy(thermo["e"]/fase.M, "Jg")
        fase.h = unidades.Enthalpy(thermo["h"]/fase.M, "Jg")
        fase.s = unidades.SpecificHeat(thermo["s"]/fase.M, "JgK")
        fase.a = unidades.Enthalpy(thermo["A"]/fase.M, "Jg")
        fase.g = unidades.Enthalpy(thermo["G"]/fase.M, "Jg")

        fase.cv = unidades.SpecificHeat(thermo["cv"]/fase.M, "JgK")
        fase.cp = unidades.SpecificHeat(thermo["cp"]/fase.M, "JgK")
        fase.cp_cv = unidades.Dimensionless(fase.cp/fase.cv)
        fase.gamma = fase.cp_cv
        fase.w = unidades.Speed(thermo["w"])

        fase.rhoM = unidades.MolarDensity(fase.rho/self.M)
        fase.hM = unidades.MolarEnthalpy(fase.h*self.M)
        fase.sM = unidades.MolarSpecificHeat(fase.s*self.M)
        fase.uM = unidades.MolarEnthalpy(fase.u*self.M)
        fase.aM = unidades.MolarEnthalpy(fase.a*self.M)
        fase.gM = unidades.MolarEnthalpy(fase.g*self.M)
        fase.cvM = unidades.MolarSpecificHeat(fase.cv*self.M)
        fase.cpM = unidades.MolarSpecificHeat(fase.cp*self.M)

        residual = refprop.residual(T, rho, x)
        fase.pr = unidades.Pressure(residual["pr"], "kPa")
        fase.ur = unidades.Enthalpy(residual["er"]/fase.M, "Jg")
        fase.hr = unidades.Enthalpy(residual["hr"]/fase.M, "Jg")
        fase.sr = unidades.SpecificHeat(residual["sr"]/fase.M, "JgK")
        fase.ar = unidades.Enthalpy(residual["Ar"]/fase.M, "Jg")
        fase.gr = unidades.Enthalpy(residual["Gr"]/fase.M, "Jg")
        fase.cvr = unidades.SpecificHeat(residual["cvr"]/fase.M, "JgK")
        fase.cpr = unidades.SpecificHeat(residual["cpr"]/fase.M, "JgK")

        fase.alfav = unidades.InvTemperature(thermo["beta"])
        fase.kappa = unidades.InvPressure(thermo["xkappa"], "kPa")
        fase.kappas = unidades.InvPressure(thermo3["betas"], "kPa")
        fase.alfap = unidades.Density(fase.alfav/self.P/fase.kappa)
        fase.deltat = unidades.EnthalpyPressure(
            thermo3["thrott"]/fase.M, "kJkgkPa")
        fase.joule = unidades.TemperaturePressure(thermo["hjt"], "KkPa")
        fase.betas = unidades.TemperaturePressure(
            self.derivative("T", "P", "s", fase))
        fase.betap = unidades.Density(
            -1/self.P*self.derivative("P", "v", "T", fase))

        fase.Kt = unidades.Pressure(thermo3["xkkt"], "kPa")
        fase.Ks = unidades.Pressure(thermo3["bs"], "kPa")
        fase.kt = unidades.Dimensionless(thermo3["xkt"])
        fase.ks = unidades.Dimensionless(thermo3["xisenk"])

        dh = refprop.dhd1(T, rho, x)
        fase.dhdT_rho = unidades.SpecificHeat(dh["dhdt_D"]/fase.M, "kJkgK")
        fase.dhdT_P = unidades.SpecificHeat(dh["dhdt_p"]/fase.M, "kJkgK")
        fase.dhdP_T = unidades.EnthalpyPressure(dh["dhdp_t"]/fase.M, "kJkgkPa")
        # dhdtp_D : fix in library
        fase.dhdP_rho = unidades.EnthalpyPressure(
            dh["dhdtp_D"]/fase.M, "kJkgkPa")
        fase.dhdrho_T = unidades.EnthalpyDensity(
            dh["dhdD_t"]/fase.M**2, "kJkgkgm3")
        fase.dhdrho_P = unidades.EnthalpyDensity(
            dh["dhdD_p"]/fase.M**2, "kJkgkgm3")

        fase.dpdT_rho = unidades.PressureTemperature(thermo["dpdt"], "kPaK")
        fase.dpdrho_T = unidades.PressureDensity(
            thermo["dpdD"]/fase.M, "kPakgm3")
        # TODO: Add unit for derivative d^2p/dD^2 [kPa-L^2/mol^2]
        # MPa·m⁶/kg²
        fase.d2pdrho2 = unidades.Dimensionless(thermo["d2pdD2"]/fase.M**2/1000)
        fase.drhodP_T = unidades.DensityPressure(
            thermo["dDdp"]*fase.M, "kgm3kPa")
        fase.drhodT_P = unidades.DensityTemperature(thermo["dDdt"]*fase.M)
        fase.Gruneisen = unidades.Dimensionless(fase.v/fase.cv*fase.dpdT_rho)

        fase.Z_rho = unidades.SpecificVolume((fase.Z-1)/fase.rho)
        fase.IntP = unidades.Pressure(thermo3["pint"], "kPa")
        fase.hInput = unidades.Enthalpy(thermo3["spht"]/fase.M, "kJkg")
        fase.invT = unidades.InvTemperature(-1/self.T)

        fpv = refprop.fpv(T, rho, self.P.kPa, x)["Fpv"]
        fase.fpv = unidades.Dimensionless(fpv)

        chempot = refprop.chempot(T, rho, x)["u"]
        fase.chempot = [unidades.Enthalpy(c/fase.M) for c in chempot]
        fi = refprop.fugcof(T, rho, x)["f"]
        fase.fi = [unidades.Dimensionless(f) for f in fi]
        f = refprop.fgcty(T, rho, x)["f"]
        fase.f = [unidades.Pressure(f_i, "kPa") for f_i in f]

        b = refprop.virb(T, x)["b"]
        fase.virialB = unidades.SpecificVolume(b/self.M)
        c = refprop.virc(T, x)["c"]
        fase.virialC = unidades.SpecificVolume_square(c/self.M**2)
        # viriald don't supported for windows
        d = refprop.vird(T, x)["d"]
        fase.virialD = unidades.Dimensionless(d/self.M**3)
        ba = refprop.virba(T, x)["ba"]
        fase.virialBa = unidades.SpecificVolume(ba/self.M)
        ca = refprop.virca(T, x)["ca"]
        fase.virialCa = unidades.SpecificVolume_square(ca/self.M**2)
        dcdt = refprop.dcdt(T, x)["dct"]
        fase.dCdt = unidades.Dimensionless(dcdt/self.M**2)
        dcdt2 = refprop.dcdt2(T, x)["dct2"]
        fase.dCdt2 = unidades.Dimensionless(dcdt2/self.M**2)
        dbdt = refprop.dbdt(T, x)["dbt"]
        fase.dBdt = unidades.Dimensionless(dbdt/self.M)

        b12 = refprop.b12(T, x)["b"]
        fase.b12 = unidades.SpecificVolume(b12*fase.M)
        try:
            cstar = refprop.cstar(T, self.P.kPa, 0, x)["cs"]
            fase.cstar = unidades.Dimensionless(cstar)
        except refprop.RefpropdllError:
            fase.cstar = unidades.Dimensionless(None)

        fase.fraccion = [unidades.Dimensionless(xi) for xi in x]
        xg = refprop.xmass(x)["xkg"]
        fase.fraccion_masica = [unidades.Dimensionless(xi) for xi in xg]

        transport = refprop.trnprp(T, rho, x)
        fase.mu = unidades.Viscosity(transport["eta"], "muPas")
        fase.nu = unidades.Diffusivity(fase.mu/fase.rho)
        fase.k = unidades.ThermalConductivity(transport["tcx"])
        fase.alfa = unidades.Diffusivity(fase.k/fase.rho/fase.cp)
        fase.Prandt = unidades.Dimensionless(fase.mu*fase.cp/fase.k)

        dielec = refprop.dielec(T, rho, x)
        fase.epsilon = unidades.Dimensionless(dielec["de"])
Example #26
0
 def _visco0(self, rho, T, fase):
     mu = _D2O_Viscosity(rho, T)
     return unidades.Viscosity(mu)