In [2]:

```
#Variable declaration:
C = 1 #Number of constituents
P = 1 #Number of phases
#Calculation:
F = C-P+2 #Number of degrees of freedom
#Result:
print "The number of degrees of freedom is :",F," ."
```

In [4]:

```
#Variable declaration:
U1 = 1237.1 #Internnal energy of gas (Btu/lb)
U2_g = 1112.2 #Internal energy of gas (Btu/lb)
U2_l = 343.15 #Internal energy of liquid (Btu/lb)
#Calculation:
Q = 0.5*(U2_g+U2_l)-1*U1 #Heat removed (Btu/lb)
#Result:
print "Heat removed from the system during the process is :",round(Q,1)," Btu/lb ."
```

In [14]:

```
from __future__ import division
from sympy import symbols,solve
#Variable declaration:
T1 = 99.0 #Mean film temperature (°C)
T2 = 98.0 #Plate surface temperature (°C)
g = 9.807 #Gravitational acceleration (m/s^2)
#From Appendix:
T3 = 100.0 #Saturation temperatre (°C)
h_vap1 = 970.3 #Latent heat of steam in Btu/lb (Btu/lb)
h_vap2 = 2.255*10**6 #Latent heat of steam in J/kg (J/kg)
p_v = 0.577 #Density of steam (kg/m^3)
p_l = 960.0 #Density of liquid water condensate (kg/m^3)
mu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)
k = 0.68 #Thermal conductivity of water (W/m.K)
#From table 12.2
Z = 0.4 #Height of rectangular plate (m)
Pw = 0.2 #Wetted perimeter of rectangular plate (m)
h = symbols('h') #Average heat transfer coefficient (W/m^2.K)
#Calculation:
A = Z*Pw #Heat transfer area of plate (m^2)
R = A/Pw #Ratio A/Pw (m)
v_l = mu_l/p_l #Kinematic viscosity of liquid water condensate (m^2/s)
Co1 = (h/k)*(v_l**2/g/(1-p_v/p_l))**(1/3) #Condensation number (in terms of the average heat transfer coefficient)
Re = 4*h*Z*(T3-T2)/(mu_l*h_vap2) #Reynolds number in terms of the average heat transfer coefficient
#From equation 12.14:
CO1 = 0.0077*Re**Z #Co in terms of Reynolds number for flow type 1
x1 = solve(Co1-CO1,h) #Solving heat transfer coefficient (W/m^2.K)
h1 =x1[1]; #Average heat transfer coefficient for flow type 1 (W/m^2.K)
Re1 = Re.subs(h,h1); #Reynolds number for flow type 1
CO2 = 1.874*Re**(-1/3) #Co in terms of Reynolds number for flow tupe 2
x2 = solve(Co1-CO2,h) #Solving average heat transfer coefficient for flow type 2 (W/m^2.K)
h2 = x2[0]; #Average heat transfer coefficient for flow type 2 (W/m^2.K)
Re2 = Re.subs(h,h2) #Reynolds number for flow type 2
#Result:
print "The type of condensation flow type 2 is laminar."
print "And the condensation heat transfer coefficient is :",round(h2,-1)," W/m^2.K ."
```

In [6]:

```
#Variable declaration:
#From example 12.5:
Re = 73.9 #Reynolds number
mu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)
Pw = 0.2 #Wetted perimeter of rectangular plate (m)
h = 14700.0 #Heat transfer coefficient (W/m^2.K)
T_sat = 100.0 #Saturation temperature (°C)
Ts = 98.0 #Surface temperature (°C)
A = 0.2*0.4 #Heat transfer area of plate (m^2)
#Calculation:
m1 = Re*mu_l/4.0 #Mass flow rate of condensate (kg/m.s)
m = Pw*m1 #Mass flow rate of condensate (kg/s)
Co = (3.038*10**-5)*h #Condensation number
Q = h*A*(T_sat-Ts) #Heat transfer rate (W)
#Result:
print "1. The mass flow rate of condensate is :",round(m1,4)," kg/m.s . "
print "2. The heat transfer rate is :",round(Q/10**3,2)," kW . "
```

In [7]:

