Chapter 4 : First Law of Thermodynamics

Example 4.1 Page No : 78

In [1]:
# Variables
V1 = 0.3; 			# Initial volume in m3
V2 = 0.15; 			# Final volume in m3
P = 0.105e06; 			# Pressure in Pa
Q = -37.6e03; 			# Heat tranferred in J

# Calculation
W = P*(V2-V1); 			# Work done
U = Q-W; 			# Internal energy change

# Results
print "Change in the internal energy of the system is %.2f kJ"%(U/1000)
Change in the internal energy of the system is -21.85 kJ

Example 4.2 Page No : 78

In [6]:
# Variables
Qacb = 84e03;
Wacb = 32e03;
Uba = Qacb-Wacb; 			# Ub-Ua

# Calculation and Results
# Part (a)
Wadb = 10.5e03; 
Qadb = Uba+Wadb; 
print "The heat flow into the system along the path adb",(Qadb/1000),"kJ"

# Part (b)
Wb_a = -21e03;
Uab = - Uba;
Qb_a = Uab+Wb_a;
print "The heat liberated along the path b-a is",round(Qb_a/1000),"kJ"

# Part (c)
Wdb = 0.; 			# Constant volume
Wad = 10.4e03; 
Wadb = Wdb-Wad; 
Ud = 42e03;
Ua = 0.;
Qad = Ud-Ua+Wad;
Qdb = Qadb-Qad; 
print "The heat absorbed in the path ad and db are",round(Qdb/1000),"kJ","and",round(Qad/1000),"kJ"
The heat flow into the system along the path adb 62.5 kJ
The heat liberated along the path b-a is -73.0 kJ
The heat absorbed in the path ad and db are 10.0 kJ and 52.0 kJ

Example 4.3 Page No : 79

In [4]:
# Variables
# Process a-b
Qab = 0;
Wab = 2170; 			# in KJ/min
Eab = Qab-Wab; 

# Process b-c
Qbc = 21000;
Wbc = 0; 
Ebc = Qbc-Wbc;

# Process c-d
Qcd = -2100;
Ecd = -36600; 
Wcd = Qcd-Ecd;

# Calculation
# Process d-a
Q = -17000; 			# Total heat transfer
Qda = Q-Qab-Qbc-Qcd; 
Eda = -Eab-Ebc-Ecd;
Wda = Qda-Eda;
M = [[Qab, Wab, Eab],[Qbc, Wbc ,Ebc],[Qcd, Wcd, Ecd],[Qda, Wda, Eda]];
process = ["a-b","b-c","c-d","d-a"]
# Results
print "The completed table is"
print "    process        Q          W         deltaE"
for i in range(4):
    print "%10s"%process[i],
    for j in range(3):
        print "%10d"%M[i][j],

    print ""
print "\nRate of work output : %.f kJ/min"%(sum([M[0][0],M[1][0],M[2][0],M[3][0]]))
The completed table is
    process        Q          W         deltaE
       a-b          0       2170      -2170 
       b-c      21000          0      21000 
       c-d      -2100      34500     -36600 
       d-a     -35900     -53670      17770 

Rate of work output : -17000 kJ/min

Example 4.4 Page No : 80

In [2]:
# Part (a)
import math 

# Variables
m = 3.;
V1 = 0.22;     #volume m^3
P1 = 500.e03;  #initial pressure Pa
P2 = 100.e03;  #final pressure Pa

# Calculation
V2 = V1*(P1/P2)**(1./1.2);
dU = 3.56*(P2*V2-P1*V1);
gama = 1.2;
W = (P2*V2-P1*V1)/(1-gama);
Q = dU+W;

# Results
print "Q,W and dU of the quasi static process are",int(dU/1000),round(W/1000),round(Q/1000),"kJ respectively"

# Part (b)
Qb = 30e03;
Wb = Qb-dU; 
print "Work transfer for the process is",round(Wb/1000),"kJ"

# Part (c)
print "Wb is not equal to integral(p*dv) .since the process is not quasi static"

# rounding off error. please check
Q,W and dU of the quasi static process are -92 129.0 37.0 kJ respectively
Work transfer for the process is 122.0 kJ
Wb is not equal to integral(p*dv) .since the process is not quasi static

Example 4.5 Page No : 81

In [36]:
from numpy.linalg import inv
from numpy import *
from scipy.integrate import *

# Variables
V1 = 0.03;    #initial volume m^3
P1 = 170e03;  #initial pressure Pa
P2 = 400e03;  #final pressure Pa
V2 = 0.06;    #final volume m^3
U = 3.15*(P2*V2-P1*V1);
B = array([P1, P2]);
B= B.transpose()

A = [[1, V1],[1, V2]];
A = array(A)
x =  inv(A)*B;

a = -60000
b = 7666666.7;

# Calculation
def pressure(V):
    return a+b*V;

W = quad(pressure,V1,V2)[0]
Q = U+W;

# Results
print "The work done by the system is",round(W/1000,2),"kJ"
print "The internal energy change of the system is",round(U/1000,1),"J"
print "The heat flow into the system is",round(Q/1000,2),"kJ"

# rounding off error. please check.
The work done by the system is 8.55 kJ
The internal energy change of the system is 59.5 J
The heat flow into the system is 68.09 kJ

Example 4.6 Page No : 82

In [39]:
# Process 1-2
import math 

# Variables
Q12 = 235; 			# in KJ/Kg
W12 = 0 ;

# Calculation
U12 = Q12-W12;
# Process 2-3
Q23 = 0; 
U23 = -70 ;
W23 = Q23-U23;

# Process 3-1
Q31 = - 200; 
U31 = -U12-U23;
W31 = Q31-U31;
W = W12 + W23 + W31;
Q = Q12 + Q23 + Q31;

# Results
print "Heat trasfer in the cycle is",Q,"KJ/Kg"
print "Work done during the the cycle is",W,"KJ/Kg"
Heat trasfer in the cycle is 35 KJ/Kg
Work done during the the cycle is 35 KJ/Kg