Chapter 4: Steam and two phase systems

Example 1: pg 61

In [1]:
#pg 61
#calculate the specific liquid enthalpy of evaporation and dry saturated steam
print('Example 4.1');

#  aim : To determine
#  the enthalpy

#  Given values
P = .50;# Pressure, [MN/m^2]

#  solution

#  From steam tables, at given pressure
hf = 640.1;#  specific liquid enthalpy ,[kJ/kg]
hfg = 2107.4;#  specific enthalpy of evaporation ,[kJ/kg]
hg = 2747.5; #  specific enthalpy of dry saturated steam ,[kJ/kg]
tf = 151.8; #  saturation temperature,[C]
#results
print 'The specific liquid enthalpy (kJ/kg) = ',hf
print 'The specific enthalpy of evaporation (kJ/kg) = ',hfg
print 'The specific enthalpy of dry saturated steam (kJ/kg) = ',hg
	
#  End
Example 4.1
The specific liquid enthalpy (kJ/kg) =  640.1
The specific enthalpy of evaporation (kJ/kg) =  2107.4
The specific enthalpy of dry saturated steam (kJ/kg) =  2747.5

Example 2: pg 61

In [3]:
#pg 61
#calculate the saturation temperature, specific enthalpy
print('Example 4.2');
import numpy
#  aim : To determine 
#  saturation temperature and enthalpy

#  Given values
P = 2.04;# pressure, [MN/m^2]

#  solution
#  since in the steam table values of enthalpy and saturation temperature at 2 and 2.1 MN?m^2 are   given, so for knowing required values at given pressure,there is need to do interpolation

#  calculation of saturation temperature and results
#  from steam table
#  P in [MN/m^2] and tf in [C]
Table_P_tf_x=[2.1,2.0]
Table_P_tf_y=[214.9,212.4]
# using interpolation
tf = numpy.interp(P,Table_P_tf_x,Table_P_tf_y);#  saturation temperature at given condition
print 'The Saturation temperature (C) = ',tf

# calculation of specific liquid enthalpy
#  from steam table
Table_P_hf_y = [920.0,908.6];#  P in [MN/m^2] and hf in [kJ/kg]
Table_P_hf_x=[2.1,2.0]
# using interpolation
hf = numpy.interp(P,Table_P_hf_x,Table_P_hf_y); #  enthalpy at given condition, [kJ/kg]
print 'The Specific liquid enthalpy (kJ/kg) = ',hf

# calculation of specific enthalpy of evaporation
#  from steam table
Table_P_hfg_x = [2.1,2.0];#  P in [MN/m^2] and hfg in [kJ/kg]
Table_P_hfg_y=[1878.2,1888.6]
# using interpolation 
hfg = numpy.interp(P,Table_P_hfg_x,Table_P_hfg_y); #  enthalpy at given condition, [kJ/kg]
print 'The Specific enthalpy of evaporation (kJ/kg) = ',hfg

#  calculation of specific enthalpy of dry saturated steam
#  from steam table
Table_P_hg_y = [2798.2,2797.2];#P in [MN/m^2] and hg in [kJ/kg]
Table_P_hg_x=[2.1,2.0]
# using interpolation
hg = numpy.interp(P,Table_P_hg_x,Table_P_hg_y); #  enthalpy at given condition, [kJ/kg]
print 'The Specific enthalpy of dry saturated steam (kJ/kg) = ',hg

print'The answers in the textbook are a bit different due to rounding off error'
#  End
Example 4.2
The Saturation temperature (C) =  212.4
The Specific liquid enthalpy (kJ/kg) =  908.6
The Specific enthalpy of evaporation (kJ/kg) =  1888.6
The Specific enthalpy of dry saturated steam (kJ/kg) =  2797.2
The answers in the textbook are a bit different due to rounding off error

Example 3: pg 63

In [4]:
#pg 63
#calculate the specific enthalpy
print('Example 4.3');

#  aim : To determine
#  the specific enthalpy

#  given values
P = 2; #  pressure ,[MN/m^2]
t = 250; #  Temperature, [C]
cp = 2.0934; #  average value of specific heat capacity, [kJ/kg K]

#  solution

#  looking up steam table it shows that at given pressure saturation temperature is 212.4 C,so
tf = 212.4; #  [C]
#  hence,
Degree_of_superheat = t-tf;#  [C]
#  from table at given temperature 250 C
h = 2902; #  specific enthalpy of steam at 250 C ,[kJ/kg]

#  Also from steam table enthalpy at saturation temperature is
hf = 2797.2 ;#  [kJ/kg]
#  so enthalpy at given temperature is
h2 = hf+cp*(t-tf);#  [kJ/kg]
#results
print 'The specific enthalpy of steam at 2 MN/m^2 with temperature 250 C (kJ/kg) = ',h
print 'The specific enthalpy at given T and P by alternative path (kJ/kg) = ',round(h2,1)

#  End
Example 4.3
The specific enthalpy of steam at 2 MN/m^2 with temperature 250 C (kJ/kg) =  2902
The specific enthalpy at given T and P by alternative path (kJ/kg) =  2875.9

Example 4: pg 63

In [5]:
#pg 63
#calculate the estimated and accurate specific enthalpy
print('Example 4.4');
import numpy
#  aim : To determine
#  the specific enthalpy of steam

#  Given values
P = 2.5;#  pressure, [MN/m^2]
t = 320; #  temperature, [C]

#  solution
#  from steam table at given condition the saturation temperature of steam is 223.9 C, therefore steam is superheated
tf = 223.9;#  [C]

#  first let's calculate estimated enthalpy
#  again from steam table 

hg = 2800.9;#  enthalpy at saturation temp, [kJ/kg]
cp =2.0934;#  specific heat capacity of steam,[kJ/kg K]

#  so enthalpy at given condition is
h = hg+cp*(t-tf);#  [kJ/kg]
print ' The estimated specific enthalpy (kJ/kg) = ',round(h,2)

#  calculation of accurate specific enthalpy
#  we need double interpolation for this

#  first interpolation w.r.t. to temperature
#  At 2 MN/m^2
Table_t_h_x = [325.,300.];# where, t in [C] and h in [kJ/kg]
Table_t_h_y=[3083.,3025.]
h1 = numpy.interp(320.,Table_t_h_x,Table_t_h_y); #  [kJ/kg]

#  at 4 MN/m^2
Table_t_h_x = [325.,300.]; #  t in [C] and h in [kJ/kg]
Table_t_h_y=[3031.,2962.]
h2 = numpy.interp(320.,Table_t_h_x,Table_t_h_y); #  [kJ/kg]

#  now interpolation w.r.t. pressure
Table_P_h_x = [4.,2.]; #  where P in NM/m^2 and h1,h2 in kJ/kg
Table_P_h_y=[h2,h1]
h = numpy.interp(2.5,Table_P_h_x,Table_P_h_y);#  [kJ/kg]
print ' The accurate specific enthalpy of steam at pressure of 2.5 MN/m^2 and with a temperature 320 C (kJ/kg) = ',h

#  End
print ' The answer is a bit different from textbook due to rounding off error'
Example 4.4
 The estimated specific enthalpy (kJ/kg) =  3002.08
 The accurate specific enthalpy of steam at pressure of 2.5 MN/m^2 and with a temperature 320 C (kJ/kg) =  3025.0
 The answer is a bit different from textbook due to rounding off error

Example 5: pg 65

In [6]:
#pg 65
#calculate the specific enthalpy
print('Example 4.5');

# aim : To determine 
#  the specific enthalpy 

#  Given values
P = 70; #  pressure, [kn/m^2]
x = .85; #  Dryness fraction

# solution

#  from steam table, at given pressure 
hf = 376.8;#  [kJ/kg]
hfg = 2283.3;#  [kJ/kg]

# now using equation [2]
h = hf+x*hfg;#  specific enthalpy of wet steam,[kJ/kg]

#results
print ' The specific enthalpy of wet steam (kJ/kg) = ',h

# There is minor variation in the book's answer

#  End
Example 4.5
 The specific enthalpy of wet steam (kJ/kg) =  2317.605

Example 8: pg 68

In [7]:
#pg 68
#calculate the specific volume
print('Example 4.8');

#  aim : To determine 
#  the specific volume of wet steam

#  Given values
P = 1.25; #  pressure, [MN/m^2]
x = .9; #  dry fraction

#  solution
#  from steam table at given pressure
vg = .1569;#  [m^3/kg]
#  hence
v = x*vg; #  [m^3/kg]
#results
print 'The specific volume of wet steam (m^3/kg) = ',v

