Chapter 4 : First Law of Thermodynamics

Example 4.1 page no : 119

In [1]:
# Variables
Q = -50.; 			#kJ/kg
W = -100.; 			#kJ/kg

# Calculations
dU = Q-W;

# Results
print ("gain in internal energy  =  "),(dU),("kJ/kg")
gain in internal energy  =   50.0 kJ/kg

Example 4.2 page no : 119

In [2]:
# Variables
u1 = 450.; 			#kJ/kg
u2 = 220; 			#kJ/kg
W = 120; 			#kJ/kg

# Calculations
Q = (u2-u1) + W;

# Results
print ("Heat rejected by air  = "),(-Q),("kJ/kg")
Heat rejected by air  =  110.0 kJ/kg

Example 4.3 page no : 119

In [3]:
# Variables
m = 0.3; 			#kg
cv = 0.75; 			#kJ/kg.K
T1 = 313.; 			#K
T2 = 433.; 			#K
W = -30.; 			#kJ

# Calculations
dU = m*cv*(T2-T1);
Q = dU + W;

# Results
print ("Heat rejected during the process = "),(-Q),("kJ")
Heat rejected during the process =  3.0 kJ

Example 4.4 page no : 120

In [4]:
# Variables
p1 = 105.; 			#kPa
V1 = 0.4;  			#m**3
p2 = p1;
V2 = 0.20; 			#m**3
Q = -42.5; 			#kJ

# Calculations
W = p1*(V2-V1);
dU = Q-W;

# Results
print ("change in internal energy  =  "),(dU),("kJ")
change in internal energy  =   -21.5 kJ

Example 4.6 Page no :121

In [10]:
import math

# Variables
p1 = 10.**5         # Pa
T1 = 25 + 273      # K
p2 = 5 * 10**5     # Pa
T2 = T1 

# Calculations and Result
print "(i) For isothermal process :"
W12 = -p1 * (1.8)* math.log(p1/p2)
print "Work done on the air = %.3e kJ/kg."%W12

print "(ii) Since temperature is constant,"
print "u2 – u1 = 0"
print "Change in internal energy = zero."

print "(iii) Again,"
Q12 = 0 + W12
print "Heat rejected = %.3e kJ/kg."%Q12
(i) For isothermal process :
Work done on the air = 2.897e+05 kJ/kg.
(ii) Since temperature is constant,
u2 – u1 = 0
Change in internal energy = zero.
(iii) Again,
Heat rejected = 2.897e+05 kJ/kg.

Example 4.7 page no : 122

In [5]:
# Variables
W_12 = -82.; 			#kJ
Q_12 = -45.; 			#kJ
dU_12 = Q_12 - W_12;
W_21 = 100.; 			#kJ
dU_21 = -dU_12;

# Calculations
Q_21 = dU_21 + W_21;

# Results
print ("Heat added to the system  =  "),(Q_21),("kJ")
Heat added to the system  =   63.0 kJ

Example 4.8 page no : 123

In [6]:
# Variables
Q2 = 9000.; 			#kJ
Q1 = 3000.; 			#kJ
Q = Q1-Q2; 
W = 0;

# Calculations
dU = W-Q;

# Results
print ("Work done  =  "),(W)

print ("Change in internal energy  =  "),(dU),("kJ")
Work done  =   0
Change in internal energy  =   6000.0 kJ

Example 4.9 page no : 124

In [5]:
# Variables
m = 20.; 			#kg
g = 9.81; 			#m/s**2
z2 = 0.;
z1 = 15.;

# Calculations and Results
print ("(i) When the stone is about to enter the water")
Q = 0
W = 0
dU = 0
PE = m*g*(z2-z1)
KE = -PE
print "∆ PE = %.3f"%KE,"J"

print ("(ii) When the stone dips into the math.tank and comes to rest")
Q = 0
W = 0
KE = 0
PE = m*g*(z2-z1)
dU = -PE
print "∆U = %.3f"%dU

print ("(iii) When the water and stone come to their initial temperature")
W = 0
KE = 0
Q = -dU
print "Q = %.3f"%Q
(i) When the stone is about to enter the water
∆ PE = 2943.000 J
(ii) When the stone dips into the math.tank and comes to rest
∆U = 2943.000
(iii) When the water and stone come to their initial temperature
Q = -2943.000

Example 4.10 page no : 125

In [1]:
# Variables
Q_lqm = 168.; 			#kJ
W_lqm = 64.; 			#kJ
dU_lm = Q_lqm - W_lqm;
W_lnm = 21.; 			#kJ
W_ml = -42.; 			#kJ

# Calculations and Results
Q_lnm = dU_lm + W_lnm;
print ("(i)Q_lnm = "),(Q_lnm), ("kJ")

Q_ml = W_ml - dU_lm;
print ("(ii)Q_ml  =  "),(Q_ml),("kJ")

W_ln = 21.; 			#kJ
dU_ln = 84.; 			#kJ
Q_ln = dU_ln + W_ln;
Q_nm = Q_lnm-Q_ln;
print ("(iii)Q_nm  =  "), (Q_nm), ("kJ")
(i)Q_lnm =  125.0 kJ
(ii)Q_ml  =   -146.0 kJ
(iii)Q_nm  =   20.0 kJ

Example 4.11 page no : 126

In [8]:
import math 
from scipy.integrate import quad 

# Variables
T1 = 55.; 			#0C
T2 = 95.; 			#0C

# Calculations
def f1( T): 
	 return 200
W =  quad(f1, T1, T2)[0]


def f2( T): 
	 return 160
Q =  quad(f2, T1, T2)[0]
dU = Q-W;

# Results
print ("change in internal energy = "),(dU/10**3),("kJ")
change in internal energy =  -1.6 kJ

Example 4.12 page no : 127

In [30]:
import math 

# Variables
Q = -340.; 			#kJ
n = 200.; 			#cycles/min

#For Process 1-2
W_12 = 4340.; 			#kJ/min
Q_12 = 0.;

# Calculations and Results
dE_12 = Q_12-W_12;
print ("dE_12  = "),(dE_12),("kJ/min")

#For process 2-3
Q_23 = 42000.; 			#kJ/min
W_23 = 0;

dE_23 = Q_23-W_23;
print ("dE_23  = "),(dE_23),("kJ/min")

#For process 3-4
Q_34 = -4200.; 			#kJ/min
dE_34 = -73200.; 			#kJ/min

W_34 = Q_34-dE_34;
print ("W_34  = "), (W_34), ("kJ/min")

#For process 4-1
Q_41 = Q*n-Q_12-Q_23-Q_34;
print ("Q_41  = "), (Q_41), ("kJ/min")

dE_41 = 0-dE_12-dE_23-dE_34;
print ("dE_41  = "), (dE_41), ("kJ/min")

W_41 = Q_41-dE_41;
print ("W_41  = "), (W_41), ("kJ/min")

