Chapter 5: First Law of Thermodynamics

Exa 5.1

In [1]:
#A stationary mass of gas is compressed without friction from an intial state
#of 10 cu ft abd 15 psia to a final state of 5 cu ft and 15 psia, the pressure
#remaining constant during the process. How much does the internal energy of 
#the gs change?
#initialisation of variables
p= 15 								#psia
V2= 5 								#cu
V1= 10 								#cu
E= 34.7 							#Btu
#CALCULATIONS
dE= -E-((p*(V2-V1)*144.)/(778.))	#Change in internal energy
#RESULTS
print '%s %.2f' %('Change in internal energy of the gas (Btu) = ',dE)
raw_input('press enter key to exit')
Change in internal energy of the gas (Btu) =  -20.82
press enter key to exit
Out[1]:
''

Exa 5.2

In [ ]:
#A stationary system of conctant volume experience a temperature rise of 35 F
#when a certain process occurs. The heat transferred in the proccess is 34 btu. 
#The specific heat at constant volume for the pure substance in the system is
# 1.2, and the system contains 2 lb of substance. Determine the internal 
#energy change and the work done?
#initialisation of variables
m= 2 			#lb
T2= 35 			#F
cv= 1.2 		#Btu/lb F
Q= 34 			#Btu
#CALCULATIONS
U= m*cv*T2		#Internal energy
W= Q-U 			#Work done
#RESULTS
print '%s %.2f' %('Change in internal enenrgy (Btu) = ',W)
raw_input('press enter key to exit')
Change in internal enenrgy (Btu) =  -50.00

Exa 5.3

In [1]:
#In the steam tables,it is set forth that during the evaporation of 1 lb
#of water at 500 psia and 467.01 F the V increases from 0.0197 to 0.9278,
#while the enthalpy increases from 449.4 to 1204.4. How much work is done by
#a stationary system consisting of 1 lb of water when, because of an inflow 
#heat, the system changes from liquid to vapor at 500 psia. How much does the
#internal energy change?
#initialisation of variables
print  '%s' %('From keenan and keyes steam tables')
p= 500 				#psia
V2= 0.9278 			#cu ft/lb
V1= 0.0197 			#cu ft/lb
h= 1204.4 			#Btu/lb
h1= 449.4 			#Btu/lb
#CALCULATIONS
W= p*144*(V2-V1)	#Work done
U= h-h1-(W/778.) 	#Internal energy
#RESULTS
print '%s' %('The second method follows the same procedure hence the same calculations are used')
print '%s %.2f' %('Change in internal enenrgy (Btu) = ',U)
raw_input('press enter key to exit')
From keenan and keyes steam tables
The second method follows the same procedure hence the same calculations are used
Change in internal enenrgy (Btu) =  670.96
press enter key to exit
Out[1]:
''

Exa 5.4

In [3]:
#The internal energy of a certain susbtance is given by u= 0.48pv + 35.
#A system composed of 3 lb of this substance expands from an intial pressure
#of 75 psia and volume of 6 to a final pressure of 15 psia in a process in 
#which pressure and volume are related by pv^1.2=c. 
#(a)If the expression is frictionless, determine Q, U and W for the process.
#(b) In another proccess the same system again exmapns according to the same 
#initial state to the same final state as in part a but the heat in this case
#is 30 btu. Find the work for this process
import math
#initialisation of variables
m= 3 										#lb
V1= 6 										#cu ft
p1= 75. 									#psia
p2= 15. 									#psia
n= 1.2
Q1= 30 										#Btu
#CALCULATIONS
V2= V1*math.pow((p1/p2),(1/n)) 				#Final volume
U= (m/3)*(0.480*p2*V2+35-0.480*p1*V1-35) 	#Internal energy
W= (p2*V2-p1*V1)/(1-n) 						#Work done
Q= U+W 										#Enthalpy
W1= Q1-U 									#Work done in case 2
#RESULTS
print '%s %.2f' %('Change in internal enenrgy (Btu) = ',U)
print '%s %.2f' %(' \n Work done (Btu) = ',W)
print '%s %.2f' %(' \n Heat generated (Btu) = ',Q)
print '%s %.2f' %(' \n Work done (Btu) = ',W1)
print '%s' %('The answers given in the textbook are wrong.please calculate them personally.')
raw_input('press enter key to exit')
Change in internal enenrgy (Btu) =  -50.82
 
 Work done (Btu) =  529.37
 
 Heat generated (Btu) =  478.55
 
 Work done (Btu) =  80.82
The answers given in the textbook are wrong.please calculate them personally.
press enter key to exit
Out[3]:
''