```
#Variable declaration:
T_sat = 126.0 #Saturation temperature (°F)
T = 64.0 #Surface temperature of tube (°F)
g = 32.2 #Gravitational acceleration (ft^2/s)
D = 4.0/12.0 #Outside diameter of tube (ft)
#Calculation:
Tf = (T_sat+T)/2.0 #Mean film temperature (°F)
#From approximate values of key properties:
h_vap = 1022.0 #Latent heat of steam (Btu/lb)
p_v = 0.00576 #Density of steam (lb/ft^3)
p_l = 62.03 #Density of liquid (lb/ft^3)
k_l = 0.364 #Thermal conductivity of liquid (Btu/h.ft.°F)
mu_l = 4.26*10**-4 #Absolute viscosity of liquid water condensate (lb/ft.s)
h = 0.725*((p_l*(p_l-p_v)*g*h_vap*k_l**3)/(mu_l*D*(T_sat-T)/3600.0))**(1.0/4.0) #Average heat transfer coefficient (Btu/h.ft^2.°F)
#Result:
print "The average heat transfer coefficient is :",round(h,1)," Btu/h.ft^2.°F ."
```

In [9]:

```
#Variable declaration:
Qs1 = 9800.0 #Heat flux (W/m^2)
Ts1 = 102.0 #Original surface temperature (°C)
Ts2 = 103.0 #New surface temperature (°C)
Tsat = 100.0 #Saturation temperature (°C)
#Calculation:
h1 = Qs1/(Ts1-Tsat) #Original heat transfer coefficient (W/m^2.K)
DT1 = (Ts1 - Tsat) #Original excess temperature (°C)
DT2 = (Ts2 - Tsat) #New excess temperature (°C)
n = 0.25 #Value of n for laminar flow
h2 = h1*(DT2/DT1)**(n) #New heat transfer coefficient (W/m^2.K)
Qs2 = h2*(Ts2-Tsat) #New heat flux (W/m^2)
#Result:
print "The new heat flux is :",round(Qs2)," W/m^2.K . "
```

In [10]:

```
#Variable declaration:
#From example 12.9:
Ts1 = 102.0 #Original surface temperature (°C)
Ts2 = 103.0 #New surface temperature (°C)
Tsat = 100.0 #Saturation temperature (°C)
#Calculation:
DTe1 = (Ts1 - Tsat) #Original excess temperature (°C)
DTe2 = (Ts2 - Tsat) #New excess temperature (°C)
#Result:
print "The original excess temperature is: DTe = ",DTe1," °C ."
print "The new excess temperature is: DTe = ",DTe2," °C ."
if ((DTe1 < 5) and (DTe2 < 5)):
print "The assumption of the free convection mechanism is valid since DTe < 5°C."
```

In [11]:

```
#Variable declaration:
#From example 12.9:
Cp = 4127.0 #heat capacity (J/kg . K)
DTe = 3.0 #New excess temperature (°C)
h_vap = 2.26*10**6 #latent heat of vaporization (J/kg)
#Calculation:
Ja_L = Cp*DTe/h_vap #Liquid Jakob number
#Result:
print "The liquid Jakob number is :",round(Ja_L,5)," ."
```

In [12]:

```
#Variable declaration:
Ts = 106.0 #Surface temperature (°C)
Tsat = 100.0 #Saturation temperature (°C)
#Calculation:
DTe = Ts-Tsat #Excess temperature (°C)
#From table 12.5:
C1 = 5.56 #Constant C1
n1 = 3.0 #Constant n1
C2 = 1040.0 #Constant C2
n2 = 1.0/3.0 #Constant n2
P = 1.0 #Absolute pressure (atm)
Pa = 1.0 #Ambient absolute pressure (atm)
#Calculation:
h1 = C1*DTe**n1*(P/Pa)**0.4 #Boiling water heat transfer coefficient (W/m^2)
Qs1 = h1*DTe #Surface flux (W/m^2)
h2 = C2*DTe**n2*(P/Pa)**0.4 #Second Boiling water heat transfer coefficient (W/m^2)
Qs2 = h2*DTe #Second Surface flux (W/m^2)
#Result:
if (Qs1/10**3 > 15.8 and Qs1/10**3 < 236):
print "The boiling regime is :",round(Qs1/10**3,1)," kW/m^2 ."
print "The heat transfer coefficient is :",round(h1), " W/m^2 ."
elif (Qs1/10**3 < 15.8):
print "The boiling regime is :",round(Qs2/10**3,2)," kW/m^2 ."
print "The heat transfer coefficient is :",round(h2), " W/m^2 ."
```

In [13]:

```
from math import pi
#Variable declaration:
#From example 12.12:
Qs1 = 11340.0 #Surface flux (W/m^2)
D = 0.3 #Diameter of electric heater (m)
#Calculation:
A = pi*(D/2.0)**2 #Surface area of heater (m^2)
Qs = Qs1*A #Heat transfer rate (W)
#Result:
print "The rate of heat transfer is :",round(Qs)," W ."
```