Chapter 08: Available energy Availability and irreversibility

Ex8.1:pg-249

In [1]:
import math
T0 = 35.0 # Heat rejection temperature in degree Celsius 
T1 = 420 #  Vapor condensation temperature in degree Celsius 
T1_ = 250 # water vapor temperature in degree Celsius 
print "\n Example 8.1"
f = ((T0+273)*((T1+273)-(T1_+273)))/((T1_+273)*((T1+273)-(T0+273)))# fraction of energy lost
print "\n The fraction of energy that becomes unavailable due to irreversible heat transfer is ",f 
#The answers vary due to round off error
 Example 8.1

 The fraction of energy that becomes unavailable due to irreversible heat transfer is  0.260038240918

Ex8.2:pg-250

In [16]:
from scipy import integrate
import math

lhw = 1858.5 # Latent heat of water in kJ/kg
Tew = 220 # Water evaporation temperature in degree Celsius
 
Tig = 1100 # Initial temperature of the gas in degree Celsius
Tfg = 550 # Final temperature of the gas in degree Celsius
T0 = 303 # Atmospheric temperature in degree Celsius
Tg2 = 823 
Tg1 = 1373
print "\n Example 8.2"
Sw = lhw/(Tew+273) # Entropy generation in water
Sg,error = integrate.quad(lambda T:3.38/T,Tg1,Tg2)
St = Sg+Sw 
print "\n Total change in entropy is ",St ," kJ/K"

print "\n Increase in unavailable energy is ",T0*St ," kJ"
#The answers vary due to round off error
 Example 8.2

 Total change in entropy is  2.03990232306  kJ/K

 Increase in unavailable energy is  618.090403887  kJ

Ex8.4:pg-253

In [17]:
import math
from scipy import integrate
Ts_ = 15 # Ambient temperature in degree Celsius
Tw1_ = 95 # Temperature of water sample 1 in degree Celsius
Tw2_ = 35# Temperature of water sample 2 in degree Celsius
m1 = 25 # Mass of water sample 1 in kg
m2 = 35 # Mass of water sample 2 in kg
cp = 4.2 # Specific heat capacity of water in kJ/kgK
print "\n Example 8.4"
Ts = Ts_+273# Ambient temperature in K
Tw1 = Tw1_+273 # Temperature of water sample 1 in K
Tw2 = Tw2_+273# Temperature of water sample 2 in K
AE25,er = integrate.quad(lambda T:m1*cp*(1-(Ts/T)),Ts,Tw1)
AE35,er2 = integrate.quad(lambda T:m2*cp*(1-(Ts/T)),Ts,Tw2)
AEt = AE25 + AE35
Tm = (m1*Tw1+m2*Tw2)/(m1+m2) # Temperature after mixing
AE60,er3 = integrate.quad(lambda T:(m1+m2)*cp*(1-(Ts/T)),Ts,Tm)
AE = AEt - AE60
print "\n The decrease in the available energy is ",AE ," kJ"
 Example 8.4

 The decrease in the available energy is  281.816890623  kJ

Ex8.5:pg-254

In [18]:
import math
from scipy import integrate
N1 = 3000 # Speed of rotation of flywheel in RPM
I = 0.54 # Moment of inertia of flywheel in kgm**2
ti_ = 15 # Temperature of insulated system in degree Celsius 
m = 2 # Water equivalent of shaft 
print "\n Example 8.5"
w1 = (2*math.pi*N1)/60 # Angular velocity of rotation in rad/s
Ei = 0.5*I*w1**2 # rotational kinetic energy
dt = Ei/(1000*2*4.187) # temperature change
ti = ti_+273# Temperature of insulated system in Kelvin
tf = ti+dt # final temperature
AE,er = integrate.quad(lambda T: m*4.187*(1-(ti/T)),ti,tf)
UE = Ei/1000 - AE # Unavailable enrgy
w2 = math.sqrt(AE*1000*2/I) # Angular speed in rad/s 
N2 = (w2*60)/(2*math.pi) # Speed of rotation in RPM
print "\n The final RPM of the flywheel would be ",N2 ," RPM"
 Example 8.5

 The final RPM of the flywheel would be  222.168786807  RPM

