Chapter 5 : Second Law of Thermodynamics and Entropy

Example 5.1 Page no : 237

In [1]:
# Variables
Q1 = 1500./60; 		#kJ/s
W = 8.2; 			#kW

# Calculations and Results
print ("(i) Thermal efficiency")
n = W/Q1;
print ("n = "),(n)

print ("(ii) Rate of heat rejection")
Q2 = Q1-W; 
print ("Q2 = "),(Q2), ("kW")
(i) Thermal efficiency
n =  0.328
(ii) Rate of heat rejection
Q2 =  16.8 kW

Example 5.2 Page no : 238

In [2]:
# Variables
Q_12 = 30.; 		#kJ
W_12 = 60; 			#kJ

# Calculations
dU_12 = Q_12-W_12;
Q_21 = 0;
W_21 = Q_21+dU_12;

# Results
print ("W_21  = "),(W_21)
print ("Thus 30 kJ work has to be done on the system to restore it to original state, by adiabatic process.")
W_21  =  -30.0
Thus 30 kJ work has to be done on the system to restore it to original state, by adiabatic process.

Example 5.3 Page no : 239

In [3]:
# Variables
Q2 = 12000.; 			#kJ/h
W = 0.75*60*60; 		#kJ/h

# Calculations and Results
COP = Q2/W;
print ("Coefficient of performance %.3f")%(COP)

Q1 = Q2+W;
print ("heat transfer rate = %.3f")%(Q1), ("kJ/h")
Coefficient of performance 4.444
heat transfer rate = 14700.000 kJ/h

Example 5.4 Page no : 239

In [5]:
# Variables
T2 = 261.; 			#K
T1 = 308.; 			#K
Q2 = 2.; 			#kJ/s

# Calculations
Q1 = Q2*(T1/T2);
W = Q1-Q2;

# Results
print ("Least power required to pump the heat continuosly %.3f")%(W),("kW")
Least power required to pump the heat continuosly 0.360 kW

Example 5.5 Page no :239

In [4]:
import math 


# Variables
Q1 = 2*10**5; 			#kJ/h
W = 3*10**4; 			#kJ/h

# Calculations and Results
Q2 = Q1-W;
print ("Heat abstracted from outside = "),(Q2), ("kJ/h")


COP_hp = Q1/(Q1-Q2);
print ("Co-efficient of performance = %.2f")%(COP_hp)
Heat abstracted from outside =  170000 kJ/h
Co-efficient of performance = 6.00

Example 5.6 Page no : 240

In [7]:
# Variables
T1 = 2373; 			#K
T2 = 288.; 			#K

# Calculations
n_max = 1-T2/T1;

# Results
print ("Highest possible theoritical efficiency = %.3f")% (n_max*100), ("%")
Highest possible theoritical efficiency = 87.863 %

Example 5.7 Page no : 240

In [6]:
# Variables
T1 = 523.; 			#K
T2 = 258.; 			#K
Q1 = 90.; 			#kJ

# Calculations and Results
n = 1-T2/T1;
print ("(i) Efficiency of the system %.3f")%(n*100), ("%")

W = n*Q1;
print ("(ii) The net work transfer"),("W = %.3f")%(W),("kJ")
 
Q2 = Q1-W;
print ("(iii) Heat rejected to the math.sink"),("Q2 = %.3f")%(Q2),("kJ")
(i) Efficiency of the system 50.669 %
(ii) The net work transfer W = 45.602 kJ
(iii) Heat rejected to the math.sink Q2 = 44.398 kJ

Example 5.8 Page no : 241

In [7]:
# Variables
T1 = 1023.; 		#K
T2 = 298.; 			#K

# Calculations
n_carnot = 1-T2/T1;
W = 75*1000*60*60;
Q = 3.9*74500*1000;
n_thermal = W/Q;

# Results
print ("n_carnot  = %.3f")%(n_carnot)

print ("n_thermal  = %.3f")%(n_thermal)

print ("Since ηthermal > ηcarnot, therefore claim of the inventor is not valid (or possible)")
n_carnot  = 0.709
n_thermal  = 0.929
Since ηthermal > ηcarnot, therefore claim of the inventor is not valid (or possible)

Example 5.9 Page no : 241

In [10]:
# Variables
T1 = 1273.; 		#K
T2 = 313.; 			#K
n_max = 1-T2/T1;
Wnet = 1.;

# Calculations
Q1 = Wnet/n_max;
Q2 = Q1-Wnet;

# Results
print ("the least rate of heat rejection  =  %.3f")%(Q2), ("kW")
the least rate of heat rejection  =  0.326 kW

Example 5.10 Page no : 242

In [2]:
# Variables
one_ton_of_refrigeration = 210.; 			#kJ/min
Cooling_required = 40*(one_ton_of_refrigeration); 			#kJ/min
T1 = 303.; 			#K
T2 = 238.; 			#K

# Calculations
COP_refrigerator = T2/(T1-T2);
COP_actual = 0.20*COP_refrigerator;
W = Cooling_required/COP_actual/60;

# Results
print ("power required  =  %.1f")% (W), ("kW")
power required  =  191.2 kW

Example 5.11 Page no : 242

In [8]:
# Variables
E = 12000.; 		#kJ/min
T2 = 308.; 			#K
# Source 1
T1 = 593.; 			#K

# Calculations
n1 = 1-T2/T1;
# Source 2
T1 = 343.; 			#K
n2 = 1-T2/T1;
W1 = E*n1;

