# Chapter 4 : Entropy¶

## Example 4.1 Page No : 6¶

In [1]:

# Variables :
T1 = 400.;			#Kelvin
T2 = 300.;			#Kelvin
Q1 = 4800.;			#KJ
Q2 = -4800.;			#KJ

# Calculations
#Q1/T1+Q2/T2< = 0
LHS = Q1/T1+Q2/T2;			#

# Results
print "/T1+Q2/T2  =  ",LHS
print ("It is less than zero. Process is irreversible")

/T1+Q2/T2  =   -4.0
It is less than zero. Process is irreversible


## Example 4.2 Page No : 6¶

In [1]:

# Variables :
T1 = 290.+273;			#Kelvin
T2 = 8.5+273;			#Kelvin
Q1 = 300.;			#KJ
#Case 1 :
Q2 = -215.;			#KJ

# Calculations and Results
sigmaQbyT = Q1/T1+Q2/T2
print "(i) Q1/T1+Q2/T2  =  %.4f"%sigmaQbyT
print ("It is less than zero. Cycle is irreversible")

#Case 2 :
Q2 = -150.;			#KJ
sigmaQbyT = Q1/T1+Q2/T2
print "(ii) Q1/T1+Q2/T2  =  %.0f"%sigmaQbyT
print ("It is equal to zero. Cycle is reversible");
#Case 3 :
Q2 = -75.;			#KJ
sigmaQbyT = Q1/T1+Q2/T2
print "(iii) Q1/T1+Q2/T2  =  %.4f"%sigmaQbyT
print ("It is greater than zero. Cycle is impossible.");

(i) Q1/T1+Q2/T2  =  -0.2309
It is less than zero. Cycle is irreversible
(ii) Q1/T1+Q2/T2  =  0
It is equal to zero. Cycle is reversible
(iii) Q1/T1+Q2/T2  =  0.2664
It is greater than zero. Cycle is impossible.


## Example 4.3 Page No : 18¶

In [2]:
import math

# Variables :
V1 = 10.;			#m**3
T1 = 175.+273;			#Kelvin
T2 = 36.+273;			#Kelvin
p1 = 5.;			#bar
p2 = 1.;			#bar
R = 287.;			#KJ/KgK
Cp = 1.005;			#KJ/KgK

# Calculations
#p*V = m*R*T
m = p1*10**5*V1/R/T1;			#Kg
deltaS = m*Cp*math.log(T2/T1)+m*R/1000*math.log(p1/p2);			#KJ/K

# Results
print "Entropy change in KJ/K :  %.3f"%deltaS

Entropy change in KJ/K :  3.445


## Example 4.4 Page No : 18¶

In [4]:

# Variables :
deltaS = 5.;			#KJ/KgK
W = 2000.;			#KJ/Kg
T1 = 327.+273;			#Kelvin

# Calculations and Results
Q1 = deltaS*T1;			#KJ/Kg
Q2 = Q1-W;			#KJ/Kg
Eta = W/Q1*100;			#%
print "Efficiency in %% : %.1f"%Eta

T2 = Q2/Q1*T1;			#K
print "Lowest temperature in Kelvin : ",T2

Efficiency in % : 66.7
Lowest temperature in Kelvin :  200.0


## Example 4.5 Page No : 19¶

In [5]:
import scipy

# Variables :
mc = 0.5;			#Kg
Tc = 100.+273;			#K
Cpc = 0.393;			#KJ/KgK
Tw = 10.+273;			#K
Cpw = 4.2;			#KJ/KgK

# Calculations and Results
def f0(T):
return mc*Cpc

def f1(T):
return mc*Cpc/T

deltaSw = abs(Q)/Tw;			#KJ/K
deltaSuniverse = deltaSc+deltaSw;			#Kj/K
print "Part (i) Chane in entropy in KJ/K : %.4f"%deltaSuniverse

T1 = 383.;			#K
T2 = 283.;			#K
T = (T1+T2)/2;			#K

def f2(T):
return 1/T
deltaSuniverse = mc*Cpc*( a + 0.1627)
print "Part (ii) Chane in entropy in KJ/K : %.5f"%deltaSuniverse