Ex8.6:pg-255

In [19]:
import math
from scipy import integrate
T1_ = 80.0 # Initial temperature of air in degree Celsius 
T2_ = 5.0 # Final temperature of air in degree Celsius 
V2 = 2.0 # Assumed final volume
V1 = 1.0 # Assumed initial volume
P0 = 100.0 # Final pressure of air in kPa
P1 = 500.0 # Initial pressure of air in kPa
R = 0.287 # Gas constant
cv = 0.718 # Specific heat capacity at constant volume for gas in kJ/kg K
m = 2.0 # Mass of gas in kg
print "\n Example 8.6"
T1= T1_+273 # Initial temperature of air in K 
T2 = T2_+273 # Final temperature of air in K 
S= integrate.quad(lambda T:(m*cv)/T,T1,T2)[0] + integrate.quad(lambda V: (m*R)/V,V1,V2)[0] # Entropy change
U = m*cv*(T1-T2)# Change in internal energy
Wmax = U-(T2*(-S)) # Maximum possible work
V1_ = (m*R*T1)/P1 # volume calculation
CA = Wmax-P0*(V1_) # Change in availability
I = T2*S # Irreversibility
print "\n The maximum work is ",Wmax ," kJ"
print "\n Change in availability is ",CA ," kJ"
print "\n Irreversibility is ",I ," kJ"
#The answers vary due to round off error
 Example 8.6

 The maximum work is  122.957271378  kJ

 Change in availability is  82.4328713783  kJ

 Irreversibility is  15.2572713783  kJ

Ex8.7:pg-256

In [2]:
import math
P1 = 500.0 # Initial pressure of steam in kPa
P2 = 100.0# Final pressure of steam in kPa
T1_ = 520.0 #Initial temperature of steam in degree Celsius
T2_ = 300.0 #Final temperature of steam in degree Celsius
cp = 1.005 # Specific heat capacity of steam in kJ/kgK
t0 = 20.0 # Atmospheric temperature in degree Celsius 
R = 0.287 # Gas constant
Q = -10.0 # Heat loss to surrounding in kJ/kg
print "\n Example 8.7"
T1 = T1_+273 #Initial temperature of steam in degree Celsius
T2 = T2_+273 #Final temperature of steam in degree Celsius
S21 = (R*math.log(P2/P1))-(cp*math.log(T2/T1))
T0 = t0+273
CA = cp*(T1-T2)-T0*S21 # Change in availability
Wmax = CA # Maximum possible work
W = cp*(T1-T2)+Q # net work
I = Wmax-W # Irreversibility
# Altenatively
Ssystem = -Q/T0
Ssurr = -S21
I1 = T0*(Ssystem+Ssurr)
print "\n The decrease in availability is ",CA ," kJ/kg"
print "\n The maximum work is ",Wmax ," kJ/kg"
print "\n The irreversibility is ",I ," kJ/kg"
print "\n Alternatively, The irreversibility is ",I1 ," kJ/kg"
 Example 8.7

 The decrease in availability is  260.756521108  kJ/kg

 The maximum work is  260.756521108  kJ/kg

 The irreversibility is  49.6565211082  kJ/kg

 Alternatively, The irreversibility is  49.6565211082  kJ/kg

Ex8.8:pg-258

In [3]:
import math
T0 = 300.0 # Atmospheric temperature in K
Tg1_ = 300.0 # Higher temperature of combustion product in degree Celcius
Tg2_ = 200.0 # Lower temperature of combustion product in degree Celcius
Ta1 = 40.0 # Initial air temperature in K
cpg = 1.09 # Specific heat capacity of combustion gas in kJ/kgK
cpa = 1.005# Specific heat capacity of air in kJ/kgK
mg = 12.5 # mass flow rate of product in kg/s
ma = 11.15# mass flow rate of air in kg/s

print "\n Example 8.8"
Tg1 = Tg1_+273 # Higher temperature of combustion product in K
Tg2 = Tg2_+273 # Lower temperature of combustion product in K
f1 = cpg*(Tg1-T0)-T0*cpg*(math.log(Tg1/T0)) # Initial availability of product
f2 = cpg*(Tg2-T0)-T0*cpg*(math.log(Tg2/T0)) # Final availabilty of product
print "\n The initial and final availbility of the products are ",f1 ," kJ/Kg and ",f2 ," kJ/Kg respectively"
#The answer provided in the textbook is wrong