# Results
print ("W1  = %.3f")% (W1),("kJ/min")

W2 = E*n2;
print ("W2  = %.3f")% (W2),("kJ/min")

print ("Thus, choose source 2.")
print ("The source 2 is selected even though efficiency in this case is lower, because the criterion for selection is the larger output.")
W1  = 5767.285 kJ/min
W2  = 1224.490 kJ/min
Thus, choose source 2.
The source 2 is selected even though efficiency in this case is lower, because the criterion for selection is the larger output.

Example 5.12 Page no : 243

In [1]:
# Variables
T1 = 973.; 			#K
T2 = 323.; 			#K
T3 = 248.; 			#K

Q1 = 2500.; 			#kJ
W = 400.;    			#kJ

# Calculations and Results
n_max = 1-T2/T1;
W1 = n_max*Q1;
COP_max = T3/(T2-T3);
W2 = W1-W;
Q4 = COP_max*W2;
COP1 = round(Q4/W2,3);
Q3 = Q4+W2;
Q2 = Q1-W1;
print ("Heat rejection to the 50°C reservoir = %.3f")%(Q2+Q3), ("kJ")


n = 0.45*n_max;
W1 = n*Q1;
W2 = W1-W;
COP2 = 0.45*COP1;
Q4 = W2*COP2;
Q3 = Q4+W2;
Q2 = Q1-W1;

print ("Heat rejected to 50°C reservoir = %.3f")% (Q2+Q3), ("kJ")

# Note : Answers are slightly different then book because of Rounding Error.
Heat rejection to the 50°C reservoir = 6299.773 kJ
Heat rejected to 50°C reservoir = 2623.147 kJ

Example 5.13 Page no : 244

In [10]:
# Variables
T1 = 298.; 			#K
T2 = 273.; 			#K
Q1 = 24.; 			#kJ/s
T3 = 653.; 			#K

# Calculations and Results
COP = T1/(T1-T2);
print ("(i) determine COP and work input required")

print ("Coefficient of performance  =  "),(COP)

COP_ref = T2/(T1-T2);
W = Q1/COP_ref;
print ("Work input required  =  %.3f")%(W),("kW")

 
Q4 = T1*W/(T3-T1);
Q3 = Q4+W;
Q2 = Q1+W;
COP = Q1/Q3;
print ("(ii)Determine overall COP of the system "),("COP = %.3f")%(COP)

COP_overall = (Q2+Q4)/Q3;
print ("Overall COP = %.3f")%(COP_overall)
(i) determine COP and work input required
Coefficient of performance  =   11.92
Work input required  =  2.198 kW
(ii)Determine overall COP of the system  COP = 5.937
Overall COP = 6.937

Example 5.14 Page no : 245

In [15]:
# Variables
T_e1 = 493.; 			#K
T_e2 = 298.; 			#K
T_p1 = 298.; 			#K
T_p2 = 273.; 			#K
Amt = 15.; 		    	#tonnes produced per day
h = 334.5; 			    #kJ/kg
Q_abs = 44500.; 		#kJ/kg

# Calculations and Results
Q_p2 = Amt*10**3*h/24/60;
COP_hp = T_p2/(T_p1-T_p2);
W = Q_p2/COP_hp/60;
print ("(i)Power developed by the engine  =  %.3f")%(W),("kW")

print ("(ii) Fuel consumed per hour")
n_carnot = 1-(T_e2/T_e1);
Q_e1 = W/n_carnot*3600; 			#kJ/h
fuel_consumed = Q_e1/Q_abs;
print ("Quantity of fuel consumed/hour  =  %.3f")%(fuel_consumed),("kg/h")
(i)Power developed by the engine  =  5.318 kW
(ii) Fuel consumed per hour
Quantity of fuel consumed/hour  =  1.088 kg/h

Example 5.15 Page no : 247

In [16]:
# Variables
T1 = 550.; 			#K
T3 = 350.; 			#K

# Calculations
T2 = (T1+T3)/2;

# Results
print ("Intermediate temperature  = "), (T2),("K")
Intermediate temperature  =  450.0 K

Example 5.16 Page no : 247

In [11]:
# Variables
T1 = 600.; 			#K
T2 = 300.; 			#K

# Calculations and Results
T3 = 2*T1/(T1/T2+1);
print ("(i) When Q1 = Q2"),("T3 = "),(T3),("K")


print ("(ii) Efficiency of Carnot engine and COP of carnot refrigerator")
n = (T1-T3)/T1; 			#carnot engine
COP = T2/(T3-T2); 			#refrigerator

print ("Efficiency of carnot engine  =  %.3f")% (n)

print ("COP of carnot refrigerator  =  "), (COP)
(i) When Q1 = Q2 T3 =  400.0 K
(ii) Efficiency of Carnot engine and COP of carnot refrigerator
Efficiency of carnot engine  =  0.333
COP of carnot refrigerator  =   3.0

Example 5.17 Page no : 249

In [18]:
# Variables
T3 = 278.; 			#K
T2 = 350.; 			#K
T4 = T2;
T1 = 1350.; 			#K

# Calculations
Q1 = 100/(((T4/T1)*(T1-T2)/(T4-T3))+T2/T1)  	#Q4+Q2 = 100; Q4 = Q1*((T4/T1)*(T1-T2)/(T4-T3)); Q2 = T2/T1*Q1;

# Results
print ("Q1 = %.3f")%(Q1),("kJ")
Q1 = 25.906 kJ

Example 5.18 Page no : 250