print "Since sum(Q) = sum(W), "
print "Rate of work output = -68000 KJ/min"
dE_12  =  -4340.0 kJ/min
dE_23  =  42000.0 kJ/min
W_34  =  69000.0 kJ/min
Q_41  =  -105800.0 kJ/min
dE_41  =  35540.0 kJ/min
W_41  =  -141340.0 kJ/min
Since sum(Q) = sum(W), 
Rate of work output = -68000 KJ/min

Example 4.13 page no : 128

In [11]:
# Variables
P = 1200.; 			#kW
Qin = 3360.; 			#kJ/kg
Qout = 2520.; 			#kJ/kg
F = 6.; 			#kW

# Calculations
dQ = Qin - Qout;
dW = P-F; 			#kJ/s
m  =  dW/dQ;

# Results
print ("Steam flow round the cycle %.3f")%(m), ("kg/s")
Steam flow round the cycle 1.421 kg/s

Example 4.14 page no : 129

In [12]:
# Variables
dT = 25.; 			#0C
Q = 30.; 			#kJ
cv = 1.2; 			#kJ/kg.0C
m = 2.5; 			#kg

# Calculations
dU = m*cv*dT;

# Results
print ("change in internal energy  =  "),(dU), ("kJ")

W = Q - dU;
print ("Work done  =  "),(W),("kJ")
change in internal energy  =   75.0 kJ
Work done  =   -45.0 kJ

Example 4.15 page no : 129

In [12]:
# Variables
Q = 50.; 			#kJ
dV = 0.14; 			#m**3
p = 1.2*10**5; 		#N/m**2
m = 90.; 			#kg
d = 5.5; 			#m
g = 9.8; 			#m/s**2
W_adb  =  -110.; 	#kJ
Wnet = m*g*d/1000; 	#kJ

# Calculations and Results
W = p*dV/1000 + Wnet; 			#kJ
dE = Q-W;
print ("(i)Change in internal energy %.3f kJ")%(dE)

Q = 0;
dE = -W_adb;
print ("(ii) Adiabatic process %.3f kJ")%(dE)


Q = 50.; 			#kJ
dE = Q - (W_adb+W);
print ("(iii)Change in internal energy %.3f kJ")%(dE)
(i)Change in internal energy 28.349 kJ
(ii) Adiabatic process 110.000 kJ
(iii)Change in internal energy 138.349 kJ

Example 4.16 page no : 130

In [9]:
import math 
from scipy.integrate import quad 

# Variables
V1 = 0.15; 			#m**3
V2 = 0.05; 			#m**3
Q = -45.; 			#kJ
p1 = (5./V1+1.5)*10**5; 			#N/m**2
p2 = (5./V2+1.5)*10**5; 			#N/m**2

# Calculations
def f0( V): 
	 return (5/V+1.5)*10**2

W =  quad(f0, V1, V2)[0]

dU = Q-W;
print ("(i)Change in internal energy  = %.3f kJ")%(dU)

dH = (dU*10**3+(p2*V2-p1*V1))/10**3;
print ("(ii) Change in enthalpy = %.3f kJ")%(dH)
(i)Change in internal energy  = 519.306 kJ
(ii) Change in enthalpy = 504.306 kJ

Example 4.17 page no : 131

In [13]:
# Variables
V1 = 0.25; 			#m**3
p1 = 500.; 			#kPa
p2 = 100.; 			#kPa

# Calculations and Results
V2 = V1*(p1/p2)**(1/1.25)
n = 1.25
dU = 3.64*(p2*V2 - p1*V1)

print ("(i) If the expansion is quasi-static")
W = (p1*V1-p2*V2)/(n-1);
Q = dU+W
print ("Heat transfered = %.3f")%(Q),("kJ")

print ("(ii) In another process")
Q = 32; 			#kJ
W = Q-dU;
print ("Work done = %.3f")%(W),("kJ")

print ("(iii)The difference")
print (" The work in (ii) is not equal to ∫ p dV math.since the process is not quasi-static.")
(i) If the expansion is quasi-static
Heat transfered = 12.385 kJ
(ii) In another process
Work done = 157.225 kJ
(iii)The difference
 The work in (ii) is not equal to ∫ p dV math.since the process is not quasi-static.

Example 4.18 page no : 132

In [17]:
import math 
from scipy.integrate import quad 

# Variables
v1 = 0.3; 			#m**3/kg
T1 = 20.; 			#0C
v2 = 0.55; 			#m**3/kg
T2 = 260; 			#0C
p = 1.6*10**5; 			#Pa

print ("(i)Heat added per kg  =  ")

# Calculations and Results
def f5( T): 
	 return 1.5 + 75/(T+45)

Q =  quad(f5, T1,T2)[0]

print ("Q = %.3f")%(Q), ("kJ/kg")


print ("(ii)The work done per kg of fluid")
W = p*(v2-v1)/1000; 			#kJ/kg
print ("W = %.3f")%(W),("kJ/kg")


print ("(iii)Change in internal energy")
dU = Q-W;
print ("dU = %.3f")%(dU),("kJ/kg")


print ("(iv)Change in enthalpy")
dH = Q;
print ("dH = %.3f")%(dH),("kJ/kg")
(i)Heat added per kg  =  
Q = 475.944 kJ/kg
(ii)The work done per kg of fluid
W = 40.000 kJ/kg
(iii)Change in internal energy
dU = 435.944 kJ/kg
(iv)Change in enthalpy
dH = 475.944 kJ/kg

Example 4.19 page no : 133

In [18]:
# Variables
m = 1.; 			#kg
du = -42000.; 			#J
cp = 840.; 			#J/kg.0C
cv = 600.; 			#J/kg.0C

# Calculations
dT = du/m/cv;
Q = m*cp*dT;
W = (Q-du)/10**3;

# Results
print ("Work done = "),(W),("kJ")
Work done =  -16.8 kJ

Example 4.20 page no : 133

In [12]:
from numpy import *
from scipy.integrate import quad 

# Variables
p1 = 190.; 			#kPa
V1 = 0.035; 			#m**3
p2 = 420.; 			#kPa
V2 = 0.07; 			#m**3
dU = 3.6*(p2*V2-p1*V1);
p = [[1,0.035],[1,0.07]]
q = [190,420];
#X = linalg.inv(p)*q;
X = linalg.solve(p,q)
a = X[0]
b = X[1]

# Calculations
def f4( V): 
	 return a+b*V

W =  quad(f4, V1, V2)[0]

# Results
print ("Work done by the system  =  "),(W),("kJ")


Q = dU+W;
print ("Heat transfer into the system  =  "),(Q),("kJ")
Work done by the system  =   10.675 kJ
Heat transfer into the system  =   92.575 kJ

Example 4.21 page no : 134

In [20]:
# Variables
Qv = 90.; 			#kJ
Qp = -95; 			#kJ
W = -18; 			#kJ
U_l = 105; 			#kJ
W_lm = 0;
Q_lm = 90;

# Calculations
U_m = U_l+90;
dU_mn = Qp-W;
U_n = U_m+dU_mn;
dQ = Qv+Qp;
dW = dQ;
W_nl = dW-W;

# Results
print ("W_nl(in kJ) = "),(W_nl)

print ("U_l in kJ  = "),(U_l)

print ("U_m in kJ  = "),(U_m)
print ("U_n in kJ"), (U_n)
W_nl(in kJ) =  13.0
U_l in kJ  =  105
U_m in kJ  =  195
U_n in kJ 118

Example 4.23 page no : 136

In [27]:
# Variables
V1 = 0.2; 			#m**3
p1 = 4.*10**5; 		#N/m**2
T1 = 403.; 			#K
p2 = 1.02*10**5; 	#N/m**2
dH = 72.5; 			#kJ
Q_23 = dH;
cp = 1.; 			#kJ/kg
cv = 0.714; 		#kJ/kg
y = 1.4;

# Calculations
V2 = round(V1*(p1/p2)**(1/y),2);
T2 = round(T1*((p2/p1)**((y-1)/y)),1);
R = (cp-cv)*1000; 			#J/kg.K
m = round(p1*V1/R/T1,3);
T3 = round(Q_23/(m*cp) +T2);
V3 = 0.732 # round(V2*T3/T2,2);
W_12 = (p1*V1 - p2*V2)/(y-1);
W_23 = p2*(V3-V2);
W_123 = W_12+W_23;

# Results
print ("Total work done  =  %.3f")%(W_123),("J")

print ("(ii) Index of expansion, n")
p3 = p2;
n = (p1*V1-p3*V3)/W_123 + 1;
print ("value of index  =  %.3f")%(n)
Total work done  =  85454.000 J
(ii) Index of expansion, n
value of index  =  1.062

Example 4.25 page no : 139

In [23]:
# Variables
d = 0.15; 			#m
T = 303.; 			#K
p = 3.*10**5; 		#N/m**2
l = 0.085; 			#m
Q = -4000.; 		#J

# Calculations and Results
print ("(i) Workdone by the system")
dv = math.pi/4*d**2*l;
W = p*dv;
print ("W = %.3f")%(W/10**3),("kJ")

print ("(ii) Decrease in internal energy of the system")
dU = (Q-W)/10**3;
print ("Decrease in internal energy  =  %.3f")%(-dU),("kJ")
(i) Workdone by the system
W = 0.451 kJ
(ii) Decrease in internal energy of the system
Decrease in internal energy  =  4.451 kJ

Example 4.27 page no : 140

In [24]:
import math

# Variables
y = 1.4
R = 294.2; 			#J/kg.0C
p1 = 1.*10**5; 		#N/m**2
T1 = 353.; 			#K
V1 = 0.45; 			#m**3
V2 = 0.13; 			#m**3
p2 = 5.*10**5; 		#N/m**2

# Calculations and Results
cv = R/(y-1);
print ("(i) The mass of gas")
m = p1*V1/R/T1;
print ("m = %.3f")%(m),("kg")

print ("(ii) The value of index ‘n’ for compression")
n = math.log(p2/p1)/math.log(V1/V2);
print ("n = %.3f")%(n)

print ("(iii) The increase in internal energy of the gas")
T2 = T1*(V1/V2)**(n-1);
dU = m*cv*(T2-T1)/10**3;
print ("dU = %.3f")%(dU),("kJ")

print ("(iv) The heat received or rejected by the gas during compression.")
W = m*R*(T1-T2)/(n-1)/10**3;
Q = dU+W;
print ("Q = %.3f")%(Q),("kJ")
(i) The mass of gas
m = 0.433 kg
(ii) The value of index ‘n’ for compression
n = 1.296
(iii) The increase in internal energy of the gas
dU = 50.000 kJ
(iv) The heat received or rejected by the gas during compression.
Q = -17.535 kJ

Example 4.28 page no : 141

In [25]:
# Variables
p1 = 1.02*10**5; 	#Pa
T1 = 295.; 			#K
V1 = 0.015; 		#m**3
p2 = 6.8*10**5; 	#Pa
y = 1.4;

# Calculations and Results
print ("(i) Final temperature")
T2 = T1*(p2/p1)**((y-1)/y);
t2 = T2-273; 
print ("t2 = %.3f")%(t2),("°C")


print ("(ii) Final volume :")
V2 = V1*(p1/p2)**(1/y);
print ("V2 = %.3f")%(V2),("m**3")


print ("(iii)Work done")
R = 287;
m = p1*V1/R/T1;
W = m*R*(T1-T2)/(y-1)/10**3;
print ("W = %.3f")%(W),("kJ")
(i) Final temperature
t2 = 234.253 °C
(ii) Final volume :
V2 = 0.004 m**3
(iii)Work done
W = -2.752 kJ

Example 4.29 page no : 142

In [26]:
from numpy import *
import math

# Variables
m = 0.44; 			#kg
T1 = 453.; 			#K
ratio = 3.; 		#ratio = V2/V1
T2 = 288.; 			#K
W_12 = 52.5; 		#kJ

# Calculations
y = math.log(T2/T1)/ math.log(1/ratio) + 1;
R = W_12*(y-1)/m/(T1-T2);
M = [[1,-1],[1,-y]];
N = [R,0];
X = linalg.inv(M)*N;
cp = X[0][0];
cv = X[1][0];

# Results
print ("cp = %.3f")%(cp),("kJ/kg.K")

print ("cv = %.3f")%(cv),("kJ/kg.K")
cp = 1.021 kJ/kg.K
cv = 0.723 kJ/kg.K

Example 4.30 page no : 143

In [27]:
# Variables
n = 1.3;
m = 1; 			#kg
p1 = 1.1; 			#bar
T1 = 300.; 			#K
p2 = 6.6; 			#bar
R0 = 8314.;
M = 30.;
cp = 1.75; 			#kJ/kg.K


# Calculations
R = R0/M/1000; 			#kJ/kg.K
cv = cp - R;
y = cp/cv;
T2 = T1 *(p2/p1)**((n-1)/n);
W = R*(T1-T2)/(n-1);
Q = ((y-n)/(y-1))*W;

# Results
print ("Heat supplied  =  %.3f")%(Q),("kJ/kg")
Heat supplied  =  84.352 kJ/kg

Example 4.31 page no : 144

In [28]:
import math

# Variables
cp = 14.3; 			#kJ/kg.K
cv = 10.2; 			#kJ/kg.K
V1 = 0.1; 			#m**3
T1 = 300.; 			#K
p1 = 1.; 			#bar
p2 = 8.; 			#bar
y = cp/cv;
R = cp-cv;
V2 = V1*(p1/p2)**(1/y);
V3 = V2;
T2 = T1*(p2/p1)**((y-1)/y);
p3 = p1*V1/V3;
T3 = 300.; 			#K


# Calculations and Results
print ("(i) Pressure at the end of consmath.tant volume cooling  =  %.3f")%(p3),("bar")

print ("(ii) Change in internal energy during consmath.tant volume process")
m = p1*V1/R/T1*10**2; 			#kg

dU_23 = m*cv*(T3-T2);
print ("dU_23  =  %.3f")%(dU_23),("kJ")

