summaryrefslogtreecommitdiff
path: root/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb')
-rw-r--r--Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb1296
1 files changed, 1296 insertions, 0 deletions
diff --git a/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb
new file mode 100644
index 00000000..72f19875
--- /dev/null
+++ b/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter4_1.ipynb
@@ -0,0 +1,1296 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 4: Steam and two phase systems"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 1: pg 61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.1\n",
+ "The specific liquid enthalpy (kJ/kg) = 640.1\n",
+ "The specific enthalpy of evaporation (kJ/kg) = 2107.4\n",
+ "The specific enthalpy of dry saturated steam (kJ/kg) = 2747.5\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 61\n",
+ "#calculate the specific liquid enthalpy of evaporation and dry saturated steam\n",
+ "print('Example 4.1');\n",
+ "\n",
+ "# aim : To determine\n",
+ "# the enthalpy\n",
+ "\n",
+ "# Given values\n",
+ "P = .50;# Pressure, [MN/m^2]\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "# From steam tables, at given pressure\n",
+ "hf = 640.1;# specific liquid enthalpy ,[kJ/kg]\n",
+ "hfg = 2107.4;# specific enthalpy of evaporation ,[kJ/kg]\n",
+ "hg = 2747.5; # specific enthalpy of dry saturated steam ,[kJ/kg]\n",
+ "tf = 151.8; # saturation temperature,[C]\n",
+ "#results\n",
+ "print 'The specific liquid enthalpy (kJ/kg) = ',hf\n",
+ "print 'The specific enthalpy of evaporation (kJ/kg) = ',hfg\n",
+ "print 'The specific enthalpy of dry saturated steam (kJ/kg) = ',hg\n",
+ "\t\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 2: pg 61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.2\n",
+ "The Saturation temperature (C) = 212.4\n",
+ "The Specific liquid enthalpy (kJ/kg) = 908.6\n",
+ "The Specific enthalpy of evaporation (kJ/kg) = 1888.6\n",
+ "The Specific enthalpy of dry saturated steam (kJ/kg) = 2797.2\n",
+ "The answers in the textbook are a bit different due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 61\n",
+ "#calculate the saturation temperature, specific enthalpy\n",
+ "print('Example 4.2');\n",
+ "import numpy\n",
+ "# aim : To determine \n",
+ "# saturation temperature and enthalpy\n",
+ "\n",
+ "# Given values\n",
+ "P = 2.04;# pressure, [MN/m^2]\n",
+ "\n",
+ "# solution\n",
+ "# 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\n",
+ "\n",
+ "# calculation of saturation temperature and results\n",
+ "# from steam table\n",
+ "# P in [MN/m^2] and tf in [C]\n",
+ "Table_P_tf_x=[2.1,2.0]\n",
+ "Table_P_tf_y=[214.9,212.4]\n",
+ "# using interpolation\n",
+ "tf = numpy.interp(P,Table_P_tf_x,Table_P_tf_y);# saturation temperature at given condition\n",
+ "print 'The Saturation temperature (C) = ',tf\n",
+ "\n",
+ "# calculation of specific liquid enthalpy\n",
+ "# from steam table\n",
+ "Table_P_hf_y = [920.0,908.6];# P in [MN/m^2] and hf in [kJ/kg]\n",
+ "Table_P_hf_x=[2.1,2.0]\n",
+ "# using interpolation\n",
+ "hf = numpy.interp(P,Table_P_hf_x,Table_P_hf_y); # enthalpy at given condition, [kJ/kg]\n",
+ "print 'The Specific liquid enthalpy (kJ/kg) = ',hf\n",
+ "\n",
+ "# calculation of specific enthalpy of evaporation\n",
+ "# from steam table\n",
+ "Table_P_hfg_x = [2.1,2.0];# P in [MN/m^2] and hfg in [kJ/kg]\n",
+ "Table_P_hfg_y=[1878.2,1888.6]\n",
+ "# using interpolation \n",
+ "hfg = numpy.interp(P,Table_P_hfg_x,Table_P_hfg_y); # enthalpy at given condition, [kJ/kg]\n",
+ "print 'The Specific enthalpy of evaporation (kJ/kg) = ',hfg\n",
+ "\n",
+ "# calculation of specific enthalpy of dry saturated steam\n",
+ "# from steam table\n",
+ "Table_P_hg_y = [2798.2,2797.2];#P in [MN/m^2] and hg in [kJ/kg]\n",
+ "Table_P_hg_x=[2.1,2.0]\n",
+ "# using interpolation\n",
+ "hg = numpy.interp(P,Table_P_hg_x,Table_P_hg_y); # enthalpy at given condition, [kJ/kg]\n",
+ "print 'The Specific enthalpy of dry saturated steam (kJ/kg) = ',hg\n",
+ "\n",
+ "print'The answers in the textbook are a bit different due to rounding off error'\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3: pg 63"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.3\n",
+ "The specific enthalpy of steam at 2 MN/m^2 with temperature 250 C (kJ/kg) = 2902\n",
+ "The specific enthalpy at given T and P by alternative path (kJ/kg) = 2875.9\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 63\n",
+ "#calculate the specific enthalpy\n",
+ "print('Example 4.3');\n",
+ "\n",
+ "# aim : To determine\n",
+ "# the specific enthalpy\n",
+ "\n",
+ "# given values\n",
+ "P = 2; # pressure ,[MN/m^2]\n",
+ "t = 250; # Temperature, [C]\n",
+ "cp = 2.0934; # average value of specific heat capacity, [kJ/kg K]\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "# looking up steam table it shows that at given pressure saturation temperature is 212.4 C,so\n",
+ "tf = 212.4; # [C]\n",
+ "# hence,\n",
+ "Degree_of_superheat = t-tf;# [C]\n",
+ "# from table at given temperature 250 C\n",
+ "h = 2902; # specific enthalpy of steam at 250 C ,[kJ/kg]\n",
+ "\n",
+ "# Also from steam table enthalpy at saturation temperature is\n",
+ "hf = 2797.2 ;# [kJ/kg]\n",
+ "# so enthalpy at given temperature is\n",
+ "h2 = hf+cp*(t-tf);# [kJ/kg]\n",
+ "#results\n",
+ "print 'The specific enthalpy of steam at 2 MN/m^2 with temperature 250 C (kJ/kg) = ',h\n",
+ "print 'The specific enthalpy at given T and P by alternative path (kJ/kg) = ',round(h2,1)\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 4: pg 63"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.4\n",
+ " The estimated specific enthalpy (kJ/kg) = 3002.08\n",
+ " The accurate specific enthalpy of steam at pressure of 2.5 MN/m^2 and with a temperature 320 C (kJ/kg) = 3025.0\n",
+ " The answer is a bit different from textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 63\n",
+ "#calculate the estimated and accurate specific enthalpy\n",
+ "print('Example 4.4');\n",
+ "import numpy\n",
+ "# aim : To determine\n",
+ "# the specific enthalpy of steam\n",
+ "\n",
+ "# Given values\n",
+ "P = 2.5;# pressure, [MN/m^2]\n",
+ "t = 320; # temperature, [C]\n",
+ "\n",
+ "# solution\n",
+ "# from steam table at given condition the saturation temperature of steam is 223.9 C, therefore steam is superheated\n",
+ "tf = 223.9;# [C]\n",
+ "\n",
+ "# first let's calculate estimated enthalpy\n",
+ "# again from steam table \n",
+ "\n",
+ "hg = 2800.9;# enthalpy at saturation temp, [kJ/kg]\n",
+ "cp =2.0934;# specific heat capacity of steam,[kJ/kg K]\n",
+ "\n",
+ "# so enthalpy at given condition is\n",
+ "h = hg+cp*(t-tf);# [kJ/kg]\n",
+ "print ' The estimated specific enthalpy (kJ/kg) = ',round(h,2)\n",
+ "\n",
+ "# calculation of accurate specific enthalpy\n",
+ "# we need double interpolation for this\n",
+ "\n",
+ "# first interpolation w.r.t. to temperature\n",
+ "# At 2 MN/m^2\n",
+ "Table_t_h_x = [325.,300.];# where, t in [C] and h in [kJ/kg]\n",
+ "Table_t_h_y=[3083.,3025.]\n",
+ "h1 = numpy.interp(320.,Table_t_h_x,Table_t_h_y); # [kJ/kg]\n",
+ "\n",
+ "# at 4 MN/m^2\n",
+ "Table_t_h_x = [325.,300.]; # t in [C] and h in [kJ/kg]\n",
+ "Table_t_h_y=[3031.,2962.]\n",
+ "h2 = numpy.interp(320.,Table_t_h_x,Table_t_h_y); # [kJ/kg]\n",
+ "\n",
+ "# now interpolation w.r.t. pressure\n",
+ "Table_P_h_x = [4.,2.]; # where P in NM/m^2 and h1,h2 in kJ/kg\n",
+ "Table_P_h_y=[h2,h1]\n",
+ "h = numpy.interp(2.5,Table_P_h_x,Table_P_h_y);# [kJ/kg]\n",
+ "print ' The accurate specific enthalpy of steam at pressure of 2.5 MN/m^2 and with a temperature 320 C (kJ/kg) = ',h\n",
+ "\n",
+ "# End\n",
+ "print ' The answer is a bit different from textbook due to rounding off error'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 5: pg 65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.5\n",
+ " The specific enthalpy of wet steam (kJ/kg) = 2317.605\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 65\n",
+ "#calculate the specific enthalpy\n",
+ "print('Example 4.5');\n",
+ "\n",
+ "# aim : To determine \n",
+ "# the specific enthalpy \n",
+ "\n",
+ "# Given values\n",
+ "P = 70; # pressure, [kn/m^2]\n",
+ "x = .85; # Dryness fraction\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "# from steam table, at given pressure \n",
+ "hf = 376.8;# [kJ/kg]\n",
+ "hfg = 2283.3;# [kJ/kg]\n",
+ "\n",
+ "# now using equation [2]\n",
+ "h = hf+x*hfg;# specific enthalpy of wet steam,[kJ/kg]\n",
+ "\n",
+ "#results\n",
+ "print ' The specific enthalpy of wet steam (kJ/kg) = ',h\n",
+ "\n",
+ "# There is minor variation in the book's answer\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 8: pg 68"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.8\n",
+ "The specific volume of wet steam (m^3/kg) = 0.14121\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 68\n",
+ "#calculate the specific volume\n",
+ "print('Example 4.8');\n",
+ "\n",
+ "# aim : To determine \n",
+ "# the specific volume of wet steam\n",
+ "\n",
+ "# Given values\n",
+ "P = 1.25; # pressure, [MN/m^2]\n",
+ "x = .9; # dry fraction\n",
+ "\n",
+ "# solution\n",
+ "# from steam table at given pressure\n",
+ "vg = .1569;# [m^3/kg]\n",
+ "# hence\n",
+ "v = x*vg; # [m^3/kg]\n",
+ "#results\n",
+ "print 'The specific volume of wet steam (m^3/kg) = ',v\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 9: pg 69"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.9\n",
+ " The specific volume of steam at pressure of 2 MN/m^2 and with temperature 325 C (m^3/kg) = 0.1321\n",
+ " The degree of superheat (C) = 112.6\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 69\n",
+ "#calculate the specific volume and degree of superheat\n",
+ "print('Example 4.9');\n",
+ "\n",
+ "# aim : To determine\n",
+ "# the specific volume \n",
+ "\n",
+ "# Given values\n",
+ "t = 325; # temperature, [C]\n",
+ "P = 2; # pressure, [MN/m^2]\n",
+ "\n",
+ "# solution\n",
+ "# from steam table at given t and P\n",
+ "vf = .1321; # [m^3/kg]\n",
+ "tf = 212.4; # saturation temperature, [C]\n",
+ "doh= t-tf; # degree of superheat, [C]\n",
+ "#results\n",
+ "print ' The specific volume of steam at pressure of 2 MN/m^2 and with temperature 325 C (m^3/kg) = ',vf\n",
+ "print ' The degree of superheat (C) = ',doh\n",
+ "\n",
+ "# End \n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 10: pg 69"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example .10\n",
+ " (a) The mass of steam entering the heater (kg/h) = 81.8\n",
+ " (b) The mass of water entering the heater (kg/h) = 628.23\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 69\n",
+ "#calculate the mass of steam and water\n",
+ "print('Example .10');\n",
+ "import math\n",
+ "# aim : To determine\n",
+ "# (a) the mass of steam entering the heater\n",
+ "# (b) the mass of water entering the heater\n",
+ "\n",
+ "# Given values\n",
+ "x = .95;# Dryness fraction\n",
+ "P = .7;# pressure,[MN/m**2]\n",
+ "d = 25;# internal diameter of heater,[mm]\n",
+ "C = 12; # steam velocity in the pipe,[m/s]\n",
+ "\n",
+ "# solution\n",
+ "# from steam table at .7 MN/m**2 pressure\n",
+ "hf = 697.1;# [kJ/kg]\n",
+ "hfg = 2064.9;# [kJ/kg]\n",
+ "hg = 2762.0; # [kJ/kg]\n",
+ "vg = .273; # [m**3/kg]\n",
+ "\n",
+ "# (a)\n",
+ "v = x*vg; # [m**3/kg]\n",
+ "ms_dot = math.pi*(d*10**-3)**2*C*3600/(4*v);# mass of steam entering, [kg/h]\n",
+ "\n",
+ "# (b)\n",
+ "h = hf+x*hfg;# specific enthalpy of steam entering heater,[kJ/kg]\n",
+ "# again from steam tables\n",
+ "hf1 = 376.8;# [kJ/kg] at 90 C\n",
+ "hf2 = 79.8;# [kJ/kg] at 19 C\n",
+ "\n",
+ "# using energy balance,mw_dot*(hf1-hf2)=ms_dot*(h-hf1)\n",
+ "mw_dot = ms_dot*(h-hf1)/(hf1-hf2);# mass of water entering to heater,[kg/h]\n",
+ "#results\n",
+ "print ' (a) The mass of steam entering the heater (kg/h) = ',round(ms_dot,1)\n",
+ "print ' (b) The mass of water entering the heater (kg/h) = ',round(mw_dot,2)\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 11: pg 72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.11\n",
+ " The change in internal energy (kJ) = -486.753\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 72\n",
+ "#calculate the change in internal energy\n",
+ "print('Example 4.11');\n",
+ "\n",
+ "# aim: To determine\n",
+ "# the change of internal energy\n",
+ "\n",
+ "# Given values\n",
+ "m = 1.5;# mass of steam,[kg]\n",
+ "P1 = 1;# initial pressure, [MN/m**2]\n",
+ "t = 225;# temperature, [C]\n",
+ "P2 = .28;# final pressure, [MN/m**2]\n",
+ "x = .9;# dryness fraction of steam at P2\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "# from steam table at P1\n",
+ "h1 = 2886;# [kJ/kg]\n",
+ "v1 = .2198; # [m**3/kg]\n",
+ "# hence\n",
+ "u1 = h1-P1*v1*10**3;# internal energy [kJ/kg]\n",
+ "\n",
+ "# at P2\n",
+ "hf2 = 551.4;# [kJ/kg]\n",
+ "hfg2 = 2170.1;# [kJ/kg]\n",
+ "vg2 = .646; # [m**3/kg]\n",
+ "# so\n",
+ "h2 = hf2+x*hfg2;# [kj/kg]\n",
+ "v2 = x*vg2;# [m**3/kg]\n",
+ "\n",
+ "# now\n",
+ "u2 = h2-P2*v2*10**3;# [kJ/kg]\n",
+ "\n",
+ "# hence change in specific internal energy is\n",
+ "del_u = u2-u1;# [kJ/kg]\n",
+ "\n",
+ "del_u = m*del_u;# [kJ];\n",
+ "#results\n",
+ "print ' The change in internal energy (kJ) = ',del_u\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12: pg 74"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.12\n",
+ " Dryness fraction of steam after throttling is = 0.787\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 74\n",
+ "#calculate the dryness fraction\n",
+ "print('Example 4.12');\n",
+ "\n",
+ "# aim : To determine \n",
+ "# the dryness fraction of steam after throttling\n",
+ "\n",
+ "# given values\n",
+ "P1 = 1.4;# pressure before throttling, [MN/m^2]\n",
+ "x1 = .7;# dryness fraction before throttling\n",
+ "P2 = .11;# pressure after throttling, [MN/m^2]\n",
+ "\n",
+ "# solution\n",
+ "# from steam table\n",
+ "hf1 = 830.1;# [kJ/kg]\n",
+ "hfg1 = 1957.7;# [kJ/kg]\n",
+ "h1 = hf1 + x1*hfg1; # [kJ/kg]\n",
+ "\n",
+ "hf2 = 428.8;# [kJ/kg]\n",
+ "hfg2 = 2250.8;# [kJ/kg]\n",
+ "\n",
+ "# now for throttling,\n",
+ "# hf1+x1*hfg1=hf2+x2*hfg2; where x2 is dryness fraction after throttling\n",
+ "\n",
+ "x2=(h1-hf2)/hfg2; # final dryness fraction\n",
+ "#results\n",
+ "print ' Dryness fraction of steam after throttling is = ',round(x2,3)\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 13: pg 75"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.13\n",
+ " (a) The condition of the resulting mixture is dry with dryness fraction = 0.965\n",
+ " (b) The internal diameter of the pipe (mm) = 145.96\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 75\n",
+ "#calculate the dryness fraction and internal diameter\n",
+ "print('Example 4.13');\n",
+ "import math\n",
+ "# aim : To determine \n",
+ "# the dryness fraction of steam \n",
+ "# and the internal diameter of the pipe\n",
+ "\n",
+ "# Given values\n",
+ "\n",
+ "# steam1\n",
+ "P1 = 2.;# pressure before throttling, [MN/m^2]\n",
+ "t = 300.;# temperature,[C]\n",
+ "ms1_dot = 2.;# steam flow rate, [kg/s]\n",
+ "P2 = 800.;# pressure after throttling, [kN/m^2]\n",
+ "\n",
+ "# steam2\n",
+ "P = 800.;# pressure, [N/m^2]\n",
+ "x2 = .9;# dryness fraction\n",
+ "ms2_dot = 5; # [kg/s]\n",
+ "\n",
+ "# solution\n",
+ "# (a)\n",
+ "# from steam table specific enthalpy of steam1 before throttling is\n",
+ "hf1 = 3025;# [kJ/kg]\n",
+ "# for throttling process specific enthalpy will same so final specific enthalpy of steam1 is\n",
+ "hf2 = hf1;\n",
+ "# hence\n",
+ "h1 = ms1_dot*hf2;# [kJ/s]\n",
+ "\n",
+ "# calculation of specific enthalpy of steam2\n",
+ "hf2 = 720.9;# [kJ/kg]\n",
+ "hfg2 = 2046.5;# [kJ/kg]\n",
+ "# hence\n",
+ "h2 = hf2+x2*hfg2;# specific enthalpy, [kJ/kg]\n",
+ "h2 = ms2_dot*h2;# total enthalpy, [kJ/s]\n",
+ "\n",
+ "# after mixing\n",
+ "m_dot = ms1_dot+ms2_dot;# total mass of mixture,[kg/s]\n",
+ "h = h1+h2;# Total enthalpy of the mixture,[kJ/s]\n",
+ "h = h/7;# [kJ/kg]\n",
+ "\n",
+ "# At pressure 800 N/m^2 \n",
+ "hf = 720.9;# [kJ/kg]\n",
+ "hfg = 2046.5;# [kJ/kg]\n",
+ "# so total enthalpy is,hf+x*hfg, where x is dryness fraction of mixture and which is equal to h\n",
+ "# hence\n",
+ "x = (h-hf)/hfg;# dryness fraction after mixing\n",
+ "\n",
+ "# (b)\n",
+ "# Given\n",
+ "C = 15;# velocity, [m/s]\n",
+ "# from steam table\n",
+ "v = .1255;# [m^/kg]\n",
+ "A = ms1_dot*v/C;# area, [m^2]\n",
+ "# using ms1_dot = A*C/v, where A is cross section area in m^2 and\n",
+ "# A = %pi*d^2/4, where d is diameter of the pipe \n",
+ "\n",
+ "# calculation of d\n",
+ "d = math.sqrt(4*A/math.pi); # diameter, [m]\n",
+ "#results\n",
+ "print ' (a) The condition of the resulting mixture is dry with dryness fraction = ',round(x,3)\n",
+ "print ' (b) The internal diameter of the pipe (mm) = ',round(d*1000,2)\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 14: pg 78"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.14\n",
+ " The dryness fraction of the steam entering seprating calorimeter is = 0.9\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 78\n",
+ "#calculate the dryness fraction\n",
+ "print('Example 4.14');\n",
+ "\n",
+ "# aim : To estimate \n",
+ "# the dryness fraction\n",
+ "\n",
+ "# Given values\n",
+ "M = 1.8;# mass of condensate, [kg]\n",
+ "m = .2;# water collected, [kg]\n",
+ "\n",
+ "# solution\n",
+ "x = M/(M+m);# formula for calculation of dryness fraction using seprating calorimeter\n",
+ "#results\n",
+ "print ' The dryness fraction of the steam entering seprating calorimeter is = ',x\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 15: pg 80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.15\n",
+ " The dryness fraction of steam is = 0.928\n",
+ "There is a calculation mistake in book so answer is not matching\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 80\n",
+ "#calculate the dryness fraction\n",
+ "print('Example 4.15');\n",
+ "import numpy\n",
+ "# aim : To determine\n",
+ "# the dryness fraction of the steam at 2.2 MN/m^2\n",
+ "\n",
+ "# Given values\n",
+ "P1 = 2.2;# [MN/m^2]\n",
+ "P2 = .13;# [MN/m^2]\n",
+ "t2 = 112;# [C]\n",
+ "tf2 = 150;# temperature, [C]\n",
+ "\n",
+ "# solution\n",
+ "# from steam table, at 2.2 MN/m^2\n",
+ "# saturated steam at 2 MN/m^2 Pressure\n",
+ "hf1 = 931;# [kJ/kg]\n",
+ "hfg1 = 1870;# [kJ/kg]\n",
+ "hg1 = 2801;# [kJ/kg]\n",
+ "\n",
+ "# for superheated steam\n",
+ "# at .1 MN/m^2\n",
+ "hg2 = 2675;# [kJ/kg]\n",
+ "hg2_150 = 2777;# specific enthalpy at 150 C, [kJ/kg]\n",
+ "tf2 = 99.6;# saturation temperature, [C]\n",
+ "\n",
+ "# at .5 MN/m^2\n",
+ "hg3 = 2693;# [kJ/kg]\n",
+ "hg3_150 = 2773;# specific enthalpy at 150 C, [kJ/kg]\n",
+ "tf3 = 111.4;# saturation temperature, [C]\n",
+ "\n",
+ "Table_P_h1_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]\n",
+ "Table_P_h1_y=[hg2,hg3]\n",
+ "hg = numpy.interp(.13,Table_P_h1_x,Table_P_h1_y);# specific entahlpy at .13 MN/m^2, [kJ/kg]\n",
+ "\n",
+ "Table_P_h2_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]\n",
+ "Table_P_h2_y =[hg2_150,hg3_150];\n",
+ "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]\n",
+ "\n",
+ "Table_P_tf_x = [.1,.5];# where, P in MN/m^2 and h in [kJ/kg]\n",
+ "Table_P_tf_y = [tf2,tf3]\n",
+ "tf = numpy.interp(.13,Table_P_tf_x,Table_P_tf_y);# saturation temperature, [C]\n",
+ "\n",
+ "# hence\n",
+ "h2 = hg+(hg_150-hg)/(t2-tf)/(tf2-tf);# specific enthalpy at .13 MN/m^2 and 112 C, [kJ/kg]\n",
+ "\n",
+ "# now since process is throttling so h2=h1\n",
+ "# and h1 = hf1+x1*hfg1, so\n",
+ "x1 = (h2-hf1)/hfg1;# dryness fraction\n",
+ "#results\n",
+ "print ' The dryness fraction of steam is = ',round(x1,3)\n",
+ "\n",
+ "print 'There is a calculation mistake in book so answer is not matching'\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 16: pg 82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.16\n",
+ " The minimum dryness fraction of steam is x = 0.939\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 82\n",
+ "#calculate the minimum dryness fraction\n",
+ "print('Example 4.16');\n",
+ "\n",
+ "# aim : To determine \n",
+ "# the minimum dryness fraction of steam\n",
+ "\n",
+ "# Given values\n",
+ "P1 = 1.8;# testing pressure,[MN/m^2]\n",
+ "P2 = .11;# pressure after throttling,[MN/m^2]\n",
+ "\n",
+ "# solution\n",
+ "# from steam table\n",
+ "# at .11 MN/m^2 steam is completely dry and specific enthalpy is\n",
+ "hg = 2680;# [kJ/kg]\n",
+ "\n",
+ "# before throttling steam is wet, so specific enthalpy is=hf+x*hfg, where x is dryness fraction\n",
+ "# from steam table\n",
+ "hf = 885.;# [kJ/kg]\n",
+ "hfg = 1912.;# [kJ/kg]\n",
+ "\n",
+ "# now for throttling process,specific enthalpy will same before and after\n",
+ "# hence\n",
+ "x = (hg-hf)/hfg;\n",
+ "#results\n",
+ "print ' The minimum dryness fraction of steam is x = ',round(x,3)\n",
+ "\n",
+ "# End"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 17: pg 83"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.17\n",
+ " (a) The mass of steam in the vessel (kg) = 1.569\n",
+ " (b) The final dryness fraction of the steam = 0.576\n",
+ " (c) The amount of heat transferred during cooling process (kJ) = -1377.1\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 83\n",
+ "#calculate the mass of steam, final dryness and amount of heat\n",
+ "print('Example 4.17');\n",
+ "\n",
+ "# aim : To determine the\n",
+ "# (a) mass of steam in the vessel\n",
+ "# (b) final dryness of the steam\n",
+ "# (c) amount of heat transferrred during the cooling process\n",
+ "\n",
+ "# Given values\n",
+ "V1 = .8;# [m^3]\n",
+ "P1 = 360.;# [kN/m^2]\n",
+ "P2 = 200.;# [kN/m^2]\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "# (a)\n",
+ "# at 360 kN/m^2\n",
+ "vg1 = .510;# [m^3]\n",
+ "m = V1/vg1;# mass of steam,[kg]\n",
+ "\n",
+ "# (b)\n",
+ "# at 200 kN/m^2\n",
+ "vg2 = .885;# [m^3/kg]\n",
+ "# the volume remains constant so\n",
+ "x = vg1/vg2;# final dryness fraction\n",
+ "\n",
+ "# (c)\n",
+ "# at 360 kN/m^2\n",
+ "h1 = 2732.9;# [kJ/kg]\n",
+ "# hence\n",
+ "u1 = h1-P1*vg1;# [kJ/kg]\n",
+ "\n",
+ "# at 200 kN/m^2\n",
+ "hf = 504.7;# [kJ/kg]\n",
+ "hfg=2201.6;#[kJ/kg]\n",
+ "# hence\n",
+ "h2 = hf+x*hfg;# [kJ/kg]\n",
+ "# now\n",
+ "u2 = h2-P2*vg1;# [kJ/kg]\n",
+ "# so\n",
+ "del_u = u2-u1;# [kJ/kg]\n",
+ "# from the first law of thermodynamics del_U+W=Q, \n",
+ "W = 0;# because volume is constant\n",
+ "del_U = m*del_u;# [kJ]\n",
+ "# hence\n",
+ "Q = del_U;# [kJ]\n",
+ "#results\n",
+ "print ' (a) The mass of steam in the vessel (kg) = ',round(m,3)\n",
+ "print ' (b) The final dryness fraction of the steam = ',round(x,3)\n",
+ "print ' (c) The amount of heat transferred during cooling process (kJ) = ',round(Q,1)\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 18: pg 84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.18\n",
+ " The heat received by the steam (kJ/kg) = 380.3\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 84\n",
+ "#calculate the heat received by steam\n",
+ "print('Example 4.18');\n",
+ "\n",
+ "# aim : To determine\n",
+ "# the heat received by the steam per kilogram\n",
+ "\n",
+ "# Given values\n",
+ "# initial\n",
+ "P1 = 4;# pressure, [MN/m^2]\n",
+ "x1 = .95; # dryness fraction\n",
+ "\n",
+ "# final\n",
+ "t2 = 350;# temperature,[C]\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "# from steam table, at 4 MN/m^2 and x1=.95\n",
+ "hf = 1087.4;# [kJ/kg]\n",
+ "hfg = 1712.9;# [kJ/kg]\n",
+ "# hence\n",
+ "h1 = hf+x1*hfg;# [kJ/kg]\n",
+ "\n",
+ "# since pressure is kept constant ant temperature is raised so at this condition\n",
+ "h2 = 3095;# [kJ/kg]\n",
+ "\n",
+ "# so by energy balance\n",
+ "Q = h2-h1;# Heat received,[kJ/kg]\n",
+ "#results\n",
+ "print ' The heat received by the steam (kJ/kg) = ',round(Q,1)\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 19: pg 85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.19\n",
+ " (a) The Quantity of steam present (kg) = 3.0\n",
+ " Dryness fraction is = 0.5\n",
+ " The enthalpy (kJ) = 5451.9\n",
+ " The heat loss (kJ) = 2917.8\n",
+ " (b) The dryness fraction is = 0.989\n",
+ " The enthalpy (kJ) = 8346.3\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 85\n",
+ "#calculate the condition after the given cases\n",
+ "print('Example 4.19');\n",
+ "\n",
+ "# aim : To determine the condition of the steam after \n",
+ "# (a) isothermal compression to half its initial volume,heat rejected\n",
+ "# (b) hyperbolic compression to half its initial volume\n",
+ "\n",
+ "# Given values\n",
+ "V1 = .3951;# initial volume,[m^3]\n",
+ "P1 = 1.5;# initial pressure,[MN/m^2]\n",
+ "\n",
+ "# solution\n",
+ "\n",
+ "# (a)\n",
+ "# from steam table, at 1.5 MN/m^2 \n",
+ "hf1 = 844.7;# [kJ/kg]\n",
+ "hfg1 = 1945.2;# [kJ/kg]\n",
+ "hg1 = 2789.9;# [kJ/kg]\n",
+ "vg1 = .1317;# [m^3/kg]\n",
+ "\n",
+ "# calculation\n",
+ "m = V1/vg1;# mass of steam,[kg]\n",
+ "vg2b = vg1/2;# given,[m^3/kg](vg2b is actual specific volume before compression)\n",
+ "x1 = vg2b/vg1;# dryness fraction\n",
+ "h1 = m*(hf1+x1*hfg1);# [kJ]\n",
+ "Q = m*x1*hfg1;# heat loss,[kJ]\n",
+ "print ' (a) The Quantity of steam present (kg) = ',m\n",
+ "print ' Dryness fraction is = ',x1\n",
+ "print ' The enthalpy (kJ) = ',h1\n",
+ "print ' The heat loss (kJ) = ',Q\n",
+ "\n",
+ "# (b)\n",
+ "V2 = V1/2;\n",
+ "# Given compression is according to the law PV=Constant,so\n",
+ "P2 = P1*V1/V2;# [MN/m^2]\n",
+ "# from steam table at P2\n",
+ "hf2 = 1008.4;# [kJ/kg]\n",
+ "hfg2 = 1793.9;# [kJ/kg]\n",
+ "hg2 = 2802.3;# [kJ/kg]\n",
+ "vg2 = .0666;# [m^3/kg]\n",
+ "\n",
+ "# calculation\n",
+ "x2 = vg2b/vg2;# dryness fraction\n",
+ "h2 = m*(hf2+x2*hfg2);# [kJ]\n",
+ "\n",
+ "print ' (b) The dryness fraction is = ',round(x2,3)\n",
+ "print ' The enthalpy (kJ) = ',round(h2,1)\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 20: pg 88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.20\n",
+ " (a) The mass of steam present (kg) = 5.0\n",
+ " (b) The work transfer (kJ) = 708.0\n",
+ " (c) The change in internal energy (kJ) = -1611.0\n",
+ "since del_U<0,so this is loss of internal energy\n",
+ " (d) The heat exchange between the steam and surrounding (kJ) = -903.0\n",
+ "since Q<0,so this is loss of heat energy to surrounding\n",
+ "there are minor vairations in the values reported in the book due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 88\n",
+ "#calculate the mass of steam, work transfer, change of internal energy, heat exchange\n",
+ "print('Example 4.20');\n",
+ "\n",
+ "# aim : To determine the\n",
+ "# (a) mass of steam \n",
+ "# (b) work transfer\n",
+ "# (c) change of internal energy\n",
+ "# (d) heat exchange b/w the steam and surroundings\n",
+ "\n",
+ "# Given values\n",
+ "P1 = 2.1;# initial pressure,[MN/m**2]\n",
+ "x1 = .9;# dryness fraction\n",
+ "V1 = .427;# initial volume,[m**3]\n",
+ "P2 = .7;# final pressure,[MN/m**2]\n",
+ "# Given process is polytropic with\n",
+ "n = 1.25; # polytropic index\n",
+ "\n",
+ "# solution\n",
+ "# from steam table\n",
+ "\n",
+ "# at 2.1 MN/m**2\n",
+ "hf1 = 920.0;# [kJ/kg]\n",
+ "hfg1=1878.2;# [kJ/kg]\n",
+ "hg1=2798.2;# [kJ/kg]\n",
+ "vg1 = .0949;# [m**3/kg]\n",
+ "\n",
+ "# and at .7 MN/m**2\n",
+ "hf2 = 697.1;# [kJ/kg]\n",
+ "hfg2 = 2064.9;# [kJ/kg]\n",
+ "hg2 = 2762.0;# [kJ/kg]\n",
+ "vg2 = .273;# [m**3/kg]\n",
+ "\n",
+ "#calculations and results\n",
+ "# (a)\n",
+ "v1 = x1*vg1;# [m**3/kg]\n",
+ "m = V1/v1;# [kg]\n",
+ "print ' (a) The mass of steam present (kg) = ',round(m)\n",
+ "\n",
+ "# (b)\n",
+ "# for polytropic process\n",
+ "v2 = v1*(P1/P2)**(1/n);# [m**3/kg]\n",
+ "\n",
+ "x2 = v2/vg2;# final dryness fraction\n",
+ "# work transfer\n",
+ "W = m*(P1*v1-P2*v2)*10**3/(n-1);# [kJ]\n",
+ "print ' (b) The work transfer (kJ) = ',round(W)\n",
+ "\n",
+ "# (c)\n",
+ "# initial\n",
+ "h1 = hf1+x1*hfg1;# [kJ/kg]\n",
+ "u1 = h1-P1*v1*10**3;# [kJ/kg]\n",
+ "\n",
+ "# final\n",
+ "h2 = hf2+x2*hfg2;# [kJ/kg]\n",
+ "u2 = h2-P2*v2*10**3;# [kJ/kg]\n",
+ "\n",
+ "del_U = m*(u2-u1);# [kJ]\n",
+ "print ' (c) The change in internal energy (kJ) = ',round(del_U)\n",
+ "if(del_U<0):\n",
+ " print('since del_U<0,so this is loss of internal energy')\n",
+ "else:\n",
+ " print('since del_U>0,so this is gain in internal energy')\n",
+ "\n",
+ "\n",
+ "# (d)\n",
+ "Q = del_U+W;# [kJ]\n",
+ "print ' (d) The heat exchange between the steam and surrounding (kJ) = ',round(Q,1)\n",
+ "if(Q<0):\n",
+ " print('since Q<0,so this is loss of heat energy to surrounding')\n",
+ "else:\n",
+ " print('since Q>0,so this is gain in heat energy to the steam')\n",
+ "\n",
+ "print 'there are minor vairations in the values reported in the book due to rounding off error'\n",
+ "\n",
+ "# End\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 21: pg 91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.21\n",
+ " (a) The volume occupied by 1 kg of steam (m^3/kg) = 0.22\n",
+ " (b)(1) The final dryness fraction of the steam = 0.887\n",
+ " (2) The change in internal energy of the steam during expansion is (kJ/kg) (This is a loss of internal energy) = -243.0\n",
+ " There are minor variation in the answer due to rounding off error\n"
+ ]
+ }
+ ],
+ "source": [
+ "#pg 91\n",
+ "#calculate the volume, dryness fraction and change in internal energy\n",
+ "print('Example 4.21');\n",
+ "\n",
+ "# aim : To determine the \n",
+ "# (a) volume occupied by steam\n",
+ "# (b)(1) final dryness fraction of steam\n",
+ "# (2) Change of internal energy during expansion\n",
+ "\n",
+ "# (a)\n",
+ "# Given values\n",
+ "P1 = .85;# [mN/m**2]\n",
+ "x1 = .97;\n",
+ "\n",
+ "# solution\n",
+ "# from steam table, at .85 MN/m**2,\n",
+ "vg1 = .2268;# [m**3/kg]\n",
+ "# hence\n",
+ "v1 = x1*vg1;# [m**3/kg]\n",
+ "print ' (a) The volume occupied by 1 kg of steam (m^3/kg) = ',round(v1,2)\n",
+ "\n",
+ "# (b)(1)\n",
+ "P2 = .17;# [MN/m**2]\n",
+ "# since process is polytropic process with\n",
+ "n = 1.13; # polytropic index\n",
+ "# hence\n",
+ "v2 = v1*(P1/P2)**(1/n);# [m**3/kg]\n",
+ "\n",
+ "# from steam table at .17 MN/m**2\n",
+ "vg2 = 1.031;# [m**3/kg]\n",
+ "# steam is wet so\n",
+ "x2 = v2/vg2;# final dryness fraction\n",
+ "print ' (b)(1) The final dryness fraction of the steam = ',round(x2,3)\n",
+ "\n",
+ "# (2)\n",
+ "W = (P1*v1-P2*v2)*10**3/(n-1);# [kJ/kg]\n",
+ "# since process is adiabatic, so\n",
+ "del_u = -W;# [kJ/kg]\n",
+ "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)\n",
+ "print' There are minor variation in the answer due to rounding off error'\n",
+ "\n",
+ "# End\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}