In [65]:
# Variables
Q1 = 300.; 			#kJ/s
T1 = 290.; 			#0C
T2 = 8.5; 			#0C

# Calculations and Results
print ("let ΣdQ/T  =  A")

print ("(i) 215 kJ/s are rejected")
Q2 = 215.; 			#kJ/s
A =  Q1/(T1+273) - Q2/(T2+273)
print ("Since, A<0, Cycle is irreversible.")


print ("(ii) 150 kJ/s are rejected")
Q2 = 150; 			#kJ/s
A =  Q1/(T1+273) - Q2/(T2+273)
print ("Since A = 0, cycle is reversible")


print ("(iii) 75 kJ/s are rejected.")
Q2 = 75; 			#kJ/s
A =  Q1/(T1+273) - Q2/(T2+273)
print ("Since A>0, cycle is impossible")
let ΣdQ/T  =  A
(i) 215 kJ/s are rejected
Since, A<0, Cycle is irreversible.
(ii) 150 kJ/s are rejected
Since A = 0, cycle is reversible
(iii) 75 kJ/s are rejected.
Since A>0, cycle is impossible

Example 5.19 Page no : 251

In [66]:
# Variables
P1 = 0.124*10**5; 			#N/m**2
T1 = 433; 			#K
T2 = 323; 			#K
h_f1 = 687; 			#kJ/kg
h2 = 2760; 			#kJ/kg
h3 = 2160; 			#kJ/kg
h_f4 = 209; 			#kJ/kg

# Calculations and Results
Q1 = h2-h_f1;
Q2 = h_f4-h3;
print ("Let A = ΣdQ/T")
A = Q1/T1+Q2/T2;
print (A)
print ("A<0. Hence classius inequality is verified")
Let A = ΣdQ/T
-3
A<0. Hence classius inequality is verified

Example 5.20 Page no :251

In [19]:
# Variables
T1 = 437.;  			#K
T2 = 324.; 	    		#K
h2 = 2760.; 			#kJ/kg
h1 = 690.; 		    	#kJ/kg
h3 = 2360.; 			#kJ/kg
h4 = 450.; 			    #kJkg

# Calculations
Q1 = h2-h1;
Q2 = h4-h3;

# Results
print ("Let A = ΣdQ/T")
A = Q1/T1 + Q2/T2;
print "%.3f"%(A)
print ("Since A<0, Classius inequality is verified")
Let A = ΣdQ/T
-1.158
Since A<0, Classius inequality is verified

Example 5.21 Page no : 266

In [68]:
import math 

# Variables
T0 = 273.; 			#K
T1 = 673.; 			#K
T2 = 298.; 			#K
m_w = 10.; 			#kg
T3 = 323.; 			#K
c_pw = 4186.; 		#kJ/kg.K

# Calculations and Results
print ("Let C = mi*cpi")
C = m_w*c_pw*(T3-T2)/(T1-T3);
S_iT1 = C*math.log(T1/T0); 			# Entropy of iron at 673 K
S_wT2 = m_w*c_pw*math.log(T2/T0); 	#Entropy of water at 298 K
S_iT3 = C*math.log(T3/T0); 			#Entropy of iron at 323 K
S_wT3 = m_w*c_pw*math.log(T3/T0); 	#Entropy of water at 323 K

dS_i = S_iT3 - S_iT1;
dS_w = S_wT3 - S_wT2; 
dS_net = dS_i + dS_w

print ("Since dS>0, process is irreversible")
Let C = mi*cpi
Since dS>0, process is irreversible

Example 5.23 Page no : 267

In [12]:
import math 

# Variables
T1 = 293.; 			#K
V1 = 0.025; 			#m**3
V3 = V1;
p1 = 1.05*10**5; 			#N/m**2
p2 = 4.5*10**5; 			#N/m**2
R = 0.287*10**3; 
cv = 0.718;
cp = 1.005;
T3 = 293.; 			#K

# Calculations and Results
m = p1*V1/R/T1;
T2 = p2/p1*T1;
Q_12 = m*cv*(T2-T1);
Q_23 = m*cp*(T3-T2)

Q_net = Q_12+Q_23;
print ("Net heat flow  =  "),(Q_net), ("kJ")


dS_32 = m*cp*math.log(T2/T1);
dS_12 = m*cv*math.log(T2/T1);
dS_31 = dS_32 - dS_12;
print ("Decrease in entropy  =  %.3f")% (dS_31), ("kJ/K")
Net heat flow  =   -8.625 kJ
Decrease in entropy  =  0.013 kJ/K

Example 5.24 Page no : 269

In [13]:
%matplotlib inline

from matplotlib.pyplot import *
from numpy import *
import math 

# Variables
p1 = 1.05*10**5; 	#N/m**2
V1 = 0.04; 			#m**3
T1 = 288.; 			#K
p2 = 4.8*10**5;
T2 = T1;
R0 = 8314.;
M = 28.;

# Calculations and Results
R = R0/M;
m = p1*V1/R/T1;
dS = m*R*math.log(p1/p2)
print ("Decrease in entropy  = %.3f")% (-dS), ("J/K")


print 
Q = T1*(-dS);
print ("(ii)Heat rejected  =  "),("Q = %.3f")%(Q),("J")


W = Q;
print ("Work done  =  %.3f")% (W), ("J")

V2 = p1*V1/p2;
v1 = V1/m; 			#specific volume
v2 = V2/m; 			#specific volume

v = linspace(v2,0.8081571,64);


def f(v):
    return p1*v1/v
