def eq_fD(self): eq = self.CreateEquation("fDturb", "Turbulent darcy factor") domains = distribute_on_domains(self.Domains, eq, eClosedClosed) fD = daeVariable_wrapper(self.fD, domains) v = daeVariable_wrapper(self.v, domains) D = daeVariable_wrapper(self.D, domains) T = daeVariable_wrapper(self.T, domains) P = daeVariable_wrapper(self.P, domains) Tast = T / Constant(1 * K) Past = P / Constant(1 * Pa) mu = viscosity(Tast, Past, simplified=True) * Constant(1 * (Pa**(1)) * (s**(1))) rho = density(Tast, Past, simplified=True) * Constant(1 * (kg**(1)) * (m**(-3))) Re = D * Abs(v) * rho / mu A = (2.457 * Log(((7 / Re)**0.9 + 0.27 * self.epw() / D)**-1))**16 B = (37530 / Re)**16 ff = 2 * ((8 / Re)**12 + (A + B)**-1.5)**(1 / 12) eq.Residual = fD - 4 * ff
def eq_calculate_hint(self): eq = self.CreateEquation("InternalConvection", "Internal convection - hint") domains = distribute_on_domains(self.Domains, eq, eClosedClosed) T = daeVariable_wrapper(self.T, domains) P = daeVariable_wrapper(self.P, domains) fD = daeVariable_wrapper(self.fD, domains) hint = daeVariable_wrapper(self.hint, domains) D = daeVariable_wrapper(self.D, domains) v = daeVariable_wrapper(self.v, domains) # Calculates the Nussel dimensionless number using Petukhov correlation modified by Gnielinski. See Incropera 4th Edition [8.63] mu = viscosity( T / Constant(1 * K) , P / Constant(1 * Pa), simplified = True) kappa = conductivity( T / Constant(1 * K), P / Constant(1 * Pa), simplified = True) cp = heat_capacity( T / Constant(1 * K), P / Constant(1 * Pa), simplified = True) rho = density( T / Constant(1 * K), P / Constant(1 * Pa), simplified = True) Dast = D / Constant(1 * m ) vast = v / Constant(1 * m * s ** -1) Re = Dast * Abs(vast) * rho / mu prandtl = cp * mu / kappa nusselt = (fD / 8.) * (Re - 1000.) * prandtl / ( 1. + 12.7 * Sqrt(fD / 8.) * (prandtl ** (2 / 3)) - 1.) eq.Residual = hint - nusselt * kappa / Dast * Constant(1 * W/(K * m**2))
def eq_calculate_hext(self): eq = self.CreateEquation("Hext", "Heat balance - Hext") xdomains = distribute_on_domains(self.XDomains, eq, eClosedClosed) ydomains = distribute_on_domains(self.YDomains, eq, eClosedClosed) domains = xdomains + ydomains g = self.g Text = self.Text() Do = self.Do() To = daeVariable_wrapper(self.To, domains) hext = daeVariable_wrapper(self.hext, domains) fNtub = daeVariable_wrapper(self.fNtub, ydomains) Tast = 0.5 * (Text + To) / Constant(1 * K) Past = self.Pext() / Constant(1 * Pa) hvap = vaporization_enthalpy(Past, simplified = True) * Constant(1 * J * (kg**-1) ) rhov = vapour_density( Past, simplified = True) * Constant(1 * (kg ** (1))*(m ** (-3))) rho_o = density( Tast, Past, simplified = True) * Constant(1 * (kg ** (1))*(m ** (-3))) mu_o = viscosity( Tast, Past, simplified = True) * Constant(1 * (Pa ** (1))*(s ** (1))) kappa_o = conductivity( Tast, Past, simplified = True) * Constant(1 * (K ** (-1))*(W ** (1))*(m ** (-1))) num = (g * rho_o * (rho_o - rhov) * kappa_o ** 3 * hvap) den = mu_o * Abs(Text - To) * Do hd1 = (0.729 * (num / den) ** 0.25) eq.Residual = hext - fNtub * hd1
def calculate_ext(Tvap, Pvap, To, fNtub_tube, L, Do): # Calculating properties T = 0.5 * (Tvap + To) g = 9.80665 film_density = density(T, Pvap, simplified=True) film_heat_capacity = heat_capacity(T, Pvap, simplified=True) film_conductivity = conductivity(T, Pvap, simplified=True) film_viscosity = viscosity(T, Pvap, simplified=True) film_prandtl = film_heat_capacity * film_viscosity / film_conductivity exhaust_steam_density = vapour_density(Pvap, simplified=True) exhaust_vaporization_heat = vaporization_enthalpy(Pvap, simplified=True) num = (g * film_density * (film_density - exhaust_steam_density) * film_conductivity**3. * exhaust_vaporization_heat) den = film_viscosity * (Tvap - To) * Do hext_row1 = 0.729 * (num / den)**0.25 Resext_row1 = 1 / (pi * Do * hext_row1 * L) hext = hext_row1 * fNtub_tube Resext = Resext_row1 / fNtub_tube return hext, Resext, exhaust_vaporization_heat
def eq_phid(self): eq = self.CreateEquation("phid", "phid") domains = distribute_on_domains(self.Domains, eq, eClosedClosed) k2 = self.k2 ksp = self.ksp conc_H = 10**(-self.pH()) conc_Ca = self.Ca() / 1000 / 40.078 conc_CO3 = k2 * self.Alc() / 1000 / (100.0869 * (conc_H + 2 * k2)) phid = daeVariable_wrapper(self.phid, domains) D = daeVariable_wrapper(self.D, domains) v = daeVariable_wrapper(self.v, domains) T = daeVariable_wrapper(self.T, domains) P = daeVariable_wrapper(self.P, domains) #Tast = 35+273.15 Tast = T / Constant(1 * K) Past = P / Constant(1 * Pa) vast = v / Constant(1 * m / s) rho = density(Tast, Past, simplified=True) * Constant(1 * (kg**(1)) * (m**(-3))) kappa = conductivity(Tast, Past, simplified=True) * Constant( 1 * (K**(-1)) * (W**(1)) * (m**(-1))) muast = viscosity(Tast, Past, simplified=True) mu = muast * Constant(1 * (Pa**(1)) * (s**(1))) Re = D * v * rho / mu kr = Exp(38.74 - Constant(20700.0 * 4.184 * J / mol) / (self.Rg * T)) Dab = Constant(3.07e-15 * m**2 / s) * (Tast / muast) Sc = mu / (rho * Dab) kd = 0.023 * vast * Re**-0.17 * Sc**-0.67 # eq.Residual = phid - 24 * 3600 * Constant(1 * kg * m ** -2 * s ** -1) * kd * \ # conc_CO3 * (1 - ksp / (conc_Ca * conc_CO3)) / \ # (1 + kd / (kr * conc_CO3) + conc_CO3 / conc_Ca) eq.Residual = phid - Constant(1 * kg * m ** -2 * s ** -1) * kd * \ conc_CO3 * (1 - ksp / (conc_Ca * conc_CO3)) / \ (1 + kd / (kr * conc_CO3) + conc_CO3 / conc_Ca)
def calculate_int(Tin, Tout, Pin, Pout, m_tube, ep, Df, L, Di): g = 9.81 T = 0.5 * (Tin + Tout) P = 0.5 * (Pin + Pout) # Calculating properties int_film_density = density(T, P, simplified=True) int_film_heat_capacity = heat_capacity(T, P, simplified=True) int_film_conductivity = conductivity(T, P, simplified=True) int_film_viscosity = viscosity(T, P, simplified=True) int_film_prandtl = int_film_heat_capacity * int_film_viscosity / int_film_conductivity v = (m_tube / int_film_density) / (0.25 * pi * Df**2) # m/s v_abs = abs(v) Re_tube = Df * int_film_density * v_abs / int_film_viscosity ff = calculate_fanning(ep, Df, Re_tube) fD_tube = 4 * ff # Calculating Darcy int_film_Re = Df * int_film_density * v_abs / int_film_viscosity int_film_fD = calculate_darcy(fD_tube, ep, Df, int_film_Re) # Calculates the Nussel dimensionless number using Petukhov correlation modified by Gnielinski. See Incropera 4th Edition [8.63] nusselt = (int_film_fD / 8.) * (int_film_Re - 1000.) * int_film_prandtl / ( 1. + 12.7 * (int_film_fD / 8.)**0.5 * (int_film_prandtl**(2 / 3) - 1.)) hint = nusselt * int_film_conductivity / Di # W/m2K Resint = 1 / (pi * Df * hint * L) # W/K tau = (1 / 8) * fD_tube * int_film_density * v**2 hL = 0.5 * fD_tube * v**2 / (Di * g) DeltaP = g * int_film_density * hL pressure_loss_in_tube = DeltaP * L Pout_ = Pin - pressure_loss_in_tube return hint, Resint, int_film_heat_capacity, Pout_, fD_tube, pressure_loss_in_tube, v, Re_tube, int_film_density, int_film_viscosity