print ("(iii) Net work done and heat transferred during the cycle")
W_12 = m*R*(T1-T2)/(y-1);
W_23 = 0;
W_31 = p3*V3*math.log(V1/V3)*10**2; 			#kJ
Wnet = W_12+W_23+W_31;
print ("Net work done = %.3f")%(Wnet),("kJ")
Qnet = Wnet;
print ("Heat transferred during the complete cycle  =  %.3f")%(Qnet),("kJ")
(i) Pressure at the end of consmath.tant volume cooling  =  4.407 bar
(ii) Change in internal energy during consmath.tant volume process
dU_23  =  -20.281 kJ
(iii) Net work done and heat transferred during the cycle
Net work done = -5.449 kJ
Heat transferred during the complete cycle  =  -5.449 kJ

Example 4.32 page no : 145

In [29]:
import math

# Variables
V1 = 0.15; 			#m**3
p1 = 15.; 			#bar
T1 = 550.; 			#K
T2 = T1;
r = 4.; 			#r = V2/V1
V2 = r*V1;
T3 = 290.; 			#K

# Calculations
p2 = p1*V1/V2;
W_12 = p1*V1*math.log(V2/V1)*10**2; 			#kJ
V3 = V2;
p3 = p2*T3/T2;
W_23 = 0;
n = math.log(p1/p3)/math.log(V3/V1);
W_31 = (p3*V3-p1*V1)/(n-1)*10**2; 			#kJ

# Results

Wnet = W_12+W_23+W_31
print ("net work done  =  %.3f")%Wnet , ("kJ")

Qnet = Wnet;
print ("Heat transferred during the cycle  =  %.3f")%(Qnet),("kJ")
net work done  =  81.537 kJ
Heat transferred during the cycle  =  81.537 kJ

Example 4.33 page no : 146

In [1]:
%matplotlib inline

import math 
from scipy.integrate import quad 
from matplotlib.pyplot import *
from numpy import *

# Variables
m = 1; 			#kg
p1 = 5; 			#bar
V1 = 0.02; 			#m**3
V2 = 0.08; 			#m**3
p2 = 1.5; 			#bar


# Calculations and Results
def f(V):
    return a+b*V;

A = [[1,0.02],[1,0.08]]
B = [5,1.5];
#X = linalg.inv(A)*B;
X  = linalg.solve(A,B)
a = X[0]
b = X[1]

print ("(i) p-V diagram")

V = linspace(0.02,0.08,80);
p = a+b*V;
plot(V,p,'b')

V = [0.0667 ,0.08];
p = [1.5 ,1.5];
plot(V,p,'g')

V = linspace(0.02,0.0667,447)
def fa(V):
    return 0.1/V;
f = fa(V)
plot(V,f,'r')
suptitle("p-V diagram")

V = [0.0667, 0.0667];
p = [1.5, 0];
plot(V,p,'--')
xlabel("V(m)**3")
ylabel("P(bar)")
text(.04,4,'Reversible Expansion')
text(0.04,2.3,"pV = C")
text(0.07,1.2,"p = C")

print ("(ii) Work done and heat transfer")


def f7(V): 
	 return (a+b*V)*10**2

W_12 =  quad(f7,V1,V2)[0]

print ("Work done by the system  = "),(W_12), ("kJ")

p3 = p2;
V3 = round(p1*V1/p3,4);
W_23 = p2*(V3-V2)*10**2; 			#kJ

W_31 = round(p3*V3*math.log(V1/V3)*10**2,2); 			#kJ
print ("Work done on the system  = %.3f")% (W_31), ("kJ")

W_net = W_12+W_23+W_31;
print ("Net work done  = %.3f")% (W_net), ("kJ")

Q_net = W_net;
print ("Heat transferred during the complete cycle  = %.3f")% (Q_net),("kJ")
Populating the interactive namespace from numpy and matplotlib
(i) p-V diagram
(ii) Work done and heat transfer
Work done by the system  =  19.5 kJ
Work done on the system  = -12.050 kJ
Net work done  = 5.455 kJ
Heat transferred during the complete cycle  = 5.455 kJ

Example 4.34 page no : 147

In [31]:
import math 
from scipy.integrate import quad 


# Variables
cv = 0.71; 			#kJ/kg.K
R = 0.287; 			#kJ/kg.K
d = 8.; 			#cm
l = 3.5; 			#cm
S = 150.; 			#N/cm
p1 = 30.; 			#N/cm
V1 = 45.; 			#cm**3
T1 = 293.; 			#K
cv = 0.71; 			#kJ/kg.K
R = 0.287; 			#kJ/kg.K

# Calculations
A = math.pi/4*d**2;
C = p1-S/A**2*V1;
dV = l*A;
V2 = V1+dV;
p2 = S/A**2*V2 + C;

def f3( p): 
	 return A**2/S*p/100

W =  quad(f3, p1, p2)[0]

T2 = p2*V2*T1/p1/V1;
m = p1*V1/R/T1/10**5; 			#kg
dU = m*cv*(T2-T1);
Q_12 = dU + W*10**(-3);

# Results
print ("Amount of heat added to the system  =  %.3f")% (Q_12), ("kJ")
Amount of heat added to the system  =  0.250 kJ

Example 4.35 page no : 164

In [32]:
# Variables
r = 10.; 			#kg/min
p1 = 1.5*10**5; 			#N/m**2
rho1 = 26.; 			#kg/m**3
C1 = 110.; 			#m/s
u1 = 910.; 			#kJ/kg
p2 = 5.5*10**5; 			#N/m**2
rho2 = 5.5; 			#kg/m**3
C2 = 190.; 			#m/s
u2 = 710.; 			#kJ/kg
Q = 55.; 			#kJ/s
h = 55.; 			#m
g = 9.81; 			#m/s**2
v2 = 1/rho2;
v1 = 1/rho1;

# Calculations and Results

dh = u2-u1+ (p2*v2-p1*v1)/10**3;
print ("(i) Change in enthalpy %.3f")%(dh), ("kJ/kg")

print ("(ii) Work done during the process (W).")

Q = 330.; 			#kJ/kg
KE = (C2**2-C1**2)/2/10**3; 			#kJ
PE = g*h/10**3; 			#kJ
W = -Q-KE-PE-dh;
print ("Work done  =  %.3f")%(W),("kJ")


P = W*10/60.;
print ("Work done per second  =  %.3f")%(P),("kW")
(i) Change in enthalpy -105.769 kJ/kg
(ii) Work done during the process (W).
Work done  =  -236.770 kJ
Work done per second  =  -39.462 kW

Example 4.36 page no : 166

In [33]:
# Variables

import math 

m = 15.; 			#kg/s
v = 0.45; 			#m**3/kg
P = 12000.; 		#kW
W = P/m; 			#kJ/kg
h1 = 1260.; 		#kJ/kg
h2 = 400.; 			#kJ/kg
C1 = 50.; 			#m/s
C2 = 110.; 			#m/s

# Calculations and Results
print ("(i) Heat rejected  =  "),
Q = h2-h1+(C2**2-C1**2)/2/10**3 +W;
Qnet = m*Q;
print ("Qnet = %.3f")%(-Qnet),("kW")