plot(v,f(v))

p = []
for i in range(len(v)):
    p.append(p1)
plot(v,p,'--')

p = [0 ,p2]
v = [v2 ,v2]
plot(v,p,'--')

p = [0 ,p1]
v = [v1 ,v1]
plot(v,p,'--')

T = [288, 288]
s = [10 ,(10-dS)]
plot(s,T)

s = [10 ,10]
T = [0 ,288]
plot(s,T,'--')

s = [(10-dS), (10-dS)]
T = [0 ,288]
plot(s,T,'--')
Populating the interactive namespace from numpy and matplotlib
Decrease in entropy  = 22.164 J/K

(ii)Heat rejected  =   Q = 6383.268 J
Work done  =  6383.268 J
Out[13]:
[<matplotlib.lines.Line2D at 0x2c3da90>]

Example 5.25 Page no : 270

In [22]:
import math 

# Variables
R = 287.; 			#kJ/kg.K
dU = 0;
W = 0;
Q = dU+W;

# Calculations
dS = R*math.log(2); 			#v2/v1 = 2

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

Example 5.26 Page no : 271

In [23]:
import math 

# Variables
m = 0.04; 			#kg
p1 = 1*10.**5; 			#N/m**2
T1 = 293.; 			#K
p2 = 9*10.**5; 			#N/m**2
V2 = 0.003; 			#m**3
cp = 0.88; 			#kJ/kg.K
R0 = 8314.;
M = 44.;

# Calculations
R = R0/M;
T2 = p2*V2/m/R;
ds_2A = R/10**3*math.log(p2/p1);
ds_1A = cp*math.log(T2/T1);
ds_21 = ds_2A - ds_1A;
dS_21 = m*ds_21;

# Results
print ("Decrease in entropy = %.3f")% (dS_21),("kJ/K")
Decrease in entropy = 0.010 kJ/K

Example 5.27 Page no : 272

In [24]:
import math 

# Variables
p1 = 7.*10**5; 			#N/m**2
T1 = 873.; 			#K
p2 = 1.05*10**5; 			#N/M62
n = 1.25;
m = 1.; 			#kg
R = 0.287;
cp = 1.005;

# Calculations
T2 = T1*(p2/p1)**((n-1)/n);

# At constant temperature from 1 to A
ds_1A = R*math.log(p1/p2);
# At constant pressure from A to 2
ds_2A = cp*math.log(T1/T2);
ds_12 = ds_1A - ds_2A;

# Results
print ("Increase in entropy  =  %.3f")% (ds_12), ("kJ/kg.K")
Increase in entropy  =  0.163 kJ/kg.K

Example 5.28 Page no : 274

In [25]:
import math 

# Variables
p1 = 7*10**5; 		#Pa
T1 = 733.; 			#K
p2 = 1.012*10**5; 	#Pa
T2a = 433.; 		#K
y = 1.4;
cp = 1.005;

# Calculations and Results
print ("(i) To prove that the process is irreversible")
T2 = T1*(p2/p1)**((y-1)/y);
print ("T2  = %.3f")% (T2)
print ("But the actual temperature is 433K at th epressure of 1.012 bar, Hence the process is irreversible. Proved.")


print ("(ii) Change of entropy per kg of air")
ds = cp*math.log(T2a/T2);
print ("Increase of entropy = %.3f")% (ds), ("kJ/kg.K")
(i) To prove that the process is irreversible
T2  = 421.820
But the actual temperature is 433K at th epressure of 1.012 bar, Hence the process is irreversible. Proved.
(ii) Change of entropy per kg of air
Increase of entropy = 0.026 kJ/kg.K

Example 5.29 Page no : 275

In [1]:
import math 

# Variables
V1 = 0.3; 			#m**3
p1 = 4*10**5; 		#N/m**2
V2 = 0.08; 			#m**3
n = 1.25; 

# Calculations and Results
p2 = p1*(V1/V2)**n;

dH = n*(p2*V2-p1*V1)/(n-1)/10**3;
print ("(i) Change in enthalpy"), ("dH = %.3f")% (dH), ("kJ")

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

dS = 0;
print ("(iii) Change in entropy"),("dS"), (dS)

Q = 0;
print ("(iv)Heat transfer"),("Q = "), (Q)

W = Q-dU;
print ("(v) Work transfer"),("W = %.3f")%(W),("kJ")
(i) Change in enthalpy dH = 234.947 kJ
(ii) Change in internal energy dU = 187.958 kJ
(iii) Change in entropy dS 0
(iv)Heat transfer Q =  0
(v) Work transfer W = -187.958 kJ

Example 5.30 Page no : 277

In [2]:
import math 

# Variables
m = 20.; 			#kg
p1 = 4.*10**5; 			#Pa
p2 = 8.*10**5; 			#Pa
V1 = 4.; 			#m**3
V2 = V1;
cp = 1.04; 			#kJ/kg.K
cv = 0.7432; 			#kJ/kg.K
R = cp-cv;
T1 = p1*V1/R/1000.; 			#kg.K;   T = mass*temperature
T2 = p2*V2/R/1000.; 			#kg.K

# Calculations and Results
dU = cv*(T2-T1);
print ("(i) Change in internal energy"),("dU = %.3f")% (dU), ("kJ")

Q = 0;
W = Q-dU;
print ("(ii) Work done"),("W  %.3f")% (W), ("kJ")

print ("(iii) Heat transferred  =  "), (Q)