# Part (b)
Dfg = f1-f2 # Decrease in availability of products
Ta2 = (Ta1+273) + (mg/ma)*(cpg/cpa)*(Tg1-Tg2) # Exit temperature of air
Ifa = cpa*(Ta2-(Ta1+273))-T0*cpa*(math.log(Ta2/(Ta1+273))) # Increase in availability of air
I = mg*Dfg-ma*Ifa # Irreversibility 
print "\n The irreversibility of the process is ",I ," kW"
##The answer provided in the textbook contains round off error

# Part (c)
Ta2_ = (Ta1+273)*(Tg1/Tg2)**((12.5*1.09)/(11.5*1.005))
Q1 = mg*cpg*(Tg1-Tg2) # Heat supply rate from gas to working fluid
Q2 = ma*cpa*(Ta2_-(Ta1+273))# Heat rejection rate from the working fluid in heat engine
W = Q1-Q2 # Power developed by heat engine
print "\n Total power generated by the heat engine is ",W ," kW"
#The answer provided in the textbook contains round off error
 Example 8.8

 The initial and final availbility of the products are  85.9672398469  kJ/Kg and  39.6826771757  kJ/Kg respectively

 The irreversibility of the process is  319.369801955  kW

 Total power generated by the heat engine is  472.671938045  kW

Ex8.9:pg-260

In [4]:
import math
T2 = 790.0 # Final temperature of gas in degree Celsius
T1 = 800.0 # Initial temperature of gas in degree Celsius
m = 2.0 # Mass flow rate in kg/s
cp = 1.1 # Specific heat capacity in kJ/KgK
T0 = 300.0 # Ambient temperature in K

print "\n Example 8.9"
I = m*cp*(((T1+273)-(T2+273))-T0*(math.log((T1+273)/(T2+273)))) # irreversibility rate
print "\n The irreversibility rate is ",I ," kW"

# At lower temperature
T1_ = 80.0 # Initial temperature of gas in degree Celsius
T2_ = 70.0 # Initial temperature of gas in degree Celsius
I_ = m*cp*(((T1_+273)-(T2_+273))-T0*(math.log((T1_+273)/(T2_+273)))) # irreversibility rate
print "\n The irreversibility rate at lower temperature is ",I_ ," kW"
#The answers vary due to round off error
 Example 8.9

 The irreversibility rate is  15.8201795694  kW

 The irreversibility rate at lower temperature is  3.03317755354  kW

Ex8.10:pg-261

In [5]:
import math
m = 3 # Mass flow rate in kg/s
R = 0.287 # Gas constant
T0 = 300 # Ambient temperature in K
k = 0.10 # Fractional pressure drop
print "\n Example 8.10"
Sgen = m*R*k # Entropy generation
I = Sgen*T0 # Irreversibility Calculation
print "\n The rate of energy loss because of the pressure drop due to friction ",I ," kW"
 Example 8.10

 The rate of energy loss because of the pressure drop due to friction  25.83  kW

Ex8.11:pg-261

In [6]:
import math
m1 = 2.0 # Flow rate of water in kg/s
m2 = 1.0 # Flow rate of another stream in kg/s
T1 = 90.0 # Temperature of water in degree Celsius
T2 = 30.0# Temperature of another stream in degree Celsius
T0 =300.0 # Ambient temperature in K
cp = 4.187 # Specific heat capacity of water in kJ/kgK

print "\n Example 8.11"
m = m1+m2 # Net mass flow rate
x = m1/m # mass fraction
t = (T2+273)/(T1+273) # Temperature ratio
Sgen = m*cp*math.log((x+t*(1-x))/(t**(1-x))) # Entropy generation
I = T0*Sgen # Irreversibility production
# Alternatively
T  = (m1*T1+m2*T2)/(m1+m2) # equilibrium temperature
Sgen1 = m1*cp*math.log((T+273)/(T1+273))+m2*cp*math.log((T+273)/(T2+273))# Entropy generation
I1 = T0*Sgen1 # Irreversibility production
print "\n The rate of entropy generation is ",Sgen ," kW/K"
print "\n The rate of energy loss due to mixing is ",I ," kW"
print "\n The rate of energy loss due to mixing is ",I1 ," kW" # Calculation from alternative way
#The answers vary due to round off error
 Example 8.11

 The rate of entropy generation is  0.0446035560498  kW/K

 The rate of energy loss due to mixing is  13.3810668149  kW

 The rate of energy loss due to mixing is  13.3810668149  kW

