Chapter 7 : Thermodynamic property relations of pure substance

Example 7.6 Page Number : 241

In [1]:
 
import math 


# Variables
P_1 = 1;			#[MPa] - Initial pressure
P_2 = 1.4;			#[MPa] - Final pressure

# Calculations
			#We know that
			# dS = (Cp/T)*dT - (dV/dT)*dP
			# Along an isothermal path,integration of above expression between states 1 and 2 yields
			# S_2 - S_1 = - integral((dV/dT)*dP)_P
			# An estimate can be made by assuming that (dV/dT)_P  remains constant over the range of pressure from P_1 to P_2 and evaluating the derivative at average pressure of 1.2 MPa
P_avg = P_2;
			# S_2 - S_1 = -integral((dV/dT)*dP)_Pavg*(P_2 - P_1)
			# (dV/dT)_P=1.2MPa = ((V_350 - V_250)/(350 - 250))
dV_dT = (0.2345 - 0.19234)/100;			#[m**(3)/kg-K]
			#Therefore
delta_S = -dV_dT*(P_2 - P_1)*1000;			#[kJ/kg-K] - Entropy change

# Results
print "The change in entropy is given by S_2-S_1 = %f kJ/kg-K"%(delta_S);

			#Let us compare this tabulated values. At 1MPA and 300 C, S_1 = 7.1229 kJ/kg-K. At 1.4 MPa and 300 C, S_2 = 6.9534 kJ/kg-K. 
			#Therefore  S_2 - S_1 = -0.1695 kJ/kg-K
The change in entropy is given by S_2-S_1 = -0.168640 kJ/kg-K

Example 7.7 Page Number : 241

In [2]:
 
import math 
from scipy.integrate import quad 
			
# Variables
T = 25. + 273.15;			#[K] - Temperature of the surrounding
P_1 = 1.;			#[atm] - Initial pressure
P_2 = 1000.;			#[atm] - Final pressure

# Calculations and Results
			# V = 18.066 - 7.15*10**(-4)*P + 4.6*10**(-8)*P**(2)    where, V is in 'cm**(3)/mol' and P is in 'atm
			# (dV/dT)_P = 0.0045 + 1.4*10**(-6)*P    ;			#cm**(3)/mol-K

			# The work done by 1 mol is given by W = integral(P*dV)
			# Differentiating both sides of the expression for V, we get
			# dV = -7.15*10**(-4)*dP + 9.2*10**(-8)*(P*dP) 
			# P*dV = -7.15*10**(-4)*P*dP + 9.2*10**(-8)*(P**(2)*dP)

			# The work done is given by

def f58(P): 
	 return -7.15*10**(-4)*P + 9.2*10**(-8)*(P**(2))

W =  quad(f58,P_1,P_2)[0];			#[atm-cm**(3)[0]

W = W*101325*10**(-6);			#[J/mol]

print "The necessary work to compress water from 1 atm to 1000 atm is  %f J/mol"%(W);

			#Let us calculate the amount of heat transfer
			# q = integral(T*dS)
			# dS = ((ds/dT)_P)*dT + ((dS/dP)_T)*dP
			# Since the temperature is constant the first term is zero and
			# dS = ((dS/dP)_T)*dP = -((dV/dT)_P)*dP
			# Thus, q = integral(T*dS) = T*(integral(dS))     ( as temperature is constant )
			# or, q = -T*(integral((dV/dT)_P)*dP)

			# Thus the heat transfer is given by

def f59(P): 
	 return 0.0045+1.4*10**(-6)*P

q = -T* quad(f59,P_1,P_2)[0];			#[atm-cm**(3)[0]

q = q*101325*10**(-6);			#[J/mol]

			# q - W = delta_U
			# Thus delta_U is given by
delta_U = q - W;			#[J/mol]

print "The change in internal energy is  %f J/mol"%(delta_U);
The necessary work to compress water from 1 atm to 1000 atm is  -33.116351 J/mol
The change in internal energy is  -123.839936 J/mol

Example 7.12 Page Number : 247

In [3]:
 
from scipy.optimize import fsolve 


# Variables
T = 25+273.15;			#[K] - Temperature
P = 1;			#[atm] - Pressure
P = P*101325;			#[Pa]
Tc = 126.2;			#[K] - Critical temperature
Pc = 34;			#[bar] - Critical pressure
Pc = Pc*10**(5);			#[Pa]
R=8.314;			#[J/mol*K] - Universal gas constant

a = (27*R**(2)*Tc**(2)/(64*Pc));			#[Pa-m**(6)/mol**(2)]
b = (R*Tc)/(8*Pc);			#[m**(3)/mol]


# Calculations and Results
			# the cubic form of van der Walls equation of state is
			# V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P=0
			#Solving the cubic equation
def f(V): 
	 return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P
V = fsolve(f,1)
			#The above equation has 1 real and 2 imaginary roots. We consider only real root.

Beta = R/((P*V)-(a/V)+((2*a*b)/V**(2)));			#[K**(-1)]

K_t = (V-b)/((P*V)-(a/V)+((2*a*b)/V**(2)));			#[Pa**(-1)]
K_t = K_t*101325;			#[atm**(-1)]

print " Beta\t = \t %f K**-1)"%(Beta);
print " K_t\t = \t %f atm**-1)"%(K_t);

			#For ideal gas, Beta = 1/T = 0.0033354 K**(-1)    and K_t = 1/P = 1 atm**(-1)
			# So results obtained are convergent with those obtained assuming ideal gas.
 Beta	 = 	 0.003364 K**-1)
 K_t	 = 	 1.000672 atm**-1)

Example 7.13 Page Number : 248

In [4]:
 