dS = m*cv*math.log(T2/T1);
print ("(iv) Change in entropy  = %.3f")%(dS), ("kJ/K")
(i) Change in internal energy dU = 4006.469 kJ
(ii) Work done W  -4006.469 kJ
(iii) Heat transferred  =   0
(iv) Change in entropy  = 10.303 kJ/K

Example 5.31 Page no : 278

In [9]:
import math 
from matplotlib.pyplot import *
%matplotlib inline

# Variables
V1 = 5.; 			#m**3
p1 = 2.*10**5; 			#Pa
T1 = 300.; 			#K
p2 = 6.*10**5; 			#Pa
p3 = 2.*10**5; 			#Pa
R = 287.;
n = 1.3;
y = 1.4;

# Calculations and Results
m = p1*V1/R/T1;
T2 = T1*(p2/p1)**((n-1)/n);
T3 = T2*(p3/p2)**((y-1)/y);
W_12 = m*R*(T1-T2)/(n-1)/1000; 			#polytropic compression
W_23 = m*R*(T2-T3)/(y-1)/1000; 			#Adiabatic expansion


W_net = W_12+W_23;
print ("Net work done on the air  =  %.3f")%(-W_net), ("kJ")

T = [T1, 310, 320, 330, 340, 350, 360, 370, 380, T2];
def f(T):
    return (y-n)/(y-1)/(1-n)*R/10**3*math.log(T);

s = [f(T1), f(310), f(320), f(330), f(340), f(350), f(360), f(370), f(380), f(T2)]

plot(s,T)

T = [T2, T3];
s = [f(T2), f(T2)];
plot(s,T,'r')

# Answers are slightly diffferent because of rounding error.
Populating the interactive namespace from numpy and matplotlib
Net work done on the air  =  94.023 kJ
WARNING: pylab import has clobbered these variables: ['f', 'draw_if_interactive']
`%pylab --no-import-all` prevents importing * from pylab and numpy
Out[9]:
[<matplotlib.lines.Line2D at 0x2aa0d90>]

Example 5.32 Page no : 279

In [5]:
# Variables
V1 = 0.004; 			#m**3
p1 = 1.*10**5; 			#Pa
T1 = 300.; 			#K
T2 = 400.; 			#K
y = 1.4;
M = 28.;
R0 = 8.314;
R = R0/M;

# Calculations and Results
print ("(i) The heat supplied")
m = p1*V1/R/1000/T1; 			#kg
cv = R/(y-1);
Q = m*cv*(T2-T1);
print ("Q  %.3f")%(Q), ("kJ")

print ("(ii) The entropy change")
dS = m*cv*math.log(T2/T1);
print ("dS = %.8f")%(dS), ("kJ/kg.K")
(i) The heat supplied
Q  0.333 kJ
(ii) The entropy change
dS = 0.00095894 kJ/kg.K

Example 5.33 Page no : 279

In [30]:
import math 

# Variables
V1 = 0.05; 			#m**3
p1 = 1.*10**5; 			#Pa
T1 = 280.; 			#K
p2 = 5.*10**5; 			#Pa

# Calculations
print ("(i) Change in entropy")
R0 = 8.314;
M = 28.;
R = R0/M;
m = p1*V1/R/T1/1000;
dS = m*R*math.log(p1/p2);

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

print ("(ii)Work done")
Q = T1*dS;
print ("Q = %.3f")%(Q),("kJ")
(i) Change in entropy
dS = -0.029 kJ/K
(ii)Work done
Q = -8.047 kJ

Example 5.34 Page no : 280

In [6]:
import math 

# Variables
R = 0.287; 			#kJ/kg.K
m = 1.; 			#kg
p1 = 8.*10**5; 			#Pa
p2 = 1.6*10**5; 			#Pa
T1 = 380.; 			#K
n = 1.2;
y = 1.4;


# Calculations and Results
print ("(i) Final specific volume and temperature")
v1 = R*T1/p1*10**3; 			#m**3/kg
v2 = v1*(p1/p2)**(1/n);
T2 = T1*(p2/p1)**((n-1)/n);

print ("v2 = %.3f")%(v2), ("m**3/kg")
print ("T2 = %.3f")% (T2),("K")

print ("(ii) Change of internal energy, work done and heat interaction")
dU = R/(y-1)*(T2-T1);
print ("dU = %.3f")%(dU), ("kJ/kg")

W = R*(T1-T2)/(n-1);
print ("W = %.3f")%(W), ("kJ/kg")

Q = dU + W;
print ("Q = %.3f")%(Q),("kJ/kg")

print ("(iii) Change in entropy")
dS = R/(y-1)*math.log(T2/T1) + R*math.log(v2/v1)
print ("dS = %.3f")%(dS),("kJ/kg.K")
(i) Final specific volume and temperature
v2 = 0.521 m**3/kg
T2 = 290.595 K
(ii) Change of internal energy, work done and heat interaction
dU = -64.148 kJ/kg
W = 128.296 kJ/kg
Q = 64.148 kJ/kg
(iii) Change in entropy
dS = 0.192 kJ/kg.K

Example 5.35 Page no : 281

In [1]:
%matplotlib inline
import math
from matplotlib.pyplot import *

# Variables
y = 1.4;
cv = 0.718; 		#kJ/kg.K
m = 1.; 			    #kg
T1 = 290.; 			#K
n = 1.3;
r = 16.;
y = 1.4;

# Calculations and Results
T2 = T1*(r)**(n-1);

print ("(a)")

