{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 5 - Gases and Single Phase systems" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1: pg 98" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.1\n", " The new pressure exerted on the air (mmHg) = 900.0\n", " The difference in the two mercury column level (mm) = 135.0\n" ] } ], "source": [ "#pg 98\n", "#calculate the new pressure and difference in two levels\n", "print('Example 5.1');\n", "\n", "# aim : To determine \n", "# new pressure exerted on the air and the difference in two mercury column level\n", "\n", "# Given values\n", "P1 = 765.;# atmospheric pressure, [mmHg]\n", "V1 = 20000.;# [mm^3]\n", "V2 = 17000.;# [mm^3]\n", "\n", "# solution\n", "\n", "# using boyle's law P*V=constant\n", "# hence\n", "P2 = P1*V1/V2;# [mmHg]\n", "\n", "del_h = P2-P1;# difference in Height of mercury column level\n", "#results\n", "print ' The new pressure exerted on the air (mmHg) = ',P2\n", "print ' The difference in the two mercury column level (mm) = ',del_h\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2: pg 99" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.2\n", " The new volume after expansion (m^3) = 0.7\n" ] } ], "source": [ "#pg 99\n", "#calculate the new volume\n", "print('Example 5.2');\n", "\n", "# aim : To determine \n", "# the new volume\n", "\n", "# Given values\n", "P1 = 300;# original pressure,[kN/m^2]\n", "V1 = .14;# original volume,[m^3]\n", "\n", "P2 = 60.;# new pressure after expansion,[kn/m^2]\n", "\n", "# solution\n", "# since temperature is constant so using boyle's law P*V=constant\n", "V2 = V1*P1/P2;# [m^3]\n", "\n", "#results\n", "print ' The new volume after expansion (m^3) = ',V2\n", "\n", "# End\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3: pg 101" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.3\n", " The new volume of the gas trapped in the apparatus (mm^3) = 12302.0\n" ] } ], "source": [ "#pg 101\n", "#calculate the new volume\n", "print('Example 5.3');\n", "\n", "# aim : To determine \n", "# the new volume of the gas\n", "\n", "# Given values\n", "V1 = 10000;# [mm^3]\n", "T1 = 273.+18;# [K]\n", "T2 = 273.+85;# [K]\n", "\n", "# solution\n", "# since pressure exerted on the apparatus is constant so using charle's law V/T=constant\n", "# hence\n", "V2 = V1*T2/T1;# [mm^3]\n", "\n", "#results\n", "print ' The new volume of the gas trapped in the apparatus (mm^3) = ',round(V2)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4: pg 102" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.4\n", " The final temperature of the gas (C) = 15.0\n" ] } ], "source": [ "#pg 102\n", "#calculate the final temperature\n", "print('Example 5.4');\n", "\n", "# aim : To determine \n", "# the final temperature\n", "\n", "# Given values\n", "V1 = .2;# original volume,[m^3]\n", "T1 = 273+303;# original temperature, [K]\n", "V2 = .1;# final volume, [m^3]\n", "\n", "# solution\n", "# since pressure is constant, so using charle's law V/T=constant\n", "# hence\n", "T2 = T1*V2/V1;# [K]\n", "t2 = T2-273;# [C]\n", "#results\n", "print ' The final temperature of the gas (C) = ',t2\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5: pg 106" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.5\n", "The new volume of the gas (m^3) = 0.0223\n" ] } ], "source": [ "#pg 106\n", "#calculate the new volume\n", "print('Example 5.5');\n", "\n", "# aim : To determine \n", "# the new volume of the gas\n", "\n", "# Given values\n", "\n", "# initial codition\n", "P1 = 140;# [kN/m^2]\n", "V1 = .1;# [m^3]\n", "T1 = 273+25;# [K]\n", "\n", "# final condition\n", "P2 = 700.;# [kN/m^2]\n", "T2 = 273.+60;# [K]\n", "\n", "# by charasteristic equation, P1*V1/T1=P2*V2/T2\n", "\n", "V2=P1*V1*T2/(T1*P2);# final volume, [m^3]\n", "\n", "#results\n", "print 'The new volume of the gas (m^3) = ',round(V2,4)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6: pg 106" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.6\n", " The mass of the gas present (kg) = 0.118\n", " The new temperature of the gas (C) = 651\n" ] } ], "source": [ "#pg 106\n", "#calculate the new temperature and mass of gas\n", "print('Example 5.6');\n", "\n", "# aim : To determine\n", "# the mas of the gas and new temperature\n", "\n", "# Given values\n", "P1 = 350;# [kN/m^2]\n", "V1 = .03;# [m^3]\n", "T1 = 273+35;# [K]\n", "R = .29;# Gas constant,[kJ/kg K]\n", "\n", "# solution\n", "# using charasteristic equation, P*V=m*R*T\n", "m = P1*V1/(R*T1);# [Kg]\n", "\n", "# Now the gas is compressed\n", "P2 = 1050;# [kN/m^2]\n", "V2 = V1;\n", "# since mass of the gas is constant so using, P*V/T=constant\n", "# hence\n", "T2 = T1*P2/P1# [K]\n", "t2 = T2-273;# [C]\n", "\n", "#results\n", "print ' The mass of the gas present (kg) = ',round(m,3)\n", "print ' The new temperature of the gas (C) = ',t2\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7: pg 111" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.7\n", " The heat transferred to the gas (kJ) = 172.8\n", " The final pressure of the gas (kN/m^2) = 338.06\n" ] } ], "source": [ "#pg 111\n", "#calculate the final pressure and heat transferred\n", "print('Example 5.7');\n", "\n", "# aim : To determine \n", "# the heat transferred to the gas and its final pressure\n", "\n", "# Given values\n", "m = 2;# masss of the gas, [kg]\n", "V1 = .7;# volume,[m^3]\n", "T1 = 273+15;# original temperature,[K]\n", "T2 = 273+135;# final temperature,[K]\n", "cv = .72;# specific heat capacity at constant volume,[kJ/kg K]\n", "R = .29;# gas law constant,[kJ/kg K]\n", "\n", "# solution\n", "Q = m*cv*(T2-T1);# Heat transferred at constant volume,[kJ]\n", "\n", "# Now,using P1*V1=m*R*T1\n", "P1 = m*R*T1/V1;# [kN/m^2]\n", "\n", "# since volume of the system is constant, so P1/T1=P2/T2\n", "# hence\n", "P2 = P1*T2/T1;# final pressure,[kN/m^2]\n", "#results\n", "print ' The heat transferred to the gas (kJ) = ',Q\n", "print ' The final pressure of the gas (kN/m^2) = ',round(P2,2)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 8: pg 114" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.8\n", " The heat transferred to the gas (kJ) = -31.84\n", " Work done on the gas during the process (kJ) = -9.19\n" ] } ], "source": [ "#pg 114\n", "#calculate the heat transferred and work done\n", "print('Example 5.8');\n", "\n", "# aim : To determine \n", "# the heat transferred from the gas and the work done on the gas\n", "\n", "# Given values\n", "P1 = 275;# pressure, [kN/m^2]\n", "V1 = .09;# volume,[m^3]\n", "T1 = 273+185;# initial temperature,[K]\n", "T2 = 273+15;# final temperature,[K]\n", "cp = 1.005;# specific heat capacity at constant pressure,[kJ/kg K]\n", "R = .29;# gas law constant,[kJ/kg K]\n", "\n", "# solution\n", "# using P1*V1=m*R*T1\n", "m = P1*V1/(R*T1);# mass of the gas\n", "\n", "# calculation of heat transfer\n", "Q = m*cp*(T2-T1);# Heat transferred at constant pressure,[kJ]\n", "\n", "# calculation of work done\n", "# Now,since pressure is constant so, V/T=constant\n", "# hence\n", "V2 = V1*T2/T1;# [m^3]\n", "\n", "W = P1*(V2-V1);# formula for work done at constant pressure,[kJ]\n", "#results\n", "print ' The heat transferred to the gas (kJ) = ',round(Q,2)\n", "print ' Work done on the gas during the process (kJ) = ',round(W,2)\n", "\n", "# End\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9: pg 117" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.9\n", " The new pressure of the gas (kN/m^2) = 1299.0\n" ] } ], "source": [ "#pg 117\n", "#calculate the new pressure\n", "print('Example 5.9');\n", "\n", "# aim : To determine\n", "# the new pressure of the gas\n", "\n", "# Given values\n", "P1 = 300.;# original pressure,[kN/m**2]\n", "T1 = 273.+25;# original temperature,[K]\n", "T2 = 273.+180;# final temperature,[K]\n", "\n", "# solution\n", "# since gas compressing according to the law,P*V**1.4=constant\n", "# so,for polytropic process,T1/T2=(P1/P2)**((n-1)/n),here n=1.4\n", "\n", "# hence\n", "P2 = P1*(T2/T1)**((1.4)/(1.4-1));# [kN/m**2]\n", "\n", "#results\n", "print ' The new pressure of the gas (kN/m^2) = ',round(P2)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 10: pg 118" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.10\n", " The new temperature of the gas (C) = 25.0\n", " there is minor error in book answer due to rounding off error\n" ] } ], "source": [ "#pg 118\n", "#calculate the new temperature\n", "print('Example 5.10');\n", "\n", "# aim : To determine\n", "# the new temperature of the gas\n", "\n", "# Given values\n", "V1 = .015;# original volume,[m**3]\n", "T1 = 273.+285;# original temperature,[K]\n", "V2 = .09;# final volume,[m**3]\n", "\n", "# solution \n", "# Given gas is following the law,P*V**1.35=constant\n", "# so process is polytropic with\n", "n = 1.35; # polytropic index\n", "\n", "# hence\n", "T2 = T1*(V1/V2)**(n-1);# final temperature, [K]\n", "\n", "t2 = T2-273;# [C]\n", "\n", "#results\n", "print ' The new temperature of the gas (C) = ',round(t2,1)\n", "\n", "print ' there is minor error in book answer due to rounding off error'\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 11: pg 119" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.11\n", " (a) The original volume of the gas (m^3) = 0.0765\n", " and The final volume of the gas (m^3) = 0.306\n", " (b) The final pressure of the gas (kN/m^2) = 231.0\n", " (c) The final temperature of the gas (C) = 92.0\n" ] } ], "source": [ "#pg 119\n", "#calculate the final pressure, temperature and volume of gas\n", "print('Example 5.11');\n", "\n", "# aim : To determine the\n", "# (a) original and final volume of the gas\n", "# (b) final pressure of the gas\n", "# (c) final temperature of the gas\n", "\n", "# Given values\n", "m = .675;# mass of the gas,[kg]\n", "P1 = 1.4;# original pressure,[MN/m**2]\n", "T1 = 273+280;# original temperature,[K]\n", "R = .287;#gas constant,[kJ/kg K]\n", "\n", "# solution and results\n", "\n", "# (a)\n", "# using characteristic equation, P1*V1=m*R*T1\n", "V1 = m*R*T1*10**-3/P1;# [m**3]\n", "# also Given \n", "V2 = 4*V1;# [m**3]\n", "print ' (a) The original volume of the gas (m^3) = ',round(V1,4)\n", "print ' and The final volume of the gas (m^3) = ',round(V2,3)\n", "\n", "# (b)\n", "# Given that gas is following the law P*V**1.3=constant\n", "# hence process is polytropic with \n", "n = 1.3; # polytropic index\n", "P2 = P1*(V1/V2)**n;# formula for polytropic process,[MN/m**2]\n", "print ' (b) The final pressure of the gas (kN/m^2) = ',round(P2*10**3)\n", "\n", "# (c)\n", "# since mass is constant so,using P*V/T=constant\n", "# hence\n", "T2 = P2*V2*T1/(P1*V1);# [K]\n", "t2 = T2-273;# [C]\n", "print ' (c) The final temperature of the gas (C) = ',round(t2)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 12: pg 120" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.12\n", " (a) The change in internal energy of the air is del_U (kJ) = 30.73\n", "since del_U>0, so it is gain of internal energy to the air\n", " (b) The work done is (kJ) = -49.1\n", "since W<0, so the work is done on the air\n", " (c) The heat transfer is Q (kJ) = -18.4\n", "since Q<0, so the heat is rejected by the air\n", "The answer is a bit different from textbook due to rounding off error\n" ] } ], "source": [ "#pg 120\n", "#calculate the change in internal energy, work done and heat transfer\n", "print('Example 5.12');\n", "\n", "# aim : T0 determine \n", "# (a) change in internal energy of the air\n", "# (b) work done\n", "# (c) heat transfer\n", "\n", "# Given values\n", "m = .25;# mass, [kg]\n", "P1 = 140;# initial pressure, [kN/m**2]\n", "V1 = .15;# initial volume, [m**3]\n", "P2 = 1400;# final volume, [m**3]\n", "cp = 1.005;# [kJ/kg K]\n", "cv = .718;# [kJ/kg K]\n", "\n", "# solution\n", "\n", "# (a)\n", "# assuming ideal gas\n", "R = cp-cv;# [kJ/kg K]\n", "# also, P1*V1=m*R*T1,hence\n", "T1 = P1*V1/(m*R);# [K]\n", "\n", "# given that process is polytropic with \n", "n = 1.25; # polytropic index\n", "T2 = T1*(P2/P1)**((n-1)/n);# [K]\n", "\n", "# Hence, change in internal energy is,\n", "del_U = m*cv*(T2-T1);# [kJ]\n", "print ' (a) The change in internal energy of the air is del_U (kJ) = ',round(del_U,2)\n", "if(del_U>0):\n", " print('since del_U>0, so it is gain of internal energy to the air')\n", "else:\n", " print('since del_U<0, so it is gain of internal energy to the surrounding')\n", "# (b)\n", "W = m*R*(T1-T2)/(n-1);# formula of work done for polytropic process,[kJ]\n", "print ' (b) The work done is (kJ) = ',round(W,1)\n", "if(W>0):\n", " print('since W>0, so the work is done by the air')\n", "else:\n", " print('since W<0, so the work is done on the air')\n", "\n", "\n", "# (c)\n", "Q = del_U+W;# using 1st law of thermodynamics,[kJ]\n", "print ' (c) The heat transfer is Q (kJ) = ',round(Q,2)\n", "if(Q>0):\n", " print('since Q>0, so the heat is received by the air')\n", "else:\n", " print('since Q<0, so the heat is rejected by the air')\n", "\n", "print 'The answer is a bit different from textbook due to rounding off error'\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 13: pg 123" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.13\n", "\n", " The final volume of the gas is V2 (m^3) = 0.048\n", "\n", " The work done by the gas is (kJ) = 9.77\n", "\n", " The change of internal energy is (kJ) = -9.77\n", "since del_U<0, so this is a loss of internal energy from the gas\n", "The answer is a bit different from textbook due to rounding off error\n" ] } ], "source": [ "#pg 123\n", "#calculate the final volume, work done and the change in internal energy\n", "print('Example 5.13');\n", "\n", "# aim : To determine the\n", "# final volume, work done and the change in internal energy\n", "\n", "# Given values\n", "P1 = 700.;# initial pressure,[kN/m^2]\n", "V1 = .015;# initial volume, [m^3]\n", "P2 = 140.;# final pressure, [kN/m^2]\n", "cp = 1.046;# [kJ/kg K]\n", "cv = .752; # [kJ/kg K]\n", "\n", "# solution\n", "\n", "Gamma = cp/cv;\n", "# for adiabatic expansion, P*V^gamma=constant, so\n", "V2 = V1*(P1/P2)**(1/Gamma);# final volume, [m^3]\n", "print '\\n The final volume of the gas is V2 (m^3) = ',round(V2,3)\n", "\n", "# work done\n", "W = (P1*V1-P2*V2)/(Gamma-1);# [kJ]\n", "print '\\n The work done by the gas is (kJ) = ',round(W,2)\n", "\n", "# for adiabatic process\n", "del_U = -W;# [kJ]\n", "print '\\n The change of internal energy is (kJ) = ',round(del_U,2)\n", "if(del_U>0):\n", " print 'since del_U>0, so the the gain in internal energy of the gas '\n", "else:\n", " print 'since del_U<0, so this is a loss of internal energy from the gas'\n", "\n", "print 'The answer is a bit different from textbook due to rounding off error'\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 14: pg 125" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.14\n", "\n", " (a) The heat transferred during compression is Q (kJ) = -60.0\n", "\n", " (b) The change of the internal energy during the expansion is,del_U (kJ) = -45.2\n", "\n", " (c) The mass of the gas is,m (kg) = 0.478\n", " There is calculation mistake in the book\n" ] } ], "source": [ "#pg 125\n", "#calculate the heat transfer, change of internal energy and mass of gas\n", "print('Example 5.14');\n", "import math\n", "# aim : To determine the\n", "# (a)heat transfer\n", "# (b)change of internal energy\n", "# (c)mass of gas\n", "\n", "# Given values\n", "V1 = .4;# initial volume, [m^3]\n", "P1 = 100.;# initial pressure, [kN/m^2]\n", "T1 = 273.+20;# temperature, [K]\n", "P2 = 450.;# final pressure,[kN/m^2]\n", "cp = 1.0;# [kJ/kg K]\n", "Gamma = 1.4; # heat capacity ratio\n", "\n", "# solution\n", "\n", "# (a)\n", "# for the isothermal compression,P*V=constant,so\n", "V2 = V1*P1/P2;# [m^3]\n", "W = P1*V1*math.log(P1/P2);# formula of workdone for isothermal process,[kJ]\n", "\n", "# for isothermal process, del_U=0;so\n", "Q = W;\n", "print '\\n (a) The heat transferred during compression is Q (kJ) = ',round(Q)\n", "\n", "\n", "# (b)\n", "V3 = V1;\n", "# for adiabatic expansion\n", "# also\n", "\n", "P3 = P2*(V2/V3)**Gamma;# [kN/m^2]\n", "W = -(P3*V3-P2*V2)/(Gamma-1);# work done formula for adiabatic process,[kJ]\n", "# also, Q=0,so using Q=del_U+W\n", "del_U = -W;# [kJ]\n", "print '\\n (b) The change of the internal energy during the expansion is,del_U (kJ) = ',round(del_U,1)\n", "\n", "# (c)\n", "# for ideal gas\n", "# cp-cv=R, and cp/cv=gamma, hence\n", "R = cp*(1-1/Gamma);# [kj/kg K]\n", "\n", "# now using ideal gas equation\n", "m = P1*V1/(R*T1);# mass of the gas,[kg]\n", "print '\\n (c) The mass of the gas is,m (kg) = ',round(m,3)\n", "\n", "print' There is calculation mistake in the book'\n", "\n", "\n", "# End\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 15: pg 128" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.15\n", " The heat received or rejected by the gas during this process is Q (kJ) = 1.03\n", "since Q>0, so heat is received by the gas\n", "\n", " The polytropic specific heat capacity is cn (kJ/kg K) = 0.239\n" ] } ], "source": [ "#pg 128\n", "#calculate the the heat transferred and polytropic specific heat capacity\n", "print('Example 5.15');\n", "\n", "# aim : To determine \n", "# the heat transferred and polytropic specific heat capacity\n", "\n", "# Given values\n", "P1 = 1;# initial pressure, [MN/m^2]\n", "V1 = .003;# initial volume, [m^3]\n", "P2 = .1;# final pressure,[MN/m^2]\n", "cv = .718;# [kJ/kg*K]\n", "Gamma=1.4;# heat capacity ratio\n", "\n", "# solution\n", "# Given process is polytropic with\n", "n = 1.3;# polytropic index\n", "# hence\n", "V2 = V1*(P1/P2)**(1/n);# final volume,[m^3]\n", "W = (P1*V1-P2*V2)*10**3/(n-1);# work done,[kJ]\n", "# so\n", "Q = (Gamma-n)*W/(Gamma-1);# heat transferred,[kJ]\n", "\n", "print ' The heat received or rejected by the gas during this process is Q (kJ) = ',round(Q,2)\n", "if(Q>0):\n", " print 'since Q>0, so heat is received by the gas'\n", "else:\n", " print 'since Q<0, so heat is rejected by the gas'\n", "\n", "# now\n", "cn = cv*(Gamma-n)/(n-1);# polytropic specific heat capacity,[kJ/kg K]\n", "print '\\n The polytropic specific heat capacity is cn (kJ/kg K) = ',round(cn,3)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 16: pg 129" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.16\n", "\n", " (a) The initial partial pressure of the steam is (kN/m^2) = 7\n", "\n", " The initial partial pressure of the air is (kN/m^2) = 93.0\n", " \n", "(b) The final partial pressure of the steam is (kN/m^2) = 200.0\n", "\n", " The final partial pressure of the air is (kN/m^2) = 117.2\n", "\n", " (c) The total pressure after heating is (kN/m^2) = 317.2\n" ] } ], "source": [ "#pg 129\n", "\n", "print('Example 5.16');\n", "\n", "# To determine the \n", "# (a) initial partial pressure of the steam and air\n", "# (b) final partial pressure of the steam and air\n", "# (c) total pressure in the container after heating\n", "\n", "# Given values\n", "T1 = 273.+39;# initial temperature,[K]\n", "P1 = 100.;# pressure, [MN/m^2]\n", "T2 = 273.+120.2;# final temperature,[K]\n", "\n", "# solution\n", "\n", "# (a)\n", "# from the steam tables, the pressure of wet steam at 39 C is\n", "Pw1 = 7;# partial pressure of wet steam,[kN/m^2]\n", "# and by Dalton's law\n", "Pa1 = P1-Pw1;# initial pressure of air, [kN/m^2]\n", "\n", "print '\\n (a) The initial partial pressure of the steam is (kN/m^2) = ',Pw1\n", "print '\\n The initial partial pressure of the air is (kN/m^2) = ',Pa1\n", "\n", "# (b)\n", "# again from steam table, at 120.2 C the pressure of wet steam is\n", "Pw2 = 200.;# [kN/m^2]\n", "\n", "# now since volume is constant so assuming air to be ideal gas so for air P/T=contant, hence\n", "Pa2 = Pa1*T2/T1 ;# [kN/m^2]\n", "\n", "print ' \\n(b) The final partial pressure of the steam is (kN/m^2) = ',Pw2\n", "print '\\n The final partial pressure of the air is (kN/m^2) = ',round(Pa2,2)\n", "\n", "# (c)\n", "Pt = Pa2+Pw2;# using dalton's law, total pressure,[kN/m^2]\n", "print '\\n (c) The total pressure after heating is (kN/m^2) = ',round(Pt,2)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 17: pg 130" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.17\n", "\n", " The partial pressure of the air in the condenser is (kN/m^2) = 6.0\n", "\n", " The partial pressure of the steam in the condenser is (kN/m^2) = 8\n", "\n", " The mass of air which will associated with this steam is (kg) = 1430.5\n", " There is misprint in book\n" ] } ], "source": [ "#pg 130\n", "print('Example 5.17');\n", "\n", "# aim : To determine \n", "# the partial pressure of the air and steam, and the mass of the air\n", "\n", "# Given values\n", "P1 = 660.;# vaccum gauge pressure on condenser [mmHg]\n", "P = 765.;# atmospheric pressure, [mmHg]\n", "x = .8;# dryness fraction \n", "T = 273.+41.5;# temperature,[K]\n", "ms_dot = 1500.;# condense rate of steam,[kg/h]\n", "R = .29;# [kJ/kg]\n", "\n", "# solution\n", "Pa = (P-P1)*.1334;# absolute pressure,[kN/m^2]\n", "# from steam table, at 41.5 C partial pressure of steam is\n", "Ps = 8;# [kN/m^2]\n", "# by dalton's law, partial pressure of air is\n", "Pg = Pa-Ps;# [kN/m^2]\n", "\n", "print '\\n The partial pressure of the air in the condenser is (kN/m^2) = ',round(Pg)\n", "print '\\n The partial pressure of the steam in the condenser is (kN/m^2) = ',Ps\n", "\n", "# also\n", "vg = 18.1;# [m^3/kg]\n", "# so\n", "V = x*vg;# [m^3/kg]\n", "# The air associated with 1 kg of the steam will occupiy this same volume\n", "# for air, Pg*V=m*R*T,so\n", "m = Pg*V/(R*T);# [kg/kg steam]\n", "# hence\n", "ma = m*ms_dot;# [kg/h]\n", "\n", "print '\\n The mass of air which will associated with this steam is (kg) = ',round(ma,1)\n", "\n", "print' There is misprint in book'\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 18: pg 130" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.18\n", " (a) The final pressure in the cylinder is (kN/m^2) = 707.1\n", " (b) The final dryness fraction of the steam is = 0.83\n" ] } ], "source": [ "#pg 130\n", "print('Example 5.18');\n", "\n", "# aim : To determine the\n", "# (a) final pressure\n", "# (b) final dryness fraction of the steam\n", "\n", "# Given values\n", "P1 = 130.;# initial pressure, [kN/m^2]\n", "T1 = 273.+75.9;# initial temperature, [K]\n", "x1 = .92;# initial dryness fraction\n", "T2 = 273.+120.2;# final temperature, [K]\n", "\n", "# solution\n", "\n", "# (a)\n", "# from steam table, at 75.9 C\n", "Pws = 40.;# partial pressure of wet steam[kN/m^2]\n", "Pa = P1-Pws;# partial pressure of air, [kN/m^2]\n", "vg = 3.99# specific volume of the wet steam, [m^3/kg]\n", "# hence\n", "V1 = x1*vg;# [m^3/kg]\n", "V2 = V1/5;# [m^3/kg]\n", "# for air, mass is constant so, Pa*V1/T1=P2*V2/T2,also given ,V1/V2=5,so\n", "P2 = Pa*V1*T2/(V2*T1);# final pressure,[kN/m^2]\n", "\n", "# now for steam at 120.2 C\n", "Ps = 200.;# final partial pressure of steam,[kN/m^2]\n", "# so by dalton's law total pressure in cylindert is\n", "Pt = P2+Ps;# [kN/m^2]\n", "print ' (a) The final pressure in the cylinder is (kN/m^2) = ',round(Pt,1)\n", "\n", "# (b)\n", "# from steam table at 200 kN/m^2 \n", "vg = .885;# [m^3/kg]\n", "# hence\n", "x2 = V2/vg;# final dryness fraction of the steam\n", "print ' (b) The final dryness fraction of the steam is = ',round(x2,2)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 19: pg 131" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.19\n", " (a) The value of adiabatic index Gamma is = 1.426\n", " (b) The change in internal energy during the adiabatic expansion is U2-U1 (This is loss of internal energy) (kJ) = -55.97\n" ] } ], "source": [ "#pg 131\n", "print('Example 5.19')\n", "\n", "# aim : To determine the \n", "# (a) Gamma,\n", "# (b) del_U\n", "import math\n", "# Given Values\n", "P1 = 1400.;# [kN/m^2]\n", "P2 = 100.;# [kN/m^2]\n", "P3 = 220.;# [kN/m^2]\n", "T1 = 273.+360;# [K]\n", "m = .23;# [kg]\n", "cp = 1.005;# [kJ/kg*K]\n", "\n", "# Solution\n", "T3 = T1;# since process 1-3 is isothermal\n", "\n", "# (a)\n", "# for process 1-3, P1*V1=P3*V3,so\n", "V3_by_V1 = P1/P3;\n", "# also process 1-2 is adiabatic,so P1*V1^(Gamma)=P2*V2^(Gamma),hence\n", "# and process process 2-3 is iso-choric so,V3=V2 and\n", "V2_by_V1 = V3_by_V1;\n", "# hence,\n", "Gamma = math.log(P1/P2)/math.log(P1/P3); # heat capacity ratio\n", "\n", "print ' (a) The value of adiabatic index Gamma is = ',round(Gamma,3)\n", "\n", "# (b)\n", "cv = cp/Gamma;# [kJ/kg K]\n", "# for process 2-3,P3/T3=P2/T2,so\n", "T2 = P2*T3/P3;# [K]\n", "\n", "# now\n", "del_U = m*cv*(T2-T1);# [kJ]\n", "print ' (b) The change in internal energy during the adiabatic expansion is U2-U1 (This is loss of internal energy) (kJ) = ',round(del_U,2)\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 20: pg 133" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.20\n", " The mass of oxygen used (kg) = 5.5\n", " The amount of heat transferred through the cylinder wall is (kJ) = 13.28\n" ] } ], "source": [ "#pg 133\n", "print('Example 5.20');\n", "\n", "# aim : To determine \n", "# the mass of oxygen and heat transferred\n", "\n", "# Given values\n", "V1 = 300.;# [L]\n", "P1 = 3.1;# [MN/m^2]\n", "T1 = 273.+18;# [K]\n", "P2 = 1.7;# [MN/m^2]\n", "T2 = 273.+15;# [K]\n", "Gamma = 1.4; # heat capacity ratio\n", "# density condition\n", "P = .101325;# [MN/m^2]\n", "T = 273.;# [K]\n", "V = 1.;# [m^3]\n", "m = 1.429;# [kg]\n", "\n", "# hence\n", "R = P*V*10**3/(m*T);# [kJ/kg*K]\n", "# since volume is constant\n", "V2 = V1;# [L]\n", "# for the initial conditions in the cylinder,P1*V1=m1*R*T1\n", "m1 = P1*V1/(R*T1);# [kg]\n", "\n", "# after some of the gas is used\n", "m2 = P2*V2/(R*T2);# [kg]\n", "# The mass of oxygen remaining in cylinder is m2 kg,so\n", "# Mass of oxygen used is\n", "m_used = m1-m2;# [kg]\n", "print ' The mass of oxygen used (kg) = ',round(m_used,1)\n", "\n", "# for non-flow process,Q=del_U+W\n", "# volume is constant so no external work is done so,Q=del_U\n", "cv = R/(Gamma-1);# [kJ/kg*K]\n", "\n", "# heat transfer is\n", "Q = m2*cv*(T1-T2);# (kJ)\n", "print ' The amount of heat transferred through the cylinder wall is (kJ) = ',round(Q,2)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21: pg 134" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.21\n", " (a) The work transferred during the compression is (kJ) = -28.1\n", " (b) The change in internal energy is (kJ) = 14.2\n", " (c) The heat transferred during the compression is (kJ) = -14.0\n" ] } ], "source": [ "#pg 134\n", "print('Example 5.21');\n", "\n", "# aim : To determine the\n", "# (a) work transferred during the compression\n", "# (b) change in internal energy\n", "# (c) heat transferred during the compression\n", "\n", "# Given values\n", "V1 = .1;# initial volume, [m^3]\n", "P1 = 120.;# initial pressure, [kN/m^2]\n", "P2 = 1200.; # final pressure, [kN/m^2]\n", "T1 = 273.+25;# initial temperature, [K]\n", "cv = .72;# [kJ/kg*K]\n", "R = .285;# [kJ/kg*K]\n", "\n", "# solution\n", "\n", "# (a)\n", "# given process is polytropic with\n", "n = 1.2; # polytropic index\n", "# hence\n", "V2 = V1*(P1/P2)**(1/n);# [m^3]\n", "W = (P1*V1-P2*V2)/(n-1);# workdone formula, [kJ]\n", "print ' (a) The work transferred during the compression is (kJ) = ',round(W,1)\n", "\n", "# (b)\n", "# now mass is constant so,\n", "T2 = P2*V2*T1/(P1*V1);# [K]\n", "# using, P*V=m*R*T\n", "m = P1*V1/(R*T1);# [kg]\n", "\n", "# change in internal energy is\n", "del_U = m*cv*(T2-T1);# [kJ]\n", "print ' (b) The change in internal energy is (kJ) = ',round(del_U,1)\n", "\n", "# (c)\n", "Q = del_U+W;# [kJ]\n", "print ' (c) The heat transferred during the compression is (kJ) = ',round(Q,0)\n", "\n", "# End\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 22: pg 135" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.22\n", " (a) The new pressure of the air in the receiver is (kN/m^2) = 442.0\n", " (b) The specific enthalpy of the air at 15 C is (kJ/kg) = 15.075\n" ] } ], "source": [ "#pg 135\n", "print('Example 5.22');\n", "\n", "# aim : To determine the\n", "# (a) new pressure of the air in the receiver\n", "# (b) specific enthalpy of air at 15 C\n", "\n", "# Given values\n", "V1 = .85;# [m^3]\n", "T1 = 15.+273;# [K]\n", "P1 = 275.;# pressure,[kN/m^2]\n", "m = 1.7;# [kg]\n", "cp = 1.005;# [kJ/kg*K]\n", "cv = .715;# [kJ/kg*K]\n", "\n", "# solution\n", "\n", "# (a)\n", "\n", "R = cp-cv;# [kJ/kg*K]\n", "# assuming m1 is original mass of the air, using P*V=m*R*T\n", "m1 = P1*V1/(R*T1);# [kg]\n", "m2 = m1+m;# [kg]\n", "# again using P*V=m*R*T\n", "# P2/P1=(m2*R*T2/V2)/(m1*R*T1/V1); and T1=T2,V1=V2,so\n", "P2 = P1*m2/m1;# [kN/m^2]\n", "print ' (a) The new pressure of the air in the receiver is (kN/m^2) = ',round(P2)\n", "\n", "# (b)\n", "# for 1 kg of air, h2-h1=cp*(T1-T0)\n", "# and if 0 is chosen as the zero enthalpy, then\n", "h = cp*(T1-273);# [kJ/kg]\n", "print ' (b) The specific enthalpy of the air at 15 C is (kJ/kg) = ',h\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 23: pg 136" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.23\n", " (a) The characteristic gas constant of the gas is R (kJ/kg K) = 0.185\n", " (b) The specific heat capacity of the gas at constant pressure cp (kJ/kg K) = 0.827\n", " (c) The specific heat capacity of the gas at constant volume cv (kJ/kg K) = 0.642\n", " (d) The change in internal energy is (kJ) = 136.0\n", " (e) The work transfer is W (kJ) = 39.0\n" ] } ], "source": [ "#pg 136\n", "print('Example 5.23');\n", "\n", "# aim : T determine the\n", "# (a) characteristic gas constant of the gas\n", "# (b) cp,\n", "# (c) cv,\n", "# (d) del_u \n", "# (e) work transfer\n", "\n", "# Given values\n", "P = 1.;# [bar] \n", "T1 = 273.+15;# [K]\n", "m = .9;# [kg]\n", "T2 = 273.+250;# [K]\n", "Q = 175.;# heat transfer,[kJ]\n", "\n", "# solution\n", "\n", "# (a)\n", "# using, P*V=m*R*T, given,\n", "m_by_V = 1.875;\n", "# hence\n", "R = P*100/(T1*m_by_V);# [kJ/kg*K]\n", "print ' (a) The characteristic gas constant of the gas is R (kJ/kg K) = ',round(R,3)\n", "\n", "# (b)\n", "# using, Q=m*cp*(T2-T1)\n", "cp = Q/(m*(T2-T1));# [kJ/kg K]\n", "print ' (b) The specific heat capacity of the gas at constant pressure cp (kJ/kg K) = ',round(cp,3)\n", "\n", "# (c)\n", "# we have, cp-cv=R,so\n", "cv = cp-R;# [kJ/kg*K]\n", "print ' (c) The specific heat capacity of the gas at constant volume cv (kJ/kg K) = ',round(cv,3)\n", "\n", "# (d)\n", "del_U = m*cv*(T2-T1);# [kJ]\n", "print ' (d) The change in internal energy is (kJ) = ',round(del_U)\n", "\n", "# (e)\n", "# using, Q=del_U+W\n", "W = Q-del_U;# [kJ]\n", "print ' (e) The work transfer is W (kJ) = ',round(W)\n", "\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 24: pg 136" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.24\n", " (a) The work transfer is W (kJ) = 198.2\n", " (b) The change of internal energy is del_U (kJ) = -157.3\n", " (c) The heat transfer Q (kJ) = 40.8\n", "The answer is a bit different due to rounding off error in textbook\n" ] } ], "source": [ "#pg 136\n", "print('Example 5.24');\n", "\n", "# aim : To determine the\n", "# (a) work transfer,\n", "# (b)del_U and,\n", "# (c)heat transfer\n", "\n", "# Given values\n", "V1 = .15;# [m^3]\n", "P1 = 1200.;# [kN/m^2]\n", "T1 = 273.+120;# [K]\n", "P2 = 200.;# [kN/m^2]\n", "cp = 1.006;#[kJ/kg K]\n", "cv = .717;# [kJ/kg K]\n", "\n", "# solution\n", "\n", "# (a)\n", "# Given, PV^1.32=constant, so it is polytropic process with\n", "n = 1.32;# polytropic index\n", "# hence\n", "V2 = V1*(P1/P2)**(1./n);# [m^3]\n", "# now, W\n", "W = (P1*V1-P2*V2)/(n-1);# [kJ]\n", "print ' (a) The work transfer is W (kJ) = ',round(W,1)\n", "\n", "# (b)\n", "R = cp-cv;# [kJ/kg K]\n", "m = P1*V1/(R*T1);# gas law,[kg]\n", "# also for polytropic process\n", "T2 = T1*(P2/P1)**((n-1)/n);# [K]\n", "# now for gas,\n", "del_U = m*cv*(T2-T1);# [kJ]\n", "print ' (b) The change of internal energy is del_U (kJ) = ',round(del_U,1)\n", "\n", "# (c)\n", "Q = del_U+W;# first law of thermodynamics,[kJ]\n", "print ' (c) The heat transfer Q (kJ) = ',round(Q,1)\n", "\n", "print 'The answer is a bit different due to rounding off error in textbook'\n", "# End\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 26: pg 141" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example 5.26\n", "heat transfer from the gas (kJ) = -248.2\n", " The volume of gas before transfer is (m^3) = 0.145\n", " The volume of pressure vessel is (m^3) = 0.27\n" ] } ], "source": [ "#pg 141\n", "print('Example 5.26');\n", "\n", "# aim : To determine\n", "# the volume of the pressure vessel and the volume of the gas before transfer\n", "\n", "# Given values\n", "\n", "P1 = 1400.;# initial pressure,[kN/m^2]\n", "T1 = 273.+85;# initial temperature,[K]\n", "\n", "P2 = 700.;# final pressure,[kN/m^2]\n", "T2 = 273.+60;# final temperature,[K]\n", "\n", "m = 2.7;# mass of the gas passes,[kg]\n", "cp = .88;# [kJ/kg]\n", "cv = .67;# [kJ/kg]\n", "\n", "# solution\n", "\n", "# steady flow equation is, u1+P1*V1+C1^2/2+Q=u2+P2*V2+C2^2/2+W [1], \n", "# given, there is no kinetic energy change and neglecting potential energy term\n", "W = 0;# no external work done\n", "# so final equation is,u1+P1*v1+Q=u2 [2]\n", "# also u2-u1=cv*(T2-T1)\n", "# hence Q=cv*(T2-T1)-P1*v1 [3]\n", "# and for unit mass P1*v1=R*T1=(cp-cv)*T1 [4]\n", "# so finally\n", "Q = cv*(T2-T1)-(cp-cv)*T1;# [kJ/kg]\n", "# so total heat transferred is\n", "Q2 = m*Q;# [kJ] \n", "\n", "# using eqn [4]\n", "v1 = (cp-cv)*T1/P1;# [m^3/kg]\n", "# Total volume is\n", "V1 = m*v1;# [m^3]\n", "\n", "# using ideal gas equation P1*V1/T1=P2*V2/T2\n", "V2 = P1*T2*V1/(P2*T1);# final volume,[m^3]\n", "\n", "print 'heat transfer from the gas (kJ) = ',round(Q2,1)\n", "print ' The volume of gas before transfer is (m^3) = ',round(V1,3)\n", "print ' The volume of pressure vessel is (m^3) = ',round(V2,2)\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.11" } }, "nbformat": 4, "nbformat_minor": 0 }