T = 45+273.15;			#[K]
P_1 = 10;			#[kPa] - Initial pressure
P_2 = 8600;			#[kPa] - Final pressure
V = 1010;			#[cm**(3)/kg] - Specific volume for saturated liquid water at 45 C
V = V*10**(-6);			#[m**(3)/kg]
			# Beta = (1/V)*(dV/dT)_P
Beta = 4.25*10**(-4);			#[k**(-1)]
Cp = 4.178;			#[kJ/kg-K] - Specific heat at constant pressure
eff = 0.75;			# Efficiency of the pump

# Calculations and Results
			#(1)
			#when efficiency of the pump is 100% ,  W = -delta_Hs
			# Now delta_H = T*dS + V*dP, therefore under isentropic conditions, dH = V*dP
			# delta_Hs = V*dP
delta_Hs = V*(P_2 - P_1);			#[kJ/kg]

			#Actual pumps are not isentropic and therefore not 100% efficient. Therefore actual work done by the pump is given by
W = -delta_Hs/eff;			#[kJ/kg]

print " 1).The work done by the pump is %f kJ/kg"%(W);

			#(2)
			# We know that dH = Cp*dT + (1 - Beta*T)*V*dP
			# Integrating the above equation we get
			# delta_H = Cp*delta_T + (1 - Beta*T)*V*(delta_P)
			# Now from energy balance delta_H = q - W . But q = 0. Therefore,
delta_H = -W;			#[kJ/kg]
			# Solving for delta_T
delta_T = (delta_H - (1 - Beta*T)*V*(P_2-P_1))/Cp;

print " 2).The temperature of water change by  delta_T = %f K"%(delta_T);

			#(3)
T_1 = T;			#[K]
T_2 = T + delta_T;			#[K]
			# dS = (Cp/T)*dT - Beta*V*dP
			# Beta and V are weak functions of pressure in the case of liquids. Integrating the above equation we get
delta_S = Cp*math.log(T_2/T_1) - Beta*V*(P_2-P_1);			#[kJ/kg-K]

print " 3).The entropy change of water is given by delta_S = %f kJ/kg-K"%(delta_S);
 1).The work done by the pump is -11.567867 kJ/kg
 2).The temperature of water change by  delta_T = 0.972970 K
 3).The entropy change of water is given by delta_S = 0.009070 kJ/kg-K

Example 7.14 Page Number : 249

In [5]:
 
T = 270;			#[K]
P_1 = 381;			#[kPa] - Initial pressure
P_2 = 1200;			#[kPa] - Final pressure
V_liq = 1.55*10**(-3);			#[m**(3)/kg] - Specific volume for saturated water in liquid phase at 270 C
Beta = 2.095*10**(-3);			#[K**(-1)]

# Calculations and Results
			#dH = Cp*dT + [V - T*(dV/dT)_P]*dP
			# dS = (Cp/T)*dT - ((dV/dT)_P)*dP
			# dH = [V - T*(dV/dT)_P]*dP = V*(1 - Beta*T)*dP
			# For the liquid assuming V and Beta to remain constant during pressure change, and since temperature is constant we get
delta_H = V_liq*(1 - Beta*T)*(P_2 - P_1);			#[kJ/kg]

print "The enthalpy change is given by delta_H = %f kJ/kg"%(delta_H);

			# Under isothermal conditions 
			# dS = -((dV/dT)_P)*dP = -Beta*V_liq*dP
			# If Beta*V is assumed to remain constant during pressure change we get
delta_S = -Beta*V_liq*(P_2-P_1);			#[kJ/kg-K]

print "The entropy change is given by delta_S = %e kJ/kg-K"%(delta_S);
The enthalpy change is given by delta_H = 0.551386 kJ/kg
The entropy change is given by delta_S = -2.659498e-03 kJ/kg-K

Example 7.15 Page Number : 249

In [6]:
 
# Variables
T_1 = 0;			#[C] - Initial tempetaure
T_2 = 100;			#[C] - Final temperature
			# Beta = 1.0414*10**(-3) + 1.5672*10**(-6)*T + 5.148*10**(-8)*T**(2),   where T is in C
			# At constant pressure  (1/V)*(dV/dT) = Beta
			# or, d(math.log(V)) = Beta*dT
			# Integrating  we get math.log(V_2/V_1) = integral(Beta*dT) from limit T_1 to T_2

# Calculations and Results
def f62(T): 
	 return 1.0414*10**(-3)+1.5672*10**(-6)*T+5.148*10**(-8)*T**(2)

integral =  quad(f62,T_1,T_2)[0]


			# math.log(V_2/V_1) = integral
			# (V_2/V_1) = exp(integral)
			# (V_2 - V_1)/V_1 = change = exp(integral) - 1;
change = math.exp(integral) - 1;
per_change = 100*change;

print "The percentage change in volume = %f %%"%(per_change);
The percentage change in volume = 13.784486 %

Example 7.16 Page Number : 250

In [7]:
 
T_1 = 25 + 273.15;			#[C] - Initial tempetaure
T_2 = 50 + 273.15;			#[C] - Final temperature
P_1 = 1;			#[bar] - Initial pressure
P_2 = 1000;			#[bar] - Final pressure

Cp_T1_P1 = 75.305;			#[J/mol-K]
Cp_T2_P1 = 75.314;			#[J/mol-K]
V_T1_P1 = 18.071;			#[cm**(3)/mol]
V_T1_P2 = 18.012;			#[cm**(3)/mol]
V_T2_P1 = 18.234;			#[cm**(3)/mol]
V_T2_P2 = 18.174;			#[cm**(3)/mol]
Beta_T1_P1 = 256*10**(-6);			#[K**(-1)]
Beta_T1_P2 = 366*10**(-6);			#[K**(-1)]
Beta_T2_P1 = 458*10**(-6);			#[K**(-1)]
Beta_T2_P2 = 568*10**(-6);			#[K**(-1)]

# Calculations and Results
			# The entropy change is given by
			# dS = (Cp/T)*dT - ((dV/dT)_P)*dP
			# The mean Cp between 25 and 50 C is 
Cp_mean = (Cp_T1_P1 + Cp_T1_P1)/2;			#[J/mol-K]


			# (dV/dT)_P=1bar = (V_T2_P1 - V_T1_P1)/(50 - 25)
dV_dT_P1 = ((V_T2_P1 - V_T1_P1)/(50 - 25))*10**(-6);			#[m**(-3)/mol-K]
dV_dT_P2 = ((V_T2_P2 - V_T1_P2)/(50 - 25))*10**(-6);			#[m**(-3)/mol-K]
			# The mean value of (dV/dT)_P between 1 and 1000 bar is
dV_dT_mean = (dV_dT_P1 + dV_dT_P2)/2;			#[m**(-3)/mol-K]
delta_S = Cp_mean*math.log(T_2/T_1) - dV_dT_mean*(P_2 - P_1)*10**(5);			#[J/mol-K]

print " The value of entropy change is given by  delta_S = %f J/mol-K"%(delta_S);

			# Now let us determine the enthalpy change. We know that
			# dH = Cp*dT + [V - T*(dV/dT)_P]*dP
			# [V - T*(dV/dT)_P] = (V - T*V*Beta) = val (say)
			# At state 1
val_1 = ((V_T1_P1)*10**(-6))*(1 - (T_1)*(Beta_T1_P1));			#[m**(3)/mol]
			# At state 2
val_2 = ((V_T2_P2)*10**(-6))*(1 - (T_2)*(Beta_T2_P2));			#[m**(3)/mol]
val_mean = (val_1 + val_2)/2;			#[m**(3)/mol]

delta_H = Cp_mean*(T_2 - T_1) + val_mean*(P_2-P_1)*10**(5);			#[J/mol]

print " The value of enthalpy change is given by  delta_H = %f J/mol"%(delta_H);
 The value of entropy change is given by  delta_S = 5.414201 J/mol-K
 The value of enthalpy change is given by  delta_H = 3457.542629 J/mol

Example 7.22 Page Number : 256

In [8]:
 
# Variables
T = 100 + 273.15;			#[K]
P = 10;			#[MPa]

# Calculations and Results
			# The volume expansivity is defined as 
			# Beta = (1/V)*(del V/del T)_P = (1/V)*(dV/dT)_P
			# From compressed liquid water tables at 100 C and 10 MPa,
V = 0.0010385;			#[m(3)/kg]
Beta = (1/V)*((0.0010549 - 0.0010245)/(120 - 80));			#[K**(-1)] 			# The values are obtained from the steam table as reported in the book.

print "The value of volume expansivity is  Beta = %e K**-1)"%(Beta);

			#Isothermal compressibility is defined as
			# K_t = -(1/V)*(del V/del T)_T = -(1/V)*(dV/dT)_T
K_t = -(1/V)*((0.0010361 - 0.0010410)/(15 - 5));			#[MPa**(-1)]  			# The values are obtained from the steam table as reported in the book.

K_t = K_t*10**(-3);			#[kPa]

print "The value of isothermal compressibility is  K_t = %e kPa**-1)"%(K_t);

			# Cp - Cv = (T*V*(Beta**(2)))/K_t
R = (T*V*(Beta**(2)))/K_t;			#[kJ/kg-K]

print "The value of the difference between Cp and Cv is  Cp-Cv = %f kJ/kg-K"%(R);
The value of volume expansivity is  Beta = 7.318247e-04 K**-1)
The value of isothermal compressibility is  K_t = 4.718344e-07 kPa**-1)
The value of the difference between Cp and Cv is  Cp-Cv = 0.439860 kJ/kg-K

Example 7.23 Page Number : 257

In [9]:
 
# Variables
T = 300 + 273.15;			#[K]
P = 4;			#[MPa] 

# Calculations and Results
Cp_0 = 7.7 + 0.04594*10**(-2)*T + 0.2521*10**(-5)*T**(2) - 0.8587*10**(-9)*T**(3);			#[cal/mol-K]
Cp_0 = (Cp_0*4.186)/18.015;			#[kJ/kg-K]

			# Cp(T,P) = Cp_0(T,P=0) - T*integral((del**2 V/del T**(2))_P)*dP from limit 0 to P
			# Cp = Cp_0 - T*((del**2 V/del T**2)_Pavg)*(P_2 - P_1)

P_avg = (0+4)/2;			#[MPa]

			#Using finite difference we get  (del**2 V/del T**(2)) = ((V_(T+delta T) - 2*V_T + V_(T-delta T))/(delta_T**(2))
			#(del**2 V/del T**(2))_Pavg = (V_(350 C) + V_(250 C) - 2*V_(300 C))/(delta_T**(2)) = del_2 (say)
del_2 = (0.13857 + 0.11144 - 2*0.12547)/(50**(2));			#[m**(3)/kg-K**2] 			# The values are obtained from the steam table as reported in the book.


Cp = Cp_0 - T*del_2*4000;			#[kJ/kg-K]

print " The value of constant pressure specific heat capacity is Cp = %f kJ/kg-K"%(Cp);

			# At P = 4 MPa
			# Cp = (del H/del T)_P = (H_350 C - H_250 C)/(350 - 250.4)
			# Cp = (3092.5 - 2801.4)/(350 - 250.4) = 2.923 [kJ/kg-K]
 The value of constant pressure specific heat capacity is Cp = 2.858079 kJ/kg-K

Example 7.24 Page Number : 257

In [10]:
 
T = 300 + 273.15;			#[K]
P = 2.0;			#[MPa]

			# At 2 MPa and 250 C 
H_1 = 2902.5;			#[kJ/kg]
			# At 2 MPa and 350 C 
H_2 = 3137.0;			#[kJ/kg]

# Calculations
Cp = (H_2 - H_1)/(350 - 250);			#[kJ/kg-K]

# Results
print " The value of constant pressure specific heat capacity is Cp = %f kJ/kg-K"%(Cp);
 The value of constant pressure specific heat capacity is Cp = 2.345000 kJ/kg-K

Example 7.25 Page Number : 258

In [2]:
 
T = 80 + 273.15;			#[K]
P = 10;			#[MPa] 

V_1 = 0.0010245;			#[m**(3)/kg]
			# At 60 C and 10 MPa
V_2 = 0.0010127;			#[m**(3)/kg]
			# At 100 C and 10 MPa
V_3 = 0.0010385;			#[m**(3)/kg]

# Calculations and Results
Beta = (1/V_1)*((V_3 - V_2)/(100 - 60));			#[K**(-1)]

print "The value of volume expansivity is  Beta = %e K**-1)"%(Beta);

			#Isothermal compressibility is given by
			# K_t = -(1/V)*(del V/del P)_T

			# Temperature is kept fixed at 80 C and different pressures are taken to calculate (del V/del P)_T
			# At 80 C and 5 MPa
V_4 = 0.0010268;			#[m**(3)/kg]
			# At 80 C and 10 MPa
V_5 = 0.0010245;			#[m**(3)/kg]
			# At 80 C and 15 MPa
V_6 = 0.0010222;			#[m**(3)/kg]

			# K_t = -(1/V)*(del V/del T)_P
K_t = -(1/V_1)*((V_4 - V_6)/(5 - 15));			#[MPa**(-1)]
K_t = K_t*10**(-6);			#[Pa**(-1)]

print "The value of isothermal compressibility is  K_t = %e Pa**-1)"%(K_t);

			# Cp - Cv = (T*V*(Beta**(2)))/K_t
R = (T*V_1*(Beta**(2)))/K_t;			#[J/kg-K]

print "The value of the difference between Cp and Cv is  Cp-Cv = %f J/kg-K"%(R);
The value of volume expansivity is  Beta = 6.295754e-04 K**-1)
The value of isothermal compressibility is  K_t = 4.489995e-10 Pa**-1)
The value of the difference between Cp and Cv is  Cp-Cv = 319.389628 J/kg-K

Example 7.26 Page Number : 260

In [12]:
 
# Variables
P_1 = 150;			#[bar]
P_2 = 1;			#[bar]

T_1 = 300;			#[K]
T_2 = 260;			#[K]
T_3 = 280;			#[K]
T_4 = 200;			#[K]
T_5 = 120;			#[K]
T_6 = 140;			#[K]

H_P1_T1 = 271.8;			#[kJ/kg]
H_P2_T2 = 260.0;			#[kJ/kg] 
H_P2_T3 = 280.2;			#[kJ/kg]
H_P1_T4 = 129.2;			#[kJ/kg]
H_P2_T5 = 118.8;			#[kJ/kg]
H_P2_T6 = 139.1;			#[kJ/kg]

# Calculations and Results
			#(a)


T_new = ((H_P1_T1 - H_P2_T2)/(H_P2_T3 - H_P2_T2))*(T_3 - T_2) + T_2;			#[K]

			# Therefore Joule-Thomson coefficient is given by,
meu = (T_1 - T_new)/(P_1 - P_2);			#[K/bar]

print " a).The value of Joule-Thomson coefficient for initial T = 300 K) is %f J/bar"%(meu);

			#(b)


T_new_prime = ((H_P1_T4 - H_P2_T5)/(H_P2_T6 - H_P2_T5))*(T_6 - T_5) + T_5;			#[K]

			# Therefore Joule-Thomson coefficient is given by,
meu_prime = (T_4 - T_new_prime)/(P_1 - P_2);			#[K/bar]

print " b).The value of Joule-Thomson coefficient for initial T = 200 K) is %f J/bar"%(meu_prime);

			# Therefore the Joule-Thomson coefficient is higher for low initial temperatures and therefore the drop in temperature is more.
 a).The value of Joule-Thomson coefficient for initial T = 300 K) is 0.190046 J/bar
 b).The value of Joule-Thomson coefficient for initial T = 200 K) is 0.468146 J/bar

Example 7.27 Page Number : 261

In [3]:
 
# Variables
T = 300;			#[K] - Temperature
P = 5;			#[atm] - Pressure
P = P*101325;			#[Pa]
Cp_0 = 35.78;			#[J/mol-K] - Smath.tan(math.radiansard specific heat capacity at constant pressure
B = -50;			#[cm**(3)/mol]
B = B*10**(-6);			#[m**(3)/mol]

# Calculations
			# (dB/dT) = 1.0 = dB_dT (say)
dB_dT = 1.0;			#[cm**(3)/mol-K]
dB_dT = dB_dT*10**(-6);			#[m**(3)/mol-K]

			# (d**2 B/d T**2) = -0.01 = dB_dT_2 (say)
dB_dT_2 = -0.01;			#[cm**(3)/mol-K**(2)]
dB_dT_2 = dB_dT_2*10**(-6);			#[m**(3)/mol-K**(2)]

Cp = Cp_0 - P*T*(dB_dT_2);			#[[J/mol-K]] - Specific heat capacity at constant pressure

			#Therefore Joule-Thomson coefficient is given by,
meu = (1/Cp)*(-B + T*dB_dT);			#[K/Pa]
meu = meu*10**(5);			#[K/bar]

# Results
print " c).The value of Joule-Thomson coefficient is %f K/bar"%(meu);
 c).The value of Joule-Thomson coefficient is 0.938341 K/bar

Example 7.30 Page Number : 267

In [5]:
 
# Variables
den_liq = 13690.;			#[kg/m**(3)] - Density of liquid mercury
den_solid = 14190.;			#[kg/m**(3)] - Density of solid mercury
mp = -38.87;			#[C] - Melting point of mercury at pressure of 1 bar
mp = mp + 273.15;			#[K]
T_req = 0.;			#[C] - Required temperature to which the melting point is to be raised
T_req = T_req + 273.15;			#[K]
H_fus = 11.62;			#[kJ/kg] - Latent heat of fusion of mercury

# Calculations
V_liq = (1/den_liq);			#[m**(3)/kg] - Specific volume of liquid mercury

V_solid = (1/den_solid);			#[m**(3)/kg] - Specific volume of solid mercury

			# (delta P/delta T) = ((P - 1)*100)/(T_req - mp)
			# delta H/(T*delta V) = (H_liq - H_solid)/(T*(V_liq - V_solid)) = del (say)
d = (H_fus)/(mp*(V_liq - V_solid));			#[kPa/K] - delta H/(T*delta V)

			#Equating the two sides and then solving we get
P = (d*(T_req - mp))/100 + 1;			#[bar]

# Results
print " The required pressure should be %f bar"%(P);

# answers are correct but vary from book because of rouding error. please calculate manually.
 The required pressure should be 7491.335878 bar

Example 7.31 Page Number : 268

In [15]:
 
# Calculations and Results
			#(1)
			# At 1 bar
			# Considering the data given at pressure 1 and 1000 bar, we have
delta_H_fus_1 = ((1000-1)*10**(5)*(273.15-22.6)*3.97*10**(-6))/(14.8+22.6);			#[J/mol]
delta_S_fus_1 = delta_H_fus_1/(273.15-22.6);			#[J/mol-K]

print " 1).The delta_H_fus at 1 bar is %f J/mol"%(delta_H_fus_1);
print "     The delta_S_fus at 1 bar is %f J/mol-K"%(delta_S_fus_1);

			#(2)
			# At 6000 bar
T_mean = (128.8+173.6)/2;			#[C] - Mean temperature
T_mean = T_mean + 273.15;			#[K]
delta_V_fus_mean = (1.12+1.55)/2;			#[cm**(3)/mol]

			# Consider the data at pressure of 5000 and 7000 bar we get,
delta_H_fus_2 = ((7000-5000)*10**(5)*(T_mean*delta_V_fus_mean*10**(-6)))/(173.6-128.8);			#[J/mol]
delta_S_fus_2 = delta_H_fus_2/T_mean;			#[J/mol-K]

print " 2).The delta_H_fus at 6000 bar is %f J/mol"%(delta_H_fus_2);
print "     The delta_S_fus at 6000 bar is %f J/mol-K"%(delta_S_fus_2);
 1).The delta_H_fus at 1 bar is 2656.921969 J/mol
     The delta_S_fus at 1 bar is 10.604358 J/mol-K
 2).The delta_H_fus at 6000 bar is 2529.050223 J/mol
     The delta_S_fus at 6000 bar is 5.959821 J/mol-K

Example 7.32 Page Number : 268

In [16]:
 
# Variables
H_fus = 80;			#[cal/g] - Heat of fusion at 0 C and 1 atm pressure
T = 0+273.15;			#[K] - Temperature
vol_ratio = 1.091;			# Ratio of the specific volume of ice and water.
sp_vol = 0.001;			#[m**(3)/kg] - Specific volume of saturated liquid water.

# Calculations
			# The clapeyron equation can be written as
			# (dP/dT)_sat = T*delta V_LS/(delta H_LS) = (T*(V_ice - V_water))/(H_ice - H_water)
dP_dT = (T*(vol_ratio - 1)*10**(-3))/(-H_fus*4.186);			#[K/kPa]

# Results
print "The value of dT/dP)_sat is %e K/kPa"%(dP_dT);
The value of dT/dP)_sat is -7.422554e-05 K/kPa

Example 7.33 Page Number : 268

In [17]:
 

# Variables
P = 2;			#[atm] - Surrounding pressure
bp_water = 100 + 273.15;			#[K] - Boiling point of water at 1 atm pressure
delta_H_vap = 2257;			#[kJ/kg] - Enthalpy of vaporization
delta_H_vap = delta_H_vap*18.015;			#[J/mol]
R = 8.314;			#[J/mol*K] - Universal gas constant

# Calculations
			# The clapeyron equation is given by
			# math.log(P_2_sat/P_1_sat) = (-delta H_vap/R)*(1/T_2 - 1/T_1)
P_1_sat = 1;			#[atm]
P_2_sat = P;
T_1 = bp_water;

			# Solving the above equation
T_2 = 1/((math.log(P_2_sat/P_1_sat))/(-delta_H_vap/R) + (1/T_1));			#[K]
T_2 = T_2 - 273.15;			#[C]

# Results
print " The boiling point of water at a pressure of 2 atm is %f C"%(T_2);
 The boiling point of water at a pressure of 2 atm is 120.836990 C

Example 7.34 Page Number : 269

In [18]:
 
# Variables
T_1 = 0.01 +273.15;			#[K]
T_2 = 1 + 273.15;			#[K]
P_sat_1 = 0.611;			#[kPa] - P_sat at temperature T_1
P_sat_2 = 0.657;			#[kPa] - P_sat at temperature T_2
Mol_wt = 18.015;			#[g/mol] - Molecular weight of water
R = 8.314;			#[J/mol*K] - Universal gas constant

# Calculations and Results            
            # The clapeyron equation is given by
			# math.log(P_sat_2/P_sat_1) = (-delta H_LV/R)*(1/T_2 - 1/T_1)

			# Solving the above equation
delta_H = -(math.log(P_sat_2/P_sat_1)/(1/T_2 - 1/T_1))*R;			#[J/mol]
delta_H = delta_H/Mol_wt;			#[kJ/kg]

print " The enthalpy of vaporization is %f kJ/kg"%(delta_H);

			# Entropy of vaporization is given by
S_vap = delta_H/T_2;			#[kJ/kg-K]
print " The entropy of vaporization is %f kJ/kg-K"%(S_vap);
 The enthalpy of vaporization is 2533.991278 kJ/kg
 The entropy of vaporization is 9.243083 kJ/kg-K

Example 7.35 Page Number : 269

In [19]:
 

# Variables
T = 100. + 273.15;			#[K]
			# (dT/dP)_sat = (1/27.12) K/mm
dT_dP = (1/27.12);			#[K/mm]
dT_dP = dT_dP*(760./101325);			#[K/Pa]

# Calculations
			# The clapeyron equation is given by
			# (dP/dT)_sat = (-delta H_LV)/(T*delta V_LV)
			# delta H_LV = T*delta V_LV*(dP/dT)_sat

			# (dP/dT)_sat = 1/(dT/dP)_sat
dP_dT = 1/dT_dP;			#[Pa/K]

			# From saturated steam table at 100 C
V_vap = 1.6729;			#[m**(3)/kg]
V_liq = 0.001044;			#[m**(3)/kg]
delta_V = V_vap - V_liq;			#[m**(3)/kg]

			# Therefore delta_H_LV is given by
delta_H_LV = T*delta_V*(dP_dT);			#[J/kg]
delta_H_LV = delta_H_LV*10**(-3);			#[kJ/kg]

# Results
print " The heat of vaporization of water is %f kJ/kg"%(delta_H_LV);
 The heat of vaporization of water is 2255.667174 kJ/kg

Example 7.36 Page Number : 270

In [20]:
 

# Variables
T_1 = 100 + 273.15;			#[K]
P_1 = 1.01325;			#[bar]
T_2 = 98 + 273.15;			#[K]
P_2 = 0.943;			#[bar]
V_vap = 1.789;			#[m**(3)] - Volume in vapour phase
vessel_vol = 1.673;			#[m**(3)] - Volume of the vessel
R = 8.314;			#[J/mol*K] - Universal gas constant

# Calculations and Results
			
x = vessel_vol/V_vap;

			
m_vap = x;			#[kg] - Mass of saturated vapour
m_liq = (1 - x);			#[kg] - Mass of saturated liquid

print " The amount of vapour condensed is %f kg"%(m_liq);

			# The clapeyron equation is given by
			# math.log(P_2_sat/P_1_sat) = (-delta H_LV/R)*(1/T_2 - 1/T_1)

			# Solving the above equation
delta_H = -(math.log(P_2/P_1)/(1/T_2 - 1/T_1))*R;
delta_H = delta_H/18.015;			#[kJ/kg]

print " The latent heat of vaporization is %f kJ/kg"%(delta_H);
 The amount of vapour condensed is 0.064841 kg
 The latent heat of vaporization is 2296.240786 kJ/kg

Example 7.37 Page Number : 270

In [3]:
 
from scipy.integrate import quad 
from scipy.optimize import *


# Variables
T_1 = 298.15;			#[K] - Smath.tan(math.radiansard reaction temperature
delta_H_gas = -52.23;			#[kcal/mol] - Enthalpy of formation of C2H5OH(gas)
delta_H_liq = -66.35;			#[kcal/mol] - Enthalpy of formation of C2H5OH(liq)


# Calculations and Results
			# For ethanol(g) [T is in K and Cp_0 in cal/mol-K]
			# Cp_0 = 4.75 + 5.006*10**(-2)*T - 2.479*10**(-5)*T**(2) + 4.79*10**(-9)*T**(3)

			# For ethanol(l) [T is in K and Cp_0 in cal/mol-K]
			# Cp_0 = 67.29 - 0.343*T - 6.94*10**(-4)*T**(2)

			# The vaporization of a liquid can be written as C2H5OH(liq) - C2H5OH(gas)
			# Since the pressure is 1 atm therefore the standard data can be used
delta_H_298 = delta_H_gas - delta_H_liq;			#[kcal/mol]
delta_H_298 = delta_H_298*1000;			#[cal/mol]
delta_a = 4.75 - 67.29;
delta_b = 5.006*10**(-2) - (-0.343);
delta_c = -2.479*10**(-5) - 6.94*10**(-4);
delta_d = 4.79*10**(-9);

			# The standard enthalpy of vaporization at a temperature T is given by

def f31(T): 
	 return delta_a + delta_b*T + delta_c*T**(2) + delta_d*T**(3)

			# delta_H_T =  delta_H_298 +  quad(f31,T_1,T)[0]


			# Therefore the standard enthalpy of vaporization at a temperature T = 283 K is given by
T_2 = 283;			#[K]

def f32(T): 
	 return delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3)

delta_H_283 =  delta_H_298 +  quad(f32,T_1,T_2)[0]


			# Therefore the standard enthalpy of vaporization at a temperature T = 348 K is given by
T_3 = 348;			#[K]

def f33(T): 
	 return delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3)

delta_H_348 =  delta_H_298 +  quad(f33,T_1,T_3)[0]


print " The value of enthalpy of vaporization at 283 K is %f cal/mol"%(delta_H_283);
print " The value of enthalpy of vaporization at 298.15 K is %f cal/mol"%(delta_H_298);
print " The value of enthalpy of vaporization at 348 K is %f cal/mol"%(delta_H_348);


			# Solving the above equatio manually we get,
			# delta_H_vap = 1.1975*10**(-9)*T**(4) - 2.396*10**(-4)*T**(3) + 0.1965*T**(2) - 62.54*T + 21639.54 
			# Solving for 'T' at which 'delta_H_vap' = 0
def f(T): 
	 return 1.1975*10**(-9)*T**(4)-2.396*10**(-4)*T**(3)+0.1965*T**(2)-62.54*T + 21639.54
T_0 = fsolve(f,500)




print " The temperature obtained by equating standard enthalpy of vaporization equal to zero is %f K"%(T_0);
 The value of enthalpy of vaporization at 283 K is 14255.030925 cal/mol
 The value of enthalpy of vaporization at 298.15 K is 14120.000000 cal/mol
 The value of enthalpy of vaporization at 348 K is 13593.385895 cal/mol
 The temperature obtained by equating standard enthalpy of vaporization equal to zero is 635.058887 K

Example 7.38 Page Number : 276

In [22]:
 
# Variables
T = 300 + 273.15;			#[K] - Temperature
P = 9000;			#[kPa] - Pressure
P_sat = 8592.7;			#[kPa] - Vapour pressure of saturated water at 300 C
f_sat = 6738.9;			#[kPa] - Fugacity of saturated water at 300 C
V_liq = 25.28;			#[cm**(3)/mol] - Molar volume of water in liquid phase
V_liq = V_liq*10**(-6);			# [m**(3)/mol]
V_vap = 391.1;			#[cm**(3)/mol] - Molar volume of water in vapour phase
V_vap = V_vap*10**(-6);			# [m**(3)/mol]
R = 8.314;			#[J/mol*K] - Universal gas constant

# Calculations
			# At 300 C and 9000 kPa water is a compressed liquid and its fugacity is given by
			# f = f_sat*exp[V_liq*(P - P_sat)/R*T]
fugacity = f_sat*math.exp((V_liq*(P - P_sat)*1000)/(R*T));

# Results
print " The fugacity of water at 9000 kPa is %f kPa"%(fugacity);
 The fugacity of water at 9000 kPa is 6753.477111 kPa

Example 7.39 Page Number : 276

In [23]:
 

# Variables
T = 200 + 273.15;			#[K] - Temperature
R = 8.314;			#[J/mol*K] - Universal gas constant

			# From steam table at 200 C as reported in the book
P_sat = 1.5538;			#[MPa] - Vapour pressure of saturated steam
H_vap = 2793.2;			#[kJ/kg] - Enthalpy of saturated steam in vapour phase
S_vap = 6.4323;			#[kJ/kg-K] - Entropy of saturated steam in vapour phase

# Calculations
G_sat = H_vap - T*S_vap;			#[kJ/kg] - Gibbs free energy
G_sat = G_sat*18.015;			#[J/mol]

			# Now let us calculate the Gibbs free energy at the lowest pressure available in superheated steam tables at 200 C
			# At 200 C and 0.01 MPa as reported in the book
H = 2879.5;			#[kJ/kg] - Enthalpy
S = 8.9038;			#[kJ/kg-K] - Entropy
G_ig = H - T*S;			#[kJ/kg] - Gibbs free energy
G_ig = G_ig*18.015;			#[J/mol]

			# Integrating from ideal gas state at 200 C and 0.01 MPa to saturated vapour at 200 C we get
			# G_sat - G_ig = R*T*math.log(f_sat/f_ig)

			# Under the ideal gas condition the pressure is small therefore f_ig = P = 0.01 MPa
f_ig = 0.01;			#[MPa]

			# Solving the above equation
f_sat = f_ig*(math.exp((G_sat - G_ig)/(R*T)));			#[MPa]

# Results
print " The fugacity of saturated steam at 200 C is %f MPa"%(f_sat);
 The fugacity of saturated steam at 200 C is 1.426074 MPa

Example 7.40 Page Number : 277

In [24]:
 

# Variables
T = 320 + 273.15;			#[K]
P_1 = 70;			#[bar]
P_2 = 170;			#[bar]
R = 8.314;			#[J/mol*K] - Universal gas constant


# Calculations and Results
			#(a)
			# dG = R*T*dmath.log(f)
			# G - G_ig = R*T*math.log(f/f_ig)

			# From steam table the low pressure that is available is 1 kPa.
f_ig = 1;			#[kPa] - Assuming ideal gas behaviour at such low pressure

			# At 1 kPa (under saturated conditions)
P_sat = 112.891;			#[bar]
			# Therefore at both 1 kPa and 70 bar the stem is superheated and byond a pressure of 112.891 bar it is compressed liquid.

			# For superheated steam table at 1 kPa and 320 C, as repoted in the book
H_1 = 3117.08;			#[kJ/kg] - Enthalpy
S_1 = 10.41232;			#[kJ/kg-K] - Entropy

			# For superheated steam table at 70 bar and 320 C, as repoted in the book
H_2 = 2916.92;			#[kJ/kg] - Enthalpy
S_2 = 6.0651;			#[kJ/kg-K] - Entropy

			# At 70 bar and 320 C,
G = H_2 - T*S_2;			#[kJ/kg] - Gibbs free energy
			# At 1 kPa and 320 C