T = [T1, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, T2];
def f(T):
    return (y-n)*cv/(1-n)/10**3*math.log(T);

s = [f(T1),f(300),f(310),f(320),f(330),f(340),f(350),f(360),f(370),f(380),f(390),f(400),f(410),f(420),f(430),f(440),f(450),f(460),f(470),f(480),f(490),f(500),f(510),f(520),f(530),f(540),f(550),f(560),f(570),f(580),f(590),f(600),f(610),f(620),f(630),f(640),f(650),f(660), f(T2)];
plot(s,T)

T = [0, T2];
s = [f(T2), f(T2)];
plot(s,T,'r--')

T = [0 ,T1];
s = [f(T1),f(T1)];
plot(s,T,'r--')

T = [T1 ,T2];
s = [f(T1), f(T2)];
plot(s,T,'r--' )
suptitle("T-S diagram")
xlabel("S")
ylabel("T")
text(-0.00150,400,"pV**n = C")

print ("(b)Entropy change")
dS = cv*((n-y)/(n-1))*math.log(T2/T1);
print ("dS = %.3f")%(dS), ("kJ/kg.K")
print ("There is decrease in entropy")

Q = cv*((y-n)/(n-1))*(T1-T2);
Tmean  =  (T1+T2)/2;
dS_app = Q/Tmean;

error = ((-dS) - (-dS_app))/(-dS) * 100;
print ("age error  = %.3f")%(error), ("%")
Populating the interactive namespace from numpy and matplotlib
(a)
(b)Entropy change
dS = -0.199 kJ/kg.K
There is decrease in entropy
age error  = 5.393 %

Example 5.36 Page no : 282

In [2]:
from matplotlib.pyplot import *
from numpy import *
# Variables
cp = 1.005; 			#kJ/kg.K
R = 0.287; 			#kJ/kg.K
V1 = 1.2; 			#m**3
p1 = 1.*10**5; 			#Pa
p2 = p1;
T1 = 300.; 			#K
T2 = 600.; 			#K
T3 = T1;
p1 = 1.*10**5; 			#Pa
cv = cp-R;

# Calculations and Results
print ("(i) The net heat flow")
m = p1*V1/R/1000/T1; 			#kg
Q = m*R*(T2-T1);
print ("Q = "), (Q), ("kJ")

print ("(ii) The overall change in entropy")
dS_12 = m*cp*math.log(T2/T1);
dS_23 = m*(cp-R)*math.log(T3/T2); 			#cv = cp-R
dS_overall = dS_12+dS_23;
print ("Overall change in entropy = %.3f")%(dS_overall),("kJ/K")

s = linspace(math.sqrt(300),math.sqrt(600),100);
T = s**2;
plot(s,T)

s = linspace(22.18,math.sqrt(600),100)
T = 10*(s-16.725)**2;
plot(s,T,'r')

s = [17, 25];
T = [600, 600];
plot(s,T,'--')

s = [17 ,25];
T = [300 ,300];
plot(s,T,'--')

suptitle("T-s diagram ")
xlabel("S")
ylabel("T")
text(24,400,"v = C")
text(20,450,"p = C")
(i) The net heat flow
Q =  120.0 kJ
(ii) The overall change in entropy
Overall change in entropy = 0.277 kJ/K
Out[2]:
<matplotlib.text.Text at 0x4787450>

Example 5.37 Page no : 283

In [3]:
import math 
from matplotlib.pyplot import *

# Variables
cv = 0.718; 			#kJ/kg.K
R = 0.287    			#kJ/kg.K
p1 = 1.*10**5; 			#Pa
T1 = 300.    			#K
V1 = 0.018; 			#m**3
p2 = 5.*10**5 			#Pa
T3 = T1;
cp = cv+R;
p3 = p2;

# Calculations and Results
m = p1*V1/R/T1/1000; 			#kg
T2 = T1*p2/p1;

print ("(i) constant volume process")
dS_12 = m*cv*math.log(T2/T1);
print ("dS = %.3f")%(dS_12), ("kJ/K")

print ("(ii) Constant prssure process ")
dS_23 = m*cp*math.log(T3/T2);
print ("dS = %.3f")%(dS_23), ("kJ/K")

print ("(iii) Isothermal process")
dS_31 = m*R*math.log(p3/p1);
print ("dS = %.5f")%(dS_31),("kJ/K")

print ("T-s diagram")
s = linspace(math.sqrt(300),math.sqrt(600),72);
T = s**2;
#plot(s,T)

s = linspace(22.18,math.sqrt(600),24)
T = 10*(s-16.725)**2;
#plot(s,T,'r')

s = [math.sqrt(300), 22.18];
T = [300 ,300];
#plot(s,T,'g')

print ("p-V diagram")

V = [0.018, 0.018];
p = [1 ,5];
#plot(V,p)

p = [5 ,5];
V = [0.0036, 0.018];
#plot(V,p,'r')

V = linspace(0.0036,0.018,145)

def f():
    return 1*0.018/V;
f1 = f()

plot(V,f1,'g')
suptitle("p-V diagram")
xlabel("V")
ylabel("p")
(i) constant volume process
dS = 0.024 kJ/K
(ii) Constant prssure process 
dS = -0.034 kJ/K
(iii) Isothermal process
dS = 0.00966 kJ/K
T-s diagram
p-V diagram
Out[3]:
<matplotlib.text.Text at 0x4047ad0>

Example 5.39 Page no : 285

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

# Variables
m = 4; 			    #kg
T1 = 400; 			#K
T2 = 500; 			#K

