def round_edge_grill(alpha, l=None, Dh=None, fd=None): r'''Returns the loss coefficient for a rounded square grill or square bar screen or perforated plate with rounded edges of thickness l, as shown in [1]_. for Dh < l < 50D .. math:: K = lookup(alpha) else: .. math:: K = lookup(alpha) + \frac{fl}{\alpha^2D} Parameters ---------- alpha : float Fraction of grill open to flow [-] l : float, optional Thickness of the grill or plate [m] Dh : float, optional Hydraulic diameter of gap in grill, [m] fd : float, optional Darcy friction factor [-] Returns ------- K : float Loss coefficient [-] Notes ----- If l, Dh, or fd is not provided, the first expression is used instead. The alteration of the expression to include friction factor is there if the grill is long enough to have considerable friction along the surface of the grill. alpha must be between 0.3 and 0.7. The velocity the loss coefficient relates to is the approach velocity before the grill. Examples -------- >>> round_edge_grill(.4) 1.0 >>> round_edge_grill(.4, l=.15, Dh=.002, fd=.0185) 2.3874999999999997 References ---------- .. [1] Blevins, Robert D. Applied Fluid Dynamics Handbook. New York, N.Y.: Van Nostrand Reinhold Co., 1984. ''' t1 = float(splev(alpha, grills_rounded_tck)) if Dh and l and fd and l > 50.0 * Dh: return t1 + fd * l / Dh else: return t1
def round_edge_grill(alpha, l=None, Dh=None, fd=None): r'''Returns the loss coefficient for a rounded square grill or square bar screen or perforated plate with rounded edges of thickness l, as shown in [1]_. for Dh < l < 50D .. math:: K = lookup(alpha) else: .. math:: K = lookup(alpha) + \frac{fl}{\alpha^2D} Parameters ---------- alpha : float Fraction of grill open to flow [-] l : float, optional Thickness of the grill or plate [m] Dh : float, optional Hydraulic diameter of gap in grill, [m] fd : float, optional Darcy friction factor [-] Returns ------- K : float Loss coefficient [-] Notes ----- If l, Dh, or fd is not provided, the first expression is used instead. The alteration of the expression to include friction factor is there if the grill is long enough to have considerable friction along the surface of the grill. alpha must be between 0.3 and 0.7. Examples -------- >>> round_edge_grill(.4) 1.0 >>> round_edge_grill(.4, l=.15, Dh=.002, fd=.0185) 2.3874999999999997 References ---------- .. [1] Blevins, Robert D. Applied Fluid Dynamics Handbook. New York, N.Y.: Van Nostrand Reinhold Co., 1984. ''' t1 = float(splev(alpha, grills_rounded_tck)) if Dh and l and fd and l > 50*Dh: return t1 + fd*l/Dh else: return t1
def K_separator_Watkins(x, rhol, rhog, horizontal=False, method='spline'): r'''Calculates the Sounders-Brown `K` factor as used in determining maximum allowable gas velocity in a two-phase separator in either a horizontal or vertical orientation. This function approximates a graph published in [1]_ to determine `K` as used in the following equation: .. math:: v_{max} = K_{SB}\sqrt{\frac{\rho_l-\rho_g}{\rho_g}} The graph has `K_{SB}` on its y-axis, and the following as its x-axis: .. math:: \frac{m_l}{m_g}\sqrt{\rho_g/\rho_l} = \frac{(1-x)}{x}\sqrt{\rho_g/\rho_l} Cubic spline interpolation is the default method of retrieving a value from the graph, which was digitized with Engauge-Digitizer. Also supported are two published curve fits to the graph. The first is that of Blackwell (1984) [2]_, as follows: .. math:: K_{SB} = \exp(-1.942936 -0.814894X -0.179390 X^2 -0.0123790 X^3 + 0.000386235 X^4 + 0.000259550 X^5) X = \ln\left[\frac{(1-x)}{x}\sqrt{\rho_g/\rho_l}\right] The second is that of Branan (1999), as follows: .. math:: K_{SB} = \exp(-1.877478097 -0.81145804597X -0.1870744085 X^2 -0.0145228667 X^3 -0.00101148518 X^4) X = \ln\left[\frac{(1-x)}{x}\sqrt{\rho_g/\rho_l}\right] Parameters ---------- x : float Quality of fluid entering separator, [-] rhol : float Density of liquid phase [kg/m^3] rhog : float Density of gas phase [kg/m^3] horizontal : bool, optional Whether to use the vertical or horizontal value; horizontal is 1.25 higher method : str One of 'spline, 'blackwell', or 'branan' Returns ------- K : float Sounders Brown horizontal or vertical `K` factor for two-phase separator design only, [m/s] Notes ----- Both the 'branan' and 'blackwell' models are used frequently. However, the spline is much more accurate. No limits checking is enforced. However, the x-axis spans only 0.006 to 5.4, and the function should not be used outside those limits. Examples -------- >>> K_separator_Watkins(0.88, 985.4, 1.3, horizontal=True) 0.07951613600476297 References ---------- .. [1] Watkins (1967). Sizing Separators and Accumulators, Hydrocarbon Processing, November 1967. .. [2] Blackwell, W. Wayne. Chemical Process Design on a Programmable Calculator. New York: Mcgraw-Hill, 1984. .. [3] Branan, Carl R. Pocket Guide to Chemical Engineering. 1st edition. Houston, Tex: Gulf Professional Publishing, 1999. ''' factor = (1. - x) / x * sqrt(rhog / rhol) if method == 'spline': K = exp(float(splev(log(factor), tck_Watkins))) elif method == 'blackwell': X = log(factor) A = -1.877478097 B = -0.81145804597 C = -0.1870744085 D = -0.0145228667 E = -0.00101148518 K = exp(A + X * (B + X * (C + X * (D + E * X)))) elif method == 'branan': X = log(factor) A = -1.942936 B = -0.814894 C = -0.179390 D = -0.0123790 E = 0.000386235 F = 0.000259550 K = exp(A + X * (B + X * (C + X * (D + X * (E + F * X))))) else: raise ValueError( "Only methods 'spline', 'branan', and 'blackwell' are supported.") K *= foot # Converts units of ft/s to m/s; the graph and all fits are in ft/s if horizontal: K *= 1.25 # Watkins recommends a factor of 1.25 for horizontal separators over vertical separators return K
def Bhirud_normal(T, Tc, Pc, omega): r'''Calculates saturation liquid density using the Bhirud [1]_ CSP method. Uses Critical temperature and pressure and acentric factor. The density of a liquid is given by: .. math:: \ln \frac{P_c}{\rho RT} = \ln U^{(0)} + \omega\ln U^{(1)} .. math:: \ln U^{(0)} = 1.396 44 - 24.076T_r+ 102.615T_r^2 -255.719T_r^3+355.805T_r^4-256.671T_r^5 + 75.1088T_r^6 .. math:: \ln U^{(1)} = 13.4412 - 135.7437 T_r + 533.380T_r^2- 1091.453T_r^3+1231.43T_r^4 - 728.227T_r^5 + 176.737T_r^6 Parameters ---------- T : float Temperature of fluid [K] Tc : float Critical temperature of fluid [K] Pc : float Critical pressure of fluid [Pa] omega : float Acentric factor for fluid, [-] Returns ------- Vm : float Saturated liquid molar volume, [mol/m^3] Notes ----- Claimed inadequate by others. An interpolation table for ln U values are used from Tr = 0.98 - 1.000. Has terrible behavior at low reduced temperatures. Examples -------- Pentane >>> Bhirud_normal(280.0, 469.7, 33.7E5, 0.252) 0.00011249657842514176 References ---------- .. [1] Bhirud, Vasant L. "Saturated Liquid Densities of Normal Fluids." AIChE Journal 24, no. 6 (November 1, 1978): 1127-31. doi:10.1002/aic.690240630 ''' Tr = T / Tc if Tr <= 0.98: lnU0 = Tr * (Tr * (Tr * (Tr * (Tr * (75.1088 * Tr - 256.671) + 355.805) - 255.719) + 102.615) - 24.076) + 1.39644 lnU1 = Tr * (Tr * (Tr * (Tr * (Tr * (176.737 * Tr - 728.227) + 1231.43) - 1091.453) + 533.38) - 135.7437) + 13.4412 elif Tr > 1.0: raise ValueError('Critical phase, correlation does not apply') else: lnU0 = float(splev(Tr, Bhirud_normal_lnU0_tck)) lnU1 = float(splev(Tr, Bhirud_normal_lnU1_tck)) Unonpolar = exp(lnU0 + omega * lnU1) Vm = Unonpolar * R * T / Pc return Vm
def K_separator_Watkins(x, rhol, rhog, horizontal=False, method='spline'): r'''Calculates the Sounders-Brown `K` factor as used in determining maximum allowable gas velocity in a two-phase separator in either a horizontal or vertical orientation. This function approximates a graph published in [1]_ to determine `K` as used in the following equation: .. math:: v_{max} = K_{SB}\sqrt{\frac{\rho_l-\rho_g}{\rho_g}} The graph has `K_{SB}` on its y-axis, and the following as its x-axis: .. math:: \frac{m_l}{m_g}\sqrt{\rho_g/\rho_l} = \frac{(1-x)}{x}\sqrt{\rho_g/\rho_l} Cubic spline interpolation is the default method of retrieving a value from the graph, which was digitized with Engauge-Digitizer. Also supported are two published curve fits to the graph. The first is that of Blackwell (1984) [2]_, as follows: .. math:: K_{SB} = \exp(-1.942936 -0.814894X -0.179390 X^2 -0.0123790 X^3 + 0.000386235 X^4 + 0.000259550 X^5) X = \log\left[\frac{(1-x)}{x}\sqrt{\rho_g/\rho_l}\right] The second is that of Branan (1999), as follows: .. math:: K_{SB} = \exp(-1.877478097 -0.81145804597X -0.1870744085 X^2 -0.0145228667 X^3 -0.00101148518 X^4) X = \log\left[\frac{(1-x)}{x}\sqrt{\rho_g/\rho_l}\right] Parameters ---------- x : float Quality of fluid entering separator, [-] rhol : float Density of liquid phase [kg/m^3] rhog : float Density of gas phase [kg/m^3] horizontal : bool, optional Whether to use the vertical or horizontal value; horizontal is 1.25 higher method : str One of 'spline, 'blackwell', or 'branan' Returns ------- K : float Sounders Brown horizontal or vertical `K` factor for two-phase separator design only, [m/s] Notes ----- Both the 'branan' and 'blackwell' models are used frequently. However, the spline is much more accurate. No limits checking is enforced. However, the x-axis spans only 0.006 to 5.4, and the function should not be used outside those limits. Examples -------- >>> K_separator_Watkins(0.88, 985.4, 1.3, horizontal=True) 0.07951613600476297 References ---------- .. [1] Watkins (1967). Sizing Separators and Accumulators, Hydrocarbon Processing, November 1967. .. [2] Blackwell, W. Wayne. Chemical Process Design on a Programmable Calculator. New York: Mcgraw-Hill, 1984. .. [3] Branan, Carl R. Pocket Guide to Chemical Engineering. 1st edition. Houston, Tex: Gulf Professional Publishing, 1999. ''' factor = (1. - x)/x*(rhog/rhol)**0.5 if method == 'spline': K = exp(float(splev(log(factor), tck_Watkins))) elif method == 'blackwell': X = log(factor) A = -1.877478097 B = -0.81145804597 C = -0.1870744085 D = -0.0145228667 E = -0.00101148518 K = exp(A + X*(B + X*(C + X*(D + E*X)))) elif method == 'branan': X = log(factor) A = -1.942936 B = -0.814894 C = -0.179390 D = -0.0123790 E = 0.000386235 F = 0.000259550 K = exp(A + X*(B + X*(C + X*(D + X*(E + F*X))))) else: raise Exception("Only methods 'spline', 'branan', and 'blackwell' are supported.") K *= foot # Converts units of ft/s to m/s; the graph and all fits are in ft/s if horizontal: K *= 1.25 # Watkins recommends a factor of 1.25 for horizontal separators over vertical separators return K