Part (i) Chane in entropy in KJ/K : 0.0082
Part (ii) Chane in entropy in KJ/K : 0.00448


## Example 4.6 Page No : 20¶

In [6]:
# Variables :
Tc = 35.+273;			#K
W = 500.;			#KJ
T1 = 308.;			#K
T2 = 308.;			#K
T0 = 15.+273;			#K
Q = W;	    		#KJ
deltaS1 = 0;			#as heat supplied is zero

# Calculations
deltaS2 = Q/T0;			#KJ/K

# Results
print "Change in entropy in KJ/K : %.4f"%deltaS2

Change in entropy in KJ/K : 1.7361


## Example 4.7 Page No : 20¶

In [1]:
import math

# Variables :
mi = 0.5;			#Kg
Ti = -10.+273;			#K
Cpi = 2.;			#KJ/KgK
Cpw = 4.2;			#KJ/KgK
Li = 334.;			#KJ/Kg
mc = 5.;			#Kg
Tc = 80.+273;			#K
Cpc = 0.5;			#KJ/KgK
T0 = 0.+273;			#K

# Calculations and Results
#mi*[Cpi*(T0-Ti)+Li+Cpw*(T-T0)] = mc*Cpc*(Tc-T)
T = (mc*Cpc*Tc-mi*Cpi*(T0-Ti)-mi*Li+mi*Cpw*T0)/(mi*Cpw+mc*Cpc);			#K
deltaSi = mi*Cpi*math.log(T0/Ti)+Li/T0+mi*Cpw*math.log(T/T0);			#KJ/K
print "Entropy chane of Ice in KJ/K : %.4f"%deltaSi

deltaSc = mc*Cpc*math.log(T/Tc);			#KJ/K
print "Entropy chane of Copper in KJ/K : %.4f"%deltaSc

deltaSsurr = 0;			#No heat transfer between system & Surrounding
deltaSuniverse = deltaSi+deltaSc+deltaSsurr;			#KJ/K
print "Entropy chane of universe in KJ/K : %.4f"%deltaSuniverse

Entropy chane of Ice in KJ/K : 1.2989
Entropy chane of Copper in KJ/K : -0.5971
Entropy chane of universe in KJ/K : 0.7018


## Example 4.8 Page No : 21¶

In [8]:
import scipy

# Variables :
m1 = 5.;			#Kg
T1 = 200.+273;			#K
Cp1 = 0.4;			#KJ/KgK
m2 = 100.;			#Kg
T2 = 30.+273;			#K
Cp2 = 2.1;			#KJ/KgK

# Calculations
#m1*Cp1*(T1-T) = m2*Cp2*(T-T2)
T = (m1*Cp1*T1+T2*m2*Cp2)/(m2*Cp2+m1*Cp1);			#K

def f8(T):
return m1*Cp1/T

def f9(T):
return m2*Cp2/T

deltaSsurr = 0;			#No heat transfer neglected
deltaSuniverse = deltaS1+deltaS2+deltaSsurr;			#KJ/K

# Results
print "Increase in Entropy of universe in KJ/K : %.4f"%deltaSuniverse

Increase in Entropy of universe in KJ/K : 0.2284


## Example 4.9 Page No : 22¶

In [9]:
import scipy

# Variables :
HeatTransfer = 2;			#KJ/degreeCentigrade(it is d'Q/dT)
T1 = 27+273;			#K
T2 = 127+273;			#K

# Calculations
def f22(T):
return HeatTransfer/T

# Results
print "Entropy change when heat is transfered to system in KJ/K : %.4f"%deltaS
print  "change when end states are achieved by stirring action in KJ/K : %.4f"%deltaS

Entropy change when heat is transfered to system in KJ/K : 0.5754
change when end states are achieved by stirring action in KJ/K : 0.5754


## Example 4.11 Page No : 23¶

In [8]:
import scipy

# Variables :
m1 = 2.;			#Kg
T1 = 80.+273;			#K
m2 = 3.;			#Kg
T2 = 30.+273;			#K
Cp = 4.187;			#KJ/KgK

# Calculations
#m1*Cp1*(T1-T) = m2*Cp2*(T-T2)
T = (m1*Cp*T1+T2*m2*Cp)/(m2*Cp+m1*Cp);			#K