print ("(ii) Inlet area")
A = v*m/C1;
print ("A = %.3f")%(A),("m**2")
(i) Heat rejected  =   Qnet = 828.000 kW
(ii) Inlet area
A = 0.135 m**2

Example 4.37 page no : 167

In [34]:
# Variables
m = 0.5; 			#kg/s
C1 = 6.; 			#m/s
C2 = 5.; 			#m/s
p1 = 1.; 			#bar
p2 = 7.; 			#bar
v1 = 0.85; 			#m**3/kg
v2 = 0.16; 			#m**3/kg
du = 90.; 			#kJ/kg
Q = -120.; 			#kJ/kg

# Calculations and Results
print ("(i) Power required to drive the compressor")
W = -du+(C1**2-C2**2)/2/1000 + (p1*v1 - p2*v2)*10**2 + Q;
Power = m*W; 
print ("Power = %.3f")%(-Power),("kW")


print ("(ii) Inlet and outlet pipe cross-sectional areas")
A1 = m*v1/C1;
A2 = m*v2/C2;
print ("Inlet crosssectional area  =  %.3f")% (A1), ("m**2")

print ("Outlet crossectional area = %.3f")%(A2), ("m**2")
(i) Power required to drive the compressor
Power = 118.497 kW
(ii) Inlet and outlet pipe cross-sectional areas
Inlet crosssectional area  =  0.071 m**2
Outlet crossectional area = 0.016 m**2

Example 4.38 page no : 168

In [35]:
# Variables
h1 = 800.; 			#kJ/kg
C1 = 5.; 			#m/s
h2 = 2520.; 			#kJ/kg
C2 = 50.; 			#m/s
dZ = 4.; 			#m
g = 9.81; 			#m/s**2
Q = 2180.; 			#kJ/kg

# Calculations
W = h1-h2+(C1**2 - C2**2)/2/1000 +dZ*g/1000+Q;

# Results
print ("Power developed  =  %.3f")%(W), ("kW")
Power developed  =  458.802 kW

Example 4.39 page no : 169

In [36]:
# Variables
g = 9.8; 			#m/s**2
m = 4500./3600; 	#kg/s
C1 = 2800./60; 		#m/s
Z1 = 5.5; 			#m
h1 = 2800.; 		#kJ/g
C2 = 5600./60; 		#m/s
Z2 = 1.5; 			#m
h2 = 2300.; 		#kJ/kg
Q = -16000./3600; 	#kJ/s

# Calculations
W = Q-m*((h1-h2) + (C2**2 - C1**2)/2/1000 + (Z2-Z1)*g/1000);

# Results
print ("Power output of the turbine  =  %.3f")% (-W),("kW")
Power output of the turbine  =  633.479 kW

Example 4.40 page no : 170

In [37]:
# Variables
p1 = 6.87; 			#bar
C1 = 50.; 			#m/s
p2 = 1.37; 			#bar
C2 = 500.; 			#m/s
print ("From steam table corresponding to p1")
h1 = 2850.; 			#kJ/kg

# Calculations
h2 = h1 - (C2**2-C1**2)/2/1000;

# Results
print ("Final enthalpy of steam  =  "), (h2),("kJ")
From steam table corresponding to p1
Final enthalpy of steam  =   2726.25 kJ

Example 4.41 page no : 171

In [38]:
# Variables
m = 220./60; 			#kg/s
C1 = 320.; 			#m/s
p1 = 6*10.**5; 			#N/m**2
u1 = 2000.*10**3; 			#J/kg
v1 = 0.36; 			#m**3/kg
C2 = 140.; 			#m/s
p2 = 1.2*10**5; 			#N/m**2
u2 = 1400.*10**3; 			#J/kg
v2 = 1.3; 			#m**3/kg
Q = 100*10.**3; 			#J/s

# Calculations
W = (m*((u1-u2)+ (p1*v1 - p2*v2) + (C1**2-C2**2)/2) -Q)/10**6;

# Results
print ("power capacity of the system  =  %.3f")% (W),("MW")
power capacity of the system  =  2.472 MW

Example 4.42 page no : 172

In [39]:
# Variables
p1 = 7.5*10**5; 			#N/m**2
C1 = 140.; 			#m/s
h1 = 950.*10**3; 			#J/kg
p2 = 2*10.**5; 			#N/m**2
C2 = 280.; 			#m/s
h2 = 650.*10**3; 			#J/kg
m = 5.; 			#kg/s

# Calculations
W = (h1-h2)+(C1**2-C2**2)/2
Power = m*W/1000;

# Results
print ("Power capacity of turbine  =  "), (Power), ("kW")
Power capacity of turbine  =   1353.0 kW

Example 4.43 page no : 173

In [40]:
# Variables
C1 = 12.; 			#m/s
p1 = 1.*10**5; 			#N/m**2
v1 = 0.5; 			#m**3/kg
C2 = 90.; 			#m/s
p2 = 8.*10**5; 			#N/m**2
v2 = 0.14; 			#m**3/kg
dh = 150.; 			#kJ/kg
Q = -11.67; 			#kJ/s
m = 0.2; 			#kg/s

# Calculations and Results
print ("(i) Motor power required to drive the compressor")
W = m*(-dh + (C1**2-C2**2)/2/1000) +Q;
print ("Power = %.3f")% (-W), ("kW")


print ("(ii)Ratio of inlet to outlet pipi diameter")
ratio = math.sqrt(C2/C1*v1/v2);
print ("ratio = %.3f")% (ratio)
(i) Motor power required to drive the compressor
Power = 42.466 kW
(ii)Ratio of inlet to outlet pipi diameter
ratio = 5.175

Example 4.44 page no : 175

In [41]:
# Variables
W = -175.; 			        #kJ/kg
dh = 70.; 		        	#kJ/kg
Q_water = -92.; 			#kJ/kg

# Calculations
Q = dh+W;
Q_atm = Q-Q_water;

# Results
print ("Heat transferred to the atmosphere  =  "),(-Q_atm), ("kJ/kg")
Heat transferred to the atmosphere  =   13.0 kJ/kg

Example 4.45 page no : 176

In [42]:
import math

# Variables
h1 = 2800.*10**3; 			#J/kg
C1 = 50.; 			#m/s
A1 = 900.*10**(-4); 			#m**2
v1 = 0.187; 			#m**3/kg
h2 = 2600.*10**3; 			#J/kg
v2 = 0.498; 			#m**3/kJ

# Calculations and Results
print ("(i) Velocity at exit of the nozzle")
C2 = math.sqrt(2*((h1-h2) + C1**2/2));

print ("C2 = %.3f")% (C2),("m/s")


print ("(ii) Mass flow rate")
m = A1*C1/v1;
print ("m = %.3f")% (m), ("kg/s")


