예제 #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)
예제 #2
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]
예제 #3
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]
예제 #4
0
 def readStatefromJSON(self, fluid):
     Thermo.readStatefromJSON(self, fluid)
     if fluid:
         self.betas = unidades.TemperaturePressure(fluid["betas"])
         self.Gruneisen = unidades.Dimensionless(fluid["Gruneisen"])
         self.virialB = unidades.SpecificVolume(fluid["virialB"])
         self.virialC = unidades.SpecificVolume_square(fluid["virialC"])
         self.dpdT_rho = unidades.PressureTemperature(fluid["dpdT_rho"])
         self.dpdrho_T = unidades.PressureDensity(fluid["dpdrho_T"])
         self.drhodT_P = unidades.DensityTemperature(fluid["drhodT_P"])
         self.drhodP_T = unidades.DensityPressure(fluid["drhodP_T"])
         self.dhdT_rho = unidades.SpecificHeat(fluid["dhdT_rho"])
         self.dhdP_T = unidades.EnthalpyPressure(fluid["dhdP_T"])
         self.dhdT_P = unidades.SpecificHeat(fluid["dhdT_P"])
         self.dhdrho_T = unidades.EnthalpyDensity(fluid["dhdrho_T"])
         self.dhdP_rho = unidades.EnthalpyPressure(fluid["dhdP_rho"])
         self.kt = unidades.Dimensionless(fluid["kt"])
         self.ks = unidades.InvPressure(fluid["ks"])
         self.Ks = unidades.Pressure(fluid["Ks"])
         self.Kt = unidades.Pressure(fluid["Kt"])
         self.IntP = unidades.Pressure(fluid["IntP"])
         self.invT = unidades.InvTemperature(fluid["invT"])
         self.hInput = unidades.Enthalpy(fluid["hInput"])
         self.epsilon = unidades.Dimensionless(fluid["epsilon"])
예제 #5
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)
예제 #6
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"])
예제 #7
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)