def f26(T):
return m1*Cp/T

print "Total Entropy change due to mixing process in KJ/K : %.4f"%deltaS

Total Entropy change due to mixing process in KJ/K : 0.0592


## Example 4.14 Page No : 26¶

In [11]:
from scipy.integrate import quad

# Variables :
V1 = 4.;			#m**3
V2 = 4.;			#m**3
m = 20.;			#Kg
p1 = 4.*100;			#KPa
p2 = 8.*100;			#KPa
Cp = 1.005;			#KJ/KgK
Cv = 0.718;			#KJ/KgK

# Calculations and Results
R = Cp-Cv;			#KJ/KgK
T1 = p1*V1/m/R;			#K
T2 = p2*V2/m/R;			#K
deltaU = m*Cv*(T2-T1);			#KJ
print "Change in internal energy in KJ : %.2f"%deltaU
W = 0;			#KJ
print  "no movement, Work done in KJ : ",W

Q = W+deltaU;			#KJ
print "Heat transfered in KJ : %.2f"%Q

def f19(T):
return m*Cv/T

print "Entropy change  in KJ/K : %.4f"%deltaS

Change in internal energy in KJ : 4002.79
no movement, Work done in KJ :  0
Heat transfered in KJ : 4002.79
Entropy change  in KJ/K : 9.9536


## Example 4.15 Page No : 26¶

In [1]:
import scipy

# Variables :
V1 = 4.;			#m**3
V2 = 4.;			#m**3
m = 600./1000;			#Kg
C = 150.;			#J/K
T1 = 100.+273;			#K
T0 = 8.+273;			#K
Cp = C/1000;			#KJ/K

# Calculations and Results
def f10(T):
return Cp/T

Q = Cp*(T1-T0);			#KJ
deltaSlake = Q/T0;			#KJ/K
deltaSuniverse = deltaSblock+deltaSlake;			#KJ/K
print "Part (i) Entropy change of universe in KJ/K : %.4f"%deltaSuniverse

T1 = 8.+273;			#K
Z = 100.;		    	#meter
g = 9.81;			    #gravity constant
PE = m*g*Z/1000.;		#KJ
T2 = T1+deltaT;			#K

def f11(T):
return Cp/T

deltaSlake = PE/T0;			#KJ/K
deltaSuniverse = deltaSblock+deltaSlake;			#KJ/K
print "Part (ii) Entropy change of universe in %f KJ/K : "%deltaSuniverse

Part (i) Entropy change of universe in KJ/K : 0.0066
Part (ii) Entropy change of universe in 0.000014 KJ/K :


## Example 4.17 Page No : 29¶

In [2]:
import math

# Variables :
m = 1.;			#Kg
p1 = 1.;			#bar
T1 = 290.;			#K
p2 = 30.;			#bar
T2 = 290.;			#K
n = 1.3;			#consmath.tant
R = 300.;			#Nm/KgK
Cv = 0.72;			#KJ/KgK

# Calculations and Results
print ("part (a) Isothermally")
V1 = R*T1/p1/10**5;			#m**3/Kg
V2 = p1*V1/p2;			#m**3/Kg
w = p1*10**5*V1*math.log(V2/V1)/1000;			#KJ/Kg
print "Workdone in KJ/Kg : %.1f"%w

deltaU = m*Cv*(T2-T1);			#KJ(as T1 = T2)
print "Change in internal energy in KJ : ",deltaU

q = w+deltaU;			#KJ/Kg
print "Heat transfer in KJ/Kg : %.1f"%q

S2subS1 = m*R/1000*math.log(V2/V1)+m*Cv*math.log(T2/T1);			#KJ/KgK
print "Change in entropy in KJ/KgK : %.4f"%S2subS1

print ("\npart (b) Polytropically")
T2 = T1*(p2/p1)**((n-1)/n);			#K
print "Temperature T2 in K : %.1f"%T2

V1 = R*T1/p1/10**5;			#m**3/Kg
V2 = (p1/p2)**(1/n)*V1;			#m**3/Kg
w =  m*R/1000*(T1-T2)/(n-1);			#KJ/Kg
print "Workdone in KJ/Kg : %.1f"%w

