6.7 Entropy change in Rigid tank#

Problem Statement#

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

a) assuming ideal gas

b) using CoolProp

c) calculate the error

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)\)

# import the libraries we'll need
import CoolProp.CoolProp as CP
import numpy as np

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

P_1 = 10e+3   #initial pressure in Pa
T_1 = 10 + 273.15   #initial temperature in K
T_2 = 55 + 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: 1.502 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: 1.504 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: 0.2 %