From c7fe425ef3c5e8804f2f5de3d8fffedf5e2f1131 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 7 Apr 2015 15:58:05 +0530 Subject: added books --- .../Chapter1.ipynb | 387 ++++++++ .../Chapter10.ipynb | 628 ++++++++++++ .../Chapter11.ipynb | 353 +++++++ .../Chapter12.ipynb | 262 +++++ .../Chapter13.ipynb | 453 +++++++++ .../Chapter14.ipynb | 393 ++++++++ .../Chapter15.ipynb | 686 +++++++++++++ .../Chapter16.ipynb | 378 +++++++ .../Chapter17.ipynb | 812 +++++++++++++++ .../Chapter2.ipynb | 588 +++++++++++ .../Chapter3.ipynb | 756 ++++++++++++++ .../Chapter4.ipynb | 720 ++++++++++++++ .../Chapter5.ipynb | 614 ++++++++++++ .../Chapter6.ipynb | 315 ++++++ .../Chapter7.ipynb | 1049 ++++++++++++++++++++ .../Chapter8.ipynb | 764 ++++++++++++++ .../Chapter9.ipynb | 540 ++++++++++ Thermodynamics_An_Engineering_Approach/README.txt | 10 + .../screenshots/Chapter_10_Ex_10-1_Screenshot.png | Bin 0 -> 45520 bytes .../Chapter_10_Ex_10-1_Screenshot_1.png | Bin 0 -> 45520 bytes .../screenshots/Chapter_14_Ex_14-2_Screenshot.png | Bin 0 -> 44124 bytes .../Chapter_14_Ex_14-2_Screenshot_1.png | Bin 0 -> 44124 bytes .../screenshots/Chapter_8_Ex_8-4_Screenshot.png | Bin 0 -> 48121 bytes .../screenshots/Chapter_8_Ex_8-4_Screenshot_1.png | Bin 0 -> 48121 bytes 24 files changed, 9708 insertions(+) create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter1.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter10.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter11.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter12.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter13.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter14.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter15.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter16.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter17.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter2.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter3.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter4.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter5.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter6.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter7.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter8.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/Chapter9.ipynb create mode 100755 Thermodynamics_An_Engineering_Approach/README.txt create mode 100755 Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot.png create mode 100755 Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot_1.png create mode 100755 Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot.png create mode 100755 Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot_1.png create mode 100755 Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot.png create mode 100755 Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot_1.png (limited to 'Thermodynamics_An_Engineering_Approach') diff --git a/Thermodynamics_An_Engineering_Approach/Chapter1.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter1.ipynb new file mode 100755 index 00000000..3e2c2051 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter1.ipynb @@ -0,0 +1,387 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Introduction and Basic Concepts" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-2, Page No.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "p=850;# density in kg/m^3\n", + "V=2; # volumne of tank in m^3\n", + "\n", + "#Calculations\n", + "m=p*V;# mass, density and volumne corealtion\n", + "\n", + "#Result\n", + "print 'The amount of oil in tank is %i kg' %round(m,0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amount of oil in tank is 1700 kg\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-3, Page No.9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Constants used\n", + "g=32.174;# gravitational constant in ft/s^2\n", + "\n", + "#given values\n", + "m=1; # mass of 1.00 lbm is subjected to standard earth gravity\n", + "\n", + "#Calculations\n", + "w=(m*g)/g; # weight is mass times the local value of gravitational acceleration\n", + "#dimensionally the above equation is represented as lbm * ft/s^2 * (lbf/ft/s^2)\n", + "\n", + "#Result\n", + "print 'The weight on earth is %i lbf' %w\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The weight on earth is 1 lbf\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-4, Page No.21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Example 1.4\n", + "\n", + "# Given values\n", + "Tc=10; #change in temp in Celcius\n", + "\n", + "# Calculations\n", + "Tk=Tc;\n", + "Tr=1.8*Tk;#conversion scale of temperature change from K to R\n", + "Tf=Tr;\n", + "# calculated using the corealtions b/w these scales\n", + "\n", + "#Results\n", + "print 'the corresponding change is %i K' %Tk\n", + "print 'the corresponding change is %i R' %Tr\n", + "print 'the corresponding change is %i F' %Tf\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the corresponding change is 10 K\n", + "the corresponding change is 18 R\n", + "the corresponding change is 18 F\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-5, Page No.23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "Patm=14.5; #atmospheric pressure in psi\n", + "Pvac=5.8; #vacuum gage reading in psi\n", + "\n", + "#Calculations\n", + "Pabs=Patm-Pvac;#pressure in vaccumm is always treated to be negative\n", + "\n", + "#Results\n", + "print'the absolute pressure in the chamber %f psi'%round(Pabs,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the absolute pressure in the chamber 8.700000 psi\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-6, Page No.26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Constants used\n", + "pw=1000; # density of water in kg/m^3;\n", + "g=9.81; # acceleration due to gravity in m/s^2;\n", + " \n", + "#Given values\n", + "SG=0.85;# specific gravity of manometric fluid\n", + "h=0.55;# converting height from cm to m\n", + "Patm=96;# atmospheric pressure in kPa\n", + "\n", + "# Calculations\n", + "p=SG*pw;\n", + "Ptank=Patm+(p*g*h/1000); # calculating pressure using liquid at same height have same pressure\n", + "\n", + "#Results\n", + "print 'absolute pressure in tank %f kPa' %round(Ptank,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "absolute pressure in tank 100.600000 kPa\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-7, Page No.28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Constants used\n", + "g=9.81;#acceleration due to gravity in m/s^2;\n", + "\n", + "#Given values\n", + "h1=0.1;# distance b/w point 1 at air-water interface and point 2 at mercury-air interface in m\n", + "h2=0.2;# distance b/w oil-water interface and mercury-oil interface in m\n", + "h3=0.35;# distance b/w air-mercury interface and mercury-oil interface in m\n", + "pw=1000;# density of water in kg/m^3\n", + "pHg=13600;# density of mercury in kg/m^3\n", + "poil=800;# density of oil in kg/m^3\n", + "Patm=85.6;# atmospheric pressure in kPa\n", + "\n", + "#Calculation\n", + "P1=Patm-(pw*g*h1+poil*g*h2-pHg*g*h3)/1000;#calculating pressure using liquid at same height have same pressure\n", + "\n", + "#Results\n", + "print 'the air pressure in tank %i kPa' %round(P1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the air pressure in tank 130 kPa\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-8, Page No.31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Constants used\n", + "g=9.81;# acceleration due to gravity in m/s^2;\n", + "\n", + "#Given values\n", + "pHg=13570;# density of mercury at 10 C in kg/m^3\n", + "h=0.74;# converting barometric reading into m from mm\n", + "\n", + "#Calculationa\n", + "Patm=pHg*g*h/1000;# standard pressure formula\n", + "\n", + "#Results\n", + "print 'the atmospheric pressure %f kPa' %round(Patm,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the atmospheric pressure 98.500000 kPa\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-9, Page No.31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#constants used\n", + "g=9.81;#acceleration due to gravity in m/s^2;\n", + "\n", + "#given values\n", + "m=60;# mass of piston in kg\n", + "Patm=0.97;# atmospheric pressure in kPa\n", + "A=0.04;# cross-sectional area in m^2\n", + "\n", + "#calculation\n", + "P=Patm+(m*g/A)/100000;# standard pressure formula\n", + "print 'The pressure inside the cylinder %f bar' %round(P,2)\n", + "#The volume change will have no effect on the free-body diagram drawn in part (a), and therefore the pressure inside the cylinder will remain the same\n", + "print('If some heat is transferred to the gas and its volume is doubled, there is no change in pressure');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure inside the cylinder 1.120000 bar\n", + "If some heat is transferred to the gas and its volume is doubled, there is no change in pressure\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1-10, Page No.32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from scipy.integrate import quad \n", + "from pylab import *\n", + "\n", + "#Constants used\n", + "g=9.81;#acceleration due to gravity in m/s^2;\n", + "\n", + "#Given values\n", + "p=1040;# density on the water surface in kg/m^3\n", + "h1=0.8;# thickness of surface zone\n", + "H=4;# thickness of gradient zone\n", + "x0=0.0;# lower limit of integration\n", + "x1=4.0;# upper limit of integration\n", + "\n", + "\n", + "#Calculations\n", + "P1=p*g*h1/1000;#standard pressure determination formula\n", + "#P2 = integration of the exp. p*g*(math.sqrt(1+(math.tan(math.pi*z/4/H)^2))) b/w 0-4\n", + "def intgrnd1(z): \n", + " return (p*g*(math.sqrt(1+(math.tan(math.pi*(z)/4/H)**2))) )#integrant\n", + "P2, err = quad(intgrnd1, x0, x1) \n", + "P2=P2/1000;#converting into kPa\n", + "P=P1+P2;\n", + "\n", + "#Results\n", + "print 'the gage pressure at the bottom of gradient zone %f kPa' %round(P)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the gage pressure at the bottom of gradient zone 54.000000 kPa\n" + ] + } + ], + "prompt_number": 17 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter10.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter10.ipynb new file mode 100755 index 00000000..df284751 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter10.ipynb @@ -0,0 +1,628 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10: Vapor and Combined Power Cycles" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-1 ,Page No.555" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P1=75;#outlet pressure at compressor in kPa\n", + "P2=3000;#inlet pressure at turbine in kPa\n", + "P3=P2;\n", + "T3=350;#steam inlet temperature in C\n", + "P4=P1;\n", + "\n", + "#from steam tables\n", + "#at state 1\n", + "v1=0.001037;\n", + "h1=384.44;\n", + "#at state 3\n", + "h3=3116.1;\n", + "s3=6.7450;\n", + "#at state 4\n", + "s4=s3;\n", + "sf=1.2132;\n", + "sfg=6.2426;\n", + "hf=384.44;\n", + "hfg=2278;\n", + "\n", + "#calculations\n", + "win=v1*(P2-P1);\n", + "h2=h1+win;\n", + "x4=(s4-sf)/sfg;\n", + "h4=hf+x4*hfg;\n", + "qin=h3-h2;\n", + "qout=h4-h1;\n", + "nth=1-(qout/qin);\n", + "print'thermal efficency is %f'%round(nth,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thermal efficency is 0.260000\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-2 ,Page No.559" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "#from figure\n", + "P1=9;#in kPa\n", + "T1=38;#in C\n", + "P2=16000;#in kPa\n", + "P3=15.9;#in MPa\n", + "T3=35;#in C\n", + "P4=15.2;#in MPa\n", + "T4=625;#in C\n", + "P5=15;#in MPa\n", + "T5=600;#in C\n", + "#from question\n", + "nT=0.87;#isentropic efficiency of turbine \n", + "nP=0.85;#isentropic efficiency of pump\n", + "m=15;#mass flow rate in kg/s\n", + "\n", + "#from steam tables\n", + "v1=0.001009;\n", + "h5=3583.1;\n", + "h6s=2115.3;\n", + "h4=3647.6;\n", + "h3=160.1;\n", + "\n", + "#calculations\n", + "Win=v1*(P2-P1)/nP;\n", + "Wout=nT*(h5-h6s);\n", + "qin=h4-h3;\n", + "Wnet=Wout-Win;\n", + "nth=Wnet/qin;\n", + "print'thermal efficency is %f'%round(nth,3)\n", + "Wnet=m*Wnet;\n", + "print'power output %f MW'%round(Wnet/1000,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thermal efficency is 0.361000\n", + "power output 18.870000 MW\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-3 ,Page No.562" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P1=10;#outlet pressure at compressor in kPa\n", + "P2=3000;#inlet pressure at turbine in kPa\n", + "P3=P2;\n", + "T3=350;#steam inlet temperature in C\n", + "P4=P1;\n", + "\n", + "#from steam tables\n", + "#at state 1\n", + "h1=191.81;\n", + "v1=0.00101;\n", + "#at state 2\n", + "#s2=s1\n", + "#at state 3\n", + "h3=3116.1;\n", + "s3=6.7450;\n", + "#at state 4\n", + "s4=s3;\n", + "sf=0.6492;\n", + "sfg=7.4996;\n", + "hf=191.81;\n", + "hfg=2392.1;\n", + "\n", + "#calculations\n", + "#part - a\n", + "win=v1*(P2-P1);\n", + "h2=h1+win;\n", + "x4=(s4-sf)/sfg;\n", + "h4=hf+x4*hfg;\n", + "qin=h3-h2;\n", + "qout=h4-h1;\n", + "nth=1-(qout/qin);\n", + "print'the thermal efficiency of this power plant is %f'%round(nth,3);\n", + "#part - b\n", + "#States 1 and 2 remain the same in this case, and the enthalpies at state 3 (3 MPa and 600\u00b0C) and state 4 (10 kPa and s4=s3) are determined to be\n", + "h3=3682.8;\n", + "h4=2380.3;\n", + "x4=0.915;\n", + "qin=h3-h2;\n", + "qout=h4-h1;\n", + "nth=1-(qout/qin);\n", + "print'the thermal efficiency if steam is superheated to 600\u00b0 instead of 350\u00b0C is %f'%round(nth,3);\n", + "#part - c\n", + "#State 1 remains the same in this case, but the other states change. The enthalpies at state 2 (15 MPa and s2 s1), state 3 (15 MPa and 600\u00b0C),and state 4 (10 kPa and s4 s3) are determined in a similar manner to be\n", + "h2=206.95;\n", + "h3=3583.1;\n", + "h4=2115.3;\n", + "x4=0.804;\n", + "qin=h3-h2;\n", + "qout=h4-h1;\n", + "nth=1-(qout/qin);\n", + "print'the thermal efficiency if the boiler pressure is raised to 15 MPa while the turbine inlet temperature is maintained at 600\u00b0C is %f'%round(nth,3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the thermal efficiency of this power plant is 0.334000\n", + "the thermal efficiency if steam is superheated to 600\u00b0 instead of 350\u00b0C is 0.373000\n", + "the thermal efficiency if the boiler pressure is raised to 15 MPa while the turbine inlet temperature is maintained at 600\u00b0C is 0.430000\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-4 ,Page No.566" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P1=10;#outlet pressure at compressor in kPa\n", + "P2=15000;#inlet pressure at turbine in kPa\n", + "P3=P2;\n", + "T3=600;#steam inlet temperature in C\n", + "P4=4000;#in kPa\n", + "T5=T3;\n", + "P6=P1;\n", + "x6=0.896;#dryness fraction\n", + "\n", + "#from steam table\n", + "#at state 1\n", + "h1=191.81;\n", + "v1=0.00101;\n", + "#at state 3\n", + "h3=3593.1;\n", + "s3=6.6796;\n", + "#at state 4\n", + "h4=3155;\n", + "T4=375.5;\n", + "#at state 6\n", + "sf=0.6492;\n", + "sfg=7.4996;\n", + "hf=191.81;\n", + "hfg=2392.1;\n", + "\n", + "#calculations\n", + "s6=sf+x6*sfg;\n", + "h6=hf+x6*hfg;\n", + "#s5 = s6\n", + "#from tables\n", + "P5=4000.0;#in kPa\n", + "h5=3674.9;\n", + "print'the pressure at which the steam should be reheated %i MPa'%(P5/1000);\n", + "#s2 = s1\n", + "win=v1*(P2-P1);\n", + "h2=h1+win;\n", + "qin=(h3-h2)+(h5-h4);\n", + "qout=h6-h1;\n", + "nth=1-(qout/qin);\n", + "print'thermal efficency is %f'%round(nth,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the pressure at which the steam should be reheated 4 MPa\n", + "thermal efficency is 0.451000\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-5 ,Page No.571" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P1=10;#outlet pressure at compressor in kPa\n", + "P2=1200;#in kPa\n", + "P3=P2;\n", + "P4=15000;#inlet pressure at turbine in kPa\n", + "P5=P4;\n", + "T5=600;#steam inlet temperature in C\n", + "P6=P2;\n", + "P7=P1;\n", + "\n", + "#from steam table\n", + "#at state 1\n", + "h1=191.81;\n", + "v1=0.00101;\n", + "#at state 3\n", + "h3=798.33;\n", + "v3=0.001138;\n", + "#at state 4\n", + "h4=3155;\n", + "T4=375.5;\n", + "#at state 5\n", + "h5=3583.1;\n", + "s5=6.6796;\n", + "#at state 6\n", + "h6=2860.2;\n", + "T6=218.4;\n", + "#at state 7\n", + "P7=10;\n", + "sf=0.6492;\n", + "sfg=7.4996;\n", + "hf=191.81;\n", + "hfg=2392.1;\n", + "\n", + "#calculations\n", + "#s2 = s1\n", + "win=v1*(P2-P1);\n", + "h2=h1+win;\n", + "#s4 = s3\n", + "win=v3*(P4-P3);\n", + "h4=h3+win;\n", + "s7=s5;\n", + "x7=(s7-sf)/sfg;\n", + "h7=hf+(x7*hfg);\n", + "#y is the fraction of steam extracted from the turbine\n", + "y=(h3-h2)/(h6-h2);\n", + "qin=h5-h4;\n", + "qout=(1-y)*(h7-h1);\n", + "nth=1-(qout/qin);\n", + "print'fraction of steam extracted is %f'%round(y,4);\n", + "print'thermal efficency is %f'%round(nth,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fraction of steam extracted is 0.226900\n", + "thermal efficency is 0.463000\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-6 ,Page No.574" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P1=10;#outlet pressure at compressor in kPa\n", + "P2=500;#steam extracted from low-pressure turbine in kPa\n", + "P3=P2;\n", + "P4=15000;#inlet pressure at turbine in kPa\n", + "P5=P4;\n", + "P6=4000;#steam extracted from turbine at pressure in kPa\n", + "P7=P5;\n", + "P8=P7;\n", + "P9=P7;\n", + "P10=P6;\n", + "P11=P10;\n", + "P12=P3;\n", + "P13=P1;\n", + "\n", + "#enthalpies at the various states and the pump work per unit mass of fluid flowing through them are\n", + "h1=191.81;\n", + "h2=192.30;\n", + "h3=640.09;\n", + "h4=643.92;\n", + "h5=1087.4;\n", + "h6=h5;\n", + "h7=1101.2;\n", + "h8=1089.8;\n", + "h9=3583.1;\n", + "h10=3155;\n", + "h11=3679.9;\n", + "h12=3014.8;\n", + "h13=2335.7;\n", + "wIin=0.49;\n", + "wIIin=3.83;\n", + "wIIIin=13.77;\n", + "\n", + "#calculations\n", + "y=(h5-h4)/((h10-h6)+(h5-h4));\n", + "z=(1-y)*(h3-h2)/(h12-h2);\n", + "h8=(1-y)*h5+(y*h7);\n", + "qin=(h9-h8)+(1-y)*(h11-h10);\n", + "qout=(1-y-z)*(h13-h1);\n", + "nth=1-(qout/qin);\n", + "print'fraction of steam extracted from closed feedwater is %f'%round(y,4);\n", + "print'fraction of steam extracted from open feedwater is %f'%round(z,4);\n", + "print'thermal efficency is %f'%round(nth,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fraction of steam extracted from closed feedwater is 0.176600\n", + "fraction of steam extracted from open feedwater is 0.130600\n", + "thermal efficency is 0.492000\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-7 ,Page No.577" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T0=290;#temperature at heat which is rejected in K \n", + "Tsource=1600;#temperature of furnace in K\n", + "Tsink=T0;\n", + "#from Ex 10.1\n", + "qin=2728.6;#in kJ/Kg\n", + "qout=2018.6;#in kJ/Kg\n", + "h4=2403;#in kJ/Kg\n", + "\n", + "#from steam tables\n", + "s1=1.2132;\n", + "s3=6.7450;\n", + "\n", + "#calculations\n", + "s2=s1;s4=s3;#isentropic processes\n", + "xdest12=0;\n", + "xdest34=0;\n", + "xdest23=T0*(s3-s2-(qin/Tsource));\n", + "xdest41=T0*(s1-s4+(qout/Tsink));\n", + "print'exergy destruction in process 1-2 %i kJ/kg'%xdest12;\n", + "print'exergy destruction in process 2-3 %i kJ/kg'%round(xdest23);\n", + "print'exergy destruction in process 3-4 %i kJ/kg'%xdest34;\n", + "print'exergy destruction in process 4-1 %i kJ/kg'%round(xdest41);\n", + "xdestcy=xdest12+xdest23+xdest34+xdest41;\n", + "print'exergy destruction %i cycle in kJ/kg'%round(xdestcy);\n", + "#from steam tables\n", + "#at 290 K and 100 kPa\n", + "h0=71.355;\n", + "s0=0.2533;\n", + "X4=(h4-h0)-T0*(s4-s0);\n", + "print'exergy of the leaving steam %i kJ/kg'%(round(X4))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "exergy destruction in process 1-2 0 kJ/kg\n", + "exergy destruction in process 2-3 1110 kJ/kg\n", + "exergy destruction in process 3-4 0 kJ/kg\n", + "exergy destruction in process 4-1 414 kJ/kg\n", + "exergy destruction 1524 cycle in kJ/kg\n", + "exergy of the leaving steam 449 kJ/kg\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-8 ,Page No.581" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "m1=15;#mass flow rate in kg/s\n", + "P1=7000;#inlet pressure at turbine in kPa\n", + "P2=P1;\n", + "P3=P1;\n", + "P4=500;#throttled to pressure in kPa\n", + "P5=P4;\n", + "P6=5;#steam expanded at a pressure in kPa\n", + "P7=P4;\n", + "P8=P6;\n", + "P9=P1;\n", + "P10=P1;\n", + "\n", + "#from steam tables\n", + "v7=0.001005;\n", + "v8=0.001093;\n", + "h1=3411.4;\n", + "h2=h1;\n", + "h3=h1;\n", + "h4=h1;\n", + "h5=2739.3;\n", + "h6=2073.0;\n", + "h7=640.09;\n", + "h8=137.75;\n", + "h11=144.78;\n", + "\n", + "#calculations\n", + "wIin=v8*(P9-P8);\n", + "wIIin=v7*(P10-P7);\n", + "h9=h8+wIin;\n", + "h10=h7+wIIin;\n", + "Qmax=m1*(h1-h7);\n", + "print'the maximum rate %i kW'%round(Qmax);\n", + "Wtout=m1*(h3-h6);#turbine\n", + "Wpin=m1*wIin;#pump\n", + "Wnet=Wtout-Wpin;\n", + "print'the power produced %i MW'%(round(Wnet/1000));\n", + "Qp=0;\n", + "Qin=m1*(h1-h11);\n", + "Eu=(Wnet+Qp)/Qin;\n", + "print'the utilization factor is %f'%round(Eu,3);\n", + "m4=0.1*m1;\n", + "m5=0.7*m1;\n", + "m7=m4+m5;\n", + "Qout=m4*h4+m5*h5-m7*h7;\n", + "print'the rate of process heat supply %f MW'%round(Qout/1000,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the maximum rate 41570 kW\n", + "the power produced 20 MW\n", + "the utilization factor is 0.407000\n", + "the rate of process heat supply 26.200000 MW\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10-9 ,Page No.585" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P1=5;#intial pressure in kPa\n", + "P2=7000;#final pressure ink Pa\n", + "P3=P2;\n", + "T3=500;#inlet temperature in K\n", + "P4=P1;\n", + "\n", + "#gas cycle from Ex9-6\n", + "#d stands for '\n", + "h4d=880.36;\n", + "T4d=853;\n", + "qin=790.58;\n", + "wnetg=210.41;\n", + "nth=0.266\n", + "h5d=451.80;\n", + "#steam cycle\n", + "h2=144.78;\n", + "T2=33;\n", + "h3=3411.4;\n", + "T3=500;\n", + "wnets=1331.4;\n", + "nth=0.408;\n", + "\n", + "#calculations\n", + "#Ein = Eout\n", + "#y is the ratio of ms/mg\n", + "y=(h4d-h5d)/(h3-h2);\n", + "print'the ratio of the mass flow rates of the steam and the combustion gasesis %f'%round(y,3);\n", + "wnet=wnetg+y*wnets\n", + "nth=wnet/qin;\n", + "print'thermal efficency is %f'%round(nth,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the ratio of the mass flow rates of the steam and the combustion gasesis 0.131000\n", + "thermal efficency is 0.487000\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter11.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter11.ipynb new file mode 100755 index 00000000..460e3a17 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter11.ipynb @@ -0,0 +1,353 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Refrigeration Cycles" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11-1 ,Page No.613" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given values\n", + "P1=0.14;#intial pressure in MPa\n", + "P2=0.8;#final pressure in MPa\n", + "m=0.05;#mass flow rate in kg/s\n", + "\n", + "#from refrigerant-134a tables\n", + "h1=239.16;\n", + "s1=0.94456;\n", + "h2=275.39;\n", + "h3=95.47;\n", + "\n", + "#calculation\n", + "s2=s1;#isentropic process \n", + "h4=h3;#throttling\n", + "QL=(h1-h4)*m;\n", + "Wm=m*(h2-h1);\n", + "Qh=m*(h2-h3);\n", + "COPR=QL/Wm;\n", + "print'the rate of heat removal from the refrigerated space %f kW'%round(QL,2);\n", + "print'the power input to the compressor %f kW'%round(Wm,2);\n", + "print'the rate of heat rejection to the environment %f kW'%round(Qh);\n", + "print'the COP of the refrigerator is %f'%round(COPR,2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the rate of heat removal from the refrigerated space 7.180000 kW\n", + "the power input to the compressor 1.810000 kW\n", + "the rate of heat rejection to the environment 9.000000 kW\n", + "the COP of the refrigerator is 3.970000\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11-2 ,Page No.615" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "m=0.05;#mass flow rate in kg/s\n", + "P1=0.14;#inlet pressure in MPa\n", + "T1=-10;#inlet temperature in C\n", + "P2=0.8;#outlet pressure in MPa\n", + "T2=50;#outlet temperature in C\n", + "P3=0.72;#condensor pressure in MPa\n", + "T3=26;#condensor temperature in C\n", + "\n", + "#from refrigerant tables\n", + "h1=246.36;\n", + "h2=286.69;\n", + "h3=87.83;\n", + "h2S=284.21;#at isentropic conditions\n", + "\n", + "#calculations\n", + "h4=h3;#throttling\n", + "QL=m*(h1-h4);\n", + "Wm=m*(h2-h1);\n", + "nC=(h2S-h1)/(h2-h1);\n", + "COPR=QL/Wm;\n", + "print'the rate of heat removal from the refrigerated space %f kW'%round(QL,2);\n", + "print'the power input to the compressor %f kW'%round(Wm,2);\n", + "print'the isentropic efficiency of the compressor is %f'%round(nC,3);\n", + "print'the COP of the refrigerator is %f'%round(COPR,2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the rate of heat removal from the refrigerated space 7.930000 kW\n", + "the power input to the compressor 2.020000 kW\n", + "the isentropic efficiency of the compressor is 0.939000\n", + "the COP of the refrigerator is 3.930000\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11-3 ,Page No.621" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "mA=0.05;#mass flow rate in kg/s\n", + "P1=0.14;#inlet pressure in MPa\n", + "P5=0.32;#pressure at heat exchanger in MPa\n", + "P7=0.8;#oultet pressure in MPa\n", + "\n", + "#from tables\n", + "h1=239.16;\n", + "h2=255.93;\n", + "h3=55.16;\n", + "h5=251.88;\n", + "h6=270.92;\n", + "h7=95.47;\n", + "\n", + "#calculations\n", + "h4=h3;#throttling\n", + "h8=h7;#throttling\n", + "# E out = E in\n", + "# mA*h5 + mB*h3 = mA*h8 + mB*h2\n", + "mB=mA*(h5-h8)/(h2-h3);\n", + "QL=mB*(h1-h4);\n", + "# W in = Wcomp I,in + Wcomp II,in\n", + "Win=mA*(h6-h5)+mB*(h2-h1);\n", + "COPR=QL/Win;\n", + "print'the mass flow rate of the refrigerant through the lower cycle %f kg/s'%round(mB,4);\n", + "print'the rate of heat removal from the refrigerated space %f kW'%round(QL,2);\n", + "print'the power input to the compressor %f kW'%round(Win,2);\n", + "print'the coefficient of performance of this cascade refrigerator is %f'%round(COPR,2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the mass flow rate of the refrigerant through the lower cycle 0.039000 kg/s\n", + "the rate of heat removal from the refrigerated space 7.170000 kW\n", + "the power input to the compressor 1.610000 kW\n", + "the coefficient of performance of this cascade refrigerator is 4.460000\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11-4 ,Page No.624" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P1=0.14;#inlet pressure in MPa\n", + "P5=0.32;#throttled pressure in MPa\n", + "P7=0.8;#oultet pressure in MPa\n", + "\n", + "#from tables\n", + "h1=239.16;\n", + "h2=255.93;\n", + "h3=251.88;\n", + "h5=95.47;\n", + "h7=55.16;\n", + "\n", + "#from saturated liquid-vapour table\n", + "#at P=0.32 MPa\n", + "hf=55.16;\n", + "hfg=196.71;\n", + "\n", + "#calculations\n", + "h8=h7;#throttling\n", + "h6=h5;#throttling\n", + "#the quality at state 6\n", + "x6=(h6-hf)/hfg;\n", + "qL=(1-x6)*(h1-h8);\n", + "# W in = Wcomp I,in + Wcomp II,in\n", + "#enthalaoy at state 9\n", + "# E out = E in\n", + "h9=x6*h3+(1-x6)*h2;\n", + "# s9 = s4 i.e isentropic process\n", + "#at 0.8MPa and s4=0.9416 kJ/kg\n", + "h4=274.48;\n", + "Win=(1-x6)*(h2-h1)+(1)*(h4-h9);\n", + "COPR=qL/Win;\n", + "print'the fraction of the refrigerant that evaporates as it is throttled to the flash chamber is %f'%round(x6,4);\n", + "print'the amount of heat removed from the refrigerated space %f kJ/kg'%round(qL,1);\n", + "print'the compressor work per unit mass of refrigerant flowing through the condensor %f kJ/kg'%round(Win,2);\n", + "print'the coefficient of performance is %f'%round(COPR,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the fraction of the refrigerant that evaporates as it is throttled to the flash chamber is 0.204900\n", + "the amount of heat removed from the refrigerated space 146.300000 kJ/kg\n", + "the compressor work per unit mass of refrigerant flowing through the condensor 32.710000 kJ/kg\n", + "the coefficient of performance is 4.470000\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11-5 ,Page No.630" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "m=0.1;#mass flow rate in lbm/s\n", + "T1=0+460;#refigerated space at temperature in R\n", + "T3=80+460;#temperature of surrounding medium in R\n", + "\n", + "#from Table A\u201317E\n", + "# at T1\n", + "h1=109.90;\n", + "Pr1=.7913;\n", + "#pressure ratio at compressor is 4\n", + "Pr2=4*Pr1;\n", + "#at Pr2\n", + "h2=163.5;\n", + "T2=683;\n", + "#at T3\n", + "h3=129.06;\n", + "Pr3=1.3860;\n", + "#pressure ratio at compressor is 4\n", + "Pr4=Pr3/4;\n", + "#at Pr4\n", + "h4=86.7;\n", + "T4=363;\n", + "\n", + "#calculations\n", + "qL=h1-h4;\n", + "Wout=h3-h4;\n", + "Win=h2-h1;\n", + "COPR=qL/(Win-Wout);\n", + "Qrefrig=m*qL;\n", + "print'the minimum temperatures in the cycle %f F'%round(T4-460);\n", + "print'the maximum temperatures in the cycle %f F'%round(T2-460);\n", + "print'the coefficient of performance is %f'%round(COPR,2)\n", + "print'the rate of refrigeration for a mass flow rate of 0.1 lbm/s. %f Btu/s'%round(Qrefrig,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the minimum temperatures in the cycle -97.000000 F\n", + "the maximum temperatures in the cycle 223.000000 F\n", + "the coefficient of performance is 2.060000\n", + "the rate of refrigeration for a mass flow rate of 0.1 lbm/s. 2.320000 Btu/s\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11-6 ,Page No.636" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "COPR=0.1;#refrigerator COP\n", + "T1=20;#intial temp in C\n", + "T2=4;#final temp in C\n", + "t=30*60;#total time required in sec\n", + "V=0.350;#volumne of can in L\n", + "\n", + "#constants used\n", + "p=1;#on kg/L\n", + "c=4.18;#in kJ/kg-C from Table A-3\n", + "\n", + "#calculations\n", + "m=p*V;\n", + "Qcooling=m*c*(T1-T2)/t*1000;#converted in W by multiplying by 1000\n", + "Win=Qcooling/COPR;\n", + "print'the average electric power consumed by the thermoelectric refrigerator %i W'%round(Win)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average electric power consumed by the thermoelectric refrigerator 130 W\n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter12.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter12.ipynb new file mode 100755 index 00000000..c181d0f6 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter12.ipynb @@ -0,0 +1,262 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12: Thermodynamic Property Relations" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12-1 ,Page No.652" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#from Table A-17\n", + "#cp value approximately by replacing the differentials\n", + "h1=305.22;#in kJ/kg\n", + "T1=305;#in K\n", + "h2=295.17;#in kJ/kg\n", + "T2=295;#in K\n", + "\n", + "#calculations\n", + "#from the given equation we can calculate\n", + "cp=(h1-h2)/(T1-T2);\n", + "print'the cp of air at 300 K %f kJ/ kg - K'%round(cp,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the cp of air at 300 K 1.005000 kJ/ kg - K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12-2 ,Page No.654" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "dT=302-300;#differnce in final and intial temperatures of air in K\n", + "dv=0.87-0.86;#differnce in final and intial volumnes of air in m^3/kg\n", + "T=(302+300)/2;#average temp in K\n", + "v=(0.87+0.86)/2;#average volumne in m^3/kg\n", + "\n", + "#constants used\n", + "R=0.287;#in kJ/kg-K\n", + "\n", + "#calculations\n", + "#using eq 12-3 by diffrentiating P= R*T/v\n", + "dP= R*dT/v - R*T*dv/v**2;\n", + "print'the change in the pressure of air %f kPa'%round(dP,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the change in the pressure of air -0.491000 kPa\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12-5 ,Page No.659" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T=20+273.15;#temperature of refrigerant in K\n", + "\n", + "#from Table A\u201311\n", + "vf=0.0008161;#in m^3/kg\n", + "vg=0.035969;#in m^3/kg\n", + "\n", + "#calculations\n", + "#using Eq 12-22\n", + "# hfg= T*vfg*(dP/dT)sat\n", + "#(dP/dT)sat b/w 24 C - 16 C \n", + "dPT=(646.18-504.58)/(24-16);#dP/dT ; values from Table A\u201311\n", + "vfg=vg-vf;\n", + "hfg=T*vfg*dPT;\n", + "print'the value of the enthalpy of vaporization of refrigerant-134a %f kJ/kg'%round(hfg,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the value of the enthalpy of vaporization of refrigerant-134a 182.400000 kJ/kg\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12-6 ,Page No.660" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import exp\n", + "\n", + "#given data\n", + "T2=-50+460.0;#temperature of refrigerant-134a on R \n", + "\n", + "#constants\n", + "R=0.01946;#in Btu/lbm\n", + "\n", + "#from Table A-11E\n", + "T1=-40+460.0;#converted into R from F\n", + "P1=7.432;\n", + "hfg=97.100;\n", + "\n", + "#calcualation\\\n", + "#using Equation 12\u201324\n", + "#ln(P2/P1)= hfg/R *(1/T1 - 1/T2)\n", + "P2=P1*exp(hfg/R *(1/T1 - 1/T2));\n", + "print'the saturation pressure of refrigerant-134a %f psia'%round(P2,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the saturation pressure of refrigerant-134a 5.560000 psia\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12-11 ,Page No.373" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#given data\n", + "T1=220;#intial temperature in K\n", + "P1=5;#intial pressure in MPa\n", + "T2=300;#final temperature in K\n", + "P2=10;#final pressure in MPa\n", + "\n", + "#constants used\n", + "Ru=8.314;#on kJ/kmol- K\n", + "\n", + "#from Table A\u20131\n", + "Tcr=154.8;\n", + "Pcr=5.08;\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "print('part - a');\n", + "#by assuming ideal-gas behavior\n", + "#from Table A\u201319\n", + "h1=6404;\n", + "h2=8736;\n", + "s2=205.213;\n", + "s1=196.171;\n", + "h21i=h2-h1;#h2 - h1 ideal\n", + "s21i=(s2-s1)-Ru*log(P2/P1);#s2 - s1 ideal\n", + "print'the enthalpy change %i kJ/kmol'%round(h21i);\n", + "print'the entropy change %f kJ/kmol-K'%round(s21i,2);\n", + "\n", + "#part - b\n", + "print('part - b');\n", + "#by accounting for the deviation from ideal-gas behavior\n", + "TR1=T1/Tcr;\n", + "Pr1=P1/Pcr;\n", + "#from the generalized charts at each state\n", + "Zh1=0.53;\n", + "Zs1=0.25;\n", + "TR2=T2/Tcr;\n", + "Pr2=P2/Pcr;\n", + "#from the generalized charts at each state\n", + "Zh2=0.48;\n", + "Zs2=0.20;\n", + "h21=h21i-Ru*Tcr*(Zh2-Zh1);\n", + "s21=s21i-Ru*(Zs2-Zs1);\n", + "print'the enthalpy change %i in kJ/kmol'%round(h21);\n", + "print'the entropy change %f kJ/kmol-K'%round(s21,2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "part - a\n", + "the enthalpy change 2332 kJ/kmol\n", + "the entropy change 3.280000 kJ/kmol-K\n", + "part - b\n", + "the enthalpy change 2396 in kJ/kmol\n", + "the entropy change 3.690000 kJ/kmol-K\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter13.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter13.ipynb new file mode 100755 index 00000000..936d90ae --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter13.ipynb @@ -0,0 +1,453 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13: Gas Mixtures" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-1 ,Page No.683" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "mO2=3.0;#moles of oxygen\n", + "mN2=5.0;#moles of nitrogen\n", + "mCH4=12.0;#moles of methane\n", + "\n", + "#molecular masses in kg\n", + "MO2=32.0;\n", + "MN2=28.0;\n", + "MCH4=16.0;\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "mm=mO2+mN2+mCH4;\n", + "mfO2=mO2/mm;\n", + "mfN2=mN2/mm;\n", + "mfCH4=mCH4/mm;\n", + "print'mass fraction of oxygen is %f'%round(mfO2,2);\n", + "print'mass fraction of nitrogen is %f'%round(mfN2,2);\n", + "print'mass fraction of methane is %f'%round(mfCH4,2);\n", + "\n", + "#part - b\n", + "NO2=mO2/MO2;\n", + "NN2=mN2/MN2;\n", + "NCH4=mCH4/MCH4;\n", + "Nm=NO2+NN2+NCH4;\n", + "yO2=NO2/Nm;\n", + "yN2=NN2/Nm;\n", + "yCH4=NCH4/Nm;\n", + "print'mole fraction of oxygen is %f'%round(yO2,3);\n", + "print'mole fraction of nitrogen is %f'%round(yN2,3);\n", + "print'mole fraction of methane is %f'%round(yCH4,3);\n", + "\n", + "#part - c\n", + "Mm=mm/Nm;\n", + "print'average molecular mass %f kg/kmol'%round(Mm,1);\n", + "Rm=Ru/Mm;\n", + "print'gas constant of mixture %f kJ/kg - K'%round(Rm,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass fraction of oxygen is 0.150000\n", + "mass fraction of nitrogen is 0.250000\n", + "mass fraction of methane is 0.600000\n", + "mole fraction of oxygen is 0.092000\n", + "mole fraction of nitrogen is 0.175000\n", + "mole fraction of methane is 0.734000\n", + "average molecular mass 19.600000 kg/kmol\n", + "gas constant of mixture 0.425000 kJ/kg - K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-2 ,Page No.687" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "NN2=2.0;#moles of nitrogen\n", + "NCO2=6.0;#moles of carbon dioxide\n", + "Tm=300.0;#temperature of gases in K\n", + "Pm=15000.0;#pressure of gases in kPa\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kmol - K\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "Nm=NN2+NCO2;\n", + "Vm=Nm*Ru*Tm/Pm;\n", + "print'the volume of the tank on the basis of the ideal-gas equation of state %f m^3'%round(Vm,3);\n", + "\n", + "#part - b\n", + "#from Table A-1\n", + "#for nitrogen\n", + "TcrN=126.2;\n", + "PcrN=3390;\n", + "#for Carbondioxide\n", + "TcrC=304.2;\n", + "PcrC=7390;\n", + "yN2=NN2/Nm;\n", + "yCO2=NCO2/Nm;\n", + "Tcr=yN2*TcrN+yCO2*TcrC;\n", + "Pcr=yN2*PcrN+yCO2*PcrC;\n", + "Tr=Tm/Tcr;\n", + "Pr=Pm/Pcr;\n", + "#from Fig A-15b\n", + "Zm=0.49;\n", + "Vm=Zm*Nm*Ru*Tm/Pm;\n", + "print'the volume of the tank on the basis Kay\u2019s rule %f m^3'%round(Vm,3);\n", + "\n", + "#part - c\n", + "#for nitrogen\n", + "TrN=Tm/TcrN;\n", + "PrN=Pm/PcrN;\n", + "#from Fig A-15b\n", + "Zn=1.02;\n", + "#for Carbondioxide\n", + "TrC=Tm/TcrC;\n", + "PcrC=Pm/PcrC;\n", + "#from Fig A-15b\n", + "Zc=0.3;\n", + "Zm=yN2*Zn+yCO2*Zc;\n", + "Vm=Zm*Nm*Ru*Tm/Pm;\n", + "print'the volume of the tank on the basis compressibility factors and Amagat\u2019s law %f m^3'%round(Vm,3);\n", + "\n", + "#part - d\n", + "VRN=(Vm/NN2)/(Ru*TcrN/PcrN);\n", + "VRC=(Vm/NCO2)/(Ru*TcrC/PcrC);\n", + "#from Fig A-15b\n", + "Zn=0.99;\n", + "Zc=0.56;\n", + "Zm=yN2*Zn+yCO2*Zc;\n", + "Vm=Zm*Nm*Ru*Tm/Pm;\n", + "#When the calculations are repeated we obtain 0.738 m3 after the second iteration, 0.678 m3 after the third iteration, and 0.648 m3 after the fourth iteration.\n", + "Vm=0.648;\n", + "print'compressibility factors and Dalton\u2019s law the volume of the tank on the basis %f m^3'%round(Vm,3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the volume of the tank on the basis of the ideal-gas equation of state 1.330000 m^3\n", + "the volume of the tank on the basis Kay\u2019s rule 0.652000 m^3\n", + "the volume of the tank on the basis compressibility factors and Amagat\u2019s law 0.639000 m^3\n", + "compressibility factors and Dalton\u2019s law the volume of the tank on the basis 0.648000 m^3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-3 ,Page No.691" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "mN=4.0;#mass of nitrogen in kg\n", + "T1N=20.0;#temperature of nitrogen in K\n", + "P1N=150.0;#pressure of nitrogen in kPa\n", + "mO=7.0;#mass of oxygen in kg\n", + "T1O=40.0;#temperature of oxygen in K\n", + "P1O=100.0;#pressure of oxygen in kPa\n", + "\n", + "#molecular masses in kg\n", + "MO=32.0;\n", + "MN=28.0;\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#from Table A-2a\n", + "CvN=0.743;\n", + "CvO=0.658;\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "#Ein - Eout = dEsystem\n", + "# (m*cv*dT)N2 + (m*cv*dT)= 0;\n", + "Tm= (mN*CvN*T1N+ mO*CvO*T1O)/(mN*CvN+mO*CvO);\n", + "print'the mixture temperature %f C'%round(Tm,1);\n", + "\n", + "#part - b\n", + "NO=mO/MO;\n", + "NN=mN/MN;\n", + "Nm=NO+NN;\n", + "VO=NO*Ru*(T1O+273)/P1O;\n", + "VN=NN*Ru*(T1N+273)/P1N;#Exergy Destruction during Mixing of Ideal Gases\n", + "Vm=VO+VN;\n", + "Pm=Nm*Ru*(Tm+273)/Vm; \n", + "print'the mixture pressure after equilibrium has been established %f kPa'%round(Pm,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the mixture temperature 32.200000 C\n", + "the mixture pressure after equilibrium has been established 114.500000 kPa\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-4 ,Page No.692" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#given data\n", + "NO=3.0;#moles of oxygen \n", + "NC=5.0;#moles of carbondioxide\n", + "T0=25+273.0;#temperature of gasses in K\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#calculations\n", + "Nm=NO+NC;\n", + "yO=NO/Nm;\n", + "yC=NC/Nm;\n", + "#dSm= -Ru*(NO*log(yO)+NC*log(yC))\n", + "Sm=-Ru*(NO*log(yO)+NC*log(yC));\n", + "print'the entropy change %f kJ/K'%round(Sm);\n", + "Xdestroyed=T0*Sm/1000;\n", + "print'exergy destruction associated %f MJ'%round(Xdestroyed,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the entropy change 44.000000 kJ/K\n", + "exergy destruction associated 13.100000 MJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-5 ,Page No.694" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T1=220;#intial temperature in K\n", + "T2=160;#final temperature in K\n", + "Pm=10;#pressure of air in MPa\n", + "yN=0.79;#mole fraction of nitrogen\n", + "yO=0.21;#mole fractions of oxygen\n", + "\n", + "\n", + "#critical properties\n", + "#for Nitrogen\n", + "TcrN=126.2;\n", + "PcrN=3.39;\n", + "#for Oxygen\n", + "TcrO=154.8;\n", + "PcrO=5.08;\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kg - K\n", + "\n", + "#from Tables A-18 & 19\n", + "#at T1\n", + "h1N=6391;\n", + "h1O=6404;\n", + "#for T2\n", + "h2N=4648;\n", + "h2O=4657;\n", + "\n", + "#calculations\n", + "#part - a\n", + "qouti=yN*(h1N-h2N)+yO*(h1O-h2O);\n", + "print'the heat transfer during this process using the ideal-gas approximation %i kJ/kmol'%round(qouti);\n", + "\n", + "#part - b\n", + "Tcrm=yN*TcrN+yO*TcrO;\n", + "Pcrm=yN*PcrN+yO*PcrO;\n", + "Tr1=T1/Tcrm;\n", + "Tr2=T2/Tcrm;\n", + "Pr=Pm/Pcrm;\n", + "#at these values we get\n", + "Zh1=1;\n", + "Zh2=2.6\n", + "qout=qouti-Ru*Tcrm*(Zh1-Zh2);\n", + "print'the heat transfer during this process using Kay\u2019s rule %i kJ/kmol'%round(qout);\n", + "\n", + "#part - c\n", + "#for nitrogen\n", + "TrN1=T1/TcrN;\n", + "TrN2=T2/TcrN;\n", + "PrN=Pm/PcrN;\n", + "#from Fig A-15b\n", + "Zh1n=0.9;\n", + "Zh2n=2.4;\n", + "#for Oxygen\n", + "TrO1=T1/TcrO;\n", + "TrO2=T2/TcrO;\n", + "PcrO=Pm/PcrO;\n", + "#from Fig A-15b\n", + "Zh1O=1.3;\n", + "Zh2O=4.0;\n", + "#from Eq 12-58\n", + "h12N=h1N-h2N-Ru*TcrN*(Zh1n-Zh2n);# h1 - h2 for nitrogen\n", + "h12O=h1O-h2O-Ru*TcrO*(Zh1O-Zh2O);# h1 - h2 for oxygen\n", + "qout=yN*h12N+yO*h12O;\n", + "print'the heat transfer during this process using Amagat\u2019s law %i kJ/kmol'%round(qout);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the heat transfer during this process using the ideal-gas approximation 1744 kJ/kmol\n", + "the heat transfer during this process using Kay\u2019s rule 3502 kJ/kmol\n", + "the heat transfer during this process using Amagat\u2019s law 3717 kJ/kmol\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13-6 ,Page No.705" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#13.6 (d) answer not matching as float datatype is giving more accurate answer in comparison to textbook that has given approximate due to rounding off to two decimal places\n", + "\n", + "#given data\n", + "mfs=0.0348;#salinity mass fraction\n", + "mfw=1-mfs;\n", + "T0=288.15;#temperature of sea water in K\n", + "\n", + "#constants used\n", + "Mw=18;\n", + "Ms=58.44;\n", + "Rw=0.4615;\n", + "pm=1028;\n", + "Ru=8.314;\n", + "\n", + "#calculations\n", + "#part - a\n", + "Mm=1/((mfs/Ms)+(mfw/Mw));\n", + "yw=mfw*Mm/Mw;\n", + "ys=1-yw;\n", + "print'the mole fraction of the water is %f'%round(yw,4);\n", + "print'the mole fraction of the saltwater is %f'%round(ys,5);\n", + "\n", + "#part - b\n", + "wmin=-Ru*T0*(ys*log(ys)+yw*log(yw));\n", + "wm=wmin/Mm;\n", + "print'the minimum work input required to separate 1 kg of seawater completely into pure water and pure salts %f kJ'%round(wm,2);\n", + "\n", + "#part - c\n", + "wmin=Rw*T0*log(1/yw);\n", + "print'the minimum work input required to obtain 1 kg of fresh water from the sea %f kJ'%round(wmin,2);\n", + "\n", + "#part - d\n", + "Pmin=pm*Rw*T0*log(1/yw);\n", + "print'the minimum gauge pressure that the seawater must be raised if fresh water is to be obtained by reverse osmosis using semipermeable membranes %i kPa'%round(Pmin)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the mole fraction of the water is 0.989000\n", + "the mole fraction of the saltwater is 0.010980\n", + "the minimum work input required to separate 1 kg of seawater completely into pure water and pure salts 7.850000 kJ\n", + "the minimum work input required to obtain 1 kg of fresh water from the sea 1.470000 kJ\n", + "the minimum gauge pressure that the seawater must be raised if fresh water is to be obtained by reverse osmosis using semipermeable membranes 1510 kPa\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter14.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter14.ipynb new file mode 100755 index 00000000..f218441e --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter14.ipynb @@ -0,0 +1,393 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14: Gas\u2013Vapor Mixtures and Air-Conditioning" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14-1 ,Page No.720" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "V=5*5*3.0;#volume of the room in m^3\n", + "RH=0.75;#relative humidity\n", + "P=100.0;#pressure of air in kPa\n", + "T=25.0;#temperature of air in C\n", + "\n", + "#constants used\n", + "Ra=0.287;#in kPa.m^3 / kg.k\n", + "Rv=0.4615;#in kPa.m^3 / kg.k\n", + "\n", + "#from Table A-2a and A-4\n", + "cp=1.005;\n", + "Psat=3.1698;\n", + "hg=2564.6;\n", + "\n", + "#calculation\n", + "Pv=RH*Psat;\n", + "Pa=P-Pv;\n", + "w=0.622*Pv/(P-Pv);\n", + "h=cp*T+w*hg;\n", + "ma=V*Pa/(Ra*(T+273));\n", + "mv=V*Pv/(Rv*(T+273));\n", + "print'the partial pressure of dry air %f kPa'%round(Pa,2);\n", + "print'the specific humidity %f kg water/kg of dry air'%round(w,4);\n", + "print'the enthalpy per unit mass of the dry air %f kJ'%round(h,1);\n", + "print'mass of air %f kg'%round(ma,2);\n", + "print'mass of water vapour %f kg'%round(mv,1);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the partial pressure of dry air 97.620000 kPa\n", + "the specific humidity 0.015100 kg water/kg of dry air\n", + "the enthalpy per unit mass of the dry air 64.000000 kJ\n", + "mass of air 85.610000 kg\n", + "mass of water vapour 1.300000 kg\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14-2 ,Page No.722" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T=20;#temperature of air in C\n", + "RH=0.75;#relative humidity\n", + "\n", + "#from Table A-4\n", + "Psat=2.3392;\n", + "Pv=RH*Psat;\n", + "#thus at this from Eq 14-13\n", + "Tdp=15.4;\n", + "print'window temperature %f C'%Tdp" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "window temperature 15.400000 C\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14-3 ,Page No.725" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T1=25.0;#dry bulb temperature in K\n", + "T2=15.0;#wet bulb temperature in K\n", + "P2=101.325;#pressure of air in kPa\n", + "\n", + "#from Table A-2a & A-4\n", + "#at T1\n", + "Psat1=3.1698;\n", + "hg1=2546.5;\n", + "#at T2\n", + "Psat2=1.7057;\n", + "hfg2=2465.4;\n", + "hf2=62.982;\n", + "cp=1.005;\n", + "\n", + "#calculations\n", + "w2=0.622*Psat2/(P2-Psat2);\n", + "w1=(cp*(T2-T1)+w2*hfg2)/(hg1-hf2);\n", + "print'the specific humidity %f kg water/kg of dry air'%round(w1,5);\n", + "RH1=w1*P2/((0.622+w1)*Psat1);\n", + "print'the relative humidity is %f'%round(RH1,3);\n", + "h=cp*T1+w1*hg1;\n", + "print'the enthalpy of the air %f kJ/kg of dry air'%round(h,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the specific humidity 0.006530 kg water/kg of dry air\n", + "the relative humidity is 0.332000\n", + "the enthalpy of the air 41.700000 kJ/kg of dry air\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14-5 ,Page No.731" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "RH1=0.3;#outdoor relative humidity\n", + "P1=100.0;#pressure of air in kPa\n", + "V1=45.0;#volumetric steady rate in m^3/min\n", + "T1=10.0;#outdoor temperature in C\n", + "T2=22.0;#first heated temperature in C\n", + "RH3=0.6;#final relative humidity \n", + "T3=25.0;#final temperature in C\n", + "\n", + "#from Table A-2a & A-4\n", + "cp=1.005;\n", + "Ra=0.287;\n", + "Pg1=1.2281;\n", + "hg1=2519.2;\n", + "hg2=2541.0;\n", + "Pg3=3.1698;\n", + "\n", + "#calculations\n", + "Pv1=RH1*Pg1;\n", + "Pa1=P1-Pv1;\n", + "v1=Ra*(T1+273)/Pa1;\n", + "ma=V1/v1;\n", + "w1=0.622*Pv1/(P1-Pv1);\n", + "h1=cp*T1+w1*hg1;\n", + "h1=round(h1,1);\n", + "w2=w1;\n", + "h2=cp*T2+w2*hg2;\n", + "h2=round(h2)\n", + "Q=ma*(h2-h1);\n", + "# ma2*w2 + mw = ma3*w3\n", + "#which reduces to mw = ma * (w3 - w2)\n", + "w3=0.622*RH3*Pg3/(P1-(RH3*Pg3));\n", + "mw=ma*(w3-w2);\n", + "print'the rate of heat supply in the heating section %f kJ/min'%round(Q);\n", + "print'the mass flow rate of the steam required in the humidifying section %f kg/min'%round(mw,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the rate of heat supply in the heating section 673.000000 kJ/min\n", + "the mass flow rate of the steam required in the humidifying section 0.539000 kg/min\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14-6 ,Page No.733" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "V1=10;#volumertric rate in m^3/min\n", + "T1=30;#intial temperature in C\n", + "RH1=0.8;#intial relative humidity\n", + "T2=14;#final temperature in C\n", + "RH2=1;#final relative humidity\n", + "\n", + "#from Table A-4\n", + "hw=58.8;\n", + "h1=85.4;\n", + "h2=39.3;\n", + "w1=0.0216;\n", + "w2=0.0100;\n", + "v1=0.889;\n", + "\n", + "#calculations\n", + "#mw= ma*(w1-w2)\n", + "#Qout=ma*(h1-h2) - mw*hw\n", + "ma=V1/v1;\n", + "mw= ma*(w1-w2);\n", + "Qout=ma*(h1-h2) - mw*hw;\n", + "print'rates of moisture removal from the air %f kg/min'%round(mw,3);\n", + "print'rate of moisture removal from the air %i kJ/min'%round(Qout);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "rates of moisture removal from the air 0.130000 kg/min\n", + "rate of moisture removal from the air 511 kJ/min\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14-8 ,Page No.736" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given values\n", + "V1=50;#saturated air volumertric rate in m^3/min\n", + "T1=14;#saturated air temperature in C\n", + "V2=20;#outside air volumertric rate in m^3/min\n", + "T2=32;#outside air temperature in C\n", + "RH2=60;#outside air relative humidity\n", + "\n", + "#from psychrometric chart\n", + "h1=39.4;\n", + "w1=0.010;\n", + "v1=0.826;\n", + "h2=79;\n", + "w2=0.0182;\n", + "v2=0.889;\n", + "\n", + "#calculations\n", + "ma1=V1/v1;\n", + "ma2=V2/v2;\n", + "ma3=ma1+ma2;\n", + "#from Eq 14-24\n", + "w3=(w2*ma2+w1*ma1)/(ma1+ma2);\n", + "h3=(h2*ma2+h1*ma1)/(ma1+ma2);\n", + "print'the specific humidity %f kg of water/kg of dry air'%round(w3,3);\n", + "#from psychrometric chart\n", + "T3=19;\n", + "RH3=0.89;\n", + "v3=0.844;\n", + "V3=ma3*v3;\n", + "print'the dry-bulb temperature %f C'%T3;\n", + "print'the relative humidity is %f'%RH3\n", + "print'the volume flow rate of the mixture %f m^3/min'%round(V3,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the specific humidity 0.012000 kg of water/kg of dry air\n", + "the dry-bulb temperature 19.000000 C\n", + "the relative humidity is 0.890000\n", + "the volume flow rate of the mixture 70.100000 m^3/min\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14-9 ,Page No.738" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data \n", + "m=100;#mass flow rate in kg/s\n", + "T1=20;#entry temperature in C\n", + "P1=1;#entry pressure im kPa\n", + "RH1=60;#entry relative humidity\n", + "T2=30;#exit temperature in C\n", + "RH2=1;#exit relative humidity\n", + "T3=35;#entry tempearture of wet cooling tower in C \n", + "T4=22;#water temperature in cooling tower in C\n", + "\n", + "#from Table A-4\n", + "h1=42.2;\n", + "w1=0.0087;\n", + "v1=0.842;\n", + "h2=100;\n", + "w2=0.0273;\n", + "h3=146.64;\n", + "h4=92.28;\n", + "\n", + "#calculations\n", + "#Dry air balane = ma1 = ma2 = ma\n", + "#Water balance = m3 - m4 = ma*(w2 - w1)\n", + "#Energy balance = ma1*h1 + m3*h3 = ma2*h2 + m4*h4\n", + "ma= m*(h3-h4)/(h2-h1-(w2-w1)*h4);\n", + "V1=ma*v1;\n", + "mmakeup=ma*(w2-w1);\n", + "print'the volume flow rate of air into the cooling tower %f m^3/s'%round(V1,1);\n", + "print'the mass flow rate of the required makeup water %f kg/s'%round(mmakeup,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the volume flow rate of air into the cooling tower 81.600000 m^3/s\n", + "the mass flow rate of the required makeup water 1.800000 kg/s\n" + ] + } + ], + "prompt_number": 22 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter15.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter15.ipynb new file mode 100755 index 00000000..c167fe73 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter15.ipynb @@ -0,0 +1,686 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15: Chemical Reactions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-1 ,Page No.755" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "nO2i=20;#intial moles of air \n", + "nC8H18i=1;#intial moles octane\n", + "\n", + "#from Table A-1\n", + "Mair=29;\n", + "MC=12;\n", + "MH=2;\n", + "\n", + "#calculations\n", + "# Chemical Reaction\n", + "# C8H18 + 20(O2+3.76N2)= xCO2 + yH2O + zO2 + wN2\n", + "#by elemental balance of moles\n", + "x=8;\n", + "y=18/2;\n", + "z=20*2-2*x-y;\n", + "w=20*3.76;\n", + "print'kmoles of CO2 %i'%x;\n", + "print'kmoles of H2O %i'%y;\n", + "print'kmoles of O2 %f'%round(z,1);\n", + "print'kmoles of N2 %f'%round(w,1);\n", + "#thus equn becomes\n", + "# C8H18 + 20(O2+3.76N2)= 8CO2 + 9H2O + 7.5O2 +75.2N2\n", + "AF=nO2i*4.76*Mair/(x*MC + y*MH);\n", + "print'air-fuel ratio of combustion process %f kg air/kg fuel'%round(AF,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "kmoles of CO2 8\n", + "kmoles of H2O 9\n", + "kmoles of O2 15.000000\n", + "kmoles of N2 75.200000\n", + "air-fuel ratio of combustion process 24.200000 kg air/kg fuel\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-2 ,Page No.757" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P=100;#total pressure in kPa\n", + "\n", + "#from Table A-1\n", + "Mair=29.0;\n", + "MC=12.0;\n", + "MH=2.0;\n", + "\n", + "#calculations\n", + "#Chemical reaction\n", + "#C2H6 + 1.2at(1O2 + 3.76) =2CO2 + 3H2O + 0.2athO2 + (1.2*3.76)athN2\n", + "#ath is the stoichiometric coefficient for air\n", + "#Oxygen balance gives\n", + "# 1.2ath = 2 + 1.5 + 0.2ath\n", + "ath=(2+1.5)/(1.2-0.2);\n", + "AF=(1.2*ath)*4.76*Mair/(2*MC+3*MH);\n", + "print'air-fuel ratio of combustion process %f kg air/kg fuel'%round(AF,1);\n", + "#C2H6 + 4.2(O2 + 3.76N2) = 2CO2 + 3H2O + 0.7O2 + 15.79N2;\n", + "Nprod=2+3+0.7+15.79;\n", + "#for dew point water vapour condenses\n", + "Nv=3;\n", + "Pv=Nv/Nprod*P;\n", + "#at this Pv\n", + "Tdp=52.3;\n", + "print'the dew-point %f C'%Tdp\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "air-fuel ratio of combustion process 19.300000 kg air/kg fuel\n", + "the dew-point 52.300000 C\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-3 ,Page No.758" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P=101.325;#total pressure in kPa\n", + "RH=0.8;#realtive humidity\n", + "T1=20;#tempearture of air in C\n", + "\n", + "#from Table A-4\n", + "Psat=2.3392;\n", + "\n", + "#calculations\n", + "#consedering 1 kmol of fuel\n", + "# 0.72CH4 + 0.09H2 + 0.14N2 + 0.02O2 + 0.03CO2 + ath(O2 + 3.76N2) = xCO2 + yH2O + zN2\n", + "#element balance\n", + "x=0.72+0.03\n", + "y=(0.72*4+0.09*2)/2;\n", + "ath=x+y/2-0.02-0.03;\n", + "z=0.14+3.76*ath;\n", + "Pv=RH*Psat;\n", + "# Nv,air = Pv,air/Ptotal * Ntotal\n", + "Nvair=Pv/P*6.97/(1-(Pv/P));\n", + "#0.72CH4 + 0.09H2 + 0.14N2 + 0.02O2 + 0.03CO2 + 1.465(O2 + 3.76N2) + 0.131H20 = 0.75CO2 + 1.661H2O + 5.648N2\n", + "Pvprod=1.661/8.059*P;\n", + "#at this Pvprod\n", + "Tdp=60.9;\n", + "print'the dew-point %f C'%Tdp" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the dew-point 60.900000 C\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-4 ,Page No.760" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "Pprod=100;#total pressure in kPa\n", + "\n", + "#from Table A-1\n", + "Mair=29;\n", + "MC=12;\n", + "MH=2;\n", + "\n", + "#from Table A-4\n", + "Psat=3.1698;\n", + "\n", + "#calculations\n", + "#consedering 100 kmol of dry products\n", + "# xC8H18 + a (O2 + 3.76N2) = 10.02CO2 + 0.88C0 + 84.48N2 + bH20\n", + "#from mass balamces\n", + "a=83.48/3.76;\n", + "x=(0.88+10.02)/8;\n", + "b=18*x/2;\n", + "# 1.36C8H18 + 22.2 (O2 + 3.76N2) = 10.02CO2 + 0.88C0 + 84.48N2 + 12.24H20\n", + "# 1 mol conversion\n", + "# C8H18 + 16.32 (O2 + 3.76N2) = 7.37CO2 + 4.13C0 + 61.38N2 + 9H20\n", + "AF= 16.32*4.76*Mair/(8*MC+9*MH);\n", + "print'air-fuel ratio of combustion process %f kg air/kg fuel'%round(AF,2);\n", + "# C8H18 + ath (O2 + 3.76N2) = 8CO2 + 9H2O + 3.76athN2\n", + "ath=8+4.5;\n", + "Pth=16.32/ath*4.76/4.76*100;\n", + "print'percentage of theoretical air is %i'%round(Pth);\n", + "Nprod=7.37+0.65+4.13+61.98+9;\n", + "# Nv/Nprod = Pv/Pprod\n", + "Pv=Psat;\n", + "Nw= (Nprod*Pv-9*Pprod)/(Pv-Pprod);\n", + "print'the amount of H2O that condenses as the products %f kmol'%round(Nw,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "air-fuel ratio of combustion process 19.760000 kg air/kg fuel\n", + "percentage of theoretical air is 131\n", + "the amount of H2O that condenses as the products 6.570000 kmol\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-5 ,Page No.764" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#there is a difference in the answer due to approximation in the textbook\n", + "\n", + "#given data\n", + "T=25;#temperature of octane in C\n", + "\n", + "#from Table A-6\n", + "HCO2=-393520;\n", + "HH2O=-285830;\n", + "HC8H18=-249950;\n", + "\n", + "#calculations\n", + "# C8H18 + ath (O2 + 3.76N2) = 8CO2 + 9H2O + 3.76athN2\n", + "#N2 and O2 are stable elements, and thus their enthalpy of formation is zero\n", + "#hc = Hprod - Hreact\n", + "hc= 8*HCO2 + 9*HH2O - HC8H18;\n", + "print'the enthalpy of combustion of liquid octane %i kJ/kmol'%hc\n", + "print 'or %i kJ/kg C8H18'%round(hc/114,0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the enthalpy of combustion of liquid octane -5470680 kJ/kmol\n", + "or -47989 kJ/kg C8H18\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-6 ,Page No.767" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "mfuel=0.05;#mass flow rate in kg/min\n", + "\n", + "#from Table A-1\n", + "Mair=29;\n", + "MC=12;\n", + "MH=2;\n", + "\n", + "#calculation\n", + "#stochiometric reaction\n", + "#C3H8 + ath(O2 + 3.76N2) = 3CO2 + 4H2O + 3.76athN2\n", + "#O2 balance\n", + "ath=3+5;\n", + "#50 percent excess air and some CO in the products\n", + "#C3H8 + 7.5(O2 + 3.76N2) = 2.7CO2 + 0.3CO + 4H2O + 2.65O2+ 28.2N2\n", + "AF=7.5*4.76*Mair/(3*MC+4*MH);\n", + "mair=AF*mfuel;\n", + "print'the mass flow rate of air %f kg air/min'%round(mair,2);\n", + "#from property tables\n", + "#C3H8 designated as p\n", + "hfp=-118910;\n", + "#oxygen as o\n", + "hfo=0;\n", + "ho280=8150;\n", + "ho298=8682;\n", + "ho1500=49292;\n", + "#nitrogen as n\n", + "hfn=0;\n", + "hn280=8141;\n", + "hn298=8669;\n", + "hn1500=47073;\n", + "#water as w\n", + "hfw=-241820;\n", + "hw298=9904;\n", + "hw1500=57999;\n", + "#carbondioxode as c\n", + "hfc=-393520;\n", + "hc298=9364;\n", + "hc1500=71078;\n", + "#carbon monoxide as co\n", + "hfco=-110530;\n", + "hco298=8669;\n", + "hco1500=47517;\n", + "qout=1*(hfp)+7.5*(hfo+ho280-ho298)+28.2*(hfn+hn280-hn298)-2.7*(hfc+hc1500-hc298)-0.3*(hfco+hco1500-hco298)-4*(hfw+hw1500-hw298)-2.65*(hfo+ho1500-ho298)-28.2*(hfn+hn1500-hn298);\n", + "#for kg of propane\n", + "qout=qout/44;\n", + "Qout=mfuel*qout/60;\n", + "print'the rate of heat transfer from the combustion chamber %f kW'%round(Qout,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the mass flow rate of air 1.180000 kg air/min\n", + "the rate of heat transfer from the combustion chamber 6.890000 kW\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-7 ,Page No.769" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#the 0.175% error in last part is due to the approximation in the textbook\n", + "\n", + "#given data\n", + "Preact=1.0;#total pressure in kPa\n", + "Treact=77+460.0;#reaction temperature in R\n", + "Tprod=1800.0;#final temperature in R\n", + "\n", + "#constants used\n", + "Ru=1.986;\n", + "\n", + "#calculation\n", + "#CH4 + 3O2 = CO2 + 2H2O + O2\n", + "Nreact=4;\n", + "Nprod=4;\n", + "Pprod=Preact*Nprod/Nreact*Tprod/Treact;\n", + "print'the final pressure in the tank %f atm'%round(Pprod,2);\n", + "#from std. values of heat of formation and ideal gasses in Appendix\n", + "#CH4 as m\n", + "hfm=-32210.0;\n", + "#O2 as o\n", + "hfo=0;\n", + "h537o=3725.1;\n", + "h1800o=13485.8;\n", + "#water as w\n", + "hfw=-104040.0;\n", + "h537w=4528.0;\n", + "h1800w=15433.0\n", + "#carbondioxide as c\n", + "hfc=-169300.0;\n", + "h537c=4027.5;\n", + "h1800c=18391.5;\n", + "Qout=1*(hfm-Ru*Treact)+3*(hfo-Ru*Treact)-1*(hfc+h1800c-h537c-Ru*Tprod)-2*(hfw+h1800w-h537w-Ru*Tprod)-1*(hfo+h1800o-h537o-Ru*Tprod);\n", + "print'the heat transfer during this process %i Btu/lbmol'%round(Qout)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the final pressure in the tank 3.350000 atm\n", + "the heat transfer during this process 309269 Btu/lbmol\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-8 ,Page No.771" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#this invovles EES hence the below code explains a approach with approximation\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "#C8H18 + 12.5 (O2 + 3.76N2) = 8CO+ 9H2O + 47N2\n", + "#from std. values of heat of formation and ideal gasses in Appendix\n", + "#octane as oc\n", + "hfoc=-249950.0;\n", + "#oxygen as o\n", + "hfo=0;\n", + "h298o=8682.0;\n", + "#nitrogen as n\n", + "hfn=0;\n", + "h298n=8669.0;\n", + "#water as w\n", + "hfw=-241820.0;\n", + "h298w=9904.0;\n", + "#carbondioxide as c\n", + "hfc=-393520.0;\n", + "h298c=9364.0;\n", + "#x refers to 8hCO2 + 9hH20 + 47hN2\n", + "xac=1*(hfoc)+8*(h298c-hfc)+9*(h298w-hfw)+47*(h298n-hfn);\n", + "#from EES the Tprod is determined by trial and error\n", + "#at 2400K\n", + "x2400=5660828.0;\n", + "#at 2350K\n", + "x2350=5526654.0;\n", + "#the actual value of x is xac and T can be determined by interpolation\n", + "Tprod=(xac-x2350)*(2400.0-2350.0)/(x2400-x2350)+2350.0;\n", + "print'adiabatic flame temperature for complete combustion with 100 percent theoretical air %i K'%round(Tprod);\n", + "\n", + "#part - b\n", + "#C8H18 + 50 (O2 + 3.76N2) = 8CO+ 9H2O + 37.5O2 + 188N2\n", + "#solved similarly using EES and approximation and interpolation\n", + "#similarly we can solve the part - c \n", + "#the above concept is applied\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "adiabatic flame temperature for complete combustion with 100 percent theoretical air 2395 K\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-9 ,Page No.776" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#from Table A-26E\n", + "#Gibbs function of formation at 77\u00b0F\n", + "gfc=0;#for carbon\n", + "gfo=0;#for oxygen\n", + "gfco=-169680;#for carbondioxide\n", + "\n", + "#calculations\n", + "# C + O2 = CO2\n", + "Wrev=1*gfc+1*gfo-1*gfco;\n", + "print'the reversible work for this process %i Btu'%round(Wrev) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the reversible work for this process 169680 Btu\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-10 ,Page No.777" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#given values\n", + "T0=298;#combustion chamber temperature in K\n", + "\n", + "#contansts used \n", + "Ru=8.314;#in kJ/kmol K\n", + "\n", + "#calculations\n", + "# CH4 + 3(O2 + 3.76N2) = CO2 + 2H2O + O2 + 11.28N2\n", + "#from std. values of heat of formation and ideal gasses in Appendix\n", + "#methane as m\n", + "hfm=-74850;\n", + "#oxygen as o\n", + "hfo=0;\n", + "h298o=8682;\n", + "#nitrogen as n\n", + "hfn=0;\n", + "h298n=8669;\n", + "#water as w\n", + "hfw=-241820;\n", + "h298w=9904;\n", + "#carbondioxide as c\n", + "hfc=-393520;\n", + "h298c=9364;\n", + "#x refers to hCO2 + 2hH2O + 11.28hN2\n", + "xac=1*(hfm)+1*(h298c-hfc)+2*(h298w-hfw)+11.28*(h298n-hfn);\n", + "#from EES the Tprod is determined by trial and error\n", + "Tprod=1789;\n", + "print'the temperature of the products %i K'%round(Tprod);\n", + "#entropy calculations by using table A-26\n", + "#Si = Ni*(si - Ruln yiPm\n", + "#reactants\n", + "Sm=1*(186.16-Ru*log(1*1));\n", + "So=3*(205.04-Ru*log(0.21*1));\n", + "Sn=11.28*(191.61-Ru*log(.79*1));\n", + "Sreact=Sm+So+Sn;\n", + "#products\n", + "Nt=1+2+1+11.28;#total moles\n", + "yc=1/Nt;\n", + "yw=2/Nt;\n", + "yo=1/Nt;\n", + "yn=11.28/Nt;\n", + "Sc=1*(302.517-Ru*log(yc*1));\n", + "Sw=2*(258.957-Ru*log(yw*1));\n", + "So=1*(264.471-Ru*log(yo*1));\n", + "Sn=11.28*(247.977-Ru*log(yn*1));\n", + "Sprod=Sc+Sw+So+Sn;\n", + "Sgen=Sprod-Sreact;\n", + "print'exergy destruction %i kJ/kmol - K'%round(Sgen);\n", + "Xdestroyed=T0*Sgen/1000;#factor of 1000 for converting kJ to MJ\n", + "print'%i MJ/kmol'%round(Xdestroyed);\n", + "#This process involves no actual work. Therefore, the reversible work and energy destroyed are identical\n", + "Wrev=Xdestroyed;\n", + "print'the reversible work %i MJ/kmol'%round(Wrev)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the temperature of the products 1789 K\n", + "exergy destruction 966 kJ/kmol - K\n", + "288 MJ/kmol\n", + "the reversible work 288 MJ/kmol\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15-11 ,Page No.778" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#given values\n", + "Tsurr=298;#temperature of surroundings in K\n", + "\n", + "#contansts used \n", + "Ru=8.314;#in kJ/kmol K\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "# CH4 + 3(O2 + 3.76N2) = CO2 + 2H2O + O2 + 11.28N2\n", + "#The amount of water vapor that remains in the products is determined as in Example 15\u20133\n", + "Nv=0.43;#moles of water vapour\n", + "Nw=1.57;#moles of water in liquid\n", + "#hf values\n", + "#methane as m\n", + "hfm=-74850;\n", + "#carbondioxide as c\n", + "hfc=-393520;\n", + "#water vapour as v\n", + "hfv=-241820;\n", + "#water in liquid as w\n", + "hfw=-285830;\n", + "Qout=1*hfm-1*hfc-Nv*hfv-Nw*hfw;\n", + "print'Qout = %i kJ/kmol'%round(Qout)\n", + "\n", + "#part - b\n", + "#entropy calculations by using table A-26\n", + "#Si = Ni*(si - Ruln yiPm\n", + "#reactants\n", + "Sm=1*(186.16-Ru*log(1*1));\n", + "So=3*(205.04-Ru*log(0.21*1));\n", + "Sn=11.28*(191.61-Ru*log(.79*1));\n", + "Sreact=Sm+So+Sn;\n", + "#products\n", + "Nt=Nv+1+1+11.28;#total moles\n", + "yw=1;\n", + "yc=1/Nt;\n", + "yv=Nv/Nt;\n", + "yo=1/Nt;\n", + "yn=11.28/Nt;\n", + "Sw=Nw*(69.92-Ru*log(yw*1));\n", + "Sc=1*(213.80-Ru*log(yc*1));\n", + "Sv=Nv*(188.83-Ru*log(yv*1));\n", + "So=1*(205.04-Ru*log(yo*1));\n", + "Sn=11.28*(191.61-Ru*log(yn*1));\n", + "Sprod=Sc+Sw+So+Sn+Sv;\n", + "Sgen=Sprod-Sreact+Qout/Tsurr;\n", + "print'Sgen = %i kJ/kmol - K'%round(Sgen);\n", + "Xdestroyed=Tsurr*Sgen/1000;#factor of 1000 for converting kJ to MJ\n", + "print'exergy destruction %i MJ/kmol'%round(Xdestroyed);\n", + "#This process involves no actual work. Therefore, the reversible work and energy destroyed are identical\n", + "Wrev=Xdestroyed;\n", + "print'the reversible work %i MJ/kmol'%round(Wrev)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Qout = 871406 kJ/kmol\n", + "Sgen = 2746 kJ/kmol - K\n", + "exergy destruction 818 MJ/kmol\n", + "the reversible work 818 MJ/kmol\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter16.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter16.ipynb new file mode 100755 index 00000000..4326dc6f --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter16.ipynb @@ -0,0 +1,378 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter 16: Chemical and Phase Equilibrium" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-1 ,Page No.798" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import exp\n", + "\n", + "#given data\n", + "T=298.15;#reaction temperature in K\n", + "\n", + "#from Table A-26\n", + "g=455510;\n", + "\n", + "#constants used\n", + "R=8.314;#in kJ/kmol K\n", + "\n", + "#calculations\n", + "# N2 = 2N\n", + "dG=2*g;\n", + "logKp=-dG/(R*T);\n", + "Kp=exp(logKp);\n", + "print('Kp = ',Kp)\n", + "print'in comparison to Table A-28 ln Kp value of -367.5 our result is %i'%logKp;\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('Kp = ', 2.4396097259977668e-160)\n", + "in comparison to Table A-28 ln Kp value of -367.5 our result is -367\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-2 ,Page No.798" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "P=10;#pressure in atm\n", + "\n", + "#constants\n", + "vH2=1;\n", + "vH=2;\n", + "\n", + "#calculations\n", + "# H2 = 0.9H2 + 0.2H\n", + "NH=0.2;\n", + "NH2=0.9;\n", + "Nt=NH+NH2;\n", + "#from Eq. 16-15\n", + "Kp=((NH**vH)/(NH2**vH2))*(P/Nt)**(vH-vH2);\n", + "#at this value of Kp from Table A-28\n", + "T=3535;\n", + "print'temperature %i K is'%T;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "temperature 3535 K is\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-6 ,Page No.807" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log\n", + "\n", + "#reaction\n", + "# H2 + 0.5O2 = H2O\n", + "#enthalpy datas in kJ/kmol \n", + "#of H2\n", + "hfH=-241820;\n", + "h2000H=82593;\n", + "h298H=9904;\n", + "#of O2\n", + "hfO=0;\n", + "h2000O=61400;\n", + "h298O=8468;\n", + "#of H2O\n", + "hfw=0;\n", + "h2000w=67881;\n", + "h298w=8682;\n", + "#Kp data from A-28\n", + "Kp2=869.6;\n", + "Kp1=18509;\n", + "T1=1800;\n", + "T2=2200;\n", + "\n", + "#constants used\n", + "Ru=8.314;#in kJ/kmol K\n", + "\n", + "#calculations\n", + "#part - a\n", + "hR=1*(hfH+h2000H-h298H)-1*(hfO+h2000O-h298O)-0.5*(hfw+h2000w-h298w);\n", + "print'enthalpy of the reaction %i kJ/kmol using enthalpy data'%round(hR);\n", + "#part - b\n", + "hR=Ru*(T1*T2)/(T2-T1)*log(Kp2/Kp1);\n", + "print'enthalpy of the reaction %i kJ/kmol using enthalpy data'%round(hR);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enthalpy of the reaction -251663 kJ/kmol using enthalpy data\n", + "enthalpy of the reaction -251698 kJ/kmol using enthalpy data\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-7 ,Page No.809" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T=120+273.15;#temperature of saturated water in K\n", + "\n", + "#from Table A-4\n", + "hf=503.81;\n", + "hg=2706;\n", + "sf=1.5279;\n", + "sg=7.1292;\n", + "\n", + "#calculations\n", + "print('liquid phase');\n", + "gf=hf-T*sf;\n", + "print'gf value %f kJ/kg'%round(gf,1);\n", + "print('vapour phase');\n", + "gg=hg-T*sg;\n", + "print'gg value %f kJ/kg'%round(gg,1);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "liquid phase\n", + "gf value -96.900000 kJ/kg\n", + "vapour phase\n", + "gg value -96.800000 kJ/kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-8 ,Page No.813" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T=15;#lake temperature in C\n", + "P=92.0;#atmospheric pressure in kPa\n", + "\n", + "#from Table A-4\n", + "Pv=1.7057;\n", + "\n", + "#calculations\n", + "yv=Pv/P;\n", + "print'mole fraction of water vapor at the surface is %f'%round(yv,4);\n", + "yw=1-yv;\n", + "print'mole fraction of water in the lake is %f percent'%(round(yw)*100)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mole fraction of water vapor at the surface is 0.018500\n", + "mole fraction of water in the lake is 100.000000 percent\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-9 ,Page No.214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T=17.0;#lake temperature in C\n", + "P=92.0;#atmospheric pressure in kPa\n", + "\n", + "#from Table A-4\n", + "Pv=1.96;\n", + "\n", + "#constants from Table 16-2\n", + "H=62000.0;\n", + "\n", + "#calculations\n", + "Pda=P-Pv;#dry air\n", + "yda=Pda/H/100;#in bar\n", + "print'mole fraction of air is %f'%(yda)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mole fraction of air is 0.000015\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-10 ,Page No.814" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T=358;#hydrogen gas temperature in K\n", + "P=300/100;#pressure of hydrogen gas in bar\n", + "\n", + "#constants used\n", + "M=2;\n", + "s=0.00901;#solubility in kmol/m^3 bar\n", + "p=0.027;\n", + "\n", + "#calculations\n", + "pH2=s*P;\n", + "print'molar density of H2 %f kmol/m^3'%round(pH2,3);\n", + "pH2=p*M;\n", + "print'mass density of H2 %f kg/m^3'%round(pH2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "molar density of H2 0.027000 kmol/m^3\n", + "mass density of H2 0.054000 kg/m^3\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16-11 ,Page No.815" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "yw=0.30;#water mole fraction\n", + "ya=0.70;#ammonia mole fraction\n", + "T=40;#mixture temperature in C\n", + "\n", + "#saturation pressure\n", + "pw=7.3851;\n", + "pa=1554.33;\n", + "#calulations\n", + "Pw=yw*pw;\n", + "Pa=ya*pa;\n", + "Pt=Pw+Pa;\n", + "yw=Pw/Pt;\n", + "ya=Pa/Pt;\n", + "print'mole fraction of water vapour %f'%round(yw,4);\n", + "print'mole fraction of ammonia %f'%round(ya,4);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mole fraction of water vapour 0.002000\n", + "mole fraction of ammonia 0.998000\n" + ] + } + ], + "prompt_number": 25 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter17.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter17.ipynb new file mode 100755 index 00000000..5b1b7ade --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter17.ipynb @@ -0,0 +1,812 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 17: Compressible Flow" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-1 ,Page No.826" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "V1=250.0;#velocity of aircraft in m/s\n", + "T1=255.07;#ambient air temperature in K\n", + "P1=54.05;#atmospheric pressure in kPa\n", + "h=5000.0;#altitude in m\n", + "\n", + "#from Table A-2a\n", + "cp=1.005;#in kJ/kg-K\n", + "k=1.4;\n", + "\n", + "#calculations\n", + "T01=T1+V1**2/(2*cp*1000);#factor of 1000 to convert kJ to J\n", + "P01=P1*(T01/T1)**(k/(k-1));\n", + "#given pressure ratio in compressor *\n", + "# T02 = T01*(P02/P01)^((k-1)/k)\n", + "T02 = T01*(8)**((k-1)/k);\n", + "win=cp*(T02-T01);\n", + "print'the stagnation pressure at the compressor inlet %f kPa'%round(P01,2);\n", + "print'the required compressor work per unit mass %f kJ/kg'%round(win,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the stagnation pressure at the compressor inlet 80.840000 kPa\n", + "the required compressor work per unit mass 233.400000 kJ/kg\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-2 ,Page No.829" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "\n", + "#given data\n", + "V=200.0;#air velocity in m/s\n", + "T=30+273.0;#air temperature in K\n", + "\n", + "#from Table A-2a\n", + "R=0.287;#in kJ/kg-K\n", + "k=1.4;\n", + "\n", + "#calculations\n", + "c=sqrt(k*R*T*1000);#factor of 1000 to convert kJ to J\n", + "print'the speed of sound %i m/s'%round(c);\n", + "Ma=V/c;\n", + "print'the Mach number at the diffuser inlet is %f'%round(Ma,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the speed of sound 349 m/s\n", + "the Mach number at the diffuser inlet is 0.573000\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-3 ,Page No.829" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "\n", + "#given data\n", + "T0=200+273.0;#intial temperature in K\n", + "P0=1400.0;#intial pressure in kPa\n", + "#stagnant temp. & pressure is same as inlet due to small inlet velocity\n", + "P=1200.0;#pressure corresponding to a pressure drop of 200 kPa\n", + "m=3.0;#mass flow rate in kg/s\n", + "\n", + "#from Table A-2a\n", + "cp=0.846;#in kJ/kg-K\n", + "R=0.1889;#in kJ/kg-K\n", + "k=1.289;\n", + "\n", + "#calculations\n", + "T=T0*(P/P0)**((k-1)/k);\n", + "V=sqrt(2*cp*(T0-T)*1000);#factor of 1000 to convert kJ to J\n", + "p=P/(R*T);\n", + "A=m/(p*V);\n", + "c=sqrt(k*R*T*1000);#factor of 1000 to convert kJ to J\n", + "Ma=V/c;\n", + "print'velocity %f m/s'%round(V,1);\n", + "print'density %f kg/m^3'%round(p,1);\n", + "print'flow area %f cm^2'%round((A*10000),1);\n", + "print'Mach number is %f'%round(Ma,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity 164.900000 m/s\n", + "density 13.900000 kg/m^3\n", + "flow area 13.100000 cm^2\n", + "Mach number is 0.494000\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-4 ,Page No.836" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T0=200+273.0;#intial temperature in K\n", + "P0=1400.0;#intial pressure in kPa\n", + "\n", + "#from Table A-2a\n", + "k=1.289;\n", + "\n", + "#calculations\n", + "#Tc & Tr stands for critical temp and ratio respectively\n", + "#Pc & Pr stands for critical temp and ratio respectively\n", + "Tr=2/(k+1);\n", + "Pr=(2/(k+1))**(k/(k-1));\n", + "Tc=Tr*T0;\n", + "Pc=Pr*P0;\n", + "print'critical temperature %i K'%round(Tc);\n", + "print'critical pressure %i kPa'%round(Pc)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical temperature 413 K\n", + "critical pressure 767 kPa\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-5 ,Page No.839" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "\n", + "#given data\n", + "Vi=150.0;#air velocity in m/s\n", + "Ti=600+273.0;#air temperature in K\n", + "Pi=1.0;#air pressure in MPa\n", + "At=50.0/10000.0;#nozzle throat area in m^2\n", + "\n", + "#from Table A-2a\n", + "R=0.287;#in kJ/kg-K\n", + "cp=1.005;#in kJ/kg-K\n", + "k=1.4;\n", + "\n", + "#calculations\n", + "Toi=Ti+Vi**2/(2*cp*1000);#factor of 1000 to convert kJ to J\n", + "Poi=Pi*(Toi/Ti)**(k/(k-1));\n", + "#flow is isentropic \n", + "#stagnation temp. and pressure values remain constant\n", + "To=Toi;\n", + "Po=Poi;\n", + "#from Table 17\u20132\n", + "#The critical-pressure ratio is 0.5283\n", + "\n", + "#Part a\n", + "Pb=0.7;\n", + "Pca=Pb/Po;\n", + "# Pca > 0.5283\n", + "#exit plane pressure is equal to the back pressure\n", + "Pt=Pb;\n", + "#from Table A\u201332\n", + "Mat=0.778;\n", + "#Tt/To = 0.892\n", + "Tt=0.892*To;\n", + "pt=Pt*1000/(R*Tt);#factor of 1000 to convert MPa to kPa\n", + "Vt=Mat*sqrt(k*R*Tt*1000);#factor of 1000 to convert kJ to J\n", + "ma=pt*At*Vt;\n", + "print'the mass flow rate through the nozzle when the back pressure is 0.7 MPa %f kg/s'%round(ma,2);\n", + "\n", + "#Part b\n", + "Pb=0.4;\n", + "Pca=Pb/Po;\n", + "# Pca < 0.5283\n", + "#sonic conditions exists at the exit\n", + "Ma=1;\n", + "mb=At*(Po*1000)*(sqrt(k*1000/(R*To)))*(2/(k+1))**((k+1)/(2*(k-1)));#factor of 1000 to convert MPa to kPa and kJ to J\n", + "print'the mass flow rate through the nozzle when the back pressure is 0.4 MPa %f kg/s'%round(mb,2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the mass flow rate through the nozzle when the back pressure is 0.7 MPa 6.770000 kg/s\n", + "the mass flow rate through the nozzle when the back pressure is 0.4 MPa 7.110000 kg/s\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-6 ,Page No.840" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "T1=400;#intial temperature in K\n", + "P1=100;#intial pressure in kPa\n", + "Ma1=0.3;#intial mach no\n", + "A21=0.8;#A2/A1 as flow area has been reduced by 20 percent\n", + "\n", + "#assumption\n", + "k=1.4;\n", + "\n", + "#from Table A\u201332\n", + "#at Ma1=0.3\n", + "#s stands for * symbol\n", + "A1s = 2.0351;#A1/As\n", + "T10 = 0.9823;#T1/T0\n", + "P10 = 0.9305;#P1/P0\n", + "A2s = A21*A1s;#A2/As\n", + "#at this value of A2/As\n", + "T20=0.9701;#T2/T0\n", + "P20=0.8993;#P2/P0\n", + "Ma2=0.391;\n", + "\n", + "#calculations\n", + "T2=T1*T20/T10;\n", + "P2=P1*P20/P10;\n", + "print'Ma2 is %f'%round(Ma2,3);\n", + "print'T2 %i K is'%round(T2);\n", + "print'P2 %f kPa is'%round(P2,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ma2 is 0.391000\n", + "T2 395 K is\n", + "P2 96.600000 kPa is\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-7 ,Page No.844" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data \n", + "T0=800;#intial temperature in K\n", + "P0=1;#intial pressure in MPa\n", + "Vi=0;#negligible intial velcity\n", + "At=20;#throat area in cm^2\n", + "Mae=2;#exit Mach number\n", + "\n", + "#from Table A-2a\n", + "R=0.287;#in kJ/kg-K\n", + "k=1.4;\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "# Mach no. at exit is 2 hence sonic conditions at throat\n", + "p0=P0*1000/(R*T0);#factor of 1000 to convert MPa to kPa\n", + "#from Table A-32 at Mat=1\n", + "#s stands for * symbol\n", + "Ps0 = 0.5283;#Ts/T0\n", + "Ts0 = 0.8333;#Ps/P0\n", + "ps0=0.6339;#ps/p0\n", + "Ps=Ps0*P0;\n", + "Ts=Ts0*T0;\n", + "ps=ps0*p0;\n", + "As=At;\n", + "Vs=sqrt(k*R*Ts*1000);#factor of 1000 to convert kJ to J\n", + "print('the throat conditions');\n", + "print'Presssure %f MPa'%round(Ps,4);\n", + "print'Temperature %f K'%round(Ts,1);\n", + "print'density %f kg/m^3'%round(ps,3);\n", + "print'area %f cm^2'%round(As);\n", + "print'velocity %f m/s'%round(Vs,1);\n", + "\n", + "#part - b\n", + "#from Table A-32\n", + "#at Mae=2\n", + "Te0 = 0.5556;#Te/T0\n", + "Pe0 = 0.1278;#Pe/P0\n", + "pe0= 0.2300;#pe/p0\n", + "Ae0= 1.6875;#Ae/Ao\n", + "Pe=Pe0*P0;\n", + "Te=Te0*T0;\n", + "pe=pe0*p0;\n", + "Ae=Ae0*At;\n", + "Ve=Mae*sqrt(k*R*Te*1000);#factor of 1000 to convert kJ to J\n", + "print('the exit plane conditions, including the exit area');\n", + "print'Presssure %f MPa'%round(Pe,4);\n", + "print'Temperature %f K'%round(Te,1);\n", + "print'density %f kg/m^3'%round(pe,3);\n", + "print'area %f cm^2'%round(Ae,2);\n", + "print'velocity %f m/s'%round(Ve,1);\n", + "#part - c\n", + "m=ps*As*Vs/10000;#factor of 10000 to convert cm^2 to m^2\n", + "print'the mass flow rate through the nozzle %f kg/s'%round(m,2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the throat conditions\n", + "Presssure 0.528300 MPa\n", + "Temperature 666.600000 K\n", + "density 2.761000 kg/m^3\n", + "area 20.000000 cm^2\n", + "velocity 517.500000 m/s\n", + "the exit plane conditions, including the exit area\n", + "Presssure 0.127800 MPa\n", + "Temperature 444.500000 K\n", + "density 1.002000 kg/m^3\n", + "area 33.750000 cm^2\n", + "velocity 845.200000 m/s\n", + "the mass flow rate through the nozzle 2.860000 kg/s\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-9 ,Page No.850" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import log,sqrt\n", + "\n", + "#data from Ex - 17.7\n", + "m=2.86;\n", + "Ma1=2;\n", + "P01=1;\n", + "P1=0.1278;\n", + "T1=444.5;\n", + "p1=1.002;\n", + "\n", + "#from Table A-2a\n", + "R=0.287;#in kJ/kg-K\n", + "cp=1.005;#in kJ/kg-K\n", + "k=1.4;\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "#from Table A-33 at Ma1=2.0\n", + "Ma2=0.5774;\n", + "P0201=0.7209;#P02/P01\n", + "P21=4.5;#P2/P1;\n", + "T21=1.6875;#T2/T1\n", + "p21=2.6667;#p2/p1\n", + "P02=P0201*P01;\n", + "P2=P21*P1;\n", + "T2=T21*T1;\n", + "p2=p21*p1;\n", + "print'the stagnation pressure %f MPa'%round(P02,3);\n", + "print'the static pressure %f MPa'%round(P2,3);\n", + "print'static temperature %f K'%round(T2);\n", + "print'static density %f kg/m^3'%round(p2,2);\n", + "\n", + "#part - b\n", + "#s21 = s2 - s1\n", + "s21=cp*log(T2/T1)-R*log(P2/P1);\n", + "print'the entropy change across the shock %fkJ/kg-K'%round(s21,4);\n", + "\n", + "#part - c\n", + "V2=Ma2*sqrt(k*R*T2*1000);#factor of 1000 to convert kJ to J\n", + "print'the exit velocity %f m/s'%round(V2);\n", + "\n", + "#part - d\n", + "print('flow rate is not affected by presence of shock waves amd remains 2.86 kg/sec')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the stagnation pressure 0.721000 MPa\n", + "the static pressure 0.575000 MPa\n", + "static temperature 750.000000 K\n", + "static density 2.670000 kg/m^3\n", + "the entropy change across the shock 0.094200kJ/kg-K\n", + "the exit velocity 317.000000 m/s\n", + "flow rate is not affected by presence of shock waves amd remains 2.86 kg/sec\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-10 ,Page No.858" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sin,pi\n", + "\n", + "#given data\n", + "#using protactor frpm Fig 17-36\n", + "u=19;#u stands for angle of the mach lines\n", + "\n", + "#calculations\n", + "#by Eq. 17-47\n", + "#i.e u= asin(1/Ma)\n", + "Ma=1/sin(u*pi/180);#converting to radians\n", + "print'The Mach number is %f'%round(Ma,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Mach number is 3.070000\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-11 ,Page No.858" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sin,pi\n", + "\n", + "#given data\n", + "Ma1=2;#Supersonic air mach no\n", + "P1=75;#Supersonic air at pressure in kPa\n", + "O=10*pi/180;#converting to radians & angle b/w shock wave and normal\n", + "\n", + "#constants used\n", + "k=1.4;\n", + "\n", + "#calcualtions\n", + "#with given values of Ma1 and O from Eq 17-46\n", + "Bweak=39.3*pi/180;#converting to radians\n", + "Bstrong=83.7*pi/180;#converting to radians\n", + "#Weak shock\n", + "Ma1w=Ma1*sin(Bweak);\n", + "#Strong shock\n", + "Ma1s=Ma1*sin(Bstrong);\n", + "#from second part Eq 17-40\n", + "Ma2w=0.8032;\n", + "Ma2s=0.5794;\n", + "#pressure ratio = (2*k*Ma^2 - k + 1)/(k + 1 )\n", + "#Weak shock\n", + "P2w=P1*(2*k*Ma1w**2 - k + 1)/(k + 1 );\n", + "print'pressure for weak shock %i kPa'%round(P2w);\n", + "#Strong shock\n", + "P2s=P1*(2*k*Ma1s**2 - k + 1)/(k + 1 );\n", + "print'pressure for strong shock %i kPa'%round(P2s);\n", + "#Weak shock\n", + "Ma2=Ma2w/sin(Bweak-O);\n", + "print'Mach number downstream for weak shock is %f'%round(Ma2,2);\n", + "#Strong shock\n", + "Ma2=Ma2s/sin(Bstrong-O);\n", + "print'Mach number downstream for strong shock is %f'%round(Ma2,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure for weak shock 128 kPa\n", + "pressure for strong shock 333 kPa\n", + "Mach number downstream for weak shock is 1.640000\n", + "Mach number downstream for strong shock is 0.604000\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 17-12 ,Page No.859" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt,pi,atan\n", + "\n", + "#given data\n", + "Ma1=2;#Supersonic air mach no\n", + "P1=230;#Supersonic air pressure in kPa\n", + "O=10*pi/180;#converting to radians & O stands for angle of the mach lines\n", + "\n", + "#constants used\n", + "k=1.4;\n", + "\n", + "#calculations\n", + "#Eq. 17\u201349 for the upstream Prandtl\u2013Meyer function\n", + "vMa1=sqrt((k+1)/(k-1))*atan(sqrt((k-1)*(Ma1**2-1)/(k+1))*pi/180)-atan(sqrt(Ma1**2-1)*pi/180);#converting to radians\n", + "#Eq. 17\u201348 to calculate the downstream Prandtl\u2013Meyer function\n", + "vMa2=O+vMa1;\n", + "#using equation solver as implict nature of Eq 17-49\n", + "Ma2=2.385;\n", + "print'downstream Mach number Ma2 is %f'%round(Ma2,3);\n", + "#P2 = (P2/P0)/(P1/P0) * P1\n", + "P2= (1 + (k-1)*Ma2**2/2 )**(-k/(k-1)) / (1 + (k-1)*Ma1**2/2 )**(-k/(k-1)) * P1;\n", + "print'downstream pressure %i kPa'%round(P2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "downstream Mach number Ma2 is 2.385000\n", + "downstream pressure 126 kPa\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-15 ,Page No.868" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import pi,sqrt\n", + "\n", + "#given data\n", + "P1=480.0;#intial pressure in kPa\n", + "T1=550.0;#intial temperature in K\n", + "V1=80.0;#intial velocity in m/s\n", + "d1=15.0/100.0;#diameter in m\n", + "AF=40.0;#air to fuel ratio\n", + "HV=40000.0;#heating value in kJ/kg\n", + "\n", + "#from Table A-2a\n", + "R=0.287;#in kJ/kg-K\n", + "cp=1.005;#in kJ/kg-K\n", + "k=1.4;\n", + "\n", + "#calculations\n", + "p1=P1/(R*T1);\n", + "A1=pi*d1**2/4;\n", + "mair=p1*A1*V1;\n", + "mfuel=mair/AF;\n", + "Q=mfuel*HV;\n", + "q=Q/mair;\n", + "T01=T1+V1**2/(2*cp);\n", + "c1=sqrt(k*R*T1*1000);#factor of 1000 to convert kJ to J\n", + "Ma1=V1/c1;\n", + "#exit stagnation energy equation q= Cp (T02 - T01)\n", + "T02=T01+q/cp;\n", + "#from Table A\u201334\n", + "#at Ma1\n", + "#s stands for * symbol\n", + "T0s=0.1291;#T0/Ts\n", + "Ts0=T01/T0s;\n", + "T2s=T02/Ts0;#T02/T*0\n", + "#from Table A\u201334 at this ratio\n", + "Ma2=0.3142;\n", + "#Rayleigh flow relations corresponding to the inlet and exit Mach no\n", + "#at Ma1\n", + "T1s=0.1541;#T1/Ts\n", + "P1s=2.3065;#P1/Ps\n", + "V1s=0.0668;#V1/Vs\n", + "#at Ma2\n", + "T2s=0.4389;#T2/Ts\n", + "P2s=2.1086;#P2/Ps\n", + "V2s=0.2082;#V2/Vs\n", + "T2=T2s/T1s*T1;\n", + "P2=P2s/P1s*P1;\n", + "V2=V2s/V1s*V1; \n", + "print'Mach Number at exit is %f'%round(Ma2,4);\n", + "print'Presssure %i MPa'%round(P2);\n", + "print'Temperature %i K'%round(T2);\n", + "print'velocity %i m/s'%round(V2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mach Number at exit is 0.314200\n", + "Presssure 439 MPa\n", + "Temperature 1566 K\n", + "velocity 249 m/s\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17-16 ,Page No.870" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "\n", + "#given data\n", + "P01=2000;#entry pressure in kPa\n", + "T1=400;#entry temperature in C\n", + "V1=0;#negligible velocity at entry\n", + "nN=0.93;#overall nozzle efficiency\n", + "m=2.5;#mass flow rate in kg/s\n", + "P2=300;#exit pressure in kPa\n", + "\n", + "#calculations\n", + "\n", + "#part - a\n", + "P201=P2/P01;\n", + "#critical pressure ratio at this values is 0.546\n", + "Pt=0.546*P01;\n", + "#at inlet\n", + "h1=3248.4;\n", + "h01=h1;\n", + "s1=7.1292;\n", + "#at throat\n", + "st=s1;\n", + "ht=3076.8;\n", + "vt=0.24196;\n", + "Vt=sqrt(2*(h01-ht)*1000);#factor of 1000 to convert kJ to J\n", + "At=m*vt/Vt;\n", + "#at state 2s\n", + "s2s=s1;\n", + "h2s=2783.6;\n", + "#nN = (h01 - h2)/ (h01 - h2s)\n", + "h2=h01-nN*(h01-h2s);\n", + "#at P2 and h2\n", + "v2=0.67723;\n", + "s2=7.2019;\n", + "V2=sqrt(2*(h01-h2)*1000);#factor of 1000 to convert kJ to J\n", + "A2=m*v2/V2;\n", + "print'throat area %f cm^2'%round((At*10000),2);\n", + "print'exit area %f cm^2'%round((A2*10000),2);\n", + "\n", + "#part - b\n", + "# at st=7.1292\n", + "#pressures of 1.115 and 1.065 MPa\n", + "#c calculated using tables\n", + "c=sqrt((1115-1065)/(1/0.23776 - 1/0.24633)*1000);#factor of 1000 to convert kPa to Pa\n", + "Ma=Vt/c;\n", + "print'the Mach number at the throat is %f'%round(Ma,2);\n", + "# at s2=7.2019\n", + "#pressures of 325 and 275 kPa\n", + "c=sqrt((325-276)/(1/0.63596 - 1/0.72245)*1000);#factor of 1000 to convert kPa to Pa\n", + "Ma=V2/c;\n", + "print'the Mach number at the nozzle exit is %f'%round(Ma,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "throat area 10.330000 cm^2\n", + "exit area 18.210000 cm^2\n", + "the Mach number at the throat is 1.000000\n", + "the Mach number at the nozzle exit is 1.820000\n" + ] + } + ], + "prompt_number": 44 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter2.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter2.ipynb new file mode 100755 index 00000000..db573fc6 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter2.ipynb @@ -0,0 +1,588 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2: Energy Conversion and General Energy Analysis" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Example 2-1 ,Page No.57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#there is a 0.00490% error as the answer in textbook is expressed in multiple of 10\n", + "#Constants used\n", + "Hu=6.73*10**10;#Energy liberated by 1 kg of uranium\n", + "\n", + "# Given values\n", + "p=0.75;# assuming the avg density of gasoline in kg/L\n", + "V=5;# consumption per day of gasoline in L\n", + "Hv=44000; #heat value in kJ/kg\n", + "mu=0.1;# mass of uranium used\n", + "\n", + "#Calculation\n", + "mgas=p*V;#mass of gasoline required per day\n", + "Egas=mgas*Hv;\n", + "Eu=mu*Hu;\n", + "d=Eu/Egas;\n", + "print'%i number of days the car can run with uranium' %round(d,0)\n", + "print'equivalent to %i years' %round(d/365,0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "40788 number of days the car can run with uranium\n", + "equivalent to 112 years\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-2 ,Page No.59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Given values\n", + "v=8.5;# wind speed in m/s\n", + "m=10;# given mass for part - b \n", + "mf=1154;# given flowrate for part - c\n", + "\n", + "#Calculations\n", + "e=(v**2)/2;\n", + "print'wind energy per unit mass %f J/kg' %round(e,1);\n", + "E=m*e;\n", + "print'wind energy for 10 kg mass %i J' %E;\n", + "E=mf*e/1000;\n", + "print'wind energy for mass flow rate of 1154kg/s %f kW'%round(E,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "wind energy per unit mass 36.100000 J/kg\n", + "wind energy for 10 kg mass 361 J\n", + "wind energy for mass flow rate of 1154kg/s 41.700000 kW\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-7 ,Page No.67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "# Given values\n", + "T=200;# applied torque in N\n", + "n=4000;# shaft rotation rate in revolutions per minute\n", + "\n", + "#Calculation\n", + "Wsh=(2*math.pi*n*T)/1000/60;#factor of 1000 to convert to kW and 60 to convert to sec\n", + "print'Power transmitted %f kW'%round(Wsh,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power transmitted 83.800000 kW\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-8 ,Page No.69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Constants used\n", + "g=9.81;#acceleration due to gravity in m/s^2;\n", + "\n", + "#Given values\n", + "m=1200;#mass of car in kg\n", + "V=90/3.6;#velocity ; converting km/h into m/s\n", + "d=30*math.pi/180;#angle of slope ; converting into radians\n", + "\n", + "#Calculation\n", + "Vver=V*math.sin(d);#velocity in vertical direction\n", + "Wg=m*g*Vver/1000;\n", + "print'the addtional power %i kW'%Wg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the addtional power 147 kW\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-9 ,Page No.69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "m=900;#mass of car in kg\n", + "v1=0;# intial velocity\n", + "v2=80/3.6;# final velocity; converting km/h into m/s\n", + "t=20;# time taken1\n", + "\n", + "#Calculation\n", + "Wa=m*(v2**2-v1**2)/2/1000;\n", + "Wavg=Wa/t;\n", + "print'the average power %f kW'%round(Wavg,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the average power 11.100000 kW\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-10 ,Page No.74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "Win=100;# work done in the process in kJ\n", + "Qout=500;# heat lost in kJ\n", + "U1=800;# internal energy of the fluid in kJ\n", + "\n", + "#Calculations\n", + "# Win - Qout = U2- U1 i.e change in internal energy \n", + "U2=U1-Qout+Win;\n", + "print'final internal of the system %i kJ'%U2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "final internal of the system 400 kJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-11 ,Page No.75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#given values\n", + "Win=20;# power consumption in W\n", + "mair=0.25;# rate of air discharge in kg/sec\n", + "\n", + "#calculation\n", + "v=math.sqrt(Win/2/mair)#Win = 1/2*m*v^2\n", + "if v >=8:\n", + " print('True');\n", + "else:\n", + " print('False')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "False\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-12 ,Page No.76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "Win=200.0;#Power of fan in W\n", + "U=6.0;#Overall heat transfer coefficient in W/m^2 C\n", + "A=30;#Surface area in m^2\n", + "To=25;#Outdoor temperature in C\n", + "\n", + "#Calculations\n", + "Ti= (Win/U/A)+To;# Win = Qout = U*A*(Ti - To)\n", + "print'the indoor air temperature %f Celcius'%Ti\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the indoor air temperature 26.111111 Celcius\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-13 ,Page No.76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "Plamp=80.0;#Power of lamp in W\n", + "N=30;#no of lamps\n", + "t=12;#time period the light is in use in hours/day\n", + "y=250;#days in a year light is in function \n", + "UC=0.07;#unit cost in $\n", + "\n", + "#Calculation\n", + "LP=Plamp*N/1000;#Lighting power in kW\n", + "OpHrs=t*y;#Operating hours\n", + "LE=LP*OpHrs;#Lighting energy in kW\n", + "LC=LE*UC;#Lighting cost\n", + "print'the annual energy cost $%i'%LC\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the annual energy cost $504\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-15 ,Page No.82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "Ein=2.0;#Power of electric burner in kW\n", + "n1=0.73;#Efficiency of open burners\n", + "n2=0.38;#efficency of gas units\n", + "CinH=0.09;#Unit cost of electricity in $\n", + "CinB=0.55;#Unit cost of natural gas in $\n", + "\n", + "#Calculations\n", + "QutH= Ein * n1;\n", + "print'rate of energy consumption by the heater %f kW'%round(QutH,2);\n", + "CutH= CinH / n1;\n", + "print'the unit cost of utilized energy for heater $%f/kWh'%round(CutH,3);\n", + "QutB= QutH / n2 ;\n", + "print'rate of energy consumption by the burner %f kW'%round(QutB,2);\n", + "CutB= CinB / n2 / 29.3; # 1 therm = 29.3 kWh\n", + "print'the unit cost of utilized energy for burner %f kWh'%round(CutB,3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "rate of energy consumption by the heater 1.460000 kW\n", + "the unit cost of utilized energy for heater $0.123000/kWh\n", + "rate of energy consumption by the burner 3.840000 kW\n", + "the unit cost of utilized energy for burner 0.049000 kWh\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-16 ,Page No.84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#there is a 0.204% error in the last part of the question due to rounding off the intermidiate steps in the solution\n", + "\n", + "#Constants used\n", + "g=9.81;#acceleration due to gravity in m/s^2;\n", + "\n", + "#Given values\n", + "h=50.0;#Depth of water in m\n", + "m=5000.0;#mass flow rate of water in kg/sec\n", + "Wout=1862.0;#generated electric power in kW\n", + "ngen=0.95;#efficiency of turbine\n", + "\n", + "#calculation\n", + "X=g*h/1000.0;# X stands for the differnce b/w change in mechanical energy per unit mass\n", + "R=m*X;#rate at which mech. energy is supplied to turbine in kW\n", + "nov=Wout/R;#overall efficiency i.e turbine and generator\n", + "print'overall efficiency is %f'%round(nov,2);\n", + "ntu=nov/ngen;#efficiency of turbine\n", + "print'efficiency of turbine is %f'%round(ntu,2);\n", + "Wsh=ntu*R;#shaft output work\n", + "print'shaft power output %i kW'%round(Wsh,0)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "overall efficiency is 0.760000\n", + "efficiency of turbine is 0.800000\n", + "shaft power output 1960 kW\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-17 ,Page No.85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "Pstd=4520.0;\n", + "Phem=5160.0;#prices of std and high eff motor in USD\n", + "R=60*0.7457;#rated power in kW from hp\n", + "OpHrs=3500.0;#Operating hours\n", + "Lf=1.0;#Load Factor\n", + "nsh=0.89;#efficiency of shaft\n", + "nhem=0.932;#efficiency of high eff. motor\n", + "CU=0.08;#per unit cost in $\n", + "\n", + "#calculation\n", + "PS=R*Lf*(1/nsh-1/nhem);#Power savings = W electric in,standard - W electric in,efficient\n", + "ES=PS*OpHrs;#Energy savings = Power savings * Operating hours\n", + "print'Energy savings %i kWh/year'%ES;\n", + "CS=ES*CU;\n", + "print'Cost savings per year $%i'%CS;\n", + "EIC=Phem-Pstd;#excess intial cost\n", + "Y=EIC/CS;\n", + "print'simple payback period %f years'%round(Y,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy savings 7929 kWh/year\n", + "Cost savings per year $634\n", + "simple payback period 1.000000 years\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-18 ,Page No.91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "#NOx details\n", + "m1=0.0047;#emissions of gas furnaces of NOx in kg/therm\n", + "N1=18*10**6;#no. of therms per year \n", + "#CO2 details\n", + "m2=6.4;#emissions of gas furnaces of CO2 in kg/therm\n", + "N2=18*10**6;#no. of therms per year \n", + "\n", + "#Calculation\n", + "NOxSav=m1*N1;\n", + "print'NOx savings %f kg/year'%round(NOxSav,1);\n", + "CO2Sav=m2*N2;\n", + "print'CO2 savings %f kg/year'%round(CO2Sav,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "NOx savings 84600.000000 kg/year\n", + "CO2 savings 115200000.000000 kg/year\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2-19 ,Page No.95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Constants used\n", + "e=0.95;#Emissivity\n", + "tc=5.67*10**-8;#thermal conductivity in W/m^2 K^4\n", + "\n", + "#Given values\n", + "h=6;#convection heat transfer coefficient in W/m^2 C\n", + "A=1.6;#cross-sectional area in m^2\n", + "Ts=29;#average surface temperature in C\n", + "Tf=20;#room temperature in C\n", + "\n", + "#Calculation\n", + "#convection rate\n", + "Q1=h*A*(Ts-Tf);\n", + "#radiation rate\n", + "Q2=e*tc*A*((Ts+273)**4-(Tf+273)**4);\n", + "Qt=Q1+Q2;\n", + "print'the total rate of heat transfer %f W'%round(Qt,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the total rate of heat transfer 168.100000 W\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter3.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter3.ipynb new file mode 100755 index 00000000..9830dbfb --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter3.ipynb @@ -0,0 +1,756 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Properties of Pure Substances" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-1 ,Page No.128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "m=50;#mass in kg\n", + "T=90;#temperature in C\n", + "\n", + "#Values from Table A-4\n", + "P=70.183;#in kPa\n", + "v=0.001036;#in m^3/kg\n", + "\n", + "#Calculation\n", + "V=m*v;#equating dimensions\n", + "print'pressure is %f kPa'%round(P,3);\n", + "print'total volumne of tank becomes %f m^3'%round(V,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure is 70.183000 kPa\n", + "total volumne of tank becomes 0.051800 m^3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-2 ,Page No.128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "V=2.0;#volumne of saturated water vapor in ft^3\n", + "P=50.0;#pressure in psia\n", + "\n", + "#Values from Table A-5E\n", + "T=280.99;#in F\n", + "v=8.5175;#in ft^3/lbm\n", + "\n", + "#caluclation\n", + "m=V/v;#dimension analysis\n", + "print'Temperature inside cylinder %f F'%round(T,2);\n", + "print'mass of vapour inside cylinder %f lbm'%round(m,3);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature inside cylinder 280.990000 F\n", + "mass of vapour inside cylinder 0.235000 lbm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-3 ,Page No.128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Constants used\n", + "Hfg=2257.5;#enthalpy of vaporization in kJ/kg\n", + "\n", + "#Given values\n", + "m=200.0/1000;#mass converting in kg\n", + "P=100;#Pressure at which process takes place in kPa\n", + "\n", + "#Values from Table A-5\n", + "vg=1.6941;#specific vol of sat liq\n", + "vf=0.001043;#specific vol of vapor\n", + "\n", + "#Caluclation\n", + "vfg=vg-vf;\n", + "V=m*vfg;\n", + "print'the volume change %f m^3'%round(V,4);\n", + "E=m*Hfg;\n", + "print'amount of energy transferred to the water %f kJ'%round(E,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the volume change 0.338600 m^3\n", + "amount of energy transferred to the water 451.500000 kJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-4 ,Page No.131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "mt=10#mass of water in kg\n", + "mf=8;#mass of water in liquid form in kg\n", + "T=90;#temperature in C\n", + "\n", + "#Values from Table A-4\n", + "P=70.183;#in kPa\n", + "vf=0.001036;#in m^3\n", + "vg=2.3593;#in m^3\n", + "\n", + "#Caluclation\n", + "mg=mt-mf;\n", + "V=mf*vf+mg*vg;# V= Vg + Vf\n", + "print'the volume of the tank %f m^3'%round(V,2);\n", + "print'the pressure in the tank %f kPa'%round(P,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the volume of the tank 4.730000 m^3\n", + "the pressure in the tank 70.183000 kPa\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-5 ,Page No.131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "m=4;#mass of refrigerant-134a in kg\n", + "V=80.0/1000;#volumne converting into m^3\n", + "P=160;#pressure in kPa\n", + "\n", + "#Values from Table A-12\n", + "vf=0.0007437;\n", + "vg=0.12348;\n", + "T=-15.60;\n", + "hf=31.21;\n", + "hfg=209.90;\n", + "\n", + "#Caluclations\n", + "v=V/m;\n", + "#vg>v>vf therefore it is a saturated mix\n", + "#hence temp will same as saturation temp\n", + "print'the temperature %f celcius'%round(T,2)\n", + "x=(v-vf)/(vg-vf);#x=vg/vfg i.e the dryness fraction\n", + "print'the quality is %f'%round(x,3);\n", + "h=hf+x*hfg;\n", + "print'the enthalpy of the refrigerant %f kJ/kg'%round(h,1);\n", + "mg=x*m;\n", + "Vg=mg*vg;\n", + "print'the volume occupied by the vapor phase %f m^3'%round(Vg,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the temperature -15.600000 celcius\n", + "the quality is 0.157000\n", + "the enthalpy of the refrigerant 64.100000 kJ/kg\n", + "the volume occupied by the vapor phase 0.077500 m^3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-7 ,Page No.133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "P=0.5;#pressure in MPa\n", + "h=2890.0;#enthaply in kJ/kg\n", + "\n", + "#from Table A\u20136\n", + "#at P=0.5 MPa\n", + "T1=200.0;\n", + "h1=2855.8;\n", + "T2=250;\n", + "h2=2961.0;\n", + "# we need linear interpolation \n", + "\n", + "#calculatiom\n", + "#by interpolation we can say that\n", + "#h=h1+(T-T1)/(T2-T1)*(h2-h1)\n", + "#we have to find T\n", + "T=(h-h1)/(h2-h1)*(T2-T1)+T1;\n", + "print'temperature of water %f celcius'%round(T,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "temperature of water 216.300000 celcius\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-8 ,Page No.134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given values\n", + "T=80;#temperature of compressed liquid water in C\n", + "P=5;#pressure in KPa\n", + "\n", + "#from Table A\u20137\n", + "#at compressed liq given conditions\n", + "u=333.82;\n", + "\n", + "#from Table A-4\n", + "#at saturation\n", + "usat=334.97;\n", + "\n", + "#calcualtion\n", + "e=(usat-u)/u*100;\n", + "print'internal energy of compressed liquid water using data from the compressed liquid table %f kJ/kg '%round(u,2);\n", + "print'internal energy of compressed liquid water using saturated liquid data %f kJ/kg '%round(usat,2);\n", + "print'the error involved %f the second case'%round(e,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "internal energy of compressed liquid water using data from the compressed liquid table 333.820000 kJ/kg \n", + "internal energy of compressed liquid water using saturated liquid data 334.970000 kJ/kg \n", + "the error involved 0.340000 the second case\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3-9 ,Page No.135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#part a\n", + "print('Part a');\n", + "\n", + "#given values\n", + "P=200;#in KPa\n", + "x=0.6;\n", + "\n", + "#from Table A-5\n", + "T=120.21;\n", + "uf=504.50;\n", + "ufg=2024.6;\n", + "\n", + "#calcualtions\n", + "u=uf+(x*ufg);\n", + "print'temperature %f Celcius '%round(T,2);\n", + "print'internal energy %f kJ/kg'%round(u,2);\n", + "print('saturated liquid\u2013vapor mixture at a pressure of 200 kPa');\n", + "\n", + "#part b\n", + "print('Part b');\n", + "\n", + "#given values\n", + "T=125;#in C\n", + "u=1600;#in kJ/kg\n", + "\n", + "#from Table A\u20134\n", + "uf=524.83;\n", + "ug=2534.3;\n", + "#ug>u>ufg so its aturated liquid\u2013vapor mixture\n", + "P=232.23;\n", + "\n", + "#calculation\n", + "ufg=ug-uf;\n", + "x=(u-uf)/ufg;\n", + "print'Pressure %f kPa'%round(P,2);\n", + "print'x is %f'%round(x,3);\n", + "print('saturated liquid\u2013vapor mixture at a temp of 125 of celcius');\n", + "\n", + "#part c\n", + "print('Part c');\n", + "\n", + "#given values\n", + "P=1000;#in kPa\n", + "u=2950;#in kJ/kg\n", + "\n", + "#from Table A\u20136\n", + "uf=761.39;\n", + "ug=2582.8;\n", + "#u>ug so its superheated steam\n", + "T=395.2;\n", + "\n", + "#calculation\n", + "print'temperature %f Celcius'%round(T,1);\n", + "print('superheated vapor at 1MPa');\n", + "\n", + "#part d\n", + "print('Part d');\n", + "\n", + "#given values\n", + "T=75;#in C\n", + "P=100;#in kPa\n", + "\n", + "#from Table A\u20135\n", + "Tsat=151.83;\n", + "#T=COP:\n", + " print('claim is true');\n", + "else:\n", + " print('claim is false')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "claim is false\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6-7 ,Page No.310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "TL=-5+273.0;#in C\n", + "TH=21+273.0;#house temp in C\n", + "QH=135000.0/3600;#heat loss rate in kW\n", + "\n", + "#calculations\n", + "COPHP=1/(1-TL/TH);\n", + "Wnet=QH/COPHP;\n", + "print'minimum power required %f kW'%round(Wnet,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum power required 3.320000 kW\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6-8 ,Page No.314" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "Qrefrig=40.0;#heat load on referigerator in W\n", + "COPR=1.3;#COP of referigerator\n", + "Wlight=40.0;#rated power of bulb in W\n", + "\n", + "#calculation\n", + "Wrefrig=Qrefrig/COPR;\n", + "Wt=Wrefrig+Wlight;\n", + "AnHr=365*24;#annual hours\n", + "NOH=20*30/3600.0*365;#normal operating hours\n", + "AOP=AnHr-NOH;#addtional operating hours\n", + "APC=Wt*AOP/1000;#additional power consumption; fator of 1000 to convert to kW\n", + "print'increase in power consumption %i kWh/yr'%round(APC);\n", + "print'increase in cost S%f/yr'%round((APC)*0.08,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "increase in power consumption 616 kWh/yr\n", + "increase in cost S49.300000/yr\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter7.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter7.ipynb new file mode 100755 index 00000000..d5ab12d2 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter7.ipynb @@ -0,0 +1,1049 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7: Entropy" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7-1 ,Page No.335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "Q=750;#heat transfered in kJ\n", + "Tsys=300.0;#temperature of liquid-water mixture in K\n", + "\n", + "#calculations\n", + "dSsys=Q/Tsys;\n", + "print'Entropy change in the process %f kJ/K'%round(dSsys,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy change in the process 2.500000 kJ/K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7-2 ,Page No.338" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "Qsink=2000.0;#heat lost in kJ\n", + "Qsource=-Qsink;\n", + "Tsource=800.0;#temp of heat loss in K\n", + "\n", + "#calculations\n", + "#part - a\n", + "Tsink=500.0;\n", + "dSsource=Qsource/Tsource;\n", + "dSsink=Qsink/Tsink;\n", + "Sgena=dSsource+dSsink;\n", + "print'entropy generated in part a %f kJ/K'%round(Sgena,1);\n", + "#part - b\n", + "Tsink=750;\n", + "dSsource=Qsource/Tsource;\n", + "dSsink=Qsink/Tsink;\n", + "Sgenb=dSsource+dSsink;\n", + "print'entropy generated in part b %f kJ/K'%round(Sgenb,1);\n", + "if Sgena>Sgenb :\n", + " print('part a is more irreversible');\n", + "elif(Sgena == Sgenb) :\n", + " print('heat transfer is equally irreversible');\n", + "else:\n", + " print('part b is more irreversible');\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "entropy generated in part a 1.500000 kJ/K\n", + "entropy generated in part b 0.200000 kJ/K\n", + "part a is more irreversible\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7-3 ,Page No.341" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#given data\n", + "m=5.0;#mass of refrigerant 134-a in kg\n", + "P1=140.0;#intial pressure in kPa\n", + "T1=20.0;#temperature in C\n", + "P2=100.0;#final pressure in kPa\n", + "\n", + "#from refrigerant-134a data\n", + "#at P1 and T1\n", + "s1=1.0624;\n", + "v1=0.16544;\n", + "#at P2\n", + "v2=v1;\n", + "vf=0.0007529;\n", + "vg=0.19254;\n", + "sf=0.07188;\n", + "sfg=0.87995;\n", + "\n", + "#calculations\n", + "# vf < v2