Chapter 4 : The first law of thermodynamics

Example 4.1 page no : 111

In [1]:
#calculate change in pot. energy per unit mass and total change in pot. energy

# variables
g=9.81;                 #m/s^2 acc. due to gravity
dh=23.;                 #m change in height

# calculation and result
dpe=g*dh                #m^2/s^2 change in pot energy per unit mass
print "change in pot. energy per unit mass is %f m^2/s^2"%dpe

m=10.;                  #kg
dPE=m*dpe               #kgm^2/s^2 or J change in pot. energy 
print "The total change in potential energy is %f J"%dPE
change in pot. energy per unit mass is 225.630000 m^2/s^2
The total change in potential energy is 2256.300000 J

Example 4.2 page no : 112

In [2]:
#calculate the kinetic energy of bullet

# variables
m=0.01;                     #lbm mass of bullet
v=2000.;                    #ft/s

# calculation
KE=(m*v**2/2)*(1.356/32.2)  #J

# result
print "the kinetic energy of bullet is %f J"%KE
the kinetic energy of bullet is 842.236025 J

Example 4.3 page no : 112

In [3]:
#Calculate the kinetic energy of bullet fired from a airplane

# variables
v_bp=2000.;                    #ft/s vel of bullet wrt plane
v_p=-1990.;                    #ft/s
v_b=v_bp+v_p                   #ft/s vel of bullet wrt ground
m=0.01;                        #lbm

# calculation
KE=(m*v_b**2/2)*(1.356/32.2)   #J

# result
print "the kinetic energy of bullet fired from a airplane is %f J"%KE
the kinetic energy of bullet fired from a airplane is 0.021056 J

Example 4.4 page no : 119

In [4]:
#calculate the change in internal energy of the system

# variables
p=14.7;                 #lbf/in^2 atmospheric pressure
dV=1.;                  #ft^3 change in volume

# calculation
dW=p*dV*(144/778.)      #Btu work done
dQ=-42.;                #Btu heat removed from the system
dU=dQ-dW                #Btu change in internal energy of the system

# result
print "the change in internal energy of the system is %f Btu"%dU
the change in internal energy of the system is -44.720823 Btu

Example 4.5 page no : 120

In [5]:
#calculate the work done
#work done=change in pot. energy + change in kinetic energy considering steady flow and adiabatic conditions

# variables
v_in=3.;                        #m/s
v_out=10.;                      #m/s
dke=(v_in**2-v_out**2)/2.0;     #m^2/s^2
g=9.81;                         #m/s^2
dh=15.;                         #m change in height in inlet and outlet

# calculation
dpe=g*dh;                       #m^2/s^2
W=dpe+dke                       #J/kg

# result
print "The work done is %f J/Kg"%W
The work done is 101.650000 J/Kg

Example 4.6 page no : 124

In [1]:
#calculate the mass consumed in a nuclear reactor per unit time

# variables
#let D=d/dt
DQ=-13.*10**8;                  #J/s
DW=7*10.**8;                    #J/s

#Dm=(DQ-DW)/c^2 where c is velocity of light sice E=mc^2
c=3.0*10**8;                    #m/s
c1=3.0;                         #velocity of light without power
p=8.                            #power of 10 in speed of light 

# calculation
Dm=float(DW-DQ)/c/c1            #kg/s

# result
print "the mass consumed in a nuclear reactor per unit time is %f * 10^(-%d) kg/s"%(Dm,p)
the mass consumed in a nuclear reactor per unit time is 2.222222 * 10^(-8) kg/s