# Calculations
def f12( T): 
	 return m*(0.48+0.0096*T)/T

dS =  quad(f12, T1,T2)[0]

# Results
print ("dS = %.3f")%(dS), ("kJ")
dS = 4.268 kJ

Example 5.40 Page no : 286

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

# Variables
p1 = 1*10**5; 			#Pa
T1 = 273;  			#K
p2 = 25*10**5; 			#Pa
T2 = 750; 			#K
R = 0.29; 			#kJ/kg.K ; cp = 0.85+0.00025*T; cv = 0.56+0.00025*T; R = cp-cv;

# Calculations
v2 = R*T2/p2;
v1 = R*T1/p1;

def f8( T): 
	 return (0.56+0.00025*T)/T

def f9(v):
    return R/v
ds =  quad(f8, T1, T2)[0] +  quad(f9,v1,v2)[0]

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

Example 5.41 Page no : 287

In [36]:
import math 

# Variables
cv = 0.715; 			#kJ/kg K
R = 0.287; 			#kJ/kg K
V_A = 0.25; 			#m**3
p_Ai = 1.4; 			#bar
T_Ai = 290; 			#K
V_B = 0.25; 			#m**3
p_Bi = 4.2; 			#bar
T_Bi = 440; 			#K

# Calculations and Results
print ("(i) Final equilibrium temperature")
m_A = p_Ai * 10**5 * V_A / R / 1000/ T_Ai; 			#kg
m_B = p_Bi * 10**5 * V_B / R / 1000/ T_Bi; 			#kg

T_f = (m_B * T_Bi + m_A * T_Ai)/(m_A + m_B);
print ("T_f  =  %.3f")% (T_f), ("K")


print ("(ii) Final pressure on each side of the diaphragm")
p_Af = p_Ai*T_f/T_Ai;
print ("p_Af = %.3f")%(p_Af),("bar")

p_Bf = p_Bi*T_f/T_Bi;
print ("p_Bf = %.3f")%(p_Bf),("bar")


print ("(iii) Entropy change of the system")
dS_A = m_A*cv*math.log(T_f/T_Ai);
dS_B = m_B*cv*math.log(T_f/T_Bi);
dS_net = dS_A+dS_B;
print ("Net change of entropy = %.3f")%(dS_net), ("kJ/K")
(i) Final equilibrium temperature
T_f  =  389.618 K
(ii) Final pressure on each side of the diaphragm
p_Af = 1.881 bar
p_Bf = 3.719 bar
(iii) Entropy change of the system
Net change of entropy = 0.016 kJ/K

Example 5.42 Page no : 287

In [11]:
import math 

# Variables
cv = 1.25; 			#kJ/kg.K
T1 = 530.; 			#K
v1 = 0.0624; 			#m**3/kg
v2 = 0.186; 			#m**3/kg
dT_31 = 25.; 			#K
T3 = T1-dT_31; 			#K
dT_21 = 165.; 			#K

# Calculations
T2 = T1-dT_21; 			#K
# Path 1-2 : Reversible adiabatic process
ds_12 = 0;
v3 = 0.186; 			#m**3/kg
v3 = v2;
ds_13 = cv*math.log(T3/T2);

# Results
print ("Chang in entropy  =  %.4f")%(ds_13), ("kJ/kgK")
Chang in entropy  =  0.4058 kJ/kgK

Example 5.44 Page no : 289

In [13]:
import math 
from numpy import *

# Variables
T1 = 500.; 			#K
T2 = 400.; 			#K
T3 = 300.; 			#K
Q1 = 1500.; 			#kJ/min
W = 200.; 			#kJ/min

# Calculations and Results
A = [[1,-1],[(1./400),(-1./300)]];
B = [(-1300),(-3)];
X = linalg.solve(A,B)

Q2 = X[0];
print ("Q2  = "), (Q2), ("kJ/min")

Q3 = X[1];
print ("Q3  = "), (Q3), ("kJ/min")

print ("(ii) Entropy change ")
dS1 = (-Q1)/T1;
print ("Entropy change of source 1  = "), (dS1), ("kJ/K")

dS2 = (-Q2)/T2;
print ("Entropy change of math.sink 2  = "), (dS2), ("kJ/K")

dS3 = Q3/T3;
print ("Entropy change of source 3  = "),(dS3), ("kJ/K")


print ("(iii) Net change of the entropy")
dSnet  =  dS1 + dS2 + dS3;
print ("dSnet = %d")% (dSnet)
Q2  =  -1600.0 kJ/min
Q3  =  -300.0 kJ/min
(ii) Entropy change 
Entropy change of source 1  =  -3.0 kJ/K
Entropy change of math.sink 2  =  4.0 kJ/K
Entropy change of source 3  =  -1.0 kJ/K
(iii) Net change of the entropy
dSnet = 0

Example 5.45 Page no : 291

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

# Variables
T1 = 250; 			#K
T2 = 125; 			#K

# Calculations
#cv = 0.0045*T**2
def f10( T): 
	 return 0.045*T**2

Q1 =  quad(f10, T1, T2)[0]

def f11( T): 
	 return 0.045*T

dS_system =  quad(f11, T1, T2)[0]

dS_universe = 0;

W_max = ((-Q1) -T2*(dS_universe-dS_system))/1000;

# Results
print ("W_max = %.3f")%(W_max), ("kJ")
W_max = 73.242 kJ

Example 5.46 Page no : 292

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

# Variables
cp = 1.005; 			#kJ/kg K
T_A = 333.; 			#K
T_B = 288.; 			#K
p_A = 140.; 			#kPa
p_B = 110.; 			#kPa
#h = cp*T
#v/T = 0.287/p

# Calculations
def f9( T): 
	 return cp/T

def f10(p):
    return 0.287/p
    
ds_system =  quad(f9, T_B, T_A)[0] + quad(f10,p_A,p_B)[0]
ds_surr = 0;
ds_universe = ds_system+ds_surr;

# Results
print ("change in entropy of universe  =  -%.4f")% (ds_universe), ("kJ/kgK")
print ("Since change in entropy of universe from A to B is -ve")
print ("The flow is from B to A")
change in entropy of universe  =  -0.0767 kJ/kgK
Since change in entropy of universe from A to B is -ve
The flow is from B to A

Example 5.47 Page no : 292

In [41]:
import math 

# Variables
m1 = 3.; 			#kg
m2 = 4.; 			#kg
T0 = 273.; 			#K
T1 = 80.+273; 			#K
T2 = 15.+273; 			#K
c_pw = 4.187; 			#kJ/kgK

# Calculations
tm = (m1*T1 + m2*T2)/(m1+m2);
Si = m1*c_pw*math.log(T1/T0) + m2*c_pw*math.log(T2/T0);
Sf = (m1+m2)*c_pw*math.log(tm/T0);
dS = Sf-Si;

# Results
print ("Net change in entropy  = %.3f")%(dS),("kJ/K")
Net change in entropy  = 0.150 kJ/K

Example 5.49 Page no : 294

In [16]:
import math 

# Variables
m = 1.; 			#kg
T1 = 273.; 			#K
T2 = 363.; 			#K
c = 4.187;

# Calculations and Results
print ("(a)")
ds_water = m*c*math.log(T2/T1);
print ("(i) Entropy of water = %.3f")%(ds_water), ("kJ/kgK")

print ("(ii) Entropy change of the reservoir ")
Q = m*c*(T2-T1);
ds_reservoir = -Q/T2;
print ("ds_reservoir = %.3f")% (ds_reservoir), ("kJ/K")

ds_universe = ds_water+ds_reservoir;
print ("(iii) Entropy change of universe  = %.3f")% (ds_universe), ("kJ/K")

print ("(b)")
T3 = 313; 			#K
ds_water = m*c*(math.log(T3/T1) + math.log(T2/T3));
ds_res1 = -m*c*(T3-T1)/T3;
ds_res2 = -m*c*(T2-T3)/T2;

ds_universe = ds_water+ds_res1+ds_res2;
print ("(iii) Entropy change of universe  = %.3f")%(ds_universe), ("kJ/K")

print ("(c) The entropy change of universe would be less and less, if the water is heated in more and more stages, by bringing")
print ("the water in contact successively with more and more heat reservoirs, each succeeding reservoir being at a higher temperature") 
print ("than the preceding one.")

print ("When water is heated in infinite steps, by bringing in contact with an infinite number of reservoirs in succession, so that") 
print ("at any insmath.tant the temperature difference between the water and the reservoir in contact is infinitesimally small, then") 
print ("the entropy change of the universe would be zero and the water would be reversibly heated.")
(a)
(i) Entropy of water = 1.193 kJ/kgK
(ii) Entropy change of the reservoir 
ds_reservoir = -1.038 kJ/K
(iii) Entropy change of universe  = 0.155 kJ/K
(b)
(iii) Entropy change of universe  = 0.081 kJ/K
(c) The entropy change of universe would be less and less, if the water is heated in more and more stages, by bringing
the water in contact successively with more and more heat reservoirs, each succeeding reservoir being at a higher temperature
than the preceding one.
When water is heated in infinite steps, by bringing in contact with an infinite number of reservoirs in succession, so that
at any insmath.tant the temperature difference between the water and the reservoir in contact is infinitesimally small, then
the entropy change of the universe would be zero and the water would be reversibly heated.

Example 5.50 Page no : 295

In [43]:
import math 

# Variables
cp = 2.093; 			#kJ/kg0C
c = 4.187;
Lf = 333.33; 			#kJ/kg
m = 1.; 			#kg
T0 = 273.; 			#K
T1 = 268.; 			#K
T2 = 298.; 			#K

# Calculations and Results
Q_s = m*cp*(T0-T1);
Q_f = m*Lf;
Q_l = m*c*(T2-T0);
Q = Q_s+Q_f+Q_l;

print ("(i) Entropy increase of the universe")
ds_atm = -Q/T2;
ds_sys1 = m*cp*math.log(T0/T1);
ds_sys2 = Lf/T0;
ds_sys3 = m*c*math.log(T2/T0);
ds_total = ds_sys1+ds_sys2+ds_sys3;
ds_universe = ds_total+ds_atm;

print ("Entropy increase of universe = %.3f")%(ds_universe), ("kJ/K")


print ("(ii) Minimum amount of work necessary to convert the water back into ice at – 5°C, Wmin.")
dS_refrigerator = 0;

dS_system = -1.6263; 			#kJ/kg K
T = 298; 			#K
#For minimum work 
W_min = T*(-dS_system)-Q;

print ("Minimum work done  = %.3f")% (W_min), ("kJ")
(i) Entropy increase of the universe
Entropy increase of universe = 0.122 kJ/K
(ii) Minimum amount of work necessary to convert the water back into ice at – 5°C, Wmin.
Minimum work done  = 36.167 kJ