diff options
Diffstat (limited to 'Thermodynamics/Chapter5.ipynb')
-rwxr-xr-x | Thermodynamics/Chapter5.ipynb | 1018 |
1 files changed, 1018 insertions, 0 deletions
diff --git a/Thermodynamics/Chapter5.ipynb b/Thermodynamics/Chapter5.ipynb new file mode 100755 index 00000000..4cdef356 --- /dev/null +++ b/Thermodynamics/Chapter5.ipynb @@ -0,0 +1,1018 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:a6720a62663d7e9e40aacc296786087fbeb2c2cce5605db25fafd27c8d98c84c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5:FIRST LAW,INTERNAL ENERGY AND ENTHALPY"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Exapmle 5.1, Page No:169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "Q12=-250; # Heat transfer during Discharging of battery in kcal\n",
+ "W21=-0.53; # Consumption of electricity dring Charging process in kWh\n",
+ "\n",
+ "#Calculation\n",
+ "Q21=(W21*3600)-(Q12*4.1868); # First law of thermodynamics\n",
+ "\n",
+ "#Result\n",
+ "print \"Heat loss from battery during charging process = \",Q21,\"kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat loss from battery during charging process = -861.3 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.2, Page No:173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "m=5; # Mass of water in a tank in kg\n",
+ "T1=30; # Temperature of water at initial state (1) in degree celcius\n",
+ "T2=95; # Temperature of water at final state (2) in degree celcius\n",
+ "Qout=70; # Heat transfer from the water tank to the surrounding air in kJ\n",
+ "W=75; #Electric energy input to a stirrer inside water in kJ\n",
+ "mf=32.3; # Mass of fel in bomb in grams\n",
+ "u1=125.78; # Internal energy of water from steam table (uf at T1) in kJ/kg\n",
+ "u2=397.88; # Internal energy of water from steam table (uf at T2) in kJ/kg\n",
+ "\n",
+ "#Calculation\n",
+ "Qf=m*(u2-u1)-W+Qout; # From First law of thermodynamics\n",
+ "qf=Qf/(mf*10**-3); # Heat consumption per unit mass of fuel \n",
+ "\n",
+ "#Result\n",
+ "print \"Heat consumption per unit mass of fuel =\",round(qf,0),\"kJ/kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat consumption per unit mass of fuel = 41966.0 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.3, Page No:173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "V=50; # Volume of water in a tank in litres\n",
+ "T1=120; # Temperature of water at initial state (1) in degree celcius\n",
+ "x1=0.6; # Dryness fraction at initial state (1)\n",
+ "T2=-10; # Temperature of water at final state (2) in degree celcius\n",
+ "vf1=0.00106; # specific volume of water from steam tables at T1 in m^3/kg\n",
+ "vg1=0.8919; # specific volume of water from steam tables at T1 in m^3/kg\n",
+ "v1=(1-x1)*vf1+x1*vg1; # Specific volume of misture of liquid and water at state (1)\n",
+ "m=(V*10**-3)/v1; # Mass of water in the tank\n",
+ "vs2=0.0010891; # Specific volume of saturated ice at T2 in m^3/kg\n",
+ "vg2=466.7; # Specific volume of water vapour at T2 in m^3/kg\n",
+ "v2=v1; # constant specific volume during cooling process\n",
+ "x2=(v2-vs2)/(vg2-vs2); # Dryness fraction at state (2)\n",
+ "uf1=503.5; # Specific internal energy at state (1) in kJ/kg\n",
+ "ug1=2529.3; # Specific internal energy at state (1) in kJ/kg\n",
+ "us2=-354.09; # Specific internal energy at state (2) in kJ/kg\n",
+ "ug2=2361.4; # Specific internal energy at state (2) in kJ/kg\n",
+ "\n",
+ "#Calculation\n",
+ "u1=(1-x1)*uf1+x1*ug1; # Total Specific internal energy at state (1) in kJ/kg\n",
+ "u2=(1-x2)*us2+x2*ug2; # Total Specific internal energy at state (2) in kJ/kg\n",
+ "Q12=m*(u2-u1); # Heat transfer during cooling pocess\n",
+ "\n",
+ "#Result\n",
+ "print \"Heat transfer during cooling pocess = \",round(Q12,1),\"kJ (round off error)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat transfer during cooling pocess = -193.3 kJ (round off error)\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.4, Page No:174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "V1=0.3; # Initial volume of water upto stop 1 in m^3\n",
+ "p1=1; # Initial pressure of water in bar\n",
+ "x1=0.2; # Dryness fraction at initial state (1)\n",
+ "p2=3; # Pressur required to lift the piston in bar\n",
+ "V4=0.45; # Volume of water upto stop 2 in m^3\n",
+ "vf1=0.001043; # Specific volume at state (1) from steam table in m^3/kg\n",
+ "vg1=1.694; # Specific volume at state (1) from steam table in m^3/kg\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "v1=vf1+x1*(vg1-vf1); # Total Specific volume at state (1) from steam table in m^3/kg\n",
+ "m=V1/v1; # Mass of water\n",
+ "v3=V4/m; # Specific volume at stop 2\n",
+ "v2=v1; p3=p2; v4=v3; V3=V4; V2=V1; # From process diagram\n",
+ "# (a)\n",
+ "p4=0.361; # Final Pressure at v4 from steam table in Mpa\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a)\",\"\\nFianl pressure = \",p4,\"MPa\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b)\n",
+ "W14=p2*10**2*(V3-V2); # Work done in process \n",
+ "uf1=417.36; # Specific internal energ at initial state in kJ/kg\n",
+ "ufg1=2088.7; # Specific internal energ at initial state in kJ/kg\n",
+ "u1=uf1+x1*ufg1; # Total Specific internal energr at initial state in kJ.kg\n",
+ "u4=2550.2; # Specific internal energ at final state in kJ/kg\n",
+ "Q14=m*(u4-u1)+W14; # From first law of thermodynamics\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n\\n(b)\",\"\\nWork done during the process = \",W14,\"kJ\",\"\\nHeat transfer during the process = \",round(Q14,1),\"kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) \n",
+ "Fianl pressure = 0.361 MPa\n",
+ "\n",
+ "\n",
+ "(b) \n",
+ "Work done during the process = 45.0 kJ \n",
+ "Heat transfer during the process = 1560.0 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.5, Page No:177"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "V1=0.01; # Initial Volume of Freon 12 vapour in cylinder in m^3\n",
+ "T1=15; # Initial Temperature of Freon 12 vapour in degree celcius\n",
+ "p1=4.914; # Initial pressure (Psat at T1) in bar\n",
+ "p2=9; # Final pressure of Freon 12 vapour after compression in bar\n",
+ "T2=65; # Final temperature of Freon 12 vapour after compression in degree celcius\n",
+ "Q=-0.5; # Heat lost to surroundings during compresson process in kJ\n",
+ "v1=0.035413; # Initial specific volume of Freon 12 vapour from table in m^3/kg\n",
+ "\n",
+ "#Calculation\n",
+ "m=V1/v1; # Mass of vapour\n",
+ "hg1=193.644; # specific enthalpy of Freon 12 vopour at state 1 in kJ/kg\n",
+ "u1=hg1-(p1*10**2*v1); # Total Specific internal energy at state 1\n",
+ "h2=222.9; # specific enthalpy of Freon 12 vapour at state 2 in kJ/kg\n",
+ "v2=0.022537; # specific volume of Freon 12 vapour at state 2 in m^3/kg\n",
+ "u2=h2-(p2*10**2*v2); # Total Specific internal energy at state 2\n",
+ "W=-m*(u2-u1)+Q; # From first law of thermodynamics\n",
+ "\n",
+ "#Result\n",
+ "print \"Work of compression = \",round(W,2),\"kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work of compression = -7.95 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.6, Page No:181"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "tS=-10; # initial temperature of ice in degree celcius\n",
+ "ts=0; # Melting temperature of ice in degree celcius\n",
+ "Cs=1.94; # Specific heat of ice in kJ/kg k\n",
+ "m=1000; # Mass of ice in kg\n",
+ "tF=10; # Temperature of water after 24 hours in degree celcius\n",
+ "tf=0; # Freezing temperature of water in degree celcius\n",
+ "Cf=4.1868; # Specific heat of water in kJ/kg K\n",
+ "hsg=335; # Latent heat of fusion of ice in kJ/kg\n",
+ "\n",
+ "#Calculation\n",
+ "Q=m*(Cs*(ts-tS)+hsg+Cf*(tF-tf)); # Heat gain of water\n",
+ "Q_dot=Q/(24*3600); # Rate of cooling\n",
+ "\n",
+ "#Result\n",
+ "print \"Rate of cooling = \",round(Q_dot,3),\"kW\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of cooling = 4.586 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.7, Page No:188"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "T1=300; # Temperature of air at state 1 in Kelvin\n",
+ "T2=500; # Temperature of air at state 2 in Kelvin\n",
+ "m_=28.966; # Molecular weight oh air in kg\n",
+ "Cpoav=1.017; # Average value of specific heat of air in kJ/kg K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a). change in enthalpy\n",
+ "h_=27.43*(T2-T1)+3.09*10**-3*(T2**2-T1**2)-0.2296*10**-6*(T2**3-T1**3); #change in enthalpy during process in kJ/kmol\n",
+ "h=h_/m_; # change in enthalpy during process in kJ/kg\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).change in enthalpy during process = \",round(h,2),\"kJ/kg\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).change in enthalpy\n",
+ "h=Cpoav*(T2-T1); # change in enthalpy in kJ/kg\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"(b).change in enthalpy during process with average specfic heat = \",h,\"kJ/kg\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).change in enthalpy during process = 205.69 kJ/kg\n",
+ "(b).change in enthalpy during process with average specfic heat = 203.4 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.8, Page No:189"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "m=0.1; # mass of nitrogen gas in kg\n",
+ "V1=0.1; # Initial volme of nitrogen gas in m^3\n",
+ "p1=1.2; # Initial pressure of nitrogen gas in bar\n",
+ "V2=0.075; # Final volume of nitrogen gas in m^3\n",
+ "Cpo=1.041; # Specific heat at constant pressure of nitrogen in kJ/kg K\n",
+ "R=0.2969393; # Characteristic gas constant of nitrogen in Kj/kg K\n",
+ "\n",
+ "#Calculation\n",
+ "T1=(p1*10**2*V1)/(m*R); # Initial temperature of nitrogen gas \n",
+ "T2=T1*(V2/V1); # Final temperature of nitrogen gas (constant pressure process)\n",
+ "Q=m*Cpo*(T2-T1); # Heat transfer to surroundings\n",
+ "W=p1*10**2*(V2-V1); # Work done\n",
+ "\n",
+ "#Result\n",
+ "print \"Final Temperature of nitrogen gas = \",round(T2,0),\"K\",\"\\nHeat transfer to surroundings = \",round(Q,1),\"kJ\"\n",
+ "print \"Work done = \",W,\"kJ\",\" The Work is done on the gas\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Final Temperature of nitrogen gas = 303.0 K \n",
+ "Heat transfer to surroundings = -10.5 kJ\n",
+ "Work done = -3.0 kJ The Work is done on the gas\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.9, Page No:190"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p=1; # pressure inside piston cylinder arrangement in MPa\n",
+ "# stae 1 = saturated liquid\n",
+ "# state 2 = saturated vapour\n",
+ "# state 3 = superheated vapour\n",
+ "v1=0.001127; # specific volume at state 1 in m^3/kg\n",
+ "v2=0.19444; # specific volume at state 2 in m^3/kg\n",
+ "v3=0.4011; # specific volume at state 3 in m^3/kg\n",
+ "u1=761.68; # specific internal energy at state 1 in kK/kg\n",
+ "u2=2583.6; # specific internal energy at state 2 in kK/kg\n",
+ "u3=3296.8; # specific internal energy at state 3 in kK/kg\n",
+ "h1=762.81; # specific enthalpy at state 1 in kJ/kg\n",
+ "h2=2778.1; # specific enthalpy at state 2 in kJ/kg\n",
+ "h3=3697.9; # specific enthalpy at state 3 in kJ/kg\n",
+ "\n",
+ "#Calculation for (Method I)\n",
+ "w12=p*10**3*(v2-v1); # Work done during process 1-2\n",
+ "w23=p*10**3*(v3-v2); # Work done during process 2-3\n",
+ "wtotal=w12+w23; # Total work done\n",
+ "# Calculation of heat transfer\n",
+ "# Method I\n",
+ "q12=(u2-u1)+w12; # Heat transfer during process 1-2\n",
+ "q23=(u3-u2)+w23; # Heat transfer during process 2-3\n",
+ "qtotal=q12+q23; # Total Heat transfer\n",
+ "\n",
+ "#Results for (Method I)\n",
+ "print \"Work done = \",round(wtotal,0),\"kJ/kg\"\n",
+ "print \"\\n\\nCalculation of Heat Transfer\",\"\\nMethod I\",\"\\nHeat Transfer = \",round(qtotal,1),\"kJ/kg\"\n",
+ "\n",
+ "#Calculation for (Method II)\n",
+ "# Method II\n",
+ "q12=h2-h1; # Heat transfer during process 1-2\n",
+ "q23=h3-h2; # Heat transfer during process 2-3\n",
+ "qtotal=q12+q23; # Total Heat transfer\n",
+ "\n",
+ "#Result for (Method II)\n",
+ "print \"\\nMethod II\",\"\\nHeat Transfer = \",round(qtotal,1),\"kJ/kg\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work done = 400.0 kJ/kg\n",
+ "\n",
+ "\n",
+ "Calculation of Heat Transfer \n",
+ "Method I \n",
+ "Heat Transfer = 2935.1 kJ/kg\n",
+ "\n",
+ "Method II \n",
+ "Heat Transfer = 2935.1 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.10, Page No:191"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "#Variable declaration\n",
+ "p1=1; # initial pressure of air in piston cylinder arrangement in bar\n",
+ "T=300; # Temperature of air in piston cylinder arrangement in kelvin\n",
+ "p2=10; # Final pressure of air in piston cylinder arrangement in bar\n",
+ "R=0.287; # Characteristic gas constant of air in kJ/kg K\n",
+ "\n",
+ "#Calculation\n",
+ "w=R*T*math.log(p1/p2); # Work done\n",
+ "q=w; # From first law of thermodynamics\n",
+ "\n",
+ "#Results\n",
+ "print \"The change in internal energy during the isothermal process is zero\"\n",
+ "print \"Work done = \",round(w,1),\"kJ/kg\",\"\\nHeat transfer = \",round(q,1),\"kJ/kg\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in internal energy during the isothermal process is zero\n",
+ "Work done = -198.3 kJ/kg \n",
+ "Heat transfer = -198.3 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.12, Page No:195"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "p1=65;# (Error in textbook) # Pressure of air at state 1 in bar\n",
+ "v1=0.0135; # Volume of air at state 1 in m^3\n",
+ "v2=0.1; # Volume of air at state 2 in m^3\n",
+ "R=0.287; # Characteristic gas constant of air in kJ/kg K\n",
+ "Cvo=0.7165; # Specific heat at constant volume in kJ/kg K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).Adiabatic process\n",
+ "k=1.4; # Index of adiabatic process\n",
+ "p2=p1*(v1/v2)**k; # Pressure of air at state 2 \n",
+ "T1=p1*10**2*v1/R;# Tempewrature of air at state 1\n",
+ "T2=p2*10**2*v2/R;# Tempewrature of air at state 2\n",
+ "w=R*(T2-T1)/(1-k); # work done\n",
+ "q=0; # Adiabatic expansion process\n",
+ "delta_u=Cvo*(T2-T1); # Change in internal energy of air\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Adiabatic Process\",\"\\nFinal Temperature = \",round(T2,1),\"K\",\"\\nWork done = \",round(w,1),\"kJ\"\n",
+ "print \"Change in internal energy of air = \",round(delta_u,1),\"kJ\",\"\\nHeat Ineraction = \",round(q,1),\"kJ\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Polytropic process\n",
+ "n=1.3; # Index of adiabatic process\n",
+ "p2=p1*(v1/v2)**n; # Pressure of air at state 2 \n",
+ "T1=p1*10**2*v1/R;# Tempewrature of air at state 1\n",
+ "T2=p2*10**2*v2/R;# Tempewrature of air at state 2\n",
+ "w=R*(T2-T1)/(1-n); # work done\n",
+ "delta_u=Cvo*(T2-T1); # Change in internal energy of air\n",
+ "q=delta_u+w; # Adiabatic expansion process\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n\\n(b).Polytropic Process\",\"\\nFinal Temperature = \",round(T2,1),\"K\",\"\\nWork done = \",round(w,1),\"kJ\"\n",
+ "print \"Change in internal energy of air = \",round(delta_u,1),\"kJ\",\"\\nHeat Ineraction = \",round(q,1),\"kJ\"\n",
+ "\n",
+ "#Calculation for (c)\n",
+ "# (c).Isothermal process\n",
+ "T1=p1*10**2*v1/R;# Tempewrature of air at state 1\n",
+ "T2=T1; # Tempewrature of air at state 2\n",
+ "p2=p1*(v1/v2); # Pressure of air at state 2\n",
+ "w=R*T1*math.log (v2/v1); # work done\n",
+ "delta_u=Cvo*(T2-T1); # Change in internal energy of air\n",
+ "q=delta_u+w; # Adiabatic expansion process\n",
+ "\n",
+ "#Result for (c)\n",
+ "print \"\\n\\n(c).Isothermal Process\",\"\\nFinal Temperature = \",round(T2,1),\"K\",\"\\nWork done = \",round(w,1),\"kJ\"\n",
+ "print \"Change in internal energy of air = \",round(delta_u,1),\"kJ\",\"\\nHeat Ineraction = \",round(q,1),\"kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Adiabatic Process \n",
+ "Final Temperature = 137.2 K \n",
+ "Work done = 120.9 kJ\n",
+ "Change in internal energy of air = -120.7 kJ \n",
+ "Heat Ineraction = 0.0 kJ\n",
+ "\n",
+ "\n",
+ "(b).Polytropic Process \n",
+ "Final Temperature = 167.7 K \n",
+ "Work done = 132.1 kJ\n",
+ "Change in internal energy of air = -98.9 kJ \n",
+ "Heat Ineraction = 33.2 kJ\n",
+ "\n",
+ "\n",
+ "(c).Isothermal Process \n",
+ "Final Temperature = 305.7 K \n",
+ "Work done = 175.7 kJ\n",
+ "Change in internal energy of air = 0.0 kJ \n",
+ "Heat Ineraction = 175.7 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.13, Page No:201"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "m=10; # mass flow rate of chilled water in kg/s\n",
+ "V1=50; #velocity of chilled water at section 1 in m/s\n",
+ "z1=30; # Elevation of section 1 in m\n",
+ "V2=10; #velocity of chilled water at section 2 in m/s\n",
+ "z2=60; # Elevation of section 2 in m\n",
+ "h1=21; # Enthalpy of chilled water at section 1 in kJ/kg\n",
+ "h2=43; # Enthalpy of chilled water at section 2 in kJ/kg\n",
+ "W=35; # Rate of work done by pump in kW\n",
+ "g=9.80665; # Acceleration due to gravity in m/s^2\n",
+ "\n",
+ "#Calculation \n",
+ "Q=m*(h2-h1)+(m*(V2**2-V1**2)/2000)+(m*g*(z2-z1)/1000)-W; # Steady flow energy equation\n",
+ "\n",
+ "#Result\n",
+ "print \"The rate of Heat Transfer From Building (Error in textbook)= \",round(Q,2),\"kW\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of Heat Transfer From Building (Error in textbook)= 175.94 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.14, Page No:206"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "p1=1; # Suction pressure of air in bar\n",
+ "p2=5; # Delivery pressure of air in bar\n",
+ "T1=310; # Suction Temperature of air in kelvin\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "# (a) Polytropic compression\n",
+ "T2=475; # Delivery Temperature of air in kelvin\n",
+ "Q=-0.15; # Heat loss to the cooling water in kW\n",
+ "Wpoly=-5.3; # Power consumption of compressor in kW\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "m=(-Wpoly+Q)/(Cpo*(T2-T1)); # mass flow rate of air from SSSF energy equation\n",
+ "n=1/((1-((math.log (T2/T1))/(math.log (p2/p1))))); # Index of polytropic process\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Polytropic compression\",\"\\nmass flow rate of air = \",round(m,3),\"kg/s\",\"\\nIndex of polytropic process = \",round(n,4)\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b) Adiabatic compression\n",
+ "k=1.4; # Index of adiabatic process\n",
+ "Wad=-m*Cpo*T1*((p2/p1)**((k-1)/k)-1); # power consumption of compressor\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Adiabatic compression\",\"\\nPower consumption of compressor = \",round(Wad,2),\"kW\"\n",
+ "\n",
+ "#Calculation for (c)\n",
+ "# (c).Difference between specific work\n",
+ "wdiff=(abs(Wad)-abs(Wpoly))/m; # Difference between specific work\n",
+ "\n",
+ "#Result for (c)\n",
+ "print \"\\n(c).Difference between specific work\",\"\\nDifference between specific work = \",round(wdiff,2),\"kJ/kg (roundoff error)\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Polytropic compression \n",
+ "mass flow rate of air = 0.031 kg/s \n",
+ "Index of polytropic process = 1.3608\n",
+ "\n",
+ "(b).Adiabatic compression \n",
+ "Power consumption of compressor = -5.65 kW\n",
+ "\n",
+ "(c).Difference between specific work \n",
+ "Difference between specific work = 11.22 kJ/kg (roundoff error)\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.15, Page No:208"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "W=500; # Power output from steam turbine in MW\n",
+ "Q=10; # Heat loss to surroundings in MW\n",
+ "p1=12.5; # Pressure of staem at steam turbine inlet in MPa\n",
+ "p2=10; # Pressure of staem at steam turbine outlet in kPa\n",
+ "V1=50; # Velocity of steam at steam turbine inlet in m/s\n",
+ "V2=100; # Velocity of steam at steam turbine outlet in m/s\n",
+ "x2=0.85; # Quality of steam at steam turbine outlet\n",
+ "h1=3341.8; # Specific enthalpy of staem at inlet from steam table in kJ/kg\n",
+ "hf2=191.83; hg2=2584.7;# Specific enthalpies of fluid and steam at outlet from steam table in kJ/kg\n",
+ "\n",
+ "#Calculation\n",
+ "h2=(1-x2)*hf2+x2*hg2;# Specific enthalpy of staem at outlet in kJ/kg\n",
+ "m=(W-Q)*10**3/((h1-h2)+(V1**2-V2**2)/2000); # Mass flow rate of steam\n",
+ "\n",
+ "#Result\n",
+ "print \"Mass flow rate of steam = \",round(m,0),\"kg/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass flow rate of steam = 441.0 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.16, Page No:212"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "p1=3; # Pressre of air at state 1 in bar\n",
+ "p2=p1; # constant pressure process\n",
+ "T1=450; # Temperature of air at state 1 in kelvin\n",
+ "T2=1250; # Temperature of air at state 2 in kelvin\n",
+ "T3=1000; # Temperature of air at state 3 in kelvin\n",
+ "V3=50; # Velocity of air at state 3 in m/s\n",
+ "T4=800; # Temperature of air at state 4 in kelvin\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).Combustion chamber\n",
+ "q=Cpo*(T2-T1); # Heat added to air\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Combustion chamber\",\"\\nHeat added to air = \",q,\"kJ/kg (round off error)\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Turbine \n",
+ "k=1.4; # Index of adiabatic process\n",
+ "w=Cpo*(T2-T3)-V3**2/2000; # Work done \n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Turbine\",\"\\nWork done = \",w,\"kJ/kg (round off error)\"\n",
+ "\n",
+ "#Calculation for (c)\n",
+ "# (c).Nozzle\n",
+ "V4=math.sqrt (2*Cpo*10**3*(T3-T4)+V3**2); # Velocity of air leaving the nozzle\n",
+ "\n",
+ "#Result for (c)\n",
+ "print \"\\n(c).Nozzle\",\"\\nVelocity of air leaving the nozzle = \",round(V4,0),\"m/s (round off error)\"\n",
+ "\n",
+ "#Calculation for (d)\n",
+ "# (d).Pressure drop\n",
+ "p3=p2*(T3/T2)**(k/(k-1)); # Pressure of air leaving turbine\n",
+ "p4=p3*(T4/T3)**(k/(k-1)); # Pressure of air leaving nozzle\n",
+ "\n",
+ "#Result for (d)\n",
+ "print \"\\n(d).Pressure drop\",\"\\nPressure of air leaving turbine = \",round(p3,3),\"bar\"\n",
+ "print \"Pressure of air leaving nozzle = \",round(p4,2),\"bar\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Combustion chamber \n",
+ "Heat added to air = 802.8 kJ/kg (round off error)\n",
+ "\n",
+ "(b).Turbine \n",
+ "Work done = 249.625 kJ/kg (round off error)\n",
+ "\n",
+ "(c).Nozzle \n",
+ "Velocity of air leaving the nozzle = 636.0 m/s (round off error)\n",
+ "\n",
+ "(d).Pressure drop \n",
+ "Pressure of air leaving turbine = 1.374 bar\n",
+ "Pressure of air leaving nozzle = 0.63 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.17, Page No:213"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "V=1000; # Speed of aircraft in kmph\n",
+ "p1=0.35; # Ambient pressure in bar\n",
+ "T1=258; # Ambient temperature in kelvin\n",
+ "V1=V*1000/3600; # unit conversion kmph into m/s\n",
+ "p=1.01325; # Atmospheric pressure in bar\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "k=1.4; # Index of compression process\n",
+ "\n",
+ "#Calculation\n",
+ "T2=T1+(V1**2)/(2*Cpo*10**3); # The temperature after leaving inlet diffuser\n",
+ "p2=p1*(T2/T1)**(k/(k-1)); # Pressure after leaving inlet diffuser\n",
+ "r=p/p2; # Pressre ratio of compressor required for pressurization\n",
+ "\n",
+ "#Result\n",
+ "print \"The temperature after leaving inlet diffuser = \",round(T2,1),\"K\"\n",
+ "print \"Pressre ratio of compressor required for pressurization = \",round(r,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temperature after leaving inlet diffuser = 296.4 K\n",
+ "Pressre ratio of compressor required for pressurization = 1.78\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.18, Page No:214"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p1=50; # Pressre of steam at diffuser inlet in kPa\n",
+ "T1=150; # Temperature of steam at diffuser inlet in degree celcius\n",
+ "V1=180; # Velocity of steam at diffuser inlet in m/s\n",
+ "A1=1000; # area of diffuser inlet in cm^2\n",
+ "V2=90; # Velocity of steam at diffuser outlet in m/s\n",
+ "p2=1; # Pressre of steam at diffuser outlet in bar\n",
+ "Q=120; # Heat loss to the surroundings in kW\n",
+ "v1=3.24; # Specific volume of steam from superheated steam table in m^3/kg at inlet\n",
+ "h1=2645.9; # # Specific enthalpy of steam from superheated steam table in m^3/kg at inlet\n",
+ "\n",
+ "#Calculation\n",
+ "m=V1*A1*10**-4/v1; # Mass flow rate of steam\n",
+ "q=Q/m; # Heat transfer per unit mass of steam\n",
+ "h2=q+h1+(V1**2-V2**2)/2000; # Specific enthalpy of steam from SSSF energy equationat outlet\n",
+ "v2=1.704; # Specific volume of steam from superheated steam table in m^3/kg at outlet\n",
+ "A2=m*v2/V2; # Area of diffuser exit and Answer given in the textbook is wrong\n",
+ "\n",
+ "#Result\n",
+ "print \"Area of diffuser exit = \",round(A2*10**4,0),\"cm^2 (Answer was wrong in textbook because that\" \n",
+ "print \"the value considered in the textbook for V2 is incorrect. So there is a difference in solution.)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area of diffuser exit = 1052.0 cm^2 (Answer was wrong in textbook because that\n",
+ "the value considered in the textbook for V2 is incorrect. So there is a difference in solution.)\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.19, Page No:217"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from numpy import matrix\n",
+ "from numpy import linalg\n",
+ "\n",
+ "#Variable declaration\n",
+ "p=0.15; # Pressure of Freon-12 gas in MPa\n",
+ "T1=10; # Temperature of Freon-12 gas in degree celcius\n",
+ "T2=35; # Temperature of Freon-12 gas in degree celcius\n",
+ "h1=196.762; # Specific enthalpy of Freon-12 from table at 1 in kJ/kg \n",
+ "h2=69.49; # Specific enthalpy of Freon-12 from table at 2 in kJ/kg \n",
+ "h3=178.54; # Specific enthalpy of Freon-12 from table at 3 in kJ/kg \n",
+ "\n",
+ "#Calculation\n",
+ "# For solving Conservation of mass and SSSF energy equations\n",
+ "A=[[1,-1],[h3,-h2]];\n",
+ "B=[[1] ,[h1]];\n",
+ "M=linalg.solve(A, B) \n",
+ "\n",
+ "#Result\n",
+ "print \"Mass of saturated liquid at 35 oC = \",round(M.item(1),3),\"kg/s\"\n",
+ "print \"Mass of saturated vapour at 0.15 MPa = \",round(M.item(0),3),\"kg/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass of saturated liquid at 35 oC = 0.167 kg/s\n",
+ "Mass of saturated vapour at 0.15 MPa = 1.167 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.20, Page No:219"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p1=15;# Inlet pressure of condenser in kPa\n",
+ "x=0.92; # Quality of steam\n",
+ "ms=25; # mass flow rate of steam in kg/s\n",
+ "d_t=12; # temperature rise of water \n",
+ "Cpw=4.1868; # Specific heat of water in kJ/kg K\n",
+ "hfg=225.94; h4_3=2599.1; # specific enthalpy in kJ/kg\n",
+ "\n",
+ "#Calculation\n",
+ "h1=(1-x)*hfg+x*h4_3; # specific enthalpy \n",
+ "h2=225.94; # specific enthalpy in kJ/kg\n",
+ "Q=ms*(h1-h2); # Heat transfer rate in condenser\n",
+ "mw=Q/(Cpw*d_t); # Mass flow rate of water \n",
+ "\n",
+ "#Result\n",
+ "print \"Heat transfer rate in condenser = \",round(Q,0),\"kW\",\"\\nMass flow rate of water = \",round(mw,1),\"kg/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat transfer rate in condenser = 54583.0 kW \n",
+ "Mass flow rate of water = 1086.4 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |