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)
def _thermo0(self, rho, T, fase=None): ek = 103.3 sigma = 0.36 rhoc = 10.4477 * self.M tau = self.Tc / T delta = rho / rhoc N = [10.72, 1.122, 0.002019] t = [.2, .05, 2.4] n_poly = [-8.876, -0.02916] t_poly = [.6, 3.6] d_poly = [1, 8] l_poly = [1, 1] g_poly = [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) lo = N[0] * muo + N[1]**tau**t[1] + N[2] * tau**t[2] lr = 0 for n, t, d, l, g in zip(n_poly, t_poly, d_poly, l_poly, g_poly): lr += n * tau**t * delta**d * exp(-g * delta**l) # TODO: Critical enchancement lc = 0 return unidades.ThermalConductivity(lo + lr + lc, "mWmK")
def _thermo0(self, rho, T, fase): GT = [ -2.903423528e5, 4.680624952e5, -1.8954783215e5, -4.8262235392e3, 2.243409372e4, -6.6206354818e3, 8.9937717078e2, -6.0559143718e1, 1.6370306422 ] lo = 0 for i in range(-3, 6): lo += GT[i + 3] * T**(i / 3.) tita = (rho.gcc - 0.221) / 0.221 j = [ 0, -1.304503323e1, 1.8214616599e1, 9.903022496e3, 7.420521631e2, -3.0083271933e-1, 9.6456068829e1, 1.350256962e4 ] l1 = exp(j[1] + j[4] / T) * ( exp(rho.gcc**0.1 * (j[2] + j[3] / self.T**1.5) + tita * rho.gcc**0.5 * (j[5] + j[6] / T + j[7] / T**2)) - 1.) lc = 0 # FIXME: no sale # deltarho=(self.rho/self.M-0.221)/0.221 # deltaT=(self.T-282.34)/282.34 # xkt=(1.0/self.rho/self.M/self.derivative("P", "rho", "T")*1e3)**0.5 # b=abs(deltarho)/abs(deltaT)**1.19 # xts=(self.rho/self.M)**2*xkt*5.039/.221**2 # g=xts*abs(deltaT)**1.19 # xi=0.69/(b**2*5.039/g/Boltzmann/282.34)**0.5 # f=exp(-18.66*deltaT**2-4.25*deltarho**4) # c=(self.M/self.rho.gcc/Avogadro/Boltzmann/self.T)**0.5 # lc=c*Boltzmann*self.T**2/6.0/pi/self.mu.muPas/xi*self.dpdT**2*self.kappa**0.5*f # print lo, l1 return unidades.ThermalConductivity(lo + l1 + lc, "mWmK")
def _thermo0(self, rho, T, fase=None): bkt = 0.0 n0 = [3.739232544, -26.20316969, 59.82252246, -49.26397634] suma = sum([ni * self.T**(-i - 1) for i, ni in enumerate(n0)]) lg = 2.7870034e-3 * self.T**0.7034007057 * exp(suma) tau = self.T**(1.0 / 3.0) delta = self.rho / self.M / 0.2498376 t = [0, 3, 1, 2, 0, 1, 2, 0, 1, 2, -3, 0, 1, 2, -3] d = [1, 1, 1, 1, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2] c = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0] n = [ 0.186297053e-3, -0.7275964435e-6, -0.1427549651e-3, 0.3290833592e-4, -0.5213335363e-7, 0.4492659933e-7, -0.5924416513e-8, 0.7087321137e-5, -0.6013335678e-5, 0.8067145814e-6, 0.3995125013e-6, -2.99050061466e-5, 2.53733162271e-5, -3.40393839209e-6, -1.68574607754e-6 ] lk = 0 for ti, di, ni, ci in zip(t, d, n, c): if ci == 0 or delta == 0: lk += ni * tau**ti * delta**di else: lk += ni * tau**ti * delta**di * log(delta**ci) lc = 0 if 3.5 <= self.T <= 12: e1 = 2.8461 e2 = .27156 delta = 4.304 # pcc = 227460. if self.rho > 0.0: bkt = 1.0 / self.derivative("P", "rho", "T") / self.rho / 1000. deld = abs((self.rho - 69.158) / 69.158) delt = abs((self.T - 5.18992) / 5.18992) r2 = (delt / 0.2)**2 + (deld / 0.25)**2 if r2 < 1.0 and self.rho > 0.0: xx = delt / deld**(1.0 / .3554) x1 = (xx + .392) / .392 x2b = x1**(2.0 * .3554) x2be = (1.0 + e2 * x2b)**((1.1743 - 1.0) / 2.0 / .3554) hh = e1 * x1 * x2be dhdx = e1 * x2be / .392 + e1 * e2 / .392 * x2b * x2be / ( 1.0 + e2 * x2b) * (1.1743 - 1.0) d2kt = (delta * hh - xx * dhdx / .3554) * deld**(delta - 1.0) bkt1 = (69.158 / self.rho)**2 / d2kt / 227460. bkt = r2 * bkt + (1.0 - r2) * bkt1 eta = self._visco0(coef=True) bkcrit = 0 if bkt >= 0 and self.rho > 0.0: bkcrit = 3.4685233e-17 * self.T**2 * bkt**0.5 / self.rho / eta * self.dpdT**2 * exp( -18.66 * delt**2 - 4.25 * deld**4) lc = 3.726229668 * bkcrit return unidades.ThermalConductivity(lg + lk + lc)
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]
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]
def _thermo1(self, rho, T, fase=None): """Hardcoded method for thermal conductivity correlation by McCarty""" # FIXME: The correlation for T < 300K dont work # Density g/cm³ rho_gcc = rho * 1e-3 def ko(T): """Dilute gas contribution""" x = log(T) Z = -4.3611622157 + 1.9250159286*x - 0.52544120165*x**2 + \ 0.090045763885*x**3 - 0.0054773874808*x**4 # Eq 7 lo = exp(Z * x) # Eq 6 return lo def ky(T, rho): """Correction for dilute gas""" x = log(T) B = exp(4.7470660612 - 5.3641468153 * x + 3.4639703698 * x**2 - # Eq 9 1.0702455443 * x**3 + 0.1571349306 * x**4 - 0.00892140047 * x**5) C = 2.2109006708 + 187.74174808/T - 1281.0947055/T**2 + \ 3645.2393216/T**3 - 3986.6937948/T**4 # Eq 10 ly = exp(B * rho + C * rho**2) # Eq 8 return ly if T < 300: lo = ko(T) ly = ky(T, rho_gcc) # C)itical enchancement lc = 0 l = lo * ly + lc # print(lo, ly) else: # Dilute gas contribution, Eq 13 lo = 1.53220256 * T**0.71938 * exp(12.451 / T - 295.67 / T**2 - 4.1249) le = ko(300) * (ky(T, rho_gcc) - 1) l = lo + le return unidades.ThermalConductivity(l * 1e2, "mWmK")
def _thermo0(self): rhol = 68.345 B1 = -2.5370 B2 = 0.05366 C1 = 0.94215 C2 = 0.14914 deltaG = 2508.58 lmax = 25. Drho = rhol-self.rho/self.M delta = self.rho/self.M-7.5114 tau = self.T-299.28 lg = (B1+B2*self.T)*(Drho/rhol)**C1 lr = (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) lc = 4*lmax/(exp(delta)+exp(-delta))/(exp(tau)+exp(-tau)) return unidades.ThermalConductivity(lg+lr+lc, "mWmK")
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))
def _thermo0(self, rho, T, fase): # λ1 in Eq 3 is always 0 GT = [ -2.903423528e5, 4.680624952e5, -1.8954783215e5, -4.8262235392e3, 2.243409372e4, -6.6206354818e3, 8.9937717078e2, -6.0559143718e1, 1.6370306422 ] lo = 0 for i in range(-3, 6): lo += GT[i + 3] * T**(i / 3.) tita = (rho - 221) / 221 k = [ -1.304503323e1, 1.8214616599e1, -9.903022496e3, 7.420521631e2, -3.0083271933e-1, 9.6456068829e1, 1.350256962e4 ] l2 = exp(k[0] + k[3] / T) * ( exp(rho.gcc**0.1 * (k[1] + k[2] / T**1.5) + tita * rho.gcc**0.5 * (k[4] + k[5] / T + k[6] / T**2)) - 1) # Critical enhancement deltarho = (rho - 221) / 221 deltaT = (T - 282.34) / 282.34 xt = rho**2 * fase.kappa * 5.039 / 221**2 B = abs(deltarho) / abs(deltaT)**1.19 # Eq 11 Gamma = xt * abs(deltaT)**1.19 # Eq 12 xi = 0.69 / (B**2 * 5.039 / Gamma / Boltzmann / 282.34)**0.5 # Eq 14 # Eq 19 F = exp(-18.66 * deltaT**2) * exp(-4.25 * deltarho**4) # Eq 18 c = (self.M / rho.gcc / Avogadro / Boltzmann / T)**0.5 d = Boltzmann * T**2 / 6 / pi / fase.mu.muPas / xi lc = c * d * fase.dpdT_rho**2 * fase.kappa**0.5 * F return unidades.ThermalConductivity(lo + l2 + lc, "mWmK")
def _thermo0(self, rho, T, fase=None): rhor = rho / 358 Tr = T / 643.847 tau = Tr / (abs(Tr - 1.1) + 1.1) no = [1.0, 37.3223, 22.5485, 13.0465, 0.0, -2.60735] Lo = sum([Li * Tr**i for i, Li in enumerate(no)]) nr = [483.656, -191.039, 73.0358, -7.57467] Lr = -167.31 * (1 - exp(-2.506 * rhor)) + sum( [Li * rhor**(i + 1) for i, Li in enumerate(nr)]) f1 = exp(0.144847 * Tr - 5.64493 * Tr**2) f2 = exp(-2.8 * (rhor - 1)**2) - 0.080738543 * exp(-17.943 * (rhor - 0.125698)**2) f3 = 1 + exp(60 * (tau - 1) + 20) f4 = 1 + exp(100 * (tau - 1) + 15) Lc = 35429.6 * f1 * f2 * (1 + f2**2 * (5e9 * f1**4 / f3 + 3.5 * f2 / f4)) Ll = -741.112 * f1**1.2 * (1 - exp(-(rhor / 2.5)**10)) return unidades.ThermalConductivity(0.742128e-3 * (Lo + Lr + Lc + Ll))
def _thermo1(self, rho, T, fase=None): k = 2.682e-3*(1+1.123e-3*self.P.bar)*T**(0.71*(1-2e-4*self.P.bar)) return unidades.ThermalConductivity(k)
def _thermo0(self, rho, T, fase=None): """Hardcoded method for Hands thermal conductivity correlation""" # Dilute-gas contribution # Table 1, Using fit parameter excluding Golubev and Shpagina's data Ci = [3.739232544, -26.20316969, 59.82252246, -49.26397634] # Eq 3 lnLo = 0 for i, C in enumerate(Ci): lnLo += C / T**(i + 1) lo = 2.7870034e-3 * T**0.7034007057 * exp(lnLo) # Special case for zero density if not rho: return unidades.ThermalConductivity(lo) # Excess conductivity # Table 3, Parameters tau = T**(1 / 3) ti = [0, 3, 1, 2, 0, 1, 2, 0, 1, 2, -3] di = [1, 1, 1, 1, 3, 3, 3, 2, 2, 2, 2] ci = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1] ni = [ 1.86297053e-4, -7.275964435e-7, -1.427549651e-4, 3.290833592e-5, -5.213335363e-8, 4.492659933e-8, -5.924416513e-9, 7.087321137e-6, -6.013335678e-6, 8.067145814e-7, 3.995125013e-7 ] # Eq 17 lr = 0 for t, d, n, c in zip(ti, di, ni, ci): if c: lr += n * tau**t * rho**d * log(rho / 68) else: lr += n * tau**t * rho**d # Critical enhancement lc = 0 if 3.5 < T < 12: # Constants, Table 2 Xo = 0.392 E1 = 2.8461 E2 = 0.27156 beta = 0.3554 gamma = 1.1743 delta = 4.304 rhoc = 69.158 Tc = 5.18992 Pc = 2.2746e5 # R = 4.633e-10 # Eq 8 DeltaT = abs(1 - T / Tc) Deltarho = abs(1 - rho / rhoc) kt = fase.kappa W = (DeltaT / 0.2)**2 + (Deltarho / 0.25)**2 # Eq 10 if W <= 1: x = DeltaT / Deltarho**(1 / beta) x1 = 1 + x / Xo x2 = x1**(2 * beta) x2be = (1 + E2 * x2)**((gamma - 1) / 2 / beta) h = E1 * x1 * x2be # dh/dx using cadena rule dhdx = E1 * x2be / Xo + E1 * E2 / Xo * x2 * x2be / ( 1 + E2 * x2) * (gamma - 1) # Right hand of Eq 9 z = Deltarho**(delta - 1) * (delta * h - x / beta * dhdx) kt_ = (rhoc / rho)**2 / z / Pc # Eq 9 kt = W * kt + (1 - W) * kt_ # Eq 11 # Eq 7 # REFPROP use another expression # c = (self.M/Avogadro*kt*Boltzmann*T**4/rho**2)**0.5 # lc = c/6/pi/fase.mu/R*fase.dpdT_rho**2 * \ # exp(-18.66*DeltaT**2-4.25*Deltarho**4) lc = kt**0.5*T**2/rho/fase.mu*fase.dpdT_rho**2 * \ exp(-18.66*DeltaT**2-4.25*Deltarho**4) lc = 3.4685233e-17 * 3.726229668 * lc # print(lo, lr, lc) return unidades.ThermalConductivity(lo + lr + lc)
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"])
def _thermo0(self, rho, T, fase): k = _D2O_ThCond(rho, T) return unidades.ThermalConductivity(k)
def _thermo1(self, rho, T, fase): # TODO: return unidades.ThermalConductivity(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)
def _thermo0(self, rho, T, fase=None): """Equation for the thermal conductivity Parameters ---------- rho : float Density [kg/m³] T : float Temperature [K] fase: dict phase properties Returns ------- k : float Thermal conductivity [W/mK] """ 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) # Eq 5 N = [1.308, 1.405, -1.036] t = [-1.1, -0.3] lo = N[0] * muo + N[1] * tau**t[0] + N[2] * tau**t[1] n_poly = [8.743, 14.76, -16.62, 3.793, -6.142, -0.3778] t_poly = [0.1, 0, 0.5, 2.7, 0.3, 1.3] d_poly = [1, 2, 3, 7, 7, 11] g_poly = [0, 0, 1, 1, 1, 1] l_poly = [0, 0, 2, 2, 2, 2] # Eq 6 lr = 0 for n, t, d, l, g in zip(n_poly, t_poly, d_poly, l_poly, g_poly): lr += n * tau**t * delta**d * exp(-g * delta**l) lc = 0 # FIXME: Tiny desviation in the test in paper, 0.06% at critical point if fase: qd = 0.31 Gamma = 0.055 Xio = 0.11 Tref = 265.262 k = 1.380658e-23 # J/K # Eq 11 X = self.Pc * 1e-3 * rho / rhoc**2 * fase.drhodP_T ref = Air() st = ref._Helmholtz(rho, Tref) drho = 1e3 / self.R / Tref / (1 + 2 * delta * st["fird"] + delta**2 * st["firdd"]) Xref = self.Pc * 1e-3 * rho / rhoc**2 * drho # Eq 10 bracket = X - Xref * Tref / T if bracket > 0: Xi = Xio * (bracket / Gamma)**(0.63 / 1.2415) Xq = Xi / qd # Eq 8 Omega = 2 / pi * ((fase.cp - fase.cv) / fase.cp * atan(Xq) + fase.cv / fase.cp * (Xq)) # Eq 9 Omega0 = 2 / pi * ( 1 - exp(-1 / (1 / Xq + Xq**2 / 3 * rhoc**2 / rho**2))) # Eq 7 lc = rho * fase.cp * k * 1.01 * T / 6 / pi / Xi / fase.mu * ( Omega - Omega0) * 1e15 else: lc = 0 # Eq 4 k = lo + lr + lc return unidades.ThermalConductivity(k, "mWmK")
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)