#Example 5.1
# water flow in a diffuser
#VARIABLE DECLARATION
Tw = 20 # [degree celcius] water temperature
m_dot = 8 # [kg/s] water flow rate
d1 = 0.03 #[m] diameter at section 1
d2 = 0.07 # [m] diameter at section 2
#CALCULATION
import math
A1 = math.pi*d1**(2)/4 # [square meter] cross-sectional area at section 1
A2 = math.pi*d2**(2)/4 # [square meter] cross-sectional area at section 2
gc = 1 # [m/s**(2)] acceleration due to gravity
rho = 1000 # [kg/cubic m] density of water at 20 degree celcius
# calculate the velocities from the mass-continuity relation
u1 = m_dot/(rho*A1) # [m/s]
u2 = m_dot/(rho*A2) # [m/s]
# the pressure difference is obtained by Bernoulli equation(5-7a)
p2_minus_p1 = rho*(u1**(2)-u2**(2))/(2*gc) # [Pa]
#RESULTS
print"the increase in static pressure between sections 1 and 2 is:",round(p2_minus_p1/1000,2)," kPa"
#Example Number 5.2
# isentropic expansion of air
# Variable declaration
Ta = 300.0+273.0 # [K] air temperature
Pa = 0.7 # [MPa] pressure of air
u2 = 300 # [m/s] final velocity
gc = 1 # [m/s^(2)] acceleration due to gravity
Y = 1.4 # gama value for air
Cp = 1005 # [J/kg degree celsius]
#the initial velocity is small and the process is adiabatic. in terms of temperature
#Calculation
T2 = Ta-u2**(2)/(2*gc*Cp)
#Result
print "The static temperature is:",round(T2,1),"K"
# we may calculate the pressure difference from the isentropic relation
p2 = Pa*((T2/Ta)**(Y/(Y-1)))
print "Static pressure is:",round(p2,1),"MPa"
# the velocity of sound at condition 2 is
a2 = (20.045*(T2**(0.5))) # [m/s]
#so that the mach no. is
M2 = u2/a2
print "Mach number is:",round(M2,3)
#Example Number 5.4
#Calculate the heat transfereed in first 20 cm of the plate and the first 40 cm of the plate
# Variable declaration
# total heat transfer over a certain length of the plate is desired, so we wish to calculate average heat transfer coefficients.
# for this purpose we use equations (5-44) and (5-45), evaluating the properties at the film temperature :
Tp = 60+273.15 # [K] plate temperature
Ta = 27+273.15 # [K] air temperature
Tf = (Tp+Ta)/2 # [K]
u = 2 # [m/s] air velocity
# from appendix A the properties are
v = 17.36*(10**(-6)) # [square meter/s] kinematic viscosity
x1 = 0.2 # [m] distance from the leading edge of plate
x2 = 0.4 # [m] distance from the leading edge of plate
k = 0.02749 # [W/m K] heat transfer coefficient
Pr = 0.7 # prandtl number
Cp = 1006 # [J/kg K]
# at x = 0.2m
#Calculation
Re_x1 =(u*x1/v) # reynolds number
Nu_x1 = 0.332*(Re_x1**(0.5))*(Pr**(0.333)) # nusselt number
hx1 = Nu_x1*k/x1 # [W/square meter K]
# the average value of the heat transfer coefficient is twice this value, or
h_bar1 = 2*hx1 # [W/square meter K]
# the heat flow is
A1 = x1*1 # [square meter] area for unit depth
q1 = h_bar1*A1*(Tp-Ta) # [W]
# at x = 0.4m
Re_x2 = u*x2/v # reynolds number
Nu_x2 = 0.332*Re_x2**(0.5)*Pr**(0.333) # nusselt number
hx2 = Nu_x2*k/x2 # [W/square meter K]
# the average value of the heat transfer coefficient is twice this value, or
h_bar2 = 2*hx2 # [W/square meter K]
# the heat flow is
A2 = x2*1 # [square meter] area for unit depth
q2 = h_bar2*A2*(Tp-Ta) # [W]
#Result
print"The heat transfered in first case of the plate is",round(q1,2),"W"
print"and the heat transfered in second case of the plate is:",round(q2,1),"W"
#Example Number 5.5
# Calculate the av temperature difference along the plate & Temperature diff at the trailing edge
#Variable declaration
u = 5 # [m/s] air velocity
l = 0.6 # [m] plate length
Ta = 27+273.15 # [K] temperature of airstream
# properties should be evaluated at the film temperature, but we do not know the plate temperature so for an initial calculation we take the properties at the free-stream conditions of
v = 15.69*10**(-6) #[square meter/s] kinematic viscosity
k = 0.02624 #[W/m deg celsius] heat transfer coefficient
Pr = 0.7 # prandtl number
Re_l = l*u/v # reynolds number
P = 1000 # [W] power of heater
qw = P/l**(2) # [W/square meter] heat flux per unit area
# from equation (5-50) the average temperature difference is
#Calculation
Tw_minus_Tinf_bar = qw*l/(0.6795*k*(Re_l)**(.5)*(Pr)**(0.333)) # [degree celsius]
# now, we go back and evaluate properties at
Tf = (Tw_minus_Tinf_bar+Ta+Ta)/2 # [degree celsius]
# and obtain
v1 = 28.22*10**(-6) # [square meter/s] kinematic viscosity
k1 = 0.035 # [W/m deg celsius] heat transfer coefficient
Pr1 = 0.687 # prandtl number
Re_l1 = l*u/v1 # reynolds number
Tw_minus_Tinf_bar1 = qw*l/(0.6795*k1*(Re_l1)**(0.5)*(Pr1)**(0.333)) #[degree celsius]
# at the end of the plate(x = l = 0.6m) the temperature difference is obtained from equation (5-48) and (5-50) with the constant of 0.453
Tw_minus_Tinf_x_equal_l = Tw_minus_Tinf_bar1*0.6795/0.453 # [degree celsius]
#Result
print "Average temperature difference along the plate is:",round(Tw_minus_Tinf_bar)," degree celsius"
print "Temperature difference at the trailing edge is:",round(Tw_minus_Tinf_x_equal_l,1),"degree celsius"
#Example Number 5.7
# Calculate the heat lost by the plate
# Variable declaration
u = 1.2 # [m/s] oil velocity
l = 0.2 # [m] plate length as well as width (square)
To = 20+273.15 # [K] temperature of engine oil
Tu = 60+273.15 # [K] uniform temperature of plate
# First we evaluate the film temperature
T = (To+Tu)/2 # [K]
# and obtain the properties of engine oil are
rho = 876 # [kg/cubic meter] density of oil
v = 0.00024 # [square meter/s] kinematic viscosity
k = 0.144 # [W/m degree celsius] heat transfer coefficient
Pr = 2870 # prandtl number
# at the trailing edge of the plate the reynolds number is
#Calculation
Re = l*u/v # reynolds number
# because the prandtl no. is so large we will employ equation(5-51) for the solution.
# we see that hx varies with x in the same fashion as in equation(5-44) , i.e. hx is inversely proportional to the square root of x ,
# so that we get the same solution as in equation(5-45) for the average heat transfer coefficient.
# evaluating equation(5-51) at x = 0.2m gives
Nux = (0.3387*(Re**(1.0/2.0))*(Pr**(1.0/3.0)))/((1+(0.0468/Pr)**(2.0/3.0))**(1.0/4.0))
hx = Nux*k/l # [W/sq m degree celsius] heat transfer coefficient
# the average value of the convection coefficient is
h = 2*hx # [W/square meter degree celsius]
# so that total heat transfer is
A = l**(2) # [square meter] area of the plate
q = h*A*(Tu-To) #[W]
print "Average value of the convection coefficient is",round(h,1),"W/sq meter degree celsius"
print " and the heat lost by the plate is",round(q,1),"W"
#Example Number 5.8
# Compute the drag force on the first 40 cm of the plate
# Variable declaration
# data is used from example 5.4
# we use equation (5-56) to compute the friction coefficient and then calculate the drag force .
# an average friction coefficient is desired, so st_bar*pr**(2/3) = Cf_bar/2
p = 101325 # [Pa] pressure of air
x = 0.4 #[m] drag force is computed on first 0.4 m of the plate
R = 287 # []
Tf = 316.5 # [K]
u = 2 # [m/s] air velocity
Cp = 1006 # [J/kg K]
Pr = 0.7 # prandtl no.
rho = p/(R*Tf) # [kg/cubic meter] density at 316.5 K
h_bar = 8.698 # [W/square meter K] heat transfer coefficient
#Calculation
# for the 0.4m length
st_bar = h_bar/(rho*Cp*u)
# then from equation (5-56)
Cf_bar = st_bar*Pr**(2.0/3.0)*2
# the average shear stress at the wall is computed from equation(5-52)
tau_w_bar = Cf_bar*rho*u**(2)/2 # [N/square meter]
A = x*1 # [square meter] area per unit length
# the drag force is the product of this shear stress and the area,
D = tau_w_bar*A # [N]
#Result
print "Drag force exerted on the first 0.4 m of the plate is",round(D*1000,2),"mN"
#Example Number 5.9
# Calculate the heat transfer from the plate
# Variable declaration
p = 101320.0 # [Pa] pressure of air
R = 287.0 # []
Ta = 20+273 # [K] temperature of air
u = 35 # [m/s] air velocity
L = 0.75 # [m] length of plate
Tp = 60+273 # [K] plate temperature
# we evaluate properties at the film temperature
#Calculations
Tf = (Ta+Tp)/2 # [K]
rho = (p/(R*Tf)) # [kg/cubic meter]
mu = 1.906*(10**(-5)) # [kg/m s] viscosity
k = 0.02723 # [W/m degree celsius]
Cp = 1007 # [J/kg K]
Pr = 0.7 # prandtl no.
# the reynolds number is
Rel = (rho*u*L)/mu
Rel=round(Rel)
# and the boundary layer is turbulent because the reynolds number is greater than 5*10**(5).
# therefore, we use equation(5-85) to calculate the average heat transfer over the plate:
Nul_bar = (Pr**(1.0/3.0))*(0.037*(Rel**(0.8))-871)
print "Nul_bar is",round(Nul_bar)
A = L*1 # [square meter] area of plate per unit depth
h_bar = Nul_bar*k/L # [W/square meter degree celsius]
q = h_bar*A*(Tp-Ta) # [W] heat transfer from plate
#Result
print "Heat transfer from plate is",round(q),"W"
#Example Number 5.10
# Calculate turbulent-boundary-layer thickness at the end of plate
# Variable declaration
# we have to use the data from example 5.8 and 5.9
Rel = 1.553*10**6 # from previous example
L = 0.75 # [m] length of plate
# it is a simple matter to insert this value in equations(5-91) and (5-95) along with
x = L # [m]
# turbulent-boundary-layer thickness are
# part a. from the leading edge of the plate
#Calculation
del_a = x*0.381*Rel**(-0.2) # [m]
# part b from the transition point at Recrit = 5*10**(5)
del_b = x*0.381*Rel**(-0.2)-10256*Rel**(-1) # [m]
#Result
print "Turbulent-boundary-layer thickness at the end of the plate from the leading edge of the plate is",round(del_a*1000,1),"mm"
print "Turbulent-boundary-layer thickness at the end of the plate from the transition point at Re_crit = 5*10**(5) is",round(del_b*1000,1)," mm"