diff options
author | hardythe1 | 2015-04-07 15:58:05 +0530 |
---|---|---|
committer | hardythe1 | 2015-04-07 15:58:05 +0530 |
commit | 92cca121f959c6616e3da431c1e2d23c4fa5e886 (patch) | |
tree | 205e68d0ce598ac5caca7de839a2934d746cce86 /Thermodynamics/Chapter6.ipynb | |
parent | b14c13fcc6bb6d01c468805d612acb353ec168ac (diff) | |
download | Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.gz Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.bz2 Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.zip |
added books
Diffstat (limited to 'Thermodynamics/Chapter6.ipynb')
-rwxr-xr-x | Thermodynamics/Chapter6.ipynb | 1076 |
1 files changed, 1076 insertions, 0 deletions
diff --git a/Thermodynamics/Chapter6.ipynb b/Thermodynamics/Chapter6.ipynb new file mode 100755 index 00000000..2e760ba9 --- /dev/null +++ b/Thermodynamics/Chapter6.ipynb @@ -0,0 +1,1076 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:009f400f836702cde3e9c0f5d144589b0ec3eb912d883ee490ce810f95fed24c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 06:SECOND LAW OF THERMODYNAMICS AND ENTROPY"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.1, Page No:259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "QH=500; # Heat supplied in kJ\n",
+ "QL=200; # Heat rejected in kJ\n",
+ "TH=720; # Resorvior Temperature in kelvin\n",
+ "TL=360; # Resorvior Temperature in kelvin\n",
+ "W=260; # Work developed in kJ\n",
+ "\n",
+ "#Calculation\n",
+ "e_max=1-TL/TH; # maximum efficiency\n",
+ "e_clamied=W/QH; # Efficiency clamied\n",
+ "\n",
+ "#Result\n",
+ "if e_clamied<e_max:\n",
+ " print \"It obeys the second law of thermodynamics.The claim is true\"\n",
+ "else:\n",
+ " print \"It violates the second law of thermodynamics.The claim is False\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "It violates the second law of thermodynamics.The claim is False\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2, Page No:260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "QH=325; # Heat supplied in kJ\n",
+ "QL=125; # Heat rejected in kJ\n",
+ "TH=1000; # Resorvior Temperature in kelvin\n",
+ "TL=400; # Resorvior Temperature in kelvin\n",
+ "W=200; # Work developed in kJ\n",
+ "\n",
+ "#Calculation\n",
+ "e_carnot=1-TL/TH; # maximum efficiency\n",
+ "e_clamied=W/QH; # Efficiency clamied\n",
+ "\n",
+ "#Result\n",
+ "print \"e_carnot =\",e_carnot\n",
+ "print \"e_clamied=\",round(e_clamied,3) \n",
+ "if e_carnot==e_clamied:\n",
+ " print \"\\nThe machine is reversible\"\n",
+ "elif e_carnot>e_clamied:\n",
+ " print \"\\nThe machine is irreversible\"\n",
+ "else:\n",
+ " print \"\\nHere e_clamied > e_carnot so the cyclic machine is impossible.\"\n",
+ "\n",
+ "print \"It would be reversible if its thermal efficiency is equal to Carnot efficiency,\"\n",
+ "print \"and irreversible if it is less than Carnot efficiency.\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "e_carnot = 0.6\n",
+ "e_clamied= 0.615\n",
+ "\n",
+ "Here e_clamied > e_carnot so the cyclic machine is impossible.\n",
+ "It would be reversible if its thermal efficiency is equal to Carnot efficiency,\n",
+ "and irreversible if it is less than Carnot efficiency.\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.3, Page No:260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "# Air conditioning unit\n",
+ "TL=278; # Operating temperature in kelvin\n",
+ "TH=318; # Operating temperature in kelvin\n",
+ "\n",
+ "#Calculation\n",
+ "COP1=TL/(TH-TL); # COP of Air conditioning unit\n",
+ "QL=1; # For some calculation purpose\n",
+ "W1=QL/COP1; # Work input of Air conditioning unit\n",
+ "# Food refrigeration unit\n",
+ "TL=258; # Operating temperature in kelvin\n",
+ "TH=318; # Operating temperature in kelvin\n",
+ "COP2=TL/(TH-TL); # COP of Food refrigeration unit\n",
+ "W2=QL/COP2; # Work input of Food refrigeration unit\n",
+ "Wper=(W2-W1)/W1; # Increase in work input\n",
+ "\n",
+ "#Result\n",
+ "print \"Increase in work input = \",round(Wper*100,0),\"%\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Increase in work input = 62.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.4, Page No:261"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#(a).Summer air conditioning (cooling)\n",
+ "TL=298; # Operating temperature in kelvin\n",
+ "TH=318; # Operating temperature in kelvin\n",
+ "q=0.75; # Heat Transfer from fabric of room per degree of temperature difference in kW\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "QL=q*(TH-TL); # Heat Transfer from fabric of room\n",
+ "COPc=TL/(TH-TL); # COP of Air conditioning unit\n",
+ "W=QL/COPc; # Work input of Air conditioning unit\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Summer air conditioning (cooling)\",\"\\nWork input of Air conditioning unit = \",round(W,0),\"kW\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Winter air conditioning (recerse cycle heating)\n",
+ "TH=293; # Operating temperature in kelvin\n",
+ "TL=(-(-2*q*TH)-math.sqrt ((-2*q*TH)**2-(4*q*(q*TH**2-TH))))/(2*q);# Lowest outdoor Temperature by root\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Winter air conditioning (recerse cycle heating)\",\"\\nLowest outdoor Temperature = \",round(TL,0),\"K\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Summer air conditioning (cooling) \n",
+ "Work input of Air conditioning unit = 1.0 kW\n",
+ "\n",
+ "(b).Winter air conditioning (recerse cycle heating) \n",
+ "Lowest outdoor Temperature = 273.0 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5, Page No:263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "# (a).For the refrigerator \n",
+ "TL=258; # Operating temperature in kelvin\n",
+ "TH=313; # Operating temperature in kelvin\n",
+ "QL=3.5167; # Ton of refrigeration in kW\n",
+ "\n",
+ "#Calculation for(a)\n",
+ "COP=TL/(TH-TL); # COP of Refrigeration unit\n",
+ "W=QL/COP; # Power comsumption of refrigerator\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).For the refrigerator\",\"\\nPower comsumption of refrigerator = \",round(W,2),\"kW\"\n",
+ "\n",
+ "#calculation for (b)\n",
+ "# (b). For the freezer\n",
+ "TL=248; # Operating temperature in kelvin\n",
+ "TH=313; # Operating temperature in kelvin\n",
+ "COP=TL/(TH-TL); # COP of Freezer unit\n",
+ "QL=W*COP; # Refrigeration produced\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b). For the freezer\",\"\\nRefrigeration produced = \",round(QL,3),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).For the refrigerator \n",
+ "Power comsumption of refrigerator = 0.75 kW\n",
+ "\n",
+ "(b). For the freezer \n",
+ "Refrigeration produced = 2.86 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.6, Page No:277"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "Psat=200;#Pressure of water in kPa\n",
+ "Tsat=393.38; # Saturation temperaure at Psat in kelvin\n",
+ "# (i).From the equation Tds=du+pdv \n",
+ "# Following are from steam table at Psat\n",
+ "ufg=2025; # specific internal energy of vapourization in kJ/kg\n",
+ "vg=0.8857; # specific volume in m^3/kg\n",
+ "vf=0.001061; # specific volume in m^3/kg\n",
+ "\n",
+ "#Calculation for (i)\n",
+ "sfg=(ufg/Tsat)+(Psat*(vg-vf)/Tsat); # specific entropy of vapourization\n",
+ "\n",
+ "#Result for (i)\n",
+ "print \"(i).From the equation Tds=du+pdv \",\"\\nspecific entropy of vapourization = \",round(sfg,4),\"kJ/kg K\"\n",
+ "\n",
+ "#Calculation for (ii)\n",
+ "# (ii).From the equation Tds=dh-vdp\n",
+ "hfg=2201.9; # Specific enthalpy of vapourization in kJ/kg\n",
+ "sfg=hfg/Tsat; # specific entropy of vapourization\n",
+ "\n",
+ "#Result for (ii)\n",
+ "print \"\\n(ii).From the equation Tds=dh-vdp \",\"\\nspecific entropy of vapourization = \",round(sfg,4),\"kJ/kg K\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i).From the equation Tds=du+pdv \n",
+ "specific entropy of vapourization = 5.5975 kJ/kg K\n",
+ "\n",
+ "(ii).From the equation Tds=dh-vdp \n",
+ "specific entropy of vapourization = 5.5974 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.7, Page No:277"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p1=1; # Pressure of steam at state 1 in bar\n",
+ "T=473; # Temperature of steam at state 1 in kelvin\n",
+ "\n",
+ "#Calculation for (i)\n",
+ "# (i).Pressure after compression\n",
+ "p2=1.5538; # Pressure after compression at (Psat)T from steam table in MPa\n",
+ "\n",
+ "#Result for (i)\n",
+ "print \"(i).Pressure after compression\",\"\\nPressure after compression = \",p2,\"MPa\"\n",
+ "\n",
+ "#Calcultion for (ii)\n",
+ "# (ii).Heat Transfer and work done during the process\n",
+ "# Following are from steam table \n",
+ "s2=6.4323; # specific entropy of steam at state 2 in kJ/kg K\n",
+ "s1=7.8343; # specific entropy of steam at state 1 in kJ/kg K\n",
+ "u2=2595.3; # specific internal energy of steam at state 2 in kJ/kg \n",
+ "u1=2658.1; # specific internal energy of steam at state 1 in kJ/kg \n",
+ "q=T*(s2-s1); # Heat transfer during the process\n",
+ "w=q-(u2-u1); # Work done during the process\n",
+ "\n",
+ "#Result for (ii)\n",
+ "print \"\\n(ii).Heat Transfer and work done during the process\",\"\\nHeat transfer during the process = \",round(q,0),\"kJ\"\n",
+ "print \"Work done during the process = \",round(w,1),\"kJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i).Pressure after compression \n",
+ "Pressure after compression = 1.5538 MPa\n",
+ "\n",
+ "(ii).Heat Transfer and work done during the process \n",
+ "Heat transfer during the process = -663.0 kJ\n",
+ "Work done during the process = -600.3 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.8, Page No:278"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p1=6; # Initial pressure of steam in MPa\n",
+ "T1=500; # Initial temperature of steam in degree celcius\n",
+ "p2=10; # Final pressure of steam in bar\n",
+ "# From steam tables\n",
+ "s1=6.8803; sf2=1.3026; sfg2=6.0568; # specific entropy in kJ/kg K\n",
+ "u1=3082.2; uf2=761.68; ufg2=1822; # specific internal energy in kJ/kg\n",
+ "v1=0.05665; vf2=0.001043; vg2=1.694; # specific volume in m^3/kg\n",
+ "\n",
+ "#Calculation\n",
+ "x2=(v1-vf2)/(vg2-vf2);# Quality of steam\n",
+ "u2=uf2+x2*ufg2; # specific internal energy in kJ/kg \n",
+ "s2=sf2+x2*sfg2; # specific entropy in kJ/kg K\n",
+ "s21=s2-s1; # Entropy change\n",
+ "q=u2-u1; # Heat transfer\n",
+ "\n",
+ "#Result\n",
+ "print \"Entropy change of the process = \",round(s21,3),\"kJ/kg\",\"\\nHeat transfer for the process =\",round(q,1),\"kJ\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entropy change of the process = -5.379 kJ/kg \n",
+ "Heat transfer for the process = -2260.7 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.10, Page No:280"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "p1=3; # initial pressure of air in bar\n",
+ "T1=200; # initial temperature of air in degree celcius\n",
+ "p2=1.5; # final pressure of air in bar\n",
+ "T2=105; # final temperature of air in degree celcius\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "R=0.287; # characteristic gas constant of air in kJ/kg K\n",
+ "\n",
+ "#Calculation\n",
+ "delta_s= Cpo*math.log ((T2+273)/(T1+273))- R*math.log (p2/p1) # change in entropy during irreversible process\n",
+ "#The value of p2 is taken as wrong in the textbook\n",
+ "\n",
+ "#Result\n",
+ "print \"change in entropy during irreversible process = \",round(delta_s,4),\"kJ/kg K (Answer in the textbook was wrong)\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "change in entropy during irreversible process = -0.0261 kJ/kg K (Answer in the textbook was wrong)\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.11, Page No:281"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "p1=5; # Initial pressure of argon gas in bar\n",
+ "T1=30; # Initial temperature of argon gas in degree celcius\n",
+ "v1=1; # Initial volume of argon gas in m^3 by assumption\n",
+ "v2=2*v1; # Final volume of argon gas in m^3\n",
+ "R=8.3144/40; # Characteristic gas constant of argon gas in kJ/kg K\n",
+ "\n",
+ "#Calculation\n",
+ "p2=p1*(v1/v2); # Final pressure of argon gas\n",
+ "delta_s= R*math.log (v2/v1); # change in entropy (choosing the reversible isothermal path)\n",
+ "\n",
+ "#Result\n",
+ "print \"Final pressure of argon gas =\",p2,\"bar\"\n",
+ "print \"change in entropy (choosing the reversible isothermal path) = \",round(delta_s,4),\"kJ/kg K\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Final pressure of argon gas = 2.5 bar\n",
+ "change in entropy (choosing the reversible isothermal path) = 0.1441 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.12, Page No:284"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "p1=1; # Atmospheric pressure in bar\n",
+ "T1=348; # Atmospheric temperature in kelvin\n",
+ "V1=800; # Volume of air sucked into the cylinder in cm^3\n",
+ "p2=15; # pressure of air after compression in bar\n",
+ "V2=V1/8; # volume of air after compression in cm^3\n",
+ "p3=50; # pressure of air after heat addition in bar\n",
+ "Cvo=0.7165; # Specific heat at constant volme in kJ/kg K\n",
+ "R=0.287; # characteristic gas constant of air in kJ/kg K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).Index of compression process\n",
+ "n=math.log (p2/p1)/math.log (V1/V2); # Index of compression process\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Index of compression process\"\n",
+ "print \"Index of compression process = \",round(n,1),\" which is less than 1.4. The compression process is polytropic.\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Change in entropy of air during each process\n",
+ "m=(p1*10**2*V1*10**-6)/(R*T1); # Mass of air in cylinder\n",
+ "T2=T1*(p2/p1)*(V2/V1); # Temperature after compression\n",
+ "T3=T2*(p3/p2); # Temperature after heat addition\n",
+ "delta_s21=m*(Cvo*math.log (T2/T1)+R*math.log (V2/V1)); # change in entropy during compression\n",
+ "delta_s32=m*Cvo*math.log (T3/T2); #change in entropy during heat addition\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Change in entropy of air during each process\"\n",
+ "print \"change in entropy during compression = (Error in textbook)\",round(delta_s21,6),\"kJ/K\"\n",
+ "print \"change in entropy during heat addition = (Error in textbook)\",round(delta_s32,6),\"kJ/K\"\n",
+ "\n",
+ "#Calculation for (c)\n",
+ "# (c).Heat transfer during polytropic compression process\n",
+ "k=1.4;# Index of isentropic preocess\n",
+ "Q=m*Cvo*((k-n)/(1-n))*(T2-T1); # Heat transfer during polytropic compression process\n",
+ "\n",
+ "#Result for (c)\n",
+ "print \"\\n(c).Heat transfer during polytropic compression process\"\n",
+ "print \"Heat transfer during polytropic compression process = (Error in textbook)\",round(Q,4),\"kJ\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Index of compression process\n",
+ "Index of compression process = 1.3 which is less than 1.4. The compression process is polytropic.\n",
+ "\n",
+ "(b).Change in entropy of air during each process\n",
+ "change in entropy during compression = (Error in textbook) -0.000117 kJ/K\n",
+ "change in entropy during heat addition = (Error in textbook) 0.000691 kJ/K\n",
+ "\n",
+ "(c).Heat transfer during polytropic compression process\n",
+ "Heat transfer during polytropic compression process = (Error in textbook) -0.0565 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.13, Page No:287"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p1=0.3; # initial pressure of ateam in MPa\n",
+ "T1=350; # Initial temperature of steam in degree celcius\n",
+ "# following are the values taken from steam table for initial state \n",
+ "v1=0.9535; # specific volume in m^3/kg\n",
+ "u1=2886.2; # specific internal energy in kJ/kg\n",
+ "s1=7.868; # specific entropy in kJ/kg K\n",
+ "v2=2*v1; # final specific volume of steam\n",
+ "u2=u1;\n",
+ "# following are the values taken from steam table final state\n",
+ "T2=349; # Final temperature of steam in degree celcius\n",
+ "p2=0.167; # Final pressure of ateam in MPa\n",
+ "s2=8.164; # specific entropy in kJ/kg K\n",
+ "\n",
+ "#Calculation\n",
+ "delta_s=s2-s1; # Entropy generation\n",
+ "LW=(T1+T2)/2 * delta_s; # Lost work\n",
+ "\n",
+ "#Result\n",
+ "print \"Entropy Generation =\",round(delta_s,3),\"kJ/kg K\",\"\\nLost work = \",round(LW,1),\"kJ\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entropy Generation = 0.296 kJ/kg K \n",
+ "Lost work = 103.5 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.15, Page No:291"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "m=1; # Mass of water in kg\n",
+ "T1=300; # Temperature of water in kelvin\n",
+ "C=4.1868; # Specific heat in kJ/kg K\n",
+ "# (a). Heat Transfer\n",
+ "T2=500; # Temperature of heat reservoir in kelvin\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "Q=m*C*(T2-T1); # Heat transfer\n",
+ "del_Swater=m*C*math.log (T2/T1); # Entropy change of water\n",
+ "del_Sreservoir=-Q/T2; # Entropy change of reservoir\n",
+ "del_Suniverse=del_Swater+del_Sreservoir; # Entropy change of universe\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Heat Transfer\",\"\\nEntropy change of universe =\",round(del_Suniverse,4),\"kJ/K\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Heat Transfer in each reservoir\n",
+ "T2=400; # Temperature of intermediate reservoir in kelvin\n",
+ "T3=500; # Temperature of heat reservoir in kelvin\n",
+ "Q=m*C*(T3-T2); # Heat transfer\n",
+ "del_Swater=m*C*(math.log (T2/T1)+math.log (T3/T2)); # Entropy change of water\n",
+ "del_SreservoirI=-Q/T2; # Entropy change of reservoir I\n",
+ "del_SreservoirII=-Q/T3; # Entropy change of reservoir II\n",
+ "del_Suniverse=del_Swater+del_SreservoirI+del_SreservoirII; # Entropy change of universe\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Heat Transfer in each reservoir\",\"\\nEntropy change of universe =\",round(del_Suniverse,5),\"kJ/K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Heat Transfer \n",
+ "Entropy change of universe = 0.464 kJ/K\n",
+ "\n",
+ "(b).Heat Transfer in each reservoir \n",
+ "Entropy change of universe = 0.25466 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.16, Page No:292"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "m=1; # Mass of saturated steam in kg\n",
+ "T=100; # Teamperature of steam in degree celcius\n",
+ "T0=303; # temperature of Surroundings in kelvin\n",
+ "hfg=2257; # Latent heat of evaporation in kJ/kg\n",
+ "sfg=6.048; # specific entropy in kJ/kg K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).Entropy change\n",
+ "Q=m*hfg; # Heat transfer\n",
+ "del_Ssystem=-m*sfg; # Change of entropy of system\n",
+ "del_Ssurr=Q/T0; # Change of entropy of surroundings\n",
+ "del_Suniverse=del_Ssystem+del_Ssurr; # Change of entropy of universe\n",
+ "\n",
+ "#Ressult for (a)\n",
+ "print \"(a).Entropy change\",\"\\nChange of entropy of system =\",del_Ssystem,\"kJ/K\"\n",
+ "print \"Change of entropy of surroundings =\",round(del_Ssurr,4),\"kJ/K\"\n",
+ "print \"Change of entropy of universe =\",round(del_Suniverse,4),\"kJ/K\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Effect of heat transfer\n",
+ "del_Suniverse=0; # process is reversible\n",
+ "del_Ssurr=del_Suniverse-del_Ssystem; #Change of entropy of surroundings\n",
+ "QH=hfg; # Heat transfer from the condensing steam to reversible heat engine\n",
+ "QL=T0*del_Ssurr; # Heat receiveded by the surroundins reversible heat engine\n",
+ "W=QH-QL; #work output of reversible heat engine\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Effect of heat transfer\",\"\\nHeat transfer from the condensing steam to reversible heat engine =\",QH,\"kJ\"\n",
+ "print \"Heat receiveded by the surroundins reversible heat engine =\",round(QL,1),\"kJ\"\n",
+ "print \"work output of reversible heat engine =\",round(W,1),\"kJ\"\n",
+ "print \"Difference between QH & QL is converted into work output in a reversible cyclic process\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Entropy change \n",
+ "Change of entropy of system = -6.048 kJ/K\n",
+ "Change of entropy of surroundings = 7.4488 kJ/K\n",
+ "Change of entropy of universe = 1.4008 kJ/K\n",
+ "\n",
+ "(b).Effect of heat transfer \n",
+ "Heat transfer from the condensing steam to reversible heat engine = 2257 kJ\n",
+ "Heat receiveded by the surroundins reversible heat engine = 1832.5 kJ\n",
+ "work output of reversible heat engine = 424.5 kJ\n",
+ "Difference between QH & QL is converted into work output in a reversible cyclic process\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.17, Page No:293"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "m=1; # Mass of ice in kg\n",
+ "T1=258;# Temperature of ice in kelvin\n",
+ "Tm=273; # Melting point of ice in kelvin\n",
+ "T2=303; # temperature of Surroundings in kelvin\n",
+ "Cpice=2.095; # Specific heat of ice in kJ/kg K\n",
+ "hsg=333.5; # Latent heat of fusion in kJ/kg\n",
+ "Cpw=4.1868; # Specific heat of water in kJ/kg K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "# (a).Change of entropy\n",
+ "Q=m*(Cpice*(Tm-T1)+hsg+Cpw*(T2-Tm));# Heat transfer\n",
+ "del_Ssystem=m*((Cpice*math.log (Tm/T1))+(hsg/Tm)+(Cpw*math.log (T2/Tm)));# Change of entropy of system\n",
+ "del_Ssurr=-Q/T2; # Change of entropy of surroundings\n",
+ "del_Suniverse=del_Ssystem+del_Ssurr; # Change of entropy of universe\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Entropy change\",\"\\nChange of entropy of system =\",round(del_Ssystem,4),\"kJ/K\"\n",
+ "print \"Change of entropy of surroundings =\",round(del_Ssurr,4),\"kJ/K\"\n",
+ "print \"Change of entropy of universe =\",round(del_Suniverse,4),\"kJ/K\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).The minimum work of restoring water back to ice\n",
+ "QL=Q; # Refrigerating effect\n",
+ "W=T2*del_Ssystem-QL; # The minimum work of restoring water back to ice\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).The minimum work of restoring water back to ice = \",round(W,1),\"kJ\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Entropy change \n",
+ "Change of entropy of system = 1.7765 kJ/K\n",
+ "Change of entropy of surroundings = -1.6189 kJ/K\n",
+ "Change of entropy of universe = 0.1576 kJ/K\n",
+ "\n",
+ "(b).The minimum work of restoring water back to ice = 47.8 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.18, Page No:297"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "TA=323;# Temperature at section A in kelvin\n",
+ "PA=125; # Pressure at section A in kPa\n",
+ "TB=287;# Temperature at section B in kelvin\n",
+ "PB=100; # Pressure at section B in kPa\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "R=0.287; # characteristic gas constant of air in kJ/kg K\n",
+ "\n",
+ "#Calculation\n",
+ "SBA=(Cpo*math.log (TB/TA))-(R*math.log (PB/PA)); # Change in entropy\n",
+ "\n",
+ "#Result\n",
+ "print \"Change in entropy from B to A =\",SBA,\"kJ/kg (Error in Textbook)\",\"\\nHence SA>SB. Therefore B to A\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Change in entropy from B to A = -0.054541503612 kJ/kg (Error in Textbook) \n",
+ "Hence SA>SB. Therefore B to A\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.19, Page No:298"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p1=12.5; # Pressure of steam at inlet in MPa\n",
+ "T1=500; # Temperature of steam at inlet in degree celcius\n",
+ "V1=50; # Velocity of steam at inlet in m/s\n",
+ "p2=10; # Pressure of steam at outlet in kPa\n",
+ "V2=100; # Velocity of steam at outlet in m/s\n",
+ "# (a).Actual expansion\n",
+ "x2=0.85; # Quality of steam\n",
+ "# From steam table\n",
+ "h1=3341.8; hf2=191.83; hg2=2584.7; # specific enthalpy in kJ/kg \n",
+ "s1=6.4618; sf2=0.6493; sfg2=7.5009; # specific entropy in kJ/kg K\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "h2a=(1-x2)*hf2+x2*hg2; # specific enthalpy in kJ/kg \n",
+ "wa=(h1-h2a)+((V1**2-V2**2)/2000); # Actual work output\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Actual work output of turbine = \",round(wa,2),\"kJ\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Reversible adiabatic expansion\n",
+ "x2s=(s1-sf2)/sfg2; # Quality of steam after reversible adiabatic expansion\n",
+ "h2s=(1-x2s)*hf2+x2s*hg2; # specific enthalpy in kJ/kg \n",
+ "ws=(h1-h2s)+((V1**2-V2**2)/2000); # Reversible adiabatic work output\n",
+ "L=ws-wa; # Lost of work\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Reversible adiabatic expansion\",\"\\nReversible adiabatic work output = \",round(ws,1),\"kJ/kg\"\n",
+ "print \"Lost of work due to irreversibity of expansion process =\",round(L,1),\"kJ/kg\"\n",
+ "\n",
+ "#Calculation for (c)\n",
+ "# (c).Entropy Generation\n",
+ "s2a=sf2+x2*sfg2; # actual specific entropy in kJ/kg K\n",
+ "Sgen=s2a-s1; # Entropy generation\n",
+ "\n",
+ "#Reult for (c)\n",
+ "print \"\\n(c).Entropy Generation =\",round(Sgen,4),\"kJ/kg K\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Actual work output of turbine = 1112.28 kJ\n",
+ "\n",
+ "(b).Reversible adiabatic expansion \n",
+ "Reversible adiabatic work output = 1292.0 kJ/kg\n",
+ "Lost of work due to irreversibity of expansion process = 179.7 kJ/kg\n",
+ "\n",
+ "(c).Entropy Generation = 0.5633 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.20, Page No:302"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration\n",
+ "p1=0.1; # pressure at state 1 in MPa\n",
+ "p2=6; # Pressure at state 2 in MPa\n",
+ "# (a).Pump work for water\n",
+ "vf1=0.001043; # specific volume in m^3/kg\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "wp=-vf1*(p2-p1)*10**3; # Pump work for water\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Pump work for water =\",round(wp,2),\"kJ\"\n",
+ "\n",
+ "\n",
+ "#Variable declaration for (b)\n",
+ "# (b).For steam\n",
+ "h1=2675.5;# specific enthalpy in kJ/kg \n",
+ "s1=7.3595;# specific entropy in kJ/kg K\n",
+ "# From superheated steam table\n",
+ "t2=675; # Temperature at state 2 in degree celcius\n",
+ "h2=3835.3;# specific enthalpy in kJ/kg \n",
+ "\n",
+ "#Calculation for (b)\n",
+ "wc=-(h2-h1); # Compressor work for steam\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"(b).Compressor work for steam =\",wc,\"kJ/kg\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Pump work for water = -6.15 kJ\n",
+ "(b).Compressor work for steam = -1159.8 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.21, Page No:303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "# (a).Restoring to initial state by throttling process\n",
+ "T1=303; #Temperature of air at state 1 in kelvin\n",
+ "p1=1; #Pressure of air at state 1 in bar\n",
+ "p2=5; #Pressure of air at state 2 in bar\n",
+ "p3=1;#Pressure of air at state 3 in bar\n",
+ "T3=303; #Temperature of air at state 3 in kelvin\n",
+ "Cpo=1.0035; # Specific heat at constant pressure in kJ/kg K\n",
+ "R=0.287; # characteristic gas constant of air in kJ/kg K\n",
+ "k=1.4; # Index of reversible adiabatic compression\n",
+ "\n",
+ "#Calculation for (a)\n",
+ "T2=T1*(p2/p1)**((k-1)/k); # Temperature after reversible adiabatic compression\n",
+ "w12=Cpo*(T2-T1); # Work of reversible adiabatic compression\n",
+ "s21=0; # Entropy change of air\n",
+ "s32=-R*math.log (p3/p2); # Entropy change \n",
+ "s31=s32; # Net entropy change of air\n",
+ "d_Ssurr=0; # Entropy change of surroundings because There is no heat transfer\n",
+ "d_Suniv=s31+d_Ssurr; # Net Entropy change of universe\n",
+ "\n",
+ "#Result for (a)\n",
+ "print \"(a).Restoring to initial state by throttling process\",\"\\nWork of reversible adiabatic compression = \",round(w12,1),\"kJ/kg\"\n",
+ "print \"Net Entropy change of universe = \",round(d_Suniv,4),\"kJ/kg K\"\n",
+ "\n",
+ "#Calculation for (b)\n",
+ "# (b).Restoring to initial state by by completing cycle\n",
+ "T0=298; # Temperature of surroundings in kelvin\n",
+ "d_Ssystem=0; # Entropy change of systrem is zero because it is cyclic process\n",
+ "q31=Cpo*(T2-T3); # Heat rejected to the surroundings\n",
+ "d_Ssurr=q31/T0; # Entropy change of surroundings\n",
+ "d_Suniv=d_Ssystem+d_Ssurr; # Increase in entropy of the universe\n",
+ "\n",
+ "#Result for (b)\n",
+ "print \"\\n(b).Restoring to initial state by by completing cycle\",\"\\nNet Entropy change of universe = \",round(d_Suniv,3),\"kJ/kg K\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a).Restoring to initial state by throttling process \n",
+ "Work of reversible adiabatic compression = 177.5 kJ/kg\n",
+ "Net Entropy change of universe = 0.4619 kJ/kg K\n",
+ "\n",
+ "(b).Restoring to initial state by by completing cycle \n",
+ "Net Entropy change of universe = 0.596 kJ/kg K\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |