Chapter 4: Second Law of Thermodynamics

Example 2, page no. 114

In [2]:
#Variable Declaration: 
T1 = 400+273.0 #Highest temperature(in K):
T2 = 15+273.0 #Lowest temperature(in K):
w = 200  #Work produced(in kJ):

#Calculation:
Q1 = w/(1-T2/T1) #Heat to be supplied(in kJ): #Ratio of Q1 to Q2 is same as T1 to T2
#Results:
print "Heat to be supplied: ",round(Q1,1),"KJ"
Heat to be supplied:  349.6 KJ

Example 3, page no. 115

In [1]:
 

#Variable Declaration: 
T1 = 42+273.0 #Upper temperature(in K):
T2 = 4+273.0 #Lower temperature(in K):
Q2 = 2.0 #Rate at which heat is extracted(in kJ/s):

#Calculation:
Q1 = T1/T2*Q2 #Heat to be supplied(in kJ/s):
P = Q1-Q2 #Power required(in kW):

#Results:
print "Power required for driving the refrigerator: ",round(P,3),"KW"
Power required for driving the refrigerator:  0.274 KW

Example 4, page no. 115

In [2]:
  
#Variable Declaration: 
T1 = 827+273.0 #Source temperature(in K):
T2 = 27+273.0 #Sink temperature(in K):
T3 = -13+273.0 #Temperature in the refrigerator(in K):
Q1 = 2000.0 #Heat input(in kJ):
W = 300.0 #Net work available(in kJ):

#Calculation:
Q2 = Q1*T2/T1 #Rate at which heat is extracted(in kJ):
We = Q1-Q2 #Work in the engine(in kJ):
Wr = We-W #Work in the refrigerator(in kJ):
Q3 = Wr/(T2/T3-1) #Heat transferred to the refrigerant(in kJ):
Q4 = Q3+Wr #Heat transferred to reservoir by refrigerant(in kJ):
Wt = Q2+Q4 #Total heat transferred to low temperature reservoir(in kJ):

#Results:
print "Heat transferred to refrigerant: ",round(Q3,2),"KJ"
print "Total heat transferred to low temperature reservoir: ",round(Wt,2),"KJ"
Heat transferred to refrigerant:  7504.55 KJ
Total heat transferred to low temperature reservoir:  9204.55 KJ

Example 5, page no. 116

In [3]:
#Variable Declaration: 
T1 = 25+273.15 #Temperature inside the house(in K):
T2 = -1+273.15 #Temperature outside the house(in K):
Q1 = 125.0 #Heating load(in MJ/h):

#Calculation:
COP = 1/(1-T2/T1) #COP:
W = Q1/COP #Minimum power required(in MJ/h):

#Results:
print "Minimum power required: ",round(W,2), "MJ/h"
print "Minimum power required: ",round(W*10**3/3600,2), "KW"
Minimum power required:  10.9 MJ/h
Minimum power required:  3.03 KW

Example 6, page no. 117

In [4]:
#Variable Declaration: 
T1 = -15+273.16 #Inside temperature(in K):
T2 = 35+273 #Atmospheric temperature(in K):
Q2 = 140.8 #Heat to be extracted (in kW):

#Calculation:
COP1 = 1/(T2/T1-1) #Carnot COP of plant:
COP = COP1/4 #Actual COP:
W = Q2/COP #Power required(in kW):

#Results:
print "Power required: ",round(W,2),"KW"
Power required:  108.73 KW

Example 7, page no. 117

In [5]:
#Variable Declaration: 
T1 = 1150+273.0 #Maximum temperature(in K):
T2 = 27+273.0 #Minimum temperature(in K):

#Calculation:
n = 1-(T2/T1) #Efficiency:

#Results:
print "Efficiency: ",round(n*100,2),"%"
Efficiency:  78.92 %

Example 8, page no. 117

In [6]:
#Variable Declaration: 
T1 = 27+273 #Maximum temperature(in K):
T2 = -8+273 #Minimum temperature(in K):
Q = 7.5/60 #Leakage(in kJ/s):

#Calculation:
W = (T1-T2)*Q/T2 #Power required(in kW):

#Results:
print "Power required: "  ,round(W,4),"KW"
Power required:  0.0165 KW

Example 9, page no. 118

In [1]:
from sympy import *
from sympy import symbols,simplify,numer,denom,collect,Wild
from sympy.solvers import solve

#Variable Declaration:
Tso = 1100                                       #Temperature of Source (K):
Ts = 300                                         #Temperature of Sink (K):
W1,Q1,T1,W2,Q2,T2,W3,Q3,T3 = symbols('W1,Q1,T1,W2,Q2,T2,W3,Q3,T3')      #Creating symbolic Variables required:
p = Wild('p')
q = Wild('q')

#Calculations:
HE1 = 1-T2/Tso                                  #Engine 1 Efficiency:
Q1 = W1/HE1
Q2 = Q1 - W1       #Energy balance equation:
#W2byW1 = simplify((Q2*(1-(T3/T2)))/W1)
W2byW1 = (T2-T3)/(1100-T2)
EQ1 = 3*numer(W2byW1)-2*denom(W2byW1)           #Creating EQ1 using above symbolic manipulation and given W1:W2 ratio of 3:2
HE2 = simplify(1 - T3/T2)                       #Engine 2 Efficiency:
Q2 = W2 + Q3             #Energy balance equation:


expr = W2*denom(HE2)-Q2*numer(HE2)
a = collect(simplify(expr),[W2,Q3]).match(-p*Q3+q)

Q3 = a[q]/a[p]
HE3 = simplify(1-Ts/T3)
#W3byW2 = HE3*Q3/W2
W3byW2 = (T3/(T2-T3))*((T3-300)/T3)
EQ2 = 2*numer(W3byW2)-1*denom(W3byW2)           #Creating EQ1 using above symbolic manipulation and given W2:W3 ratio of 2:1
Sol = solve([EQ1,EQ2],[T2,T3])                  #Solving the two generated symbolic equations:

#Results:
print "Intermediate Temperature, T2: ",Sol[T2],"K"
print "Intermediate Temperature, T3: ",round(Sol[T3],2),"K"
Intermediate Temperature, T2:  700 K
Intermediate Temperature, T3:  433.33 K

Example 10, page no. 119

In [9]:
#Variable Declaration: 
T1 = 800.0 #Temperature at which heat is receieved (in K):
T2 = 280.0 #Temperature maintained by the carnot engine(in K):

#Calculation:
T = 2*T1*T2/(T1+T2) #Temperature at which heat is rejected(in K):
n = (T1-T)/T1 #Efficiency:
COP = T2/(T-T2) #COP of refrigerator:

#Results:
print "Efficiency: ",round(n,4)
print "COP of refrigerator: " ,round(COP,3)
 Efficiency:  0.4815
COP of refrigerator:  2.077

Example 11, page no. 120

In [10]:
import math
#Variable Declaration: 
n = 0.5 #Efficiency of carnot cycle:
m = 0.5 #Mass of air(in kg):
p2 = 7*10**5 #Initial pressure(in Pa):
v2 = 0.12 #Initial volume(in m**3):
Q23 = 40 #Heat transferred during the process 2-3(in kJ):
Cp = 1.008 #Specific heat at const pressure(in kJ/kg):
Cv = 0.721 #Specific heat at const volume(in kJ/kg):
Ra = 287 #Gas constant for air:
Q12 = 0 #Heat transfer in process 1-2(in kJ):
Q34 = 0 #Heat transfer in process 3-4(in kJ):

#Calculation:
T2 = p2*v2/(m*Ra)   #Maximum temperature of the cycle(in K):
T1 = T2/2  #Minimum temperature(in K):
v3 = v2*(math.e**(Q23/(m*Ra*10**(-3)*T2)))  #Volume at state 3(in m**3):
r = Cp/Cv  #Compression factor:
p1 = p2/((T2/T1)**(r/(r-1)))   #Pressure at point 1(in Pa):
v1 = m*Ra*T1/p1    #Volume at point 1(in m**3):
T3 = T2        #Temperature at state 3(in K):
T4 = T1   #Temperature at state 4(in K):
W12 = -m*Cv*(T2-T1)  #During process 1-2, work done(in kJ):
W23 = Q23 #Work done in process 2-3(in kJ):
W34 = -m*Cv*(T4-T3)  #During process 3-4, work done(in kJ):
W41 = -W23  #During process 4-1, work done(in kJ):
Q41 = -Q23 #Heat transfer in process 4-1(in kJ):

#Results:
print "Process    Heat transfer    Work interaction"
print "  1-2           ",Q12,"KJ        ",round(W12,2)
print "  2-3           ",Q23,"KJ        ",W23
print "  3-4           ",Q34,"KJ        ",round(W34,2)
print "  4-1          ",Q41,"KJ       ",W41
print "Maximum temperature of the cycle: ",round(T2,2),"KJ"
print "Minimum temperature of the cycle: ",round(T1,2),"KJ"
print "Volume at the end of the expansion:",round(v3,4),"m**3"
Process    Heat transfer    Work interaction
  1-2            0 KJ         -105.51
  2-3            40 KJ         40
  3-4            0 KJ         105.51
  4-1           -40 KJ        -40
Maximum temperature of the cycle:  585.37 KJ
Minimum temperature of the cycle:  292.68 KJ
Volume at the end of the expansion: 0.1932 m**3

Example 12, page no. 122

In [11]:
#Variable Declaration: 
Q1 = 5000 #Heat drawn from 400 K reservoir(in kJ):
W = 840        #Work output(in kJ):

#Calculation:
Q2 = 3*(Q1/2-W) #Value of heat from heat engine(in kJ):
Q3 = Q1-W-Q2 #Value of heat to heat engine(in kJ):

