Chapter8-Entropy

Example1 pg- 168

In [1]:
#calculate and entropy of ice and environment and universe
##initialisation of variables
m= 2 ##kg
dh= 333.39 ##kg/h
T= 0 ##C
T1= 20 ##C
##CALCULATIONS
Q12= m*dh
dS= Q12/(273.15+T)
dSenvir= -Q12/(273.15+T1)
dStotal= dS+dSenvir
##RESULTS
print'%s %.3f %s'%(' entropy of ice =',dS,'kJ/K')
print'%s %.3f %s'%('entropy of environment =',dSenvir,'kJ/K')
print'%s %.3f %s'%('entropy of universe =',dStotal,'kJ/K')
 entropy of ice = 2.441 kJ/K
entropy of environment = -2.275 kJ/K
entropy of universe = 0.167 kJ/K

Example2-pg169

In [2]:
import math
#calculate change in entropy in system and environment and entropy
##initialisation of variables
Q= 666.78 ##kJ
T= 0 ##C
Th= 20. ##C
##CALCULATIONS
Ssys= Q/(273.15+T)
Qh= Q*((273.15+Th)/(273.15+T))
Senvir= -Qh/(273.15+Th)
Stotal= Ssys+Senvir
##RESULTS
print'%s %.4f %s'%('change in entropy in sysytem =',Ssys,' kJ/K')
print'%s %.4f %s'%('change in entropy in environment =',Senvir,'kJ/K')
print'%s %.f %s'%('total change in entropy =',Stotal,'kJ/K')
change in entropy in sysytem = 2.4411  kJ/K
change in entropy in environment = -2.4411 kJ/K
total change in entropy = 0 kJ/K

Example3-pg171

In [3]:
#calculate change in entropy
##initialisation of variables
S1= 6.2872 ##J/kg K
S2= 5.8712 ##J/kg K
m= 18 ##kg
##CALCULATIONS
S= m*(S1-S2)
##RESULTS
print'%s %.3f %s'%(' change in entropy =',S,'kJ/K')
 change in entropy = 7.488 kJ/K

Example4-pg 171

In [5]:
#calculate change in entropy
##initialisation of variables
S2= 5.8328 ##kJ/kg
S1= 5.8712 ##kJ/kg
##CALCULATIONS
S= S2-S1
##RESULTS
print'%s %.5f %s'%('change in entropy = ',S,'kJ/K')
change in entropy =  -0.03840 kJ/K

Example5-pg172

In [4]:
import math
#calculate enthalpy and change in entropy
##initialisation of variables
m= 0.1 ##kg
p= 3 ##bar
p1= 10 ##bar
h1= 2964.3 ##kJ/kg
v1=0.2378
s2= 7.1619 ##kJ/k
s1= 6.9641 ##kJ/k
##CALCULATIONS
h2= h1+(p-p1)*math.pow(10,5)*v1*math.pow(10,-3)
S= m*(s2-s1)
##RESULTS
print'%s %.1f %s'%(' enthalpy =',h2,'kJ/kg')
print'%s %.5f %s'%('change in entropy =',S,'kJ/K')
 enthalpy = 2797.8 kJ/kg
change in entropy = 0.01978 kJ/K

Example6-pg 174

In [6]:
#calculate final pressure and change in entropy
import math
##initialisation of variables
p1= 5. ##bar
V1= 0.4 ##m^2
V2= 1.2 ##m^3
R= 8.314 ##J/mol K
M= 28.##gms
T1= 80.##C
##CALCULATIONS
p2= p1*(V1/V2)
S= R*math.log(V2/V1)/M
S1= S*p1*V1*100/((R/M)*(273.15+T1))
##RESULTS
print'%s %.3f %s'%(' final pressure =',p2,'bar')
print'%s %.4f %s'% ('change in entropy =',S1,'kJ/kg K')
 final pressure = 1.667 bar
change in entropy = 0.6222 kJ/kg K

Example7-pg 175

In [7]:
import math
#calculate heat and change in entropy of system and change in entropy of enironment
##initialisation of variables
R= 8.314 ##J/mol K
M= 29. ##gms
T= 400. ##K
p2= 1.6 ##bar
p1= 1. ##bar
Tenvir= 300. ##K
##CALCULATIONS
q= R*T*math.log(p2/p1)/M
S= -R*math.log(p2/p1)/M
Senvir= q/Tenvir
##RESULTS
print'%s %.1f %s'%('heat =',q,'kJ/kg')
print'%s %.4f %s'%('change in entropy of system=',S,'kJ/kg K')
print'%s %.4f %s'%('change in entropy of environment=',Senvir,'kJ/kg K')
heat = 53.9 kJ/kg
change in entropy of system= -0.1347 kJ/kg K
change in entropy of environment= 0.1797 kJ/kg K

Ex8-pg176

In [3]:
import math
##initialisation of variables
m1= 5 ##kg
c1= 1.26 ##kJ/kg K
m2= 20 ##kg
c2= 4.19 ##kJ/kg K
T1= 95 ##C
T2= 25 ##C
##CALCULATIONS
T= (m1*c1*T1+m2*c2*T2)/(m1*c1+m2*c2)
S1= m1*c1*math.log((273.15+T)/(273.15+T1))
S2= m2*c2*math.log((273.15+T)/(273.15+T2))
S= S1+S2
##RESULTS
print'%s %.2f %s'% (' change in entropy of billet =',S1,' kJ/K')
print'%s %.2f %s'% ('  change in entropy of water= ',S2,' kJ/kg K')
print'%s %.2f %s'% ('  change in entropy of water=',S,' kJ/kg K')
 change in entropy of billet = -1.23  kJ/K
  change in entropy of water=  1.36  kJ/kg K
  change in entropy of water= 0.14  kJ/kg K