6.13 Entropy in a heated rigid tank#

Problem Statement:#

Water is heated up in a rigid tank from \(P=101\:kPa\) and \(T=110^{\circ} C\) till its temperature increases to \(T=120^{\circ} C\). Determine the changes in specific entropy,

a) assuming ideal gas

b) using CoolProp

c) calculate the error

d) discuss the error percentage compared to 6.13 in this chapter

Solution Approach for a)#

the tank is rigid therefore the density of hydrogen remains constant

\(D_1 = D_2\)

to calculate changes in specific entropy assuming ideal gas

\(s_2-s_1=C_pln(T_2/T_1)-Rln(P_2/P_1)\)

%%script false --no-raise-error
# import the libraries we'll need
import CoolProp.CoolProp as CP
import numpy as np

#define variables
fluid = ''
R =    #hydrogen gas constant kJ/kg.K
C_p =    #hydrogen Cp kJ/kg.K

P_1 =    #initial pressure in Pa
T_1 =  + 273.15   #initial temperature in K
T_2 =  + 273.15   #final temperature in K

D_1 = CP.PropsSI("", "T",, "P", , fluid)   #initial density in kg/m3
D_2 = D_1   #constant density

P_2 = CP.PropsSI("P", "T", , "D", D_2, fluid)   #final pressure based on temperature and density in Pa

ds_a = C_p * np.log(/) - R * np.log(/)   #changes in entropy in kJ/kg.k

print('The entropy change using ideal gas assumption is:', f"{ds_a:.3f}", 'kJ/kg.K')
Hide code cell source
# import the libraries we'll need
import CoolProp.CoolProp as CP
import numpy as np

#define variables
fluid = 'water'
R = 0.4615   #hydrogen gas constant kJ/kg.K
C_p = 1.8723   #hydrogen Cp kJ/kg.K

P_1 = 101e+3   #initial pressure in Pa
T_1 = 110 + 273.15   #initial temperature in K
T_2 = 120 + 273.15   #final temperature in K

D_1 = CP.PropsSI("D", "T", T_1, "P", P_1, fluid)   #initial density in kg/m3
D_2 = D_1   #constant density

P_2 = CP.PropsSI("P", "T", T_2, "D", D_2, fluid)   #final pressure based on temperature and density in Pa

ds_a = C_p * np.log(T_2/T_1) - R * np.log(P_2/P_1)   #changes in entropy in kJ/kg.k

print('The entropy change using ideal gas assumption is:', f"{ds_a:.3f}", 'kJ/kg.K')
The entropy change using ideal gas assumption is: 0.036 kJ/kg.K

Solution Approach for b)#

specific entropy values are to be extracted from coolprop

s_1 = CP.PropsSI("S", "T", T_1, "P", P_1, fluid)/1000   #initial entropy in kJ/kg.K
s_2 = CP.PropsSI("S", "T", T_2, "P", P_2, fluid)/1000   #final entropy in kJ/kg.K

ds_b = s_2 - s_1   #changes in entropy in kJ/kg.K

print('The entropy change using CoolProp is:', f"{ds_b:.3f}", 'kJ/kg.K')
The entropy change using CoolProp is: 0.039 kJ/kg.K

Solution Approach for c)#

E = np.absolute(ds_b - ds_a) / ds_b * 100

print('The error based on ideal gas assumption is:', f"{E:.1f}", '%')
The error based on ideal gas assumption is: 8.9 %