G_ig = H_1 - T*S_1;			#[kJ/kg] - Gibbs free energy

			# math.log(f/f_ig) = (G - G_ig)/(R*T)
f = f_ig*(math.exp((G - G_ig)*18/(R*T)));			#[kPa]
f = f*10**(-2);			#[bar]

			# At 70 bar
phi = f/P_1;

print " a).The fugacity of steam at 320 C and 70 bar is %f bar"%(f);
print "     The fugacity coefficient at 320 C and 70 bar is  phi = %f"%(phi);

			#(b)
			# Now consider saturated steam at 320 C. We have
P_sat = 112.891;			#[bar]
V_liquid = 1.5;			#[cm**(3)/mol] - Molar vlume of saturated liquid
V_liquid = V_liquid*10**(-6);			#[m**(3)/mol]
V_vapour = 15.48;			#[cm**(3)/mol] - Molar vlume of saturated vapour
U_liqid = 1445.7;			#[Kj/kg] - Internal energy of satuarted liquid
U_vapour = 2528.9;			#[kJ/kg] - Internal energy of satuarted vapour
H_liquid = 1462.6;			#[kJ/kg] - Enthalpy of saturated liquid
H_vapour = 2703.7;			#[kJ/kg] - Enthalpy of saturated vapour
S_liquid = 3.45;			#[kJ/kg-K]  - Entropy of saturated liquid
S_vapour = 5.5423;			#[kJ/kg-K] - Entropy of saturated vapour

			# Now let us calculate Gibbs free energy of saturated liquid and saturated vapour
G_liquid = H_liquid - T*S_liquid;			#[kJ/kg]
G_vapour = H_vapour - T*S_vapour;			#[kJ/kg]
			# Note that under saturated conditions
			# G_sat = G_liquid = G_vapour
G_sat = G_liquid;			#[kJ/kg]

			# math.log(f_sat/f_ig) = (G_sat - G_ig)/(R*T)
f_sat = f_ig*(math.exp((G_sat - G_ig)*18/(R*T)));			#[kPa]
f_sat = f_sat*10**(-2);			#[bar]

phi_sat = f_sat/P_sat;

			# And now the fugacity is to be determined at 320 C and P = 170 bar. We know the following relation for compressed liquid.
			# f_CL = f_sat*exp(V_liquid*(P-P_sat)/(R*T))
f_CL = f_sat*math.exp(V_liquid*18*(P_2-P_sat)*10**(5)/(R*T));			#[bar]

			# Therefore the fugacity coefficient at 170 bar and 320 C is given by
phi_2 = f_CL/P_2;

print " b).The fugacity of steam at 320 C and 170 bar is %f bar"%(f_CL);
print "     The fugacity coefficient at 320 C and 170 bar is phi = %f"%(phi_2);
 a).The fugacity of steam at 320 C and 70 bar is 58.913361 bar
     The fugacity coefficient at 320 C and 70 bar is  phi = 0.841619
 b).The fugacity of steam at 320 C and 170 bar is 86.552966 bar
     The fugacity coefficient at 320 C and 170 bar is phi = 0.509135

Example 7.41 Page Number : 278

In [25]:
 

# Variables
T = 300 + 273.15;			#[K]
P_1 = 12500*10**(3);			#[Pa]
P_2 = 8581*10**(3);			#[Pa]
P_3 = 300*10**(3);			#[Pa]
V_liq = 1.404;			#[cm**(3)/g] - Specific volume of liquid
V_liq = (V_liq/10**(6))*18.015;			#[m**(3)/mol]
R = 8.314;			#[J/mol*K] - Universal gas constant

# Calculations and Results
			# state 1: 300 C, 12500 kPa
			# state 2: 300 C, 8581 kPa
			# state 3: 300 C, 300 kPa

			# From state 1 to state 2 the system is liquid water and if the molar volume of liquid is assumed costant we can write
			# G_2 - G_1 = V_liq*(P_2 - P_1)
			# G_2 - G_1 = R*Tmath.log(f_2/f_1)
			# Comparing the above two equations we get
			# (f_2/f_1) = exp((V_liq*(P_2 - P_1)/(R*T))
f2_f1 = math.exp((V_liq*(P_2 - P_1)/(R*T))); 			# (f_2/f_1) = f2_f1 (say)

			# In state 2 the fugacity of liquid is same as that of saturated vapour and for the vapour phase change from state 2 to 3 the fugacity ratio is calculated using 
			# G_3 - G_2 = R*Tmath.log(f_3/f_2)

			# At 300 C, 8581 kPa 
H_liq_2 = 2749.0;			#[kJ/kg]
S_vap_2 = 5.7045;			#[kJ/kg-K]
G_vap_2 = -520.53;			#[kJ/kg]
G_vap_2 = G_vap_2*18.015;			#[J/mol]

			# At 300 C, 300 kPa 
H_3 = 3069.3;			#[kJ/kg]
S_3 = 7.7022;			#[kJ/kg-K]
G_3 = -1345.22;			#[kJ/kg]
G_3 = G_3*18.015;			#[J/mol]

			# Substituting and solving the equation  G_3 - G_2 = R*Tmath.log(f_3/f_2)
f3_f2 = math.exp((G_3 - G_vap_2)/(R*T));			#  (f_3/f_2) = f3_f2 (say)

			# (f_3/f_1) = (f_3/f_2)*(f_2/f_1)
f3_f1 = f3_f2*f2_f1;

print " The ratio of fugacity in the final state to that in the initial state is given by f3/f2 = %f"%(f3_f2);
 The ratio of fugacity in the final state to that in the initial state is given by f3/f2 = 0.044255