In [1]:

```
#An automobile with a mass of 3000 lb comes over the top of a hill 50 ft high
#with a velocity of 50 mph. Brakes are applied at the instant the automobile
#reaches the top, and it comes to rest at the bottom of the hill. How much
#energy is dissipated from the brakes?
import math
#initialisation of variables
m= 3000 #lb
Z1= 50 #ft
V1= 50 #mph
gc= 32.2 #ft/lbf s^2
V2= 0 #mph
g= 32.2 #ft/s^2
Z2= 0 #ft
#CALCULATIONS
V1= V1*(73.3/50.) #Velocity
Q2= ((m*(V2*V2-V1*V1))/(2*gc))+((m*g)/gc)*(Z2-Z1)
#RESULTS
print '%s %.2e' % ('Energy dissipated from the brakes (ft lbf) = ',-Q2)
raw_input('press enter key to exit')
```

Out[1]:

In [2]:

```
#Steam at a pressure of 13 bar and a temperature of 300C flows adiabatically
#and with negligible velocity into an evacuated tank. Using a closed system
#analysis, determine the temperature of the steam in the tank reaches line
#pressure.
#initialisation of variables
P= 15 #bar
T= 300 #C
h1= 3043.1 #J/gm
#CALCULATIONS
u2= h1
print '%s' %('From keenan and keyes steam tables')
T= 453.4 #C temperature
#RESULTS
print '%s %.2f' % ('Temperature of the steam in the tank (C) = ',T)
raw_input('press enter key to exit')
```

Out[2]:

In [3]:

```
#A 10 lb mass of air at 120F is contained in a rigid tank. How much heat
#is transferred to the tank to raise the air temperature of 275 F?
#initialisation of variables
m= 10 #lbf
T= 120 #F
T1= 275 #F
u1= 98.9 #Btu/lbm
u2= 125.6 #Btu/lbm
#CALCULATIONS
Q= m*(u2-u1) #Heat transferred
#RESULTS
print '%s %.2f' % ('Heat transferred to the tank (Btu) = ',Q)
raw_input('press enter key to exit')
```

Out[3]:

In [4]:

```
#Fluid enters a turbine with a velocity of 1 m/s and an enthalpy of 2000 j/gm;
#it leaves with a velocity of 60 m/s and enthalpy of 1800 J/gm. Heat losses
#are 500 J/s, and the flow rate is 0.5 kg/s. If the inlet of the turbine is
#3 m higher than the outlet, what is the maximum theoretical power
# that can be developed?
#initialisation of variables
v0= 1 #m/s
vi= 60 #m/s
Q= -500 #J/s
m= 500 #gm/s
hi= 2000 #J/gm
h0= 1800 #J/gm
zi= 3 #m
z0= 0 #m
g= 9.8 #m/s^2
gc= 1000. #gm m/Ns^2
#CALCULATIONS
W= Q+m*((hi-h0)+(vi*vi-v0*v0)/(2*gc)+(g/gc)*(zi-z0)) #Work
#RESULTS
print '%s %.2e' % ('Maximum theotrical power that can be devoloped (J/s) = ',W)
raw_input('press enter key to exit')
```

Out[4]:

In [5]:

```
#To produce 0.3 lt/s hot water at 82 C, low pressure steam at 2.4 bar and
#80 percent quality is mixed with a stream of water at 16 C. What is the
#required steam flow rate?
#initialisation of variables
m= 0.3 #lt/s
T= 82 #C
P= 2.4 #bar
p= 80.
Tw= 800 #C
h1= 67.19 #J/gm
h3= 343.3 #J/gm
hf= 529.65 #J/gm
hfg= 2185.4 #J/gm
v3= 1.0305 #cm^3/gm
V3= 300 #cm^3/s
#CALCULATIONS
h2= hf+(p/100.)*hfg #Enthalpy at 2
m3= V3/v3 #Mass at 3
m2= (m3*(h3-h1))/(h2-h1) #Mass at 2
#RESULTS
print '%s %.2f' % ('Required steam flow rate (gm/s) = ',m2)
raw_input('press enter key to exit')
```

Out[5]:

In [6]:

```
#Latent heat of transforation can be defined as the ratio of heat absorbed
#to the mass which undergoes a change of phase(L=Q/m). Show that the heat of
#transformation for any phase change equals the difference between the
#enthalphies of the system in the two phases.
#initialisation of variables
h2= 2 #J/gm
h1= 1 #J/gm
#CALCULATIONS
L= h2-h1 #Difference between enthalpies
#RESULTS
print '%s %.2f' % ('Difference between the enthalpies of the system in the two phases ((h2-h1) J/gm) = ',L)
raw_input('press enter key to exit')
```

Out[6]: