10.3. Exercise 3 Solutions#

Section 5.3.2 Exercise 3

#5.3.2 Exercise 1
#A closed rigid container of 0.5 m3 is placed on a hot plate. Initially it contains a two phase mixture of saturated liquid and saturated vapor H2O at  𝑝1 = 1 bar with x = 0.5. After heating  𝑝2 = 1.5 bar. 
#Determine T at states 1 and 2. Determine the heat transfer during the process.

V1 = 0.5 #m3
Q1 = 0.5
P1 = 100*1000 #Pa
P2 = 150*1000 #Pa

#Using Cantera:
import cantera as ct
#define state 1
species1=ct.Water()

species1.PQ=P1,Q1

print(f"Initial temperature:  {round(species1.TQ[0],2)} K")

v1 = v2 = species1.TV[1] # Initial and final specific volume since it is a rigid container

#define state 2
species2=ct.Water()

species2.PV=P2,v2

print(f"Final temperature:  {round(species2.TQ[0],2)} K")

m = V1/v1 # kg
u1 = species1.UV[0]
u2 = species2.UV[0]
Q = m*(u2-u1) # From Delta_U = Q-W, work is zero because volume is fixed

print(f"Heat Transfer:  {round(Q/1000,2)} kJ")
Initial temperature:  372.81 K
Final temperature:  384.55 K
Heat Transfer:  298.1 kJ
#5.3.2 Exercise 2
#A piston cylinder assembly initially (State 1) contains 10 kg of H2O at 1200 kPa.
# a) If 8 kg is in the liquid form and the rest vapor, determine the temperature, specific volume and specific enthalpy.
# b) The cylinder continues to be heated at constant pressure until the temperature reaches 300 °C (State 2). Determine the final state (compressed liquid, saturated mixture, superheated vapor), specific volume and specific enthalpy.
# c) Determine the heat transfer and work for this process.

# part a
m=10 #kg
P1 = 1200*1000 #Pa
mg = 2 #kg
Q1 = mg/m

#Using Cantera:
import cantera as ct
#define state 1
species1=ct.Water()

species1.PQ=P1,Q1
T1 = species1.TV[0]
v1 = species1.TV[1]
h1 = species1.HP[0]

print(f"Initial temperature:  {round(T1,2)} K")
print(f"Initial specific volume:  {round(v1,6)} K")
print(f"Initial specific enthalpy:  {round(h1,2)} K")

# part b
T2 = 300+273.15 # K
P2=P1

#define state 2
species2=ct.Water()

species2.TP=T2,P2
v2 = species2.TV[1]
phase = species2.phase_of_matter
h2 = species2.HP[0]

print(f"Final state of matter:  {phase}")
print(f"Final specific volume:  {round(v2,6)} K")
print(f"Final specific enthalpy:  {round(h2,2)} K")

# part c

Q = m*(h2-h1) # J, constant pressure process
W = P2*(v2-v1) # J,constant volume process

print(f"Work:  {round(W/1000,2)} kJ")
print(f"Heat Transfer:  {round(Q/1000,2)} kJ")
Initial temperature:  461.18 K
Initial specific volume:  0.033582 K
Initial specific enthalpy:  -14774746.42 K
Final state of matter:  gas
Final specific volume:  0.213816 K
Final specific enthalpy:  -12925000.32 K
Work:  216.28 kJ
Heat Transfer:  18497.46 kJ
#5.3.2 Exercise 3
#Water initially at 200 kPa and 300C is contained in a piston-cylinder device fitted with stops. The water is allowed to cool at constant pressure until it exists as a saturated vapor and the piston rests on its stops. Then the water continues to cool until the pressure is 100 kPa.
import cantera as ct
P1 = 200e3 #Pa
T1 = 300 + 273.15 #K
P2 = P1
P3 = 100e3 #Pa
Q2 = 1

state1 = ct.Water()
state1.TP = T1, P1

state2 = ct.Water()
state2.PQ = P2, Q2
v2 = state2.TV[1]
v3 = v2

state3 = ct.Water()
state3.PV = P3, v3

# Part A

# Find internal energy change between states 1 and 3
state1 = ct.Water()
state1.TP = T1, P1
u1 = state1.UP[0]

# P2 = P1, Q2 = 1
state2 = ct.Water()
state2.PQ = P2, Q2
u2 = state2.UP[0]

deltau21 = u2 - u1 
print(f"A) : The change in internal energy between states 1 and 2 is {deltau21/1000} kJ/kg")
A) : The change in internal energy between states 1 and 2 is -279.015197695978 kJ/kg
# Part B 
v1 = state1.TV[1]
v2 = state2.TV[1]
print(f"B) : The change in specific volume between states 1 and 2 is {(v2 -v1)/1000} kJ/kg")
B) : The change in specific volume between states 1 and 2 is -0.00043035589952211537 kJ/kg
# Part C
h1 = state1.HP[0]
h2 = state2.HP[0]
print(f"C): The change in specific enthalpy between states 1 and 2 is {round((h2 - h1)/1000,2)} kJ/kg") 
C): The change in specific enthalpy between states 1 and 2 is -365.09 kJ/kg
# Part D
Q = (u2 - u1) + (P1*(v2 - v1))
print(f"D) : The heat transfer between states 1 and 2 is {round(Q/1000,2)} kJ/kg")
D) : The heat transfer between states 1 and 2 is -365.09 kJ/kg
# Part E
# specific heat transfer from cooling to stops
print(f"E) : The heat transfer between states 1 and 2 is {round((h2 - h1)/1000,2)} kJ/kg") 
E) : The heat transfer between states 1 and 2 is -365.09 kJ/kg
# Part F
state3 = ct.Water()
state3.PV = P3, v3
u3 = state3.UP[0]
deltau32 = u3 - u2
print(f"F) : The change in internal energy between states 2 and 3 is {deltau32/1000} kJ/kg")
F) : The change in internal energy between states 2 and 3 is -1020.621570467569 kJ/kg
# Part G  (total specific heat transfer)
q12 = h2 - h1 
q23 = u3 - u2 
qtotal = q12 + q23 
print(f"G) : The total specific heat transfer is {round(qtotal/1000, 2)} kJ/kg")
G) : The total specific heat transfer is -1385.71 kJ/kg