def KM_Cond_Average(x_min,x_max,Ref,G,Dh,Tbubble,Tdew,p,beta,satTransport=None):
"""
Returns the average pressure gradient and average heat transfer coefficient
between qualities of x_min and x_max.
for Kim&Mudawar two-phase condensation in mico-channel HX
To obtain the pressure gradient for a given value of x, pass it in as x_min and x_max
Required parameters:
* x_min : The minimum quality for the range [-]
* x_max : The maximum quality for the range [-]
* Ref : String with the refrigerant name
* G : Mass flux [kg/m^2/s]
* Dh : Hydraulic diameter of tube [m]
* Tbubble : Bubblepoint temperature of refrigerant [K]
* Tdew : Dewpoint temperature of refrigerant [K]
* beta: channel aspect ratio (=width/height)
Optional parameters:
* satTransport : A dictionary with the keys 'mu_f','mu_g,'rho_f','rho_g', 'sigma' for the saturation properties. So they can be calculated once and passed in for a slight improvement in efficiency
"""
def KMFunc(x):
dpdz, h = Kim_Mudawar_condensing_DPDZ_h(Ref,G,Dh,x,Tbubble,Tdew,p,beta,satTransport)
return dpdz , h
## Use Simpson's Rule to calculate the average pressure gradient
## Can't use adapative quadrature since function is not sufficiently smooth
## Not clear why not sufficiently smooth at x>0.9
if x_min==x_max:
return KMFunc(x_min)
else:
#Calculate the tranport properties once
satTransport={}
satTransport['rho_f']=PropsSI('D','T',Tbubble,'Q',0.0,Ref)
satTransport['rho_g']=PropsSI('D','T',Tdew,'Q',1.0,Ref)
satTransport['mu_f']=PropsSI('V','T',Tbubble,'Q',0.0,Ref)
satTransport['mu_g']=PropsSI('V','T',Tdew,'Q',1.0,Ref)
satTransport['cp_f']=PropsSI('C', 'T', Tbubble, 'Q', 0, Ref)
satTransport['k_f']=PropsSI('L', 'T', Tbubble, 'Q', 0, Ref)
#Calculate Dp and h over the range of xx
xx=np.linspace(x_min,x_max,30)
DP=np.zeros_like(xx)
h=np.zeros_like(xx)
for i in range(len(xx)):
DP[i]=KMFunc(xx[i])[0]
h[i]=KMFunc(xx[i])[1]
#Use Simpson's rule to carry out numerical integration to get average DP and average h
if abs(x_max-x_min)<5*machine_eps:
#return just one of the edge values
return DP[0], h[0]
else:
#Use Simpson's rule to carry out numerical integration to get average DP and average h
return -simps(DP,xx)/(x_max-x_min), simps(h,xx)/(x_max-x_min)
评论列表
文章目录