#  End
Example 4.8
The specific volume of wet steam (m^3/kg) =  0.14121

Example 9: pg 69

In [8]:
#pg 69
#calculate the specific volume and degree of superheat
print('Example 4.9');

#  aim : To determine
#  the specific volume 

#  Given values
t = 325; #  temperature, [C]
P = 2; #  pressure, [MN/m^2]

#  solution
# from steam table at given t and P
vf = .1321; #  [m^3/kg]
tf = 212.4; #  saturation temperature, [C]
doh= t-tf; #  degree of superheat, [C]
#results
print ' The specific volume of steam at pressure of 2 MN/m^2 and with temperature 325 C (m^3/kg) = ',vf
print ' The degree of superheat (C) = ',doh

# End 
Example 4.9
 The specific volume of steam at pressure of 2 MN/m^2 and with temperature 325 C (m^3/kg) =  0.1321
 The degree of superheat (C) =  112.6

Example 10: pg 69

In [9]:
#pg 69
#calculate the mass of steam and water
print('Example .10');
import math
# aim : To determine
# (a) the mass of steam entering the heater
# (b) the mass of water entering the heater

#  Given values
x = .95;#  Dryness fraction
P = .7;#  pressure,[MN/m**2]
d = 25;#  internal diameter of heater,[mm]
C = 12; #  steam velocity in the pipe,[m/s]

#  solution
#  from steam table at .7 MN/m**2 pressure
hf = 697.1;#  [kJ/kg]
hfg = 2064.9;#  [kJ/kg]
hg = 2762.0; #  [kJ/kg]
vg = .273; #  [m**3/kg]

#  (a)
v = x*vg; #  [m**3/kg]
ms_dot = math.pi*(d*10**-3)**2*C*3600/(4*v);#  mass of steam entering, [kg/h]

#  (b)
h = hf+x*hfg;#  specific enthalpy of steam entering heater,[kJ/kg]
#  again from steam tables
hf1 = 376.8;#  [kJ/kg] at 90 C
hf2 = 79.8;#  [kJ/kg] at 19 C

#  using energy balance,mw_dot*(hf1-hf2)=ms_dot*(h-hf1)
mw_dot = ms_dot*(h-hf1)/(hf1-hf2);#  mass of water entering to heater,[kg/h]
#results
print ' (a) The mass of steam entering the heater (kg/h) = ',round(ms_dot,1)
print ' (b) The mass of water entering the heater (kg/h) = ',round(mw_dot,2)

#  End
Example .10
 (a) The mass of steam entering the heater (kg/h) =  81.8
 (b) The mass of water entering the heater (kg/h) =  628.23

Example 11: pg 72

In [10]:
#pg 72
#calculate the change in internal energy
print('Example 4.11');

# aim: To determine
#  the change of internal energy

#  Given values
m = 1.5;#  mass of steam,[kg]
P1 = 1;#  initial pressure, [MN/m**2]
t = 225;#  temperature, [C]
P2 = .28;#  final pressure, [MN/m**2]
x = .9;#  dryness fraction of steam at P2

#  solution

# from steam table at P1
h1 = 2886;#  [kJ/kg]
v1 = .2198; #  [m**3/kg]
#  hence
u1 = h1-P1*v1*10**3;# internal energy [kJ/kg]

# at P2
hf2 = 551.4;# [kJ/kg]
hfg2 = 2170.1;# [kJ/kg]
vg2 = .646; #  [m**3/kg]
#  so
h2 = hf2+x*hfg2;#  [kj/kg]
v2 = x*vg2;#   [m**3/kg]

# now
u2 = h2-P2*v2*10**3;#  [kJ/kg]

#  hence change in specific internal energy is
del_u = u2-u1;#  [kJ/kg]

del_u = m*del_u;#  [kJ];
#results
print ' The change in internal energy (kJ) = ',del_u

#  End
Example 4.11
 The change in internal energy (kJ) =  -486.753

Example 12: pg 74

In [11]:
#pg 74
#calculate the dryness fraction
print('Example 4.12');

#  aim : To determine 
#  the dryness fraction of steam after throttling

#  given values
P1 = 1.4;#  pressure before throttling, [MN/m^2]
x1 = .7;#  dryness fraction before throttling
P2 = .11;#  pressure after throttling, [MN/m^2]

#  solution
#  from steam table
hf1 = 830.1;#  [kJ/kg]
hfg1 = 1957.7;#  [kJ/kg]
h1 = hf1 + x1*hfg1; #  [kJ/kg]

hf2 = 428.8;#  [kJ/kg]
hfg2 = 2250.8;#  [kJ/kg]

#  now for throttling,
#  hf1+x1*hfg1=hf2+x2*hfg2; where x2 is dryness fraction after throttling

x2=(h1-hf2)/hfg2; # final dryness fraction
#results
print ' Dryness fraction of steam after throttling is  = ',round(x2,3)

#  End
Example 4.12
 Dryness fraction of steam after throttling is  =  0.787

Example 13: pg 75

In [12]:
#pg 75
#calculate the dryness fraction and internal diameter
print('Example 4.13');
import math
#  aim : To determine 
#  the dryness fraction of steam 
#  and the internal diameter of the pipe

#  Given values

#  steam1
P1 = 2.;# pressure before throttling, [MN/m^2]
t = 300.;#  temperature,[C]
ms1_dot = 2.;# steam flow rate, [kg/s]
P2 = 800.;#  pressure after throttling, [kN/m^2]

#  steam2
P = 800.;# pressure, [N/m^2]
x2 = .9;#  dryness fraction
ms2_dot = 5; #  [kg/s]

#  solution
#  (a)
#  from steam table specific enthalpy of steam1 before throttling is
hf1 = 3025;#  [kJ/kg]
#  for throttling process specific enthalpy will same so final specific enthalpy of steam1 is
hf2 = hf1;
# hence
h1 = ms1_dot*hf2;# [kJ/s]

#  calculation of specific enthalpy of steam2
hf2 = 720.9;#  [kJ/kg]
hfg2 = 2046.5;#  [kJ/kg]
#  hence
h2 = hf2+x2*hfg2;#  specific enthalpy, [kJ/kg]
h2 = ms2_dot*h2;#  total enthalpy, [kJ/s]

#  after mixing
m_dot = ms1_dot+ms2_dot;#  total mass of mixture,[kg/s]
h = h1+h2;#  Total enthalpy of the mixture,[kJ/s]
h = h/7;#  [kJ/kg]

#  At pressure 800 N/m^2 
hf = 720.9;#  [kJ/kg]
hfg = 2046.5;#  [kJ/kg]
#  so total enthalpy is,hf+x*hfg, where x is dryness fraction of mixture and which is equal to h
#  hence
x = (h-hf)/hfg;# dryness fraction after mixing

#  (b)
# Given
C = 15;#  velocity, [m/s]
#  from steam table
v = .1255;#  [m^/kg]
A = ms1_dot*v/C;#  area, [m^2]
#  using ms1_dot = A*C/v, where A is cross section area in m^2 and
#  A = %pi*d^2/4, where d is diameter of the pipe 

#  calculation of d
d = math.sqrt(4*A/math.pi); # diameter, [m]
#results
print ' (a) The condition of the resulting mixture is dry with dryness fraction  =  ',round(x,3)
print ' (b) The internal diameter of the pipe (mm) = ',round(d*1000,2)

#  End
Example 4.13
 (a) The condition of the resulting mixture is dry with dryness fraction  =   0.965
 (b) The internal diameter of the pipe (mm) =  145.96

Example 14: pg 78

In [13]:
#pg 78
#calculate the dryness fraction
print('Example 4.14');

#  aim : To estimate 
#  the dryness fraction

#  Given values
M = 1.8;#  mass of condensate, [kg]
m = .2;#  water collected, [kg]

#  solution
x = M/(M+m);#  formula for calculation of dryness fraction using seprating calorimeter
#results
print ' The dryness fraction of the steam entering seprating calorimeter is  = ',x

#  End
Example 4.14
 The dryness fraction of the steam entering seprating calorimeter is  =  0.9

Example 15: pg 80

In [14]:
#pg 80
#calculate the dryness fraction
print('Example 4.15');
import numpy
#  aim : To determine
#  the dryness fraction of the steam at 2.2 MN/m^2

#  Given values
P1 = 2.2;#  [MN/m^2]
P2 = .13;#  [MN/m^2]
t2 = 112;#  [C]
tf2 = 150;#  temperature, [C]

