Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
2012): 86-97. doi:10.1016/j.nucengdes.2012.08.007.
'''
# Liquid-only flow
v_lo = m/rhol/(pi/4*D**2)
Re_lo = Reynolds(V=v_lo, rho=rhol, mu=mul, D=D)
# Actual Liquid flow
v_l = m*(1-x)/rhol/(pi/4*D**2)
Re_l = Reynolds(V=v_l, rho=rhol, mu=mul, D=D)
fd_l = friction_factor(Re=Re_l, eD=roughness/D)
dP_l = fd_l*L/D*(0.5*rhol*v_l**2)
# Actual gas flow
v_g = m*x/rhog/(pi/4*D**2)
Re_g = Reynolds(V=v_g, rho=rhog, mu=mug, D=D)
fd_g = friction_factor(Re=Re_g, eD=roughness/D)
dP_g = fd_g*L/D*(0.5*rhog*v_g**2)
# Actual model
X = (dP_l/dP_g)**0.5
Co = Confinement(D=D, rhol=rhol, rhog=rhog, sigma=sigma)
C = 0.227*Re_lo**0.452*X**-0.320*Co**-0.820
phi_l2 = 1 + C/X + 1./X**2
return dP_l*phi_l2
doi:10.1016/j.ijheatmasstransfer.2012.02.047.
.. [3] Choi, Kwang-Il, A. S. Pamitran, Chun-Young Oh, and Jong-Taek Oh.
"Two-Phase Pressure Drop of R-410A in Horizontal Smooth Minichannels."
International Journal of Refrigeration 31, no. 1 (January 2008): 119-29.
doi:10.1016/j.ijrefrig.2007.06.006.
'''
# Liquid-only properties, for calculation of dP_lo
v_lo = m/rhol/(pi/4*D**2)
Re_lo = Reynolds(V=v_lo, rho=rhol, mu=mul, D=D)
fd_lo = friction_factor(Re=Re_lo, eD=roughness/D)
dP_lo = fd_lo*L/D*(0.5*rhol*v_lo**2)
# Gas-only properties, for calculation of dP_go
v_go = m/rhog/(pi/4*D**2)
Re_go = Reynolds(V=v_go, rho=rhog, mu=mug, D=D)
fd_go = friction_factor(Re=Re_go, eD=roughness/D)
dP_go = fd_go*L/D*(0.5*rhog*v_go**2)
Gamma2 = dP_go/dP_lo
Co = Confinement(D=D, rhol=rhol, rhog=rhog, sigma=sigma)
phi_lo2 = 1 + (4.3*Gamma2 -1)*(Co*x**0.875*(1-x)**0.875 + x**1.75)
return dP_lo*phi_lo2
----------
.. [1] Xu, Yu, and Xiande Fang. "A New Correlation of Two-Phase Frictional
Pressure Drop for Condensing Flow in Pipes." Nuclear Engineering and
Design 263 (October 2013): 87-96. doi:10.1016/j.nucengdes.2013.04.017.
'''
A = pi/4*D*D
# Liquid-only properties, for calculation of E, dP_lo
v_lo = m/rhol/A
Re_lo = Reynolds(V=v_lo, rho=rhol, mu=mul, D=D)
fd_lo = friction_factor(Re=Re_lo, eD=roughness/D)
dP_lo = fd_lo*L/D*(0.5*rhol*v_lo**2)
# Gas-only properties, for calculation of E
v_go = m/rhog/A
Re_go = Reynolds(V=v_go, rho=rhog, mu=mug, D=D)
fd_go = friction_factor(Re=Re_go, eD=roughness/D)
dP_go = fd_go*L/D*(0.5*rhog*v_go**2)
# Homogeneous properties, for Froude/Weber numbers
voidage_h = homogeneous(x, rhol, rhog)
rho_h = rhol*(1-voidage_h) + rhog*voidage_h
Q_h = m/rho_h
v_h = Q_h/A
Fr = Froude(V=v_h, L=D, squared=True)
We = Weber(V=v_h, L=D, rho=rho_h, sigma=sigma)
Y2 = dP_go/dP_lo
phi_lo2 = Y2*x**3 + (1-x**2.59)**0.632*(1 + 2*x**1.17*(Y2-1)
+ 0.00775*x**-0.475*Fr**0.535*We**0.188)
.. [2] Kim, Sung-Min, and Issam Mudawar. "Universal Approach to Predicting
Two-Phase Frictional Pressure Drop for Adiabatic and Condensing Mini/
Micro-Channel Flows." International Journal of Heat and Mass Transfer
55, no. 11-12 (May 2012): 3246-61.
doi:10.1016/j.ijheatmasstransfer.2012.02.047.
.. [3] Xu, Yu, Xiande Fang, Xianghui Su, Zhanru Zhou, and Weiwei Chen.
"Evaluation of Frictional Pressure Drop Correlations for Two-Phase Flow
in Pipes." Nuclear Engineering and Design, SI : CFD4NRS-3, 253 (December
2012): 86-97. doi:10.1016/j.nucengdes.2012.08.007.
'''
G_tp = m/(pi/4*D**2)
# Actual Liquid flow
v_l = m*(1-x)/rhol/(pi/4*D**2)
Re_l = Reynolds(V=v_l, rho=rhol, mu=mul, D=D)
fd_l = friction_factor(Re=Re_l, eD=roughness/D)
dP_l = fd_l*L/D*(0.5*rhol*v_l**2)
# Actual gas flow
v_g = m*x/rhog/(pi/4*D**2)
Re_g = Reynolds(V=v_g, rho=rhog, mu=mug, D=D)
fd_g = friction_factor(Re=Re_g, eD=roughness/D)
dP_g = fd_g*L/D*(0.5*rhog*v_g**2)
X = (dP_l/dP_g)**0.5
if G_tp >= 200:
phi_g2 = 1 + 9.397*X**0.62 + 0.564*X**2.45
else:
# Liquid-only flow; Re_lo is oddly needed
v_lo = m/rhol/(pi/4*D**2)
Re_lo = Reynolds(V=v_lo, rho=rhol, mu=mul, D=D)
if radius_ratio < 0.5:
radius_ratio = 0.5
if radius_ratio > 10.0:
radius_ratio = 10.0
if angle < 10.0:
angle = 10.0
# Curve fit in terms of degrees
# Caching could work here - angle, radius ratio does not change often
Kb = bend_rounded_Miller_Kb(radius_ratio, angle)
# Section 9.2.4 - Roughness correction
# Re limited to under 1E6 in friction factor falculations
# Use a cached smooth fd value if Re too high
Re_fd_min = min(1E6, Re)
fd_smoth = friction_factor(Re=Re_fd_min, eD=0.0) if Re_fd_min < 1E6 else 0.011645040997991626
fd_rough = friction_factor(Re=Re_fd_min, eD=roughness/Di)
C_roughness = fd_rough/fd_smoth
'''Section 9.2.2 - Reynolds Number Correction
Allow some extrapolation up to 1E8 (1E7 max in graph but the trend looks good)
'''
Re_C_Re = min(max(Re, 1E4), 1E8)
if radius_ratio >= 2.0:
if Re_C_Re == 1E8:
C_Re = 0.4196741237602154 # bend_rounded_Miller_C_Re(1e8, 2.0)
elif Re_C_Re == 1E4:
C_Re = 2.1775876405173977 # bend_rounded_Miller_C_Re(1e4, 2.0)
else:
C_Re = bend_rounded_Miller_C_Re(Re_C_Re, 2.0)
elif radius_ratio <= 1.0:
# newton(lambda x: bend_rounded_Miller_C_Re(x, 1.0)-1, 2e5) to get the boundary value
--------
>>> Xu_Fang(m=0.6, x=0.1, rhol=915., rhog=2.67, mul=180E-6, mug=14E-6,
... sigma=0.0487, D=0.05, roughness=0.0, L=1.0)
604.0595632116267
References
----------
.. [1] Xu, Yu, and Xiande Fang. "A New Correlation of Two-Phase Frictional
Pressure Drop for Condensing Flow in Pipes." Nuclear Engineering and
Design 263 (October 2013): 87-96. doi:10.1016/j.nucengdes.2013.04.017.
'''
A = pi/4*D*D
# Liquid-only properties, for calculation of E, dP_lo
v_lo = m/rhol/A
Re_lo = Reynolds(V=v_lo, rho=rhol, mu=mul, D=D)
fd_lo = friction_factor(Re=Re_lo, eD=roughness/D)
dP_lo = fd_lo*L/D*(0.5*rhol*v_lo**2)
# Gas-only properties, for calculation of E
v_go = m/rhog/A
Re_go = Reynolds(V=v_go, rho=rhog, mu=mug, D=D)
fd_go = friction_factor(Re=Re_go, eD=roughness/D)
dP_go = fd_go*L/D*(0.5*rhog*v_go**2)
# Homogeneous properties, for Froude/Weber numbers
voidage_h = homogeneous(x, rhol, rhog)
rho_h = rhol*(1-voidage_h) + rhog*voidage_h
Q_h = m/rho_h
v_h = Q_h/A
Fr = Froude(V=v_h, L=D, squared=True)
Reibungsdruckverlustes Der Mehrphasenströmung (A Generally Valid Method
for Calculating Frictional Pressure Drop on Multiphase Flow)." Chemie
Ingenieur Technik 52, no. 4 (January 1, 1980): 344-345.
doi:10.1002/cite.330520414.
.. [2] Mekisso, Henock Mateos. "Comparison of Frictional Pressure Drop
Correlations for Isothermal Two-Phase Horizontal Flow." Thesis, Oklahoma
State University, 2013. https://shareok.org/handle/11244/11109.
.. [3] Greco, A., and G. P. Vanoli. "Experimental Two-Phase Pressure
Gradients during Evaporation of Pure and Mixed Refrigerants in a Smooth
Horizontal Tube. Comparison with Correlations." Heat and Mass Transfer
42, no. 8 (April 6, 2006): 709-725. doi:10.1007/s00231-005-0020-7.
'''
# Liquid-only flow
v_lo = m/rhol/(pi/4*D**2)
Re_lo = Reynolds(V=v_lo, rho=rhol, mu=mul, D=D)
fd_lo = friction_factor(Re=Re_lo, eD=roughness/D)
dP_lo = fd_lo*L/D*(0.5*rhol*v_lo**2)
# Gas-only flow
v_go = m/rhog/(pi/4*D**2)
Re_go = Reynolds(V=v_go, rho=rhog, mu=mug, D=D)
fd_go = friction_factor(Re=Re_go, eD=roughness/D)
dP_go = fd_go*L/D*(0.5*rhog*v_go**2)
# Handle x = 0, x=1:
if x == 0:
return dP_lo
elif x == 1:
return dP_go
# Actual Liquid flow
v_l = m*(1-x)/rhol/(pi/4*D**2)
LV = Vsl*(rhol/(g*sigma))**0.25
if angle is None: angle = 0.0
angle = deg2rad*angle
if regime != 1:
Hl = _Beggs_Brill_holdup(regime, lambda_L, Fr, angle, LV)
else:
A = (L3 - Fr)/(L3 - L2)
Hl = (A*_Beggs_Brill_holdup(0, lambda_L, Fr, angle, LV)
+ (1.0 - A)*_Beggs_Brill_holdup(2, lambda_L, Fr, angle, LV))
rhos = rhol*Hl + rhog*(1.0 - Hl)
mum = mul*lambda_L + mug*(1.0 - lambda_L)
rhom = rhol*lambda_L + rhog*(1.0 - lambda_L)
Rem = rhom*D/mum*Vm
fn = friction_factor(Re=Rem, eD=roughness/D)
x = lambda_L/(Hl*Hl)
if 1.0 < x < 1.2:
S = log(2.2*x - 1.2)
else:
logx = log(x)
# from horner(-0.0523 + 3.182*log(x) - 0.8725*log(x)**2 + 0.01853*log(x)**4, x)
S = logx/(logx*(logx*(0.01853*logx*logx - 0.8725) + 3.182) - 0.0523)
if S > 7.0:
S = 7.0 # Truncate S to avoid exp(S) overflowing
ftp = fn*exp(S)
dP_ele = g*sin(angle)*rhos*L
dP_fric = ftp*L/D*0.5*rhom*Vm*Vm
# rhos here is pretty clearly rhos according to Shoham
if P is None: P = 101325.0
State University, 2013. https://shareok.org/handle/11244/11109.
.. [3] Greco, A., and G. P. Vanoli. "Experimental Two-Phase Pressure
Gradients during Evaporation of Pure and Mixed Refrigerants in a Smooth
Horizontal Tube. Comparison with Correlations." Heat and Mass Transfer
42, no. 8 (April 6, 2006): 709-725. doi:10.1007/s00231-005-0020-7.
'''
# Liquid-only flow
v_lo = m/rhol/(pi/4*D**2)
Re_lo = Reynolds(V=v_lo, rho=rhol, mu=mul, D=D)
fd_lo = friction_factor(Re=Re_lo, eD=roughness/D)
dP_lo = fd_lo*L/D*(0.5*rhol*v_lo**2)
# Gas-only flow
v_go = m/rhog/(pi/4*D**2)
Re_go = Reynolds(V=v_go, rho=rhog, mu=mug, D=D)
fd_go = friction_factor(Re=Re_go, eD=roughness/D)
dP_go = fd_go*L/D*(0.5*rhog*v_go**2)
# Handle x = 0, x=1:
if x == 0:
return dP_lo
elif x == 1:
return dP_go
# Actual Liquid flow
v_l = m*(1-x)/rhol/(pi/4*D**2)
Re_l = Reynolds(V=v_l, rho=rhol, mu=mul, D=D)
fd_l = friction_factor(Re=Re_l, eD=roughness/D)
dP_l = fd_l*L/D*(0.5*rhol*v_l**2)
# Actual gas flow
v_g = m*x/rhog/(pi/4*D**2)
bMit = pi/2*Dtank*(1 + pi**2/4*Dtank**2/H**2)**0.5
vMit = Q/(2*delta*bMit)
vch = vMit*log(bMit/bEin)/(1 - bEin/bMit)
ReJ = vch*dch*rho/mu
elif inlettype == 'tangential':
f = friction_factor(1E5, roughness/dch)
for run in range(5):
vinlet = Q/(pi/4*Dinlet**2)
vz = Q/(pi*Dtank*delta)
K4 = Dinlet**2*vinlet**2/(2*f*Dtank*H)
K3 = vinlet/4. - Dinlet**2*vinlet/(4*f*Dtank*H)
vx0 = K3 + (K3**2 + K4)**0.5
vx = vinlet*log(1 + f*Dtank*H/Dinlet**2*vx0/vinlet)/(f*Dtank*H/Dinlet**2)
vch = (vx**2 + vz**2)**0.5
ReJ = vch*dch*rho/mu
f = friction_factor(ReJ, roughness/dch)
if inletlocation and rhow:
GrJ = g*rho*(rho-rhow)*dch**3/mu**2
if rhow < rho: # Heating jacket fluid
if inletlocation == 'auto' or inletlocation == 'bottom':
ReJeq = (ReJ**2 + GrJ*H/dch/50.)**0.5
else:
ReJeq = (ReJ**2 - GrJ*H/dch/50.)**0.5
else: # Cooling jacket fluid
if inletlocation == 'auto' or inletlocation == 'top':
ReJeq = (ReJ**2 + GrJ*H/dch/50.)**0.5
else:
ReJeq = (ReJ**2 - GrJ*H/dch/50.)**0.5
else:
ReJeq = (ReJ**2)**0.5
NuA = 3.66
NuB = 1.62*Pr**(1/3.)*ReJeq**(1/3.)*(dch/lch)**(1/3.)