Ex8.12:pg-262

In [7]:
import math
Qr = 500.0 # Heat release in kW
Tr = 2000.0 # Fuel burning temperature in K 
T0 = 300.0 # Ambient temperature in K
# Part (a)
print "\n Example 8.12"
Qa = 480.0 # Energy absorption by furnace in kW
Ta = 1000.0 # Furnace temperature in K 
n1a = (Qa/Qr) # first law efficiency
n2a = n1a*(1.0-(T0/Ta))/(1.0-(T0/Tr)) #second law efficiency

#The answers vary due to round off error
print " \n\n PART (A)"
print "\n The first law efficiency is ",n1a*100 ," percent" 
print "\n The second law efficiency is ",n2a*100 ," percent"

# Part (b)
Qb = 450.0 # Energy absorption in steam generation in kW
Tb = 500.0# steam generation temperature in K 
n1b = (Qb/Qr)# first law efficiency
n2b = n1b*(1.0-(T0/Tb))/(1.0-(T0/Tr))#second law efficiency
print " \n\n PART (B)"
print "\n The first law efficiency is ",n1b*100 ," percent" 
print "\n The second law efficiency is ",n2b*100 ," percent"
# Part (c)
Qc = 300.0 # Energy absorption in chemical process in kW
Tc = 320.0 # chemical process temperature in K 
n1c = (Qc/Qr) # first law efficiency
n2c = n1c*(1.0-(T0/Tc))/(1.0-(T0/Tr))#second law efficiency
print " \n\n PART (C)"
print "\n The first law efficiency is ",n1c*100 ," percent"
print "\n The second law efficiency is ",n2c*100 ,"  percent" 
# Part (d)
Qd = 450.0 
n1d = (Qd/Qr)
n2a_= n1d*(1.0-(T0/Ta))/(1.0-(T0/Tr))
n2b_= n1d*(1.0-(T0/Tb))/(1.0-(T0/Tr))
n2c_= n1d*(1.0-(T0/Tc))/(1.0-(T0/Tr))
print " \n\n PART (D)"
print "\n The First law efficiency for all the three cases would remain same and here is ",n1d*100 ," percent" #The answer provided in the textbook is wrong

print "\n The Second law efficiency of part (a) is ",n2a_*100 ," percent"

print "\n The Second law efficiency of part (b) is ",n2b_*100 ," percent"

print "\n The Second law efficiency of part (c) is ",n2c_*100 ," percent"
 Example 8.12
 

 PART (A)

 The first law efficiency is  96.0  percent

 The second law efficiency is  79.0588235294  percent
 

 PART (B)

 The first law efficiency is  90.0  percent

 The second law efficiency is  42.3529411765  percent
 

 PART (C)

 The first law efficiency is  60.0  percent

 The second law efficiency is  4.41176470588   percent
 

 PART (D)

 The First law efficiency for all the three cases would remain same and here is  90.0  percent

 The Second law efficiency of part (a) is  74.1176470588  percent

 The Second law efficiency of part (b) is  42.3529411765  percent

 The Second law efficiency of part (c) is  6.61764705882  percent

Ex8.14:pg-265

In [8]:
import math
cp = 1.005 # Specific heat capacity of air in kJ/kgK 
T2 = 160.0 # Compressed air temperature in degree Celsius
T1 = 25.0 # Ambient temperature
T0 = 25.0 # Ambient temperature
R = 0.287 # Gas constant
P2 = 8.0 # Pressure ratio
P1 = 1.0 # Initial pressure of gas in bar
Q = -100.0 # Heat loss to surrounding in kW
m = 1.0 # Mass flow rate in kg/s