# solution
# from steam table, at 2.2 MN/m^2
#  saturated steam at 2 MN/m^2 Pressure
hf1 = 931;#  [kJ/kg]
hfg1 = 1870;#  [kJ/kg]
hg1 = 2801;#  [kJ/kg]

# for superheated steam
#  at .1 MN/m^2
hg2 = 2675;#  [kJ/kg]
hg2_150 = 2777;# specific enthalpy at 150 C, [kJ/kg]
tf2 = 99.6;#  saturation temperature, [C]

# at .5 MN/m^2
hg3 = 2693;#  [kJ/kg]
hg3_150 = 2773;# specific enthalpy at 150 C, [kJ/kg]
tf3 = 111.4;#  saturation temperature, [C]

Table_P_h1_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]
Table_P_h1_y=[hg2,hg3]
hg = numpy.interp(.13,Table_P_h1_x,Table_P_h1_y);#  specific entahlpy at .13 MN/m^2, [kJ/kg]

Table_P_h2_x = [.1,.5];#  where, P in MN/m^2 and h in [kJ/kg]
Table_P_h2_y =[hg2_150,hg3_150];
hg_150 = numpy.interp(.13,Table_P_h2_x,Table_P_h2_y);#  specific entahlpy at .13 MN/m^2 and 150 C, [kJ/kg]

Table_P_tf_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]
Table_P_tf_y = [tf2,tf3]
tf = numpy.interp(.13,Table_P_tf_x,Table_P_tf_y);#  saturation temperature, [C]

#  hence
h2 = hg+(hg_150-hg)/(t2-tf)/(tf2-tf);#  specific enthalpy at .13 MN/m^2 and 112 C, [kJ/kg]

# now since process is throttling so h2=h1
# and h1 = hf1+x1*hfg1, so
x1 = (h2-hf1)/hfg1;# dryness fraction
#results
print ' The dryness fraction of steam is  = ',round(x1,3)

print 'There is a calculation mistake in book so answer is not matching'

#  End
Example 4.15
 The dryness fraction of steam is  =  0.928
There is a calculation mistake in book so answer is not matching

Example 16: pg 82

In [16]:
#pg 82
#calculate the minimum dryness fraction
print('Example 4.16');

#  aim : To determine 
#  the minimum dryness fraction of steam

#  Given values
P1 = 1.8;#  testing pressure,[MN/m^2]
P2 = .11;#  pressure after throttling,[MN/m^2]

#  solution
#  from steam table
#  at .11 MN/m^2 steam is completely dry and specific enthalpy is
hg = 2680;#  [kJ/kg]

#  before throttling steam is wet, so specific enthalpy is=hf+x*hfg, where x is dryness fraction
#  from steam table
hf = 885.;#  [kJ/kg]
hfg = 1912.;#  [kJ/kg]

#  now for throttling process,specific enthalpy will same before and after
#  hence
x = (hg-hf)/hfg;
#results
print ' The minimum dryness fraction of steam is x  =  ',round(x,3)

#  End
Example 4.16
 The minimum dryness fraction of steam is x  =   0.939

Example 17: pg 83

In [17]:
#pg 83
#calculate the mass of steam, final dryness and amount of heat
print('Example 4.17');

#  aim : To determine the
#  (a) mass of steam in the vessel
#  (b) final dryness of the steam
#  (c) amount of heat transferrred during the cooling process

#  Given values
V1 = .8;#  [m^3]
P1 = 360.;#  [kN/m^2]
P2 = 200.;#  [kN/m^2]

#  solution

#  (a)
# at 360 kN/m^2
vg1 = .510;#  [m^3]
m = V1/vg1;#  mass of steam,[kg]

#  (b)
#  at 200 kN/m^2
vg2 = .885;# [m^3/kg]
#  the volume remains constant so
x = vg1/vg2;# final dryness fraction

# (c)
#  at 360 kN/m^2
h1 = 2732.9;# [kJ/kg]
#  hence
u1 = h1-P1*vg1;#  [kJ/kg]

#  at 200 kN/m^2
hf = 504.7;# [kJ/kg]
hfg=2201.6;#[kJ/kg]
#  hence
h2 = hf+x*hfg;# [kJ/kg]
#  now
u2 = h2-P2*vg1;#  [kJ/kg]
#  so
del_u = u2-u1;#  [kJ/kg]
#  from the first law of thermodynamics del_U+W=Q, 
W = 0;#  because volume is constant
del_U = m*del_u;#  [kJ]
#  hence
Q = del_U;#  [kJ]
#results
print ' (a) The mass of steam in the vessel (kg) = ',round(m,3)
print ' (b) The final dryness fraction of the steam = ',round(x,3)
print ' (c) The amount of heat transferred during cooling process (kJ) = ',round(Q,1)

#  End
Example 4.17
 (a) The mass of steam in the vessel (kg) =  1.569
 (b) The final dryness fraction of the steam =  0.576
 (c) The amount of heat transferred during cooling process (kJ) =  -1377.1

Example 18: pg 84

In [18]:
#pg 84
#calculate the heat received by steam
print('Example 4.18');

#  aim : To determine
#  the heat received by the steam per kilogram

# Given values
# initial
P1 = 4;# pressure, [MN/m^2]
x1 = .95; #  dryness fraction

#  final
t2 = 350;#  temperature,[C]

#  solution

# from steam table, at 4 MN/m^2 and x1=.95
hf = 1087.4;#  [kJ/kg]
hfg = 1712.9;#  [kJ/kg]
#  hence
h1 = hf+x1*hfg;#  [kJ/kg]

#  since pressure is kept constant ant temperature is raised so at this condition
h2 = 3095;#  [kJ/kg]

#  so by energy balance
Q = h2-h1;#  Heat received,[kJ/kg]
#results
print ' The heat received by the steam (kJ/kg) = ',round(Q,1)

#  End
Example 4.18
 The heat received by the steam (kJ/kg) =  380.3

Example 19: pg 85

In [19]:
#pg 85
#calculate the condition after the given cases
print('Example 4.19');

#  aim : To determine the condition of the steam after 
#  (a) isothermal compression to half its initial volume,heat rejected
#  (b) hyperbolic compression to half its initial volume

#  Given values
V1 = .3951;#  initial volume,[m^3]
P1 = 1.5;#  initial pressure,[MN/m^2]

#  solution

#  (a)
#  from steam table, at 1.5 MN/m^2 
hf1 = 844.7;#  [kJ/kg]
hfg1 = 1945.2;#  [kJ/kg]
hg1 = 2789.9;# [kJ/kg]
vg1 = .1317;#  [m^3/kg]

#  calculation
m = V1/vg1;#  mass of steam,[kg]
vg2b = vg1/2;# given,[m^3/kg](vg2b is actual specific volume before compression)
x1 = vg2b/vg1;#  dryness fraction
h1 = m*(hf1+x1*hfg1);#  [kJ]
Q = m*x1*hfg1;#  heat loss,[kJ]
print ' (a) The Quantity of steam present (kg) = ',m
print '      Dryness fraction is  =  ',x1
print '      The enthalpy (kJ) = ',h1
print '      The heat loss (kJ) = ',Q

#  (b)
V2 = V1/2;
#  Given compression is according to the law PV=Constant,so
P2 = P1*V1/V2;#  [MN/m^2]
#  from steam table at P2
hf2 = 1008.4;# [kJ/kg]
hfg2 = 1793.9;#  [kJ/kg]
hg2 = 2802.3;#  [kJ/kg]
vg2 = .0666;#  [m^3/kg]

#  calculation
x2 = vg2b/vg2;#  dryness fraction
h2 = m*(hf2+x2*hfg2);#  [kJ]

print ' (b) The dryness fraction is  = ',round(x2,3)
print '     The enthalpy (kJ) = ',round(h2,1)

#  End
Example 4.19
 (a) The Quantity of steam present (kg) =  3.0
      Dryness fraction is  =   0.5
      The enthalpy (kJ) =  5451.9
      The heat loss (kJ) =  2917.8
 (b) The dryness fraction is  =  0.989
     The enthalpy (kJ) =  8346.3

Example 20: pg 88

In [20]:
#pg 88
#calculate the mass of steam, work transfer, change of internal energy, heat exchange
print('Example 4.20');

#  aim : To determine the
#  (a) mass of steam 
#  (b) work transfer
#  (c) change of internal energy
#  (d) heat exchange b/w the steam and surroundings

#  Given values
P1 = 2.1;#  initial pressure,[MN/m**2]
x1 = .9;#  dryness fraction
V1 = .427;#  initial volume,[m**3]
P2 = .7;#  final pressure,[MN/m**2]
#  Given process is polytropic with
n = 1.25; # polytropic index

