2.8: Internal Energy in a Rigid Container

2.8: Internal Energy in a Rigid Container#

A rigid tank of volume \(V=1\:m^3\) contains \(m=1\:kg\) of a materials at room temperature \(T=25\:^{\circ}C\). Determine the state, the pressure, and internal energy of the materials inside the tank if it is:

a) water

b) ammonia

CH2-Q8.png

Solution Approach for a)#

the specific volume of the container is calculated using

\(v=V/m\)

then the properties are used to determine the state, pressure (\(P\)), and internal energy (\(U\)).

for the internal energy

\(U=mu\)

where \(m\) is the mass and \(u\) is the specific internal energy

#import librarier
import CoolProp.CoolProp as CP

#define variables
V = 1   #tank volume in m3
m = 1   #materials mass in kg
T = 25 + 273.15   #temperature in K

v = V / m   #specific volume in m3/kg
D = m / V   #density in kg/m3 used in CoolProp

fluid = "water"  # define the fluid or material of interest

v_f = 1 / CP.PropsSI("D", "T", T, "Q", 0 , fluid)   #sat fluid specific volume in m3/kg 
v_g = 1 / CP.PropsSI("D", "T", T, "Q", 1 , fluid)   #sat fluid specific volume in m3/kg 

if v > v_g:
    print(fluid, 'is in a superheated state')
elif v < v_f:
    print(fluid, 'is in a subcooled state')
else:
    print(fluid, 'is in a saturated state')

P = CP.PropsSI("P", "T", T, "D", D , fluid)   #pressure in Pa

print('The pressure of', fluid, 'is', f"{P/1000:.2f}", 'kPa')

u = CP.PropsSI("U", "T", T, "D", D , fluid)   #specific internal energy in J/kg
U = m * u   #internal energy in J

print('The internal energy of', fluid, 'is', f"{U/1000:.2f}", 'kJ')
water is in a saturated state
The pressure of water is 3.17 kPa
The internal energy of water is 157.95 kJ

Solution Approach for a)#

the same approach with a different fluid is applied

fluid = "ammonia"  # define the fluid or material of interest

v_f = 1 / CP.PropsSI("D", "T", T, "Q", 0 , fluid)   #sat fluid specific volume in m3/kg 
v_g = 1 / CP.PropsSI("D", "T", T, "Q", 1 , fluid)   #sat fluid specific volume in m3/kg 

if v > v_g:
    print(fluid, 'is in a superheated state')
elif v < v_f:
    print(fluid, 'is in a subcooled state')
else:
    print(fluid, 'is in a saturated state')

P = CP.PropsSI("P", "T", T, "D", D , fluid)   #pressure in Pa

print('The pressure of', fluid, 'is', f"{P/1000:.2f}", 'kPa')

u = CP.PropsSI("U", "T", T, "D", D , fluid)   #specific internal energy in J/kg
U = m * u   #internal energy in J

print('The internal energy of', fluid, 'is', f"{U/1000:.2f}", 'kJ')
ammonia is in a superheated state
The pressure of ammonia is 143.38 kPa
The internal energy of ammonia is 1546.33 kJ