deltaU = m*Cv*(T2-T1);			#KJ(as T1 = T2)
q = w+deltaU;			#KJ/Kg
print "Heat transfer in KJ/Kg : %.1f"%q

S2subS1 = m*R/1000*math.log(V2/V1)+m*Cv*math.log(T2/T1);			#KJ/KgK
print "Change in entropy in KJ/KgK : %.4f"%S2subS1

part (a) Isothermally
Workdone in KJ/Kg : -295.9
Change in internal energy in KJ :  0.0
Heat transfer in KJ/Kg : -295.9
Change in entropy in KJ/KgK : -1.0204

part (b) Polytropically
Temperature T2 in K : 635.7
Workdone in KJ/Kg : -345.7
Heat transfer in KJ/Kg : -96.8
Change in entropy in KJ/KgK : -0.2198


## Example 4.18 Page No : 30¶

In [16]:
import math

# Variables :
P1 = 480.;			#kPa
T1 = 190.+273;			#K
T3 = 190.+273;			#K
P2 = 94.;			#kPa
P3 = 150.;			#kPa
T2 = T3*P2/P3;			#K
R = 0.29;			#KJ/KgK
m = 1.;			#Kg
Cp = 1.011;			#KJ/KgK

#T2/T1 = (P2/P1)**((Gamma-1)/Gamma)
#((Gamma-1)/Gamma) = math.log(T2/T1)/math.log(P2/P1);			#
Gamma = 1.402;			#by trial method
print "Index of adiabatic expansion : %.2f"%Gamma

Cv = R/(Gamma-1);			#KJ/KgK
W1_2 = m*R*(T1-T2)/(Gamma-1);			#KJ/Kg
print "Work done, W1-2 per Kg of air in KJ/Kg : %.2f"%W1_2

W2_3 = 0;			#Consmath.tant volume process
print "Work done, W2-3 per Kg of air in KJ/Kg : %.0f"%W2_3

W3_1 = m*R*T2*math.log(P3/P1);			#KJ/Kg
print "Work done, W1-2 per Kg of air in KJ/Kg : %.2f"%W3_1

W = W1_2+W2_3+W3_1;			#KJ/Kg
print "Total Work done in KJ/Kg : %.2f"%W

S3subS2 = m*R*math.log(P2/P3)+m*Cp*math.log(T3/T2);			#KJ/KgK
print "Change in specific entropy, S1-2 in KJ/KgK ;  %.3f"%S3subS2

S1subS3 = -S2subS1-S3subS2;			#KJ/KgK
print "Change in specific entropy, S3-1 in KJ/KgK ;  %.3f"%S1subS3

Index of adiabatic expansion : 1.40
Work done, W1-2 per Kg of air in KJ/Kg : 124.70
Work done, W2-3 per Kg of air in KJ/Kg : 0
Work done, W1-2 per Kg of air in KJ/Kg : -97.87
Total Work done in KJ/Kg : 26.82
Change in specific entropy, S1-2 in KJ/KgK ;  0.337
Change in specific entropy, S3-1 in KJ/KgK ;  -0.337


## Example 4.21 Page No : 33¶

In [17]:
import math

# Variables :
p1 = 5.;			#bar
T1 = 30.+273;			#K
p2 = 4.;			#bar
m = 1.; 			#Kg
R = 0.287;			#KJ/KgK

# Calculations
#deltaS = m*R*math.log(p1/p2)+m*Cp*math.log(T2/T1);			#KJ/kgK
deltaS = m*R*math.log(p1/p2);			#KJ/kgK(T2/T1 leads to 2nd term zero)

# Results
print "Entropy Change in KJ/KgK :  %.5f"%deltaS

Entropy Change in KJ/KgK :  0.06404


## Example 4.22 Page No : 34¶

In [18]:
import scipy

# Variables :
Cpg = 1.05;			#KJ/KgK
T = 30.+273;			#K

# Calculations
Q = Cpg*(t1-t2);			#KJ/Kg
deltaSsurr = Q/T;			#KJ/KgK

def f25(T):
return Cpg/T


Change in entropy of the universe in KJ/KgK :  0.0743