#Results:
print "Q2 =",Q2,"kJ from heat engine"
print "Q3 =",-Q3,"kJ to heat engine"
Q2 = 4980 kJ from heat engine
Q3 = 820 kJ to heat engine

Example 13, page no. 123

In [12]:
#Variable Declaration: 
T3 = 3+273 #Temperature of the reservoir(in K):
T1 = 77+273 #Lower temperature limit(in K):
T2 = 1077+273 #Higher temperature limit(in K):
E = 100         #Energy supplied to the reservoir(in kJ/s):

#Calculation:
n = 1-T1/T2 #Efficiency:
Q1 = 26.71 #Solving all the equations, we get: #It is given that Q2+Q4 = E #We get Q4 = 1.27*Q3		
#COP for heat pump  =  Q4/(Q4-Q3)  =  T1/(T1-T3)				#We get Q2 = 0.2593*Q1				#n = 1-Q2/Q1				
#Energy taken from the reservoir Q1 can be found by solving the simultaneous equations

#Results:
print "Energy taken from reservoir at 1077ºC: ",round(Q1,2),"KJ"				#Results: 
Energy taken from reservoir at 1077ºC:  26.71 KJ

Example 14, page no. 124

In [13]:
#Variable Declaration: 
Qs = 2000.0 #Heat supplied(in kJ/s):
Tso = 1500 #Temperature of source(in K):
Tr = 15+273 #Temperature at which heat is rejected(in K):
Qt = 3000 #Total heat received(in kJ/s):

#Calculation:
Qr = Qt-Qs #Heat rejected(in kJ/s):
Ts = Qt/(Qs/Tso+Qr/Tr) #Temperature of the sink(in K):

#Results: 
print "Temperature of the sink: ",round(Ts,2),"K" 
Temperature of the sink:  624.28 K

Example 15, page no. 124

In [14]:
 
#Variable Declaration: 
T1 = 500+273.0 #Maximum temperature(in K):
T2 = 200+273.0 #Minimum temperature(in K):
T3 = 450+273.0 #Temperature of the body(in K):

#Calculation:
n = 1-T2/T1 #Efficiency:
r1 = n  #Ratio of W to Q1:
COP = T3/(T3-T2) #COP of pump:
r2 = COP*2/3 #Ratio of Q3 to W:
r3 = r1*r2 #Ratio of Q3 to Q1:

#Results:
print "Ratio of heat rejected to body at 450C to the heat supplied by the reservoir: ",round(r3,4)
Ratio of heat rejected to body at 450C to the heat supplied by the reservoir:  0.7483

Example 17, page no. 126

In [11]:
from sympy import *

#Variable Declaration:
W,Q1,Q2,Q3,T1,T2,T3 = symbols('W,Q1,Q2,Q3,T1,T2,T3')        #Creating symbolic variables:

#Calculations:
n = 1 - T3/T1                                               #Efficiency of heat engine:
COP = T2/(T3-T2)                                            #COP of refrigerator:
r = 1/(n*COP)                                               #Ratio of Q1:Q3 :

#Results:
print "Ratio of heat supplied from source to heat absorbed from cold body: ",(simplify(r))
Ratio of heat supplied from source to heat absorbed from cold body:  -T1*(T2 - T3)/(T2*(T1 - T3))

Example 18, page no. 127

In [17]:
#Variable Declaration: 
T1 = 900+273.0 #Maximum temperature(in K):
T2 = 50+273.0 #Minimum temperature(in K):
T3 = 50+273.0 #Temperature of the 3rd reservoir(in K):
T4 = 10+273.0 #Temperature of the 4th reservoir(in K):
Q3 = 15.0   #Heat picked up by Carnot cycle(in kW):
E = 25.0  #Energy required to run a machine(in kW):

#Calculation:
n = 1-T2/T1 #Efficiency:
Q4 = Q3*T3/T4 #From the relation of COP:
Whp = Q4-Q3 #Work by heat pump(in kW):
Whe = Whp+E #Work in the heat engine(in kW):
Q1 = Whe/n #Heat from source at 1173 K(in kW):
Q2 = Q1-Whe #Heat rejected to the reservoir from engine 1(in kW):
Qt = Q2+Q4 #Total heat rejected to the reservoir(in kW):

#Results:
print "Heat rejected to the reservoir: ",round(Qt,3),"KW" 
print "Heat received from the highest temperature reservoir: ",round(Q1,3),"KW"
Heat rejected to the reservoir:  27.426 KW
Heat received from the highest temperature reservoir:  37.426 KW

Example 19, page no. 128

In [18]:
 

#Variable Declaration: 
v1 = 1.8 #Volume of 1st tank(in m**3):
v2 = 3.6 #Volume of 2nd tank(in m**3):
p1 = 12  #Initial pressure(in bar):
T1 = 40+273 #Initial temperature(in K):
R = 0.208 #Gas constant for argon(in kJ/kg.K):

#Calculation:
pf = p1*v1/(v1+v2) #By gas law for final and initial state:

#Results:
print "Final pressure: ",round(pf),"bar"
Final pressure:  4.0 bar