print ("(iii) Area at the exit")
A2 = m*v2/C2*10**4;
print ("A2 = %.3f")%(A2), ("cm**2")
(i) Velocity at exit of the nozzle
C2 = 634.429 m/s
(ii) Mass flow rate
m = 24.064 kg/s
(iii) Area at the exit
A2 = 188.894 cm**2

Example 4.46 page no : 177

In [43]:
# Variables
h1 = 240.; 			#kJ/kg
h2 = 192.; 			#kJ/kg
dZ = 20.; 			#m
g = 9.81; 			#m/s**2

# Calculations
Q = (h2-h1)+dZ*g/1000;

# Results
print ("heat transfer  =  %.3f")% (-Q), ("kJ/kg")
heat transfer  =  47.804 kJ/kg

Example 4.47 page no : 178

In [44]:
import math 

# Variables
p1 = 2.; 			#bar
C1 = 300.; 			#m/s
Q = 0.;
h1 = 915.*10**3; 			#J/kg
h2 = 800.*10**3; 			#J/kg

# Calculations
C2 = math.sqrt(2*(h1-h2 + C1**2/2));

# Results
print ("Relative velocity of gas leaving the pipe = %.3f")% (C2), ("m/s")
Relative velocity of gas leaving the pipe = 565.685 m/s

Example 4.48 page no : 179

In [45]:
import math 

# Variables
mw = 50; 			#kg/s
p1 = 10.**5; 			#N/m**2
p2 = 4.2*10**5; 			#N/m**2
h = 10.7; 			#m
d1 = 0.2; 			#m
d2 = 0.1; 			#m
v1 = 1./1000;
v2 = 1./1000;
g = 9.81; 			#m/s**2

# Calculations
C1 = mw*4/math.pi/d1**2*v1;
C2 = mw*4/math.pi/d2**2*v2;
W = mw*((p1*v1-p2*v2) + (g*(0-h))+(C1**2-C2**2)/2)/10**3;

# Results
print ("Capacity of electric motor %.3f")%(-W), ("kW")
Capacity of electric motor 22.198 kW

Example 4.49 page no : 180

In [46]:
import math 

# Variables
Ca = 250.; 			#m/s
t = -14.; 			#0C
ha = 250.; 			#kJ/kg
hg = 900.; 			#kJ/kg
ratio = 0.0180;
Ef = 45.*10**3; 			#kJ/kg
Q = -21.; 			#kJ/kg
ma = 1.; 			#kg
mg = 1.018; 			#kg
mf = 0.018; 			#kg

#Calculations
Eg = 0.06*mf/mg*Ef;
Cg = math.sqrt(2000*((ma*(ha+Ca**2/2/1000) + mf*Ef + Q)/mg -hg-Eg));

# Results
print ("velocity of exhaust gas jet  =  %.3f")%(Cg),("m/s")
velocity of exhaust gas jet  =  455.160 m/s

Example 4.50 page no : 181

In [47]:
# Variables
t1 = 20.; 			#0C
C1 = 40.; 			#m/s
t2 = 820.; 			#0C
C2 = 40.; 			#m/s
t3 = 620.; 			#0C
C3 = 55.; 			#m/s
t4 = 510.; 			#0C
m = 2.5; 			#kg/s
cp = 1.005; 			#kJ/kg.0C

# Calculations and Results
print ("(i) Heat exchanger")
Q_12 = m*cp*(t2-t1);
print ("rate of heat transfer = "),(Q_12), ("kJ/s")

print ("(ii) Turbine")
W_23 = m*((cp*(t2-t3))+(C2**2-C3**2)/2/1000);
print ("Power output of turbine = %.3f")%(W_23), ("kW")

print ("(iii) Nozzle")
C4 = math.sqrt(2*1000*(cp*(t3-t4)+C3**2/2/1000));
print ("Velocity at exit from the nozzle =  %.3f")%(C4), ("m/s")
(i) Heat exchanger
rate of heat transfer =  2010.0 kJ/s
(ii) Turbine
Power output of turbine = 500.719 kW
(iii) Nozzle
Velocity at exit from the nozzle =  473.418 m/s

Example 4.51 page no : 185

In [48]:
# Variables
V = 0.028; 			#m**3
p1 = 80.; 			#bar
t = 350.; 			#0C
p2 = 50.; 			#bar
v1 = 0.02995; 			#m**3/kg
h1 = 2987.3; 			#kJ/kg
v2 = 0.02995; 			#m**3/kg
vg2 = 0.0394; 			#m**3/kg
uf2 = 1149.; 			#kJ/kg
ug2 = 2597.; 			#kJ/kg

# Calculations and Results
m = V/v1;
u1 = h1 - (p1*v1*10**2); 			#kJ/kg

print ("(i) State of steam after cooling")
x2 = v2/vg2;
print ("dryness fraction  =  %.3f")%(x2)


print ("(ii) Heat rejected by the steam")
u2 = (1-x2)*uf2 + x2*ug2;
Q = m*(u2-u1);
print ("Heat rejected  =  %.3f")% (-Q), ("kJ")
(i) State of steam after cooling
dryness fraction  =  0.760
(ii) Heat rejected by the steam
Heat rejected  =  465.575 kJ

Example 4.52 page no : 188

In [15]:
# Variables
m = 0.08; 			#kg
p = 2.*10**5; 			#Pa
V = 0.10528; 			#m**3
h1 = 2706.3; 			#kJ/kg
h2 = 3071.8; 			#kJ/kg
v1 = 0.885; 			#m**3/kg

# Calculations and Results
v2 = V/m; 			#m**3/kg

print ("(i) Heat supplied")
Q = m*(h2-h1);
print ("Q = "),(Q), ("kJ")


W = p*(v2-v1);
W_total = m*W/10**3;
print ("(ii)Total work done  =  "), (W_total), ("kJ")
(i) Heat supplied
Q =  29.24 kJ
(ii)Total work done  =   6.896 kJ

Example 4.53 page no : 189

In [50]:
from numpy import *
from matplotlib.pyplot import *

# Variables
m = 1.; 			#kg
p = 8.; 			#bar
s1 = 6.55; 			#kJ/kg.K
T = 200.; 			#0C
s_f1 = 2.0457; 			#kJ/kg.K
s_fg1 = 4.6139; 			#kJ/kg.K
h_f1 = 720.9; 			#kJ/kg
h_fg1 = 2046.5; 			#kJ/kg
h2 = 2839.3; 			#kJ/kg

# Calculations and Results
x1 = (s1-s_f1)/s_fg1;
h1 = h_f1+x1*h_fg1;
Q = h2-h1;
print ("Heat supplied = %.3f")%(Q), ("kJ/kg")

# For T-s diagram

s = linspace(0,.10,10);
T = (-(s-5)**2+298);
plot(s,T)

T = [295.44 ,295.44];
s = [6.6 ,3.45];
plot(s,T,'g')

s = [6.6 ,7];
T = [295.44, 300];
plot(s,T,'g')

s = [6.55 ,6.55];
T = [270 ,295.44];
plot(s,T,'r')

s = [6.6, 6.6];
T = [270 ,295.44];
plot(s,T,'--r')