#  solution
#  from steam table

#  at 2.1 MN/m**2
hf1 = 920.0;#  [kJ/kg]
hfg1=1878.2;#  [kJ/kg]
hg1=2798.2;#  [kJ/kg]
vg1 = .0949;#  [m**3/kg]

#  and at .7 MN/m**2
hf2 = 697.1;#  [kJ/kg]
hfg2 = 2064.9;#  [kJ/kg]
hg2 = 2762.0;# [kJ/kg]
vg2 = .273;#  [m**3/kg]

#calculations and results
#  (a)
v1 = x1*vg1;#  [m**3/kg]
m = V1/v1;#  [kg]
print ' (a) The mass of steam present (kg) = ',round(m)

#  (b)
#  for polytropic process
v2 = v1*(P1/P2)**(1/n);#  [m**3/kg]

x2 = v2/vg2;#  final dryness fraction
#  work transfer
W = m*(P1*v1-P2*v2)*10**3/(n-1);#  [kJ]
print ' (b) The work transfer (kJ) = ',round(W)

#  (c)
#  initial
h1 = hf1+x1*hfg1;#  [kJ/kg]
u1 = h1-P1*v1*10**3;#  [kJ/kg]

#  final
h2 = hf2+x2*hfg2;#  [kJ/kg]
u2 = h2-P2*v2*10**3;#  [kJ/kg]

del_U = m*(u2-u1);#  [kJ]
print ' (c) The change in internal energy (kJ) = ',round(del_U)
if(del_U<0):
    print('since del_U<0,so this is loss of internal energy')
else:
    print('since del_U>0,so this is gain in internal energy')


#  (d)
Q = del_U+W;#  [kJ]
print ' (d) The heat exchange between the steam and surrounding (kJ) = ',round(Q,1)
if(Q<0):
    print('since Q<0,so this is loss of heat energy to surrounding')
else:
    print('since Q>0,so this is gain in heat energy to the steam')

print 'there are minor vairations in the values reported in the book due to rounding off error'

#  End
Example 4.20
 (a) The mass of steam present (kg) =  5.0
 (b) The work transfer (kJ) =  708.0
 (c) The change in internal energy (kJ) =  -1611.0
since del_U<0,so this is loss of internal energy
 (d) The heat exchange between the steam and surrounding (kJ) =  -903.0
since Q<0,so this is loss of heat energy to surrounding
there are minor vairations in the values reported in the book due to rounding off error

Example 21: pg 91

In [21]:
#pg 91
#calculate the volume, dryness fraction and change in internal energy
print('Example 4.21');

#  aim : To determine the 
#  (a) volume occupied by steam
#  (b)(1) final dryness fraction of steam
#       (2) Change of internal energy during expansion

#  (a)
#  Given values
P1 = .85;#  [mN/m**2]
x1 = .97;

#  solution
#  from steam table, at .85 MN/m**2,
vg1 = .2268;#  [m**3/kg]
#  hence
v1 = x1*vg1;#  [m**3/kg]
print ' (a) The volume occupied by 1 kg of steam (m^3/kg) = ',round(v1,2)

# (b)(1)
P2 = .17;#  [MN/m**2]
# since process is polytropic process with
n = 1.13; #  polytropic index
# hence
v2 = v1*(P1/P2)**(1/n);# [m**3/kg]

# from steam table at .17 MN/m**2
vg2 = 1.031;# [m**3/kg]
# steam is wet so
x2 = v2/vg2;#  final dryness fraction
print ' (b)(1) The final dryness fraction of the steam = ',round(x2,3)

#  (2)
W = (P1*v1-P2*v2)*10**3/(n-1);# [kJ/kg]
#  since process is adiabatic, so
del_u = -W;# [kJ/kg]
print '    (2) The change in internal energy of the steam during expansion is  (kJ/kg)  (This is a loss of internal energy) = ',round(del_u)
print' There are minor variation in the answer due to rounding off error'

#  End
Example 4.21
 (a) The volume occupied by 1 kg of steam (m^3/kg) =  0.22
 (b)(1) The final dryness fraction of the steam =  0.887
    (2) The change in internal energy of the steam during expansion is  (kJ/kg)  (This is a loss of internal energy) =  -243.0
 There are minor variation in the answer due to rounding off error