print "\n Example 8.14"
W = Q + m*cp*((T1+273)-(T2+273)) # power input
AF = cp*((T2+273)- (T1+273))-(T0+273)*((cp*math.log((T2+273)/(T1+273))-(R*math.log(P2/P1))))  # Availability
e = AF/-W # efficiency 
print "\n The power input is ",W ," kW"
print " \n The second law efficiency of the compressor is ",e*100 ," percent"
#The answers vary due to round off error
 Example 8.14

 The power input is  -235.675  kW
 
 The second law efficiency of the compressor is  85.5494233193  percent

Ex8.15:pg-265

In [9]:
import math
# Since vacuum has zero mass
U = 0 # Initial internal energy in kJ/kg
H0 = 0 # Initial enthalpy in kJ/kg
S = 0 # Initial entropy in kJ/kgK
# If the vacuum has reduced to dead state
U0 = 0 # Final internal energy in kJ/kg
H0 = 0  # Final enthalpy in kJ/kg
S0 = 0 # Final entropy in kJ/kgK
V0 = 0 # Final volume in m**3
P0 = 1.0 # Pressure in bar
V = 1.0 # Volume of space in m**3
fi = P0*1e5*V

print "\n Example 8.15"
print "\n The exergy of the complete vacuum is ",fi/1e3 ," kJ"
 Example 8.15

 The exergy of the complete vacuum is  100.0  kJ

Ex8.16:pg-266

In [10]:
import math
m = 1000.0 # Mass of fish in kg 
T0 = 300.0 # Ambient temperature in K
P0 = 1.0 # Ambient pressure in bar
T1 = 300.0 # Initial temperature of fish in K
T2_ = -20.0 # Final temperature of fish in degree Celsius
Tf_ = -2.2 # Freezing point temperature of fish in degree Celsius
Cb = 1.7 # Specific heat of fish below freezing point in kJ/kg
Ca = 3.2 # Specific heat of fish above freezing point in kJ/kg
Lh = 235.0 # Latent heat of fusion of fish in kJ/kg 

print "\n Example 8.16"
T2 = T2_+273 # Final temperature of fish in K
Tf = Tf_+273 # Freezing point temperature of fish in K
H12 = m*((Cb*(Tf-T2))+Lh+(Ca*(T1-Tf))) # Enthalpy change 
H21 = -H12 # Enthalpy change 
S12 = m*((Cb*math.log(Tf/T2))+(Lh/Tf)+(Ca*math.log(T1/Tf))) # Entropy change
S21 = -S12 # Entropy change
E = H21-T0*S21 #Exergy produced
print "\n Exergy produced is ",E/1e3 ," MJ or ",E/3600 ," kWh"
#The answers vary due to round off error
 Example 8.16

 Exergy produced is  34.6210270729  MJ or  9.61695196469  kWh

Ex8.17:pg-267

In [11]:
import math
cv = 0.718 # Specific heat capacity of air in kJ/kg
T2 = 500.0 # Final temperature of air in K
T1 = 300.0# Initial temperature of air in K
m = 1.0 # Mass of air in kg
T0 = 300.0 # Ambient temperature
# Case (a)
print "\n Example 8.17"
Sua = cv*math.log(T2/T1) # Entropy change of universe
Ia = T0*Sua # irreversibility
print "\n The irreversibility in case a is ",Ia ," kJ/kg"

# Case (b)
Q = m*cv*(T2-T1) # Heat transfer
T = 600 # Temperature of thermal reservoir in K
Sub = Sua-(Q/T) # Entropy change of universe
Ib = T0*Sub # irreversibility
print "\n The irreversibility in case b is ",Ib ," kJ/kg"
#The answers vary due to round off error
 Example 8.17

 The irreversibility in case a is  110.031839359  kJ/kg

 The irreversibility in case b is  38.2318393592  kJ/kg

Ex8.18:pg-268

In [12]:
import math
h1 = 3230.9 # Enthalpy of steam at turbine inlet in kJ/kg
s1 = 6.69212# Entropy of steam at turbine inlet in kJ/kgK 
V1 = 160.0 # Velocity of steam at turbine inlet in m/s
T1 = 400.0 # Temperature of steam at turbine inlet in degree Celsius
h2 = 2676.1 # Enthalpy of steam at turbine exit in kJ/kg
s2 = 7.3549 # Entropy of steam at turbine exit in kJ/kgK 
V2 = 100.0 # Velocity of steam at turbine exit in m/s
T2 = 100.0 # Temperature of steam at turbine exit in degree Celsius
T0 = 298.0 # Ambient temperature in K
W = 540.0 # Work developed by turbine in kW
Tb = 500.0 # Average outer surface temperature of turbine in K