s = [6.66, 6.66];
T = [270, 295.44];
plot(s,T,'r')

			#The area in red represents the heat flow and it goes upto x-axis
Heat supplied = 120.513 kJ/kg
Out[50]:
[<matplotlib.lines.Line2D at 0x3e9d150>]

Example 4.54 page no : 192

In [16]:
# Variables
p1 = 7.*10**5; 			#Pa
p2 = 1.5*10**5; 			#Pa
Q = 420.; 			#kJ/kg
uf = 696.; 			#kJ/kg
x = 0.95;
ug = 2573.; 			#kJ/kg
u_f2 = 2580.; 			#kJ/kg
u_g2 = 2856.; 			#kJ/kg
x2 = 15./50;
h_f1 = 697.1; 			#kJ/kg
h_fg1 = 2064.9; 			#kJ.kg
h_f2 = 2772.6; 			#kJ/kg
h_g2 = 2872.9; 			#kJ/kg

# Calculations and Results
print ("(i) Change of internal energy")
u1 = (1-x)*uf + x*ug;
u2 = 2602.8; 			#kJ/kg
du = u2-u1;
print ("du = "),(du), ("kJ/kg")

print ("(ii) Change in enthalpy")
h1 = h_f1+x*h_fg1;
h2 = h_f2+x2*(h_g2-h_f2);
dh = h2-h1;
print ("dh = "), (dh), ("kJ/kg")

print ("(iii) Work done   ")
W = Q-du;
print ("W = "), (W), ("kJ/kg")
(i) Change of internal energy
du =  123.65 kJ/kg
(ii) Change in enthalpy
dh =  143.935 kJ/kg
(iii) Work done   
W =  296.35 kJ/kg

Example 4.55 page no : 194

In [19]:
import math 
from scipy.integrate import quad 


p1 = 5.5*10**5; 			#Pa
x1 = 1.;
p2 = 0.75*10**5; 			#Pa
v1 = 0.3427; 			#m**3/kg
v2 = p1*v1/p2;

# Since v2 > vg (at 0.75 bar), therefore, the steam is superheated at state 2.
u2 = 2567.25; 			#kJ/kg
u1 = 2565.; 			#kJ/kg

# Calculations and Results
du = u2-u1; 			#kJ/kg
C = p1*v1;

print ("Work done  "),

def f6( v): 
	 return C/v

W =  quad(f6, v1,v2)[0]

print ("W ="),(W), ("N-m/kg")



Q = du+W/10**3;

print ("Heat supplied  =  %.3f")%(Q),("kJ/kg")
Work done   W = 375543.199592 N-m/kg
Heat supplied  =  377.793 kJ/kg

Example 4.56 page no : 195

In [53]:
# Variables
p1 = 100.; 			#bar
p2 = 10.; 			#bar
s1 = 5.619; 			#kJ/kg.K
T = 584.; 			#K
s2 = 7.163; 			#kJ/kg.K
u1 = 2545.; 			#kJ/kg
u2 = 2811.8; 			#kJ/kg

# Calculations and Results
print ("(i)Heat supplied ")
Q = T*(s2-s1);
print ("Q = "),(Q),("kJ/kg")

print ("(ii) Work done")
W = Q-(u2-u1);
print ("W = "), (W), ("kJ/kg")
(i)Heat supplied 
Q =  901.696 kJ/kg
(ii) Work done
W =  634.896 kJ/kg

Example 4.57 page no : 198

In [20]:
# Variables
m = 1.; 			#kg
p1 = 120.*10**5; 	#N/m**2
t1 = 400.; 			#0C
p2 = 38.; 			#bar
h1 = 3051.3; 		#kJ/kg
v1 = 0.02108; 		#m**3/kg

# Calculations
u1 = h1-p1*v1/10**3; 	#kJ/kg
u2 = 2602; 			    #kJ/kg

# Results
W = u1-u2; 
print ("Work done  =  %.3f")%(W),("kJ/kg")
Work done  =  196.340 kJ/kg

Example 4.58 page no : 201

In [55]:
# Variables
p1 = 7.*10**5; 			#N/m**2
x1 = 0.98;
p2 = 0.34*10**5; 		#N/m**2
vg = 0.273; 			#m**3/kg
n = 1.1;
v_g2 = 4.65; 			#m**3/kg
u_f1 = 696.; 			#kJ/kg
u_g1 = 2573.; 			#kJ/kg
u_f2 = 302.; 			#kJ/kg
u_g2 = 2472.; 			#kJ/kg

# Calculations and Results
v1 = x1*vg;
v2 = v1*(p1/p2)**(1/n);
x2 = v2/v_g2;


print ("(i) Work done by the steam during the process")
W = (p1*v1-p2*v2)/(n-1)/10**3; 			#kJ/kg
print ("W = %.3f")%(W), ("kJ/kg")


print ("(ii) Heat transferred")
u1 = (1-x1)*u_f1+x1*u_g1;
u2 = (1-x2)*u_f2+x2*u_g2;
Q = u2-u1 + W;
print ("Q = %.3f")%(Q), ("kJ/kg")
(i) Work done by the steam during the process
W = 450.232 kJ/kg
(ii) Heat transferred
Q = 169.289 kJ/kg

Example 4.59 page no : 203

In [56]:
# Variables
p1 = 15.; 			#bar
t1 = 350.; 			#0C
C1 = 60.; 			#m/s
p2 = 1.2; 			#bar
C2 = 180.; 			#m/s
s1 = 7.102; 			#kJ/kg
s_f2 = 1.3609; 			#kJ/kg
s_g2 = 7.2884; 			#kJ/kg
h_f2 = 439.4; 			#kJ/kg
h_fg2 = 2241.1; 			#kJ/kg
h1 = 3147.5; 			#kJ/kg

# Calculations
x2 = (s1 - s_f2)/(s_g2-s_f2);
h2 = h_f2+x2*h_fg2;
W = (h1-h2) + (C1**2 - C2**2)/2/1000;

# Results
print ("Work done  =  %.3f")%(W),("kJ/kg")
Work done  =  523.075 kJ/kg

Example 4.60 page no : 204

In [57]:
# Variables
p1 = 10.; 			#bar
t1 = 200.; 			#0C
C1 = 60.; 			#m/s**2
c2 = 650.; 			#m/s
p2 = 1.5; 			#bar
h1 = 2827.9; 			#kJ/kg
h_f2 = 467.1; 			#kJ/kg
h2 = 2618.45; 			#kJ/kg
h_g2 = 2693.4; 			#kJ/kg

# Calculations
x2 = (h2-h_f2)/(h_g2-h_f2);

# Results
print ("quality of steam leaving the nozzle = %.3f")%(x2)
quality of steam leaving the nozzle = 0.966

Example 4.61 page no : 206

In [58]:
# Variables
h1 = 2776.4; 			#kJ/kg
h2 = h1;
h_f1 = 884.6; 			#kJ/kg
h_fg1 = 1910.3; 		#kJ/kg

# Calculations
x1 = (h1-h_f1)/h_fg1;