print "\n Example 8.18"
Q = (h1-h2)+((V1**2-V2**2)/2)*1e-03-W # Heat loss
I = 151.84-Q*(0.404) # Irreversibility 
AF = W + Q*(1.0-(T0/Tb)) + I # Exergy transfer
n2 = W/AF # second law efficiency

print "\n Irreversibility per unit mass is ",I ," kJ/kg"
print "\n The second law efficiency of the turbine is ",n2*100 ," percent"
 Example 8.18

 Irreversibility per unit mass is  142.7096  kJ/kg

 The second law efficiency of the turbine is  78.0527289547  percent

Ex8.19:pg-269

In [13]:
import math
T0 = 300.0 # Ambient temperature in K
T = 1500.0 # Resistor temperature in K
Q = -8.5 # Power supply in kW
 
# Case (a)
W = -Q # work transfer
I = Q*(1.0-T0/T) + W # Irreversibility
R = Q*(1.0-T0/T) # availability

print "\n Example 8.19"
print "\n Case A:"
print "\n Rate of availability transfer with heat and the irreversibility rate are \n  ",I ," kW and ",R ," kW respectively."
# Case (b)
T1 = 500.0 # Furnace wall temperature
Ib = - Q*(1.0-T0/T) + Q*(1.0-T0/T1) # Irreversibility
print "\n Case B:"
print "\n Rate of availability in case b is ",Ib ," kW "
 Example 8.19

 Case A:

 Rate of availability transfer with heat and the irreversibility rate are 
   1.7  kW and  -6.8  kW respectively.

 Case B:

 Rate of availability in case b is  3.4  kW 

Ex8.20:pg-270

In [32]:
import math
p1 = 1 # Air pressure at compressure inlet in bar
t1 = 30 # Air temperature at compressure inlet in degree Celsius
p2 = 3.5 # Air pressure at compressure exit in bar
t2 = 141 # Air temperature at compressure exit in degree Celsius
v = 90 # Air velocity at compressure exit in m/s
cp = 1.0035 # Specific heat capacity of air in kJ/kg
y = 1.4 # Heat capacity ratio
R = 0.287 # Gas constant
print "\n Example 8.20\n"
T2s = (t1+273)*(p2/p1)**((y-1)/y)
if T2s>(t2+273): 
    print "\n Part A:"
    print "\n There is heat loss to surrounding."
n =(1/(1-((math.log((t2+273)/(t1+273)))/(math.log(p2/p1)))))
print "\n\n Part B:"
print "\n The polytropic index is ",n
Wa = cp*(t1-t2)-(v**2)/2000 # Actual work 
Wt = -R*(t1+273)*math.log(p2/p1) - (v**2)/2000 # Isothermal work
nt =Wt/Wa # Isothermal efficency
print "\n\n Part C:"
print "\n Isothermal efficiency is ",nt*100 ," percent "
df = cp*(t1-t2) + (t1+273)*(R*math.log(p2/p1) - cp*math.log((t2+273)/(t1+273))) -(v**2)/2000
Wm = df # Minimum work input
I = Wm-Wa # Irreversibility

print "\n\n Part D:"
print "\n The minimum work input is ",Wm," kJ/kg, and irreversibility is ",I ," kJ/kg"
# The answers given in the book contain round off error

neta = Wm/Wa
print "\n\n Part E:"
print "\n Second law efficiency is ",math. ceil(neta*100) ," percent"
 Example 8.20


 Part A:

 There is heat loss to surrounding.


 Part B:

 The polytropic index is  1.0


 Part C:

 Isothermal efficiency is  97.8793558312  percent 


 Part D:

 The minimum work input is  -6.44697949667  kJ/kg, and irreversibility is  108.941520503  kJ/kg


 Part E:

 Second law efficiency is  6.0  percent