# Results
print ("Initial dryness fraction  =  %.3f")%(x1)
Initial dryness fraction  =  0.990

Example 4.62 page no : 207

In [59]:
# Variables
p1 = 10.; 			#bar
x1 = 0.9; 			#bar
p2 = 2.; 			#bar

# Calculations
# Umath.sing Mollier chart, we get
x2 = 0.94;

# Results
print ("x2  = "),(x2)
x2  =  0.94

Example 4.63 Page no :208

In [4]:
import math 
print ("(a)From steam tables")

# Variables
p1 = 15*10**5; 			#Pa
p2 = 7.5*10**5; 			#Pa
h_f1 = 844.7; 			#kJ/kg
ts1 = 198.3; 			#0C
s_f1 = 2.3145; 			#kJ/kg.K
s_g1 = 6.4406; 			#kJ/kg.K
v_g1 = 0.132; 			#m**3/kg
h_fg1 = 1945.2; 			#kJ/kg
x1 = 0.95;
h_f2 = 709.3; 			#kJ/kg
h_fg2 = 2055.55; 			#kJ/kg
s_f2 = 2.0195; 			#kJ/kg
s_g2 = 6.6816; 			#kJ/kg.K
v_g2 = 0.255; 			#m**3/kg
x2 = 0.9;
x3 = 1;
s_f3 = 0.521; 			#kJ/kg K
s_g3 = 8.330; 			#kJ/kg K

# Calculations
h2 = h_f2+x2*h_fg2;
h1 = h_f1 + x1*h_fg1;
s1 = s_f1 + x1*(s_g1-s_f1);
s2 = s1;
ds_12 = s2-s1;

s3 = s_f3+x3*(s_g3-s_f3);
ds_23 = s3-s2;

ds = 709.3 + 0.9 * 2055.55

# Results
print ("(i) Change in entropy  = %.3f")% (ds), ("kJ/kg K")

h3 = h2;

dh = h2-h1;
print ("(ii) Change in enthalpy %.2f")%(dh), ("kJ/kg")


print ("(iii) Change in internal energy"),
u1 = h1-p1*x1*v_g1/10**3;
u2 = h2-p2*x2*v_g2/10**3;
du = u2-u1;
print ("du = %.3f")% (du), ("kJ/kg")


			# Only the expansion of steam from point 1 to 2 (i.e., isentropic expansion) is reversible because of unresisted flow whereas the expansion from point 2 to point 3 (i.e., throttling expansion) is irreversible because of frictional resismath.tance to flow. Increase of entropy also shows that expansion from point 2 to point 3 is irreversible.


print ("(b) Using Mollier chart")
h1 = 2692; 			#kJ/kg
h2 = 2560; 			#kJ/kg
s1 = 6.23; 			#kJ/kg K
s2 = s1;
s3 = 8.3; 			#kJ/kg K

ds = s3-s1;
print ("(i) Change in entropy  = %.3f")%(ds), ("kJ/kg K")


dh = h2-h1;
print ("(ii) Change in enthalpy  = %.3f")%(dh),("kJ/kg")

u3=u2-u1
print ("(iii) Change in internal energy =%.3f")%(u3),("kJ/kg")
(a)From steam tables
(i) Change in entropy  = 2559.295 kJ/kg K
(ii) Change in enthalpy -133.35 kJ/kg
(iii) Change in internal energy du = -117.370 kJ/kg
(b) Using Mollier chart
(i) Change in entropy  = 2.070 kJ/kg K
(ii) Change in enthalpy  = -132.000 kJ/kg
(iii) Change in internal energy =-117.370 kJ/kg

Example 4.64 Page no :212

In [3]:
# Variables
V1 = 5.5; 			#m**3
p1 = 16.*10**5; 			#Pa
T1 = 315.; 			#K
V2 = V1;
p2 = 12.*10**5; 			#Pa
R = 0.287*10**3;
y = 1.4;

# Calculations
m1 = p1*V1/R/T1;
T2 = T1*(p2/p1)**((y-1)/y);
m2 = p2*V2/R/T2;

# Results
m = m1-m2;
print ("Mass of air which left the receiver = %.3f")% (m), ("kg")

# Note : Rounding error is there.
Mass of air which left the receiver = 18.081 kg

Example 4.65 Page no :213

In [2]:
# Variables
cp = 1.; 			#kJ/kg.K
cv = 0.711; 			#kJ/kg.K
V1 = 1.6; 			#m**3
V2 = V1;
p1 = 5.*10**5; 			#Pa
T1 = 373.; 			#K
p2 = 1.*10**5; 			#Pa
R = 287.;
y = 1.4;

# Calculations
m1 = round(p1*V1/R/T1,2);
T2 = round(T1*(p2/p1)**((y-1)/y),2);
m2 = round(p2*V2/R/T2,3);
KE = (m1*cv*T1)-(m2*cv*T2)-(m1-m2)*cp*T2;

# Results
print "Kinetic energy of discharge air  = %.3f"% (KE), ("kJ")
print ("This is the exact answer when using proper value of cv")

# Book answer is wrong.
Kinetic energy of discharge air  = 382.910 kJ
This is the exact answer when using proper value of cv

Example 4.66 Page no :214

In [1]:
#For oxygen
import math 

# Variables
cpa = 0.88; 			#kJ/kg K
Ra = 0.24; 			#kJ/kg K
V1a = 0.035; 			#m**3
p1a = 4.5; 			#bar
T1a = 333.; 			#K
V2a = 0.07; 			#m**3

#For methane
V1b = 0.07; 			#m**3
V2b = 0.035; 			#m**3
p1b = 4.5; 			#bar
T1b = 261; 			#K
cpb = 1.92; 			#kJ/kg K
Rb = 0.496; 			#kJ/kg K

# Calculations and Results
yb = cpb/(cpb-Rb); 			#for methane
cva = cpa-Ra; 			#for oxygen

print ("(i) Final state condition")

p2b = p1b*(V1b/V2b)**yb;
print ("p2 for methane  = %.3f")% (p2b), ("bar")

T2b = p2b*V2b*T1b/p1b/V1b;
print ("T2 for methane  = %.3f")% (T2b), ("K")

p2a = p2b;

T2a = p2a*V2a/p1a/V1a*T1a;
print ("T2 for oxygen  = %.3f")% (T2a), ("K")

Wb = (p1b*V1b - p2b*V2b)/(yb-1)*100; 			#kJ

print ("(ii)The piston will be in virtual equilibrium and hence zero work is effected by the piston.")

Wa = -Wb;

ma = p1a*V1a/Ra/T1a*10**2;

Q = ma*cva*(T2a-T1a) + Wa;
print "(iii) Heat transferred to oxygen  = %.3f"% (Q), ("kJ")

# Rouding error is there.
(i) Final state condition
p2 for methane  = 11.458 bar
T2 for methane  = 332.272 K
T2 for oxygen  = 1695.733 K
(ii)The piston will be in virtual equilibrium and hence zero work is effected by the piston.
(iii) Heat transferred to oxygen  = 196.572 kJ
In [ ]: