diff options
Diffstat (limited to 'Thermodynamics_An_Engineering_Approach')
24 files changed, 9708 insertions, 0 deletions
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<Tsat so it is a compressed liquid\n",
+ "#the given pressure is much lower than the lowest pressure value in the compressed liquid table i.e 5 MPa\n",
+ "#assuming, the compressed liquid as saturated liquid at the given temperature\n",
+ "\n",
+ "#from Table A-4\n",
+ "u=313.99;\n",
+ "print'Internal energy %f kJ/kg'%round(u,2);\n",
+ "print('the compressed liquid condition');\n",
+ "\n",
+ "#Part e\n",
+ "print('Part e');\n",
+ "\n",
+ "#given values\n",
+ "P=850;#in kPa\n",
+ "x=0;\n",
+ "\n",
+ "#x=0 therefore it is a saturateed liquid condition\n",
+ "#from Table A-5\n",
+ "T=172.94;\n",
+ "u=731.00;\n",
+ "print'temperature %f Celcius'%round(T,2);\n",
+ "print'Internal energy %f kJ/kg'%round(u,2);\n",
+ "print('saturateed liquid condition')\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Part a\n",
+ "temperature 120.210000 Celcius \n",
+ "internal energy 1719.260000 kJ/kg\n",
+ "saturated liquid\u2013vapor mixture at a pressure of 200 kPa\n",
+ "Part b\n",
+ "Pressure 232.230000 kPa\n",
+ "x is 0.535000\n",
+ "saturated liquid\u2013vapor mixture at a temp of 125 of celcius\n",
+ "Part c\n",
+ "temperature 395.200000 Celcius\n",
+ "superheated vapor at 1MPa\n",
+ "Part d\n",
+ "Internal energy 313.990000 kJ/kg\n",
+ "the compressed liquid condition\n",
+ "Part e\n",
+ "temperature 172.940000 Celcius\n",
+ "Internal energy 731.000000 kJ/kg\n",
+ "saturateed liquid condition\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3-10 ,Page No.139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#constants used\n",
+ "R=0.287# in kPa m^3/kg K\n",
+ "\n",
+ "#given values\n",
+ "l=4;#dimensions of room in m\n",
+ "b=5;#dimensions of room in m\n",
+ "h=6;#dimensions of room in m\n",
+ "P=100.0;#pressure in kPa\n",
+ "T=25+273.0;#temperature in Kelvin\n",
+ "\n",
+ "#calculation\n",
+ "V=l*b*h;\n",
+ "m=P*V/R/T;\n",
+ "print'the mass of the air %f kg'%round(m,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the mass of the air 140.300000 kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3-11 ,Page No.142"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given values\n",
+ "P=1;#pressure in MPa\n",
+ "T=50+273;#tempearture converting into Kelvin\n",
+ "vgiv=0.021796;#specific vol. given in m^3\n",
+ "\n",
+ "#from Table A-1\n",
+ "R=0.0815;\n",
+ "Pcr=4.059;\n",
+ "Tcr=374.2;\n",
+ "\n",
+ "#calculation\n",
+ "\n",
+ "#Part A\n",
+ "v1=R*T/(P*1000);\n",
+ "print'specific volume of refrigerant-134a under the ideal-gas assumption %fm^3/kg'%round(v1,6);\n",
+ "e=(v1-vgiv)/vgiv;\n",
+ "print'an error of %f'%round(e,3);\n",
+ "\n",
+ "#Part B\n",
+ "#determine Z from the compressibility chart, we will calculate the reduced pressure and temperature\n",
+ "Pr=P/Pcr;\n",
+ "Tr=T/Tcr;\n",
+ "#from chart\n",
+ "Z=0.84;\n",
+ "v=Z*v1;\n",
+ "print'specific volume of refrigerant-134a under the generalized compressibility chart %f m^3/kg'%round(v,6);\n",
+ "e=(v-vgiv)/vgiv;\n",
+ "print'an error of %f'%round(e,3);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "specific volume of refrigerant-134a under the ideal-gas assumption 0.026325m^3/kg\n",
+ "an error of 0.208000\n",
+ "specific volume of refrigerant-134a under the generalized compressibility chart 0.022113 m^3/kg\n",
+ "an error of 0.015000\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3-12 ,Page No.143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given values\n",
+ "v=0.51431;\n",
+ "T=600;\n",
+ "\n",
+ "#from Table A-1E\n",
+ "R=0.5956;\n",
+ "Pcr=3200;\n",
+ "Tcr=1164.8;\n",
+ "\n",
+ "#calculation\n",
+ "\n",
+ "#Part A\n",
+ "#from Table A-6E\n",
+ "Pa=1000.0;#in psia\n",
+ "print'from the steam tables %i psia'%Pa;\n",
+ "\n",
+ "#Part B\n",
+ "T=1060;#converted into R from F\n",
+ "Pb=R*T/v;\n",
+ "print'from the ideal-gas equation %i psia'%round(Pb,0);\n",
+ "e=(Pb-Pa)/Pa;\n",
+ "print'treating the steam as an ideal gas would result in an error of %f'%round(e,3)\n",
+ "\n",
+ "#Part C\n",
+ "#calculating the pseudo-reduced specific volume and the reduced temperature\n",
+ "Vr=v/(R*Tcr/Pcr);\n",
+ "Tr=T/Tcr;\n",
+ "#from the compressibility chart\n",
+ "Pr=0.33;\n",
+ "P=Pr*Pcr;\n",
+ "print'from the generalized compressibility chart %i psia'%P\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "from the steam tables 1000 psia\n",
+ "from the ideal-gas equation 1228 psia\n",
+ "treating the steam as an ideal gas would result in an error of 0.228000\n",
+ "from the generalized compressibility chart 1056 psia\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3-13 ,Page No.147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Answer of part c-d are having slight difference due to approximation in molar volumne in the textbook which here is caluculated to the approximation of 7 decimal digits\n",
+ "\n",
+ "from math import exp\n",
+ "\n",
+ "#given values\n",
+ "T=175.0;#temperature in C\n",
+ "v=0.00375;#sp. volumne in m^3/kg\n",
+ "Pex=10000;#experimentaion determination\n",
+ "\n",
+ "#from Table A-1\n",
+ "R=0.2968# in kPa m^3/kg K\n",
+ "\n",
+ "#calculating\n",
+ "\n",
+ "#Part-a\n",
+ "P=R*T/v;\n",
+ "print'using the ideal-gas equation of state %i kPa'%(round(P))\n",
+ "e=(P-Pex)/Pex*100;\n",
+ "print'error is %f percent'%e;\n",
+ "\n",
+ "#Part-b\n",
+ "#van der Waals constants from Eq. 3-23\n",
+ "a=0.175;\n",
+ "b=0.00138;\n",
+ "#from van der waal eq.\n",
+ "P=R*T/(v-b)-a/v**2;\n",
+ "print'using the van der Waals equation of state is %i kPa'%(round(P));\n",
+ "e=(P-Pex)/Pex*100;\n",
+ "print'error is %f percent'%e;\n",
+ "\n",
+ "#Part-c\n",
+ "#constants in the Beattie-Bridgeman equation from Table 3\u20134\n",
+ "A=102.29;\n",
+ "B=0.05378;\n",
+ "c=4.2*10**4;\n",
+ "Ru=8.314;#in kPa m^3/kmol K\n",
+ "M=28.013;#molecular weight in kg/mol\n",
+ "vb=M*v;#molar vol.\n",
+ "P=(Ru*T)/(vb**2)*(1-((c)/(vb*T**3)))*(vb+B)-(A/vb**2);\n",
+ "print'using the Beattie-Bridgeman equationis %i kPa'%(round(P));\n",
+ "e=(P-Pex)/Pex*100;\n",
+ "print'error is %f percent'%e;\n",
+ "\n",
+ "#Part-d\n",
+ "#constants of Benedict-Webb-Rubin equation from Table 3\u20134\n",
+ "a=2.54;\n",
+ "b=0.002328;\n",
+ "c=7.379*10**4;\n",
+ "alp=1.272*10**-4;\n",
+ "Ao=106.73;\n",
+ "Bo=0.040704;\n",
+ "Co=8.164*10**5;\n",
+ "gam=0.0053;\n",
+ "P=((Ru*T)/vb)+((Bo*Ru*T)-Ao-Co/T**2)/vb**2+(b*Ru*T-a)/vb**3+(a*alp/vb**6)+(c/((vb**3)*(T**2)))*(1 + (gam/vb**2))*exp(-gam/vb**2);\n",
+ "print'using Benedict-Webb-Rubin equation %i kPa'%(round(P));\n",
+ "e=(P-Pex)/Pex*100;\n",
+ "print'error is %f percent'%e;\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "using the ideal-gas equation of state 13851 kPa\n",
+ "error is 38.506667 percent\n",
+ "using the van der Waals equation of state is 9471 kPa\n",
+ "error is -5.288326 percent\n",
+ "using the Beattie-Bridgeman equationis 10109 kPa\n",
+ "error is 1.092970 percent\n",
+ "using Benedict-Webb-Rubin equation 10004 kPa\n",
+ "error is 0.039256 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3-14 ,Page No.152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given value\n",
+ "T=25;#air temperature over a lake in C\n",
+ "\n",
+ "#from table 3-1\n",
+ "Psat=3.17;#in kPa\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#Relative Humidity 10%\n",
+ "Pv1=0.1*Psat\n",
+ "#Relative Humidity 80%\n",
+ "Pv2=0.8*Psat\n",
+ "#Relative Humidity 100%\n",
+ "Pv3=1*Psat\n",
+ "\n",
+ "# from table 3-1 Tsat at these Pressures are\n",
+ "T1=-8.0;\n",
+ "T2=21.2;\n",
+ "T3=25.0;\n",
+ "print'with relative humidity 10, temperature is %i in C'%T1\n",
+ "print'with relative humidity 80, temperature is %i in C'%T2\n",
+ "print'with relative humidity 100, temperature is %i in C'%T3\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "with relative humidity 10, temperature is -8 in C\n",
+ "with relative humidity 80, temperature is 21 in C\n",
+ "with relative humidity 100, temperature is 25 in C\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter4.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter4.ipynb new file mode 100755 index 00000000..b9e964f0 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter4.ipynb @@ -0,0 +1,720 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4: Energy Analysis of Closed Systems"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-2 ,Page No.169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Given values\n",
+ "m=10;#mass in lbm\n",
+ "Po=60;#steam oressure in psia\n",
+ "T1=320;#intial temp in F\n",
+ "T2=400;#final temp in F\n",
+ "\n",
+ "#from Table A\u20136E\n",
+ "v1=7.4863;#at 60 psia and 320 F\n",
+ "v2=8.3548;#at 60 psia and 400 F\n",
+ "\n",
+ "#calculations\n",
+ "#W = P dV which on integrating gives W = m * P * (V2 - V1)\n",
+ "W=m*Po*(v2-v1)/5.404;#coverting into Btu from psia-ft^3\n",
+ "print'work done by the steam during this process %f Btu'%round(W,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "work done by the steam during this process 96.400000 Btu\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-3 ,Page No.170"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "#given data\n",
+ "P1=100;#pressure in kPa\n",
+ "V1=0.4;#intial vol in m^3\n",
+ "V2=0.1;#final vol in m^3\n",
+ "\n",
+ "#calculations\n",
+ "#for isothermal W = P1*V1* ln(V2/V1)\n",
+ "W=P1*V1*log(V2/V1);\n",
+ "print'the work done during this process %f kJ'%round(W,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the work done during this process -55.500000 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-4 ,Page No.171"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "V1=0.05;#Volumne of gas in m^3\n",
+ "P1=200;#Pressure in kPa\n",
+ "k=150;#Spring constant in kN/m\n",
+ "A=0.25;#Cross-sectional area in m^2\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#Part - a\n",
+ "V2=2*V1;\n",
+ "x2=(V2-V1)/A;#printlacement of spring\n",
+ "F=k*x2;#compression force\n",
+ "P2=P1+F/A;#additional pressure is equivalent the compression of spring\n",
+ "print'the final pressure inside the cylinder %i kPa'%P2;\n",
+ "\n",
+ "#Part - b\n",
+ "#work done is equivalent to the area of the P-V curve of Fig 4-10\n",
+ "W=(P1+P2)/2*(V2-V1);#area of trapezoid = 1/2 * sum of parallel sides * dist. b/w them\n",
+ "print'the total work done by the gas %i kJ'%W;\n",
+ "\n",
+ "#Part - c\n",
+ "x1=0;#intial compression of spring\n",
+ "Wsp=0.5*k*(x2**2-x1**2);\n",
+ "print'the fraction of this work done against the spring to compress it %i kJ'%Wsp\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final pressure inside the cylinder 320 kPa\n",
+ "the total work done by the gas 13 kJ\n",
+ "the fraction of this work done against the spring to compress it 3 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-5 ,Page No.174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given values\n",
+ "m=0.025;#mass of saturated water vapor in kg\n",
+ "V=120;#rated voltage of heater in V\n",
+ "I=0.2;#rated current in A\n",
+ "t=300;#total time taken in sec\n",
+ "P1=300;#constant pressure in kPa\n",
+ "Qout=3.7;#heat lost in kJ\n",
+ "\n",
+ "#from Table A\u20135\n",
+ "#at P1 the conditon is sat. vap\n",
+ "h1=2724.9;\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "#Part - a\n",
+ "#therotical proving\n",
+ "\n",
+ "#Part - b\n",
+ "We=V*I*t/1000;#electrical work in kJ\n",
+ "#from eqn 4 -18 i.e derived in earler part\n",
+ "#it states it Ein - Eout = Esystem\n",
+ "# it applies as Win - Qout = H = m (h2 - h1)\n",
+ "h2=(We-Qout)/m+h1;\n",
+ "##from Table A\u20135\n",
+ "#at h2 we get\n",
+ "P2=300;\n",
+ "T=200;\n",
+ "print'the final temperature of the steam %i C'%T\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final temperature of the steam 200 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-6 ,Page No.176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "m=5.0;#mass of water in kg\n",
+ "P1=200;#pressure on one side in kPa\n",
+ "T=25;#temperature in C\n",
+ "\n",
+ "#from Table A\u20134\n",
+ "#the liq. is in compressed state at 200 kPa and 25 C\n",
+ "vf=0.001;\n",
+ "vg=43.340;\n",
+ "uf=104.83;\n",
+ "ufg=2304.3;\n",
+ "v1=vf;\n",
+ "u1=uf;\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#Part - a\n",
+ "V1=m*v1;\n",
+ "Vtank=2*V1;\n",
+ "print'the volume of the tank %f m^3'%round(Vtank,2);\n",
+ "\n",
+ "#Part - b\n",
+ "V2=Vtank;\n",
+ "v2=V2/m;\n",
+ "#from Table A\u20134 \n",
+ "# at T=25 vf=0.101003 m^3/kg and vg=43.340 m^3/kg\n",
+ "# vf<v2<vg therefore it is saturated liquid\u2013vapor mixture\n",
+ "P2=3.1698;\n",
+ "print'the final pressure %f kPa'%round(P2,4);\n",
+ "\n",
+ "#Part - c\n",
+ "#Ein - Eout = Esystem\n",
+ "#Qin= dU = m(u2 - u1)\n",
+ "x2=(v2-vf)/(vg-vf);\n",
+ "u2=uf+x2*ufg;\n",
+ "Qin=m*(u2-u1);\n",
+ "print'the heat transfer for this process %f kJ'%Qin\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the volume of the tank 0.010000 m^3\n",
+ "the final pressure 3.169800 kPa\n",
+ "the heat transfer for this process 0.265846 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-7 ,Page No.183"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from scipy.integrate import quad \n",
+ "from pylab import *\n",
+ "\n",
+ "#given data\n",
+ "T1=300;#intial temp of air in K\n",
+ "P=200;#pressure in kPa\n",
+ "T2=600;#final temp in K\n",
+ "M=28.97;#molecular weight in kg/kmol\n",
+ "Ru=8.314;\n",
+ "\n",
+ "#Part - a\n",
+ "#from Table A\u201317\n",
+ "u1=214.07;\n",
+ "u2=434.78;\n",
+ "du=u2-u1;#change in internal energy\n",
+ "print'change in internal energy from data from the air table %f kJ/kg'%round(du,2);\n",
+ "\n",
+ "#Part - b\n",
+ "#from Table A\u20132c\n",
+ "a=28.11;\n",
+ "b=0.1967*10**-2;\n",
+ "c=0.4802*10**-5;\n",
+ "d=-1.966*10**-9;\n",
+ "# by equation Cp(T)=a+bT+cT^2+dT^3\n",
+ "def intgrnd1(T): \n",
+ " return ((a-Ru)+b*T+c*T**2+d*T**3)\n",
+ "dU, err = quad(intgrnd1, T1, T2) \n",
+ "du=dU/M;\n",
+ "print'change in internal energy the functional form of the specific heat %f kJ/kg'%round(du,1); \n",
+ "\n",
+ "#Part - c\n",
+ "#from Table A\u20132b\n",
+ "Cavg=0.733;\n",
+ "du=Cavg*(T2-T1);\n",
+ "print'change in internal energy the functional form the average specific heat value %i kJ/kg'%round(du,0);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "change in internal energy from data from the air table 220.710000 kJ/kg\n",
+ "change in internal energy the functional form of the specific heat 222.500000 kJ/kg\n",
+ "change in internal energy the functional form the average specific heat value 220 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-8 ,Page No.184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "m=1.5;#mass in lbm\n",
+ "T1=80;#temperature in F\n",
+ "P1=50;#pressure in psia\n",
+ "W=0.02;#power rating in hp\n",
+ "t=30.0/60;#converting into hrs from min\n",
+ "\n",
+ "#from Table A\u20132Ea\n",
+ "Cv=0.753;\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#part a\n",
+ "Wsh=W*t*2545;#in Btu\n",
+ "#Ein - Eout = Esystem\n",
+ "#Wsh = dU = m (u2 - u1) = m * Cv * (T2 - T1)\n",
+ "T2= Wsh/(m*Cv)+T1;\n",
+ "print'the final temperature %f F'%round(T2,1);\n",
+ "\n",
+ "#part b\n",
+ "#using ideal gas eqn\n",
+ "# P1 * V1 / T1 = P2 * T2 /V2\n",
+ "P2= 50 * (T2 +460)/ (T1+460);\n",
+ "# temp should in R therefore + 460\n",
+ "print'the final pressure %f psia'%round(P2,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final temperature 102.500000 F\n",
+ "the final pressure 52.100000 psia\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-9 ,Page No.185"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "V1=0.5;#volumne of nitrogen gas in m^3\n",
+ "P=400;#pressure in kPa\n",
+ "T1=27;#temp in C\n",
+ "I=2;#rated current in A\n",
+ "t=5*60;#converting into s from min\n",
+ "V=120;#rated voltage in V\n",
+ "Qout=2800/1000;#in kJ\n",
+ "R=0.297;\n",
+ "\n",
+ "#from Table A\u20132a\n",
+ "Cp=1.039;\n",
+ " \n",
+ "#calculations\n",
+ "P1=P;\n",
+ "We=V*I*t/1000;#in kJ\n",
+ "m=P1*V1/(R*(T1+273));\n",
+ "#Ein - Eout = Esystem\n",
+ "# We,in - Qout = dH = m (h2 - h1) = m * Cp * (T2 - T1)\n",
+ "T2=(We-Qout)/(m*Cp)+T1;\n",
+ "print'the final temperature of nitrogen in %i C'%T2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final temperature of nitrogen in 57 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-10 ,Page No.187"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=150;#initially air pressure in kPa\n",
+ "P2=350;#final pressure in kPa\n",
+ "T1=27+273;#temperatuere in K\n",
+ "V1=400.0/1000;#volumne in m^3\n",
+ "R=0.287;\n",
+ "\n",
+ "#from Table A\u201317\n",
+ "u1=214.07;\n",
+ "u2=1113.52;\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#part a\n",
+ "V2=2*V1;\n",
+ "#using ideal gas eqn\n",
+ "# P1 * V1 / T1 = P2 * T2 /V2\n",
+ "T2=P2*V2*T1/(P1*V1);\n",
+ "print'the final temperature %i K'%T2;\n",
+ "\n",
+ "#part b\n",
+ "# Work done is Pdv\n",
+ "W=P2*(V2-V1);\n",
+ "print'the work done by the air %i kJ'%W;\n",
+ "\n",
+ "#part c\n",
+ "#Ein - Eout = Esystem\n",
+ "#Qin - Wout = dU = m(u2 - u1)\n",
+ "m= P1* V1 /(T1 * R);\n",
+ "Q= m*(u2 - u1)+ W;\n",
+ "print'the total heat transferred to the air %i kJ'%round(Q)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final temperature 1400 K\n",
+ "the work done by the air 140 kJ\n",
+ "the total heat transferred to the air 767 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-11 ,Page No.190"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T=100;#twmperature of liquid water in C\n",
+ "P=15;#pressure in MPa\n",
+ "\n",
+ "#from Table A\u20137\n",
+ "#at P=15 mPa and T = 100 C\n",
+ "hg=430.39;\n",
+ "hf=419.17\n",
+ "vf=0.001;\n",
+ "Psat=101.42;#in kPa\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#part a\n",
+ "h=hg;\n",
+ "print'enthalpy of liquid water by using compressed liquid tables %f kJ/kg'%round(h,2);\n",
+ "\n",
+ "#part b\n",
+ "#Approximating the compressed liquid as a saturated liquid at 100\u00b0C\n",
+ "h=hf;\n",
+ "print'enthalpy of liquid water by approximating it as a saturated liquid %f kJ/kg'%round(h,2);\n",
+ "\n",
+ "#part c\n",
+ "h=hf + vf*(P*1000 - Psat );\n",
+ "print'enthalpy of liquid water by using the correction given by Eq. 4\u201338 %f kJ/kg'%round(h,2);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "enthalpy of liquid water by using compressed liquid tables 430.390000 kJ/kg\n",
+ "enthalpy of liquid water by approximating it as a saturated liquid 419.170000 kJ/kg\n",
+ "enthalpy of liquid water by using the correction given by Eq. 4\u201338 434.070000 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-12 ,Page No.191"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#suffix i for iron\n",
+ "#suffix w for water\n",
+ "#given data\n",
+ "mi=50;#mass in Kg\n",
+ "T1i=80;#temperature in C \n",
+ "Vw=0.5;#volumne in m^3\n",
+ "T1w=25;#temperature in C \n",
+ "v=0.001;#specific volume of liquid water at or about room temperature\n",
+ "\n",
+ "#from Table A\u20133\n",
+ "ci=0.45;\n",
+ "cw=4.18;\n",
+ "\n",
+ "#calculations\n",
+ "mw=Vw/v;\n",
+ "#Ein - Eout = Esystem\n",
+ "# du = 0 i.e (mcdT)iron + (mcdT)water = 0\n",
+ "# mi * ci * (T - T1i) + mw *cw * (T-T1w)\n",
+ "#on rearranging above equn\n",
+ "T= (mi*ci*T1i + mw*cw*T1w)/(mi*ci+mw*cw);\n",
+ "print'the temperature when thermal equilibrium is reached %f C'%round(T,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the temperature when thermal equilibrium is reached 25.600000 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-13 ,Page No.191"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import sqrt\n",
+ "\n",
+ "#given data\n",
+ "maf=0.15;#mass of affected tissue in kg\n",
+ "caf=3.8;#specific heat of the tissue in kJ/Kg C\n",
+ "dTaf=1.8;#suffix af for affected tissue\n",
+ "mh=1.2;#suffix h for hand ; mass of hand in kg\n",
+ "\n",
+ "#calculations\n",
+ "#Ein - Eout = Esystem\n",
+ "#dUaffected tissue - KEhand = 0\n",
+ "#from above equation we can deduce that\n",
+ "Vhand= sqrt(2*maf*caf*dTaf*1000/mh);#for conversion factor mutiplying by 1000 to get m^2/s^2\n",
+ "print'the velocity of the hand just before impact %f m/s'%round(Vhand,1);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the velocity of the hand just before impact 41.400000 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-14 ,Page No.199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "m=90;#mass of man in kg\n",
+ "\n",
+ "#from Tables 4\u20131 and 4\u20132\n",
+ "Ehb=275;#hamburger\n",
+ "Ef=250;#fries\n",
+ "Ec=87;#cola\n",
+ "\n",
+ "#calculation\n",
+ "\n",
+ "#part a\n",
+ "Ein=2*Ehb+Ef+Ec;\n",
+ "#The rate of energy output for a 68-kg man watching TV is to be 72 Calories/h\n",
+ "Eout=m*72.0/68;\n",
+ "t=Ein/Eout;\n",
+ "print'by watching TV %f hours'%round(t,1);\n",
+ "\n",
+ "#part b\n",
+ "#The rate of energy output for a 68-kg man watching TV is to be 860 Calories/h\n",
+ "Eout=m*860.0/68;\n",
+ "t=Ein/Eout*60#converting in min\n",
+ "t=ceil(t);\n",
+ "print'by fast swimming %f mins'%t;\n",
+ "\n",
+ "#for last question\n",
+ "print('answers be for a 45-kg man energy takes twice as long in each case');\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "by watching TV 9.300000 hours\n",
+ "by fast swimming 47.000000 mins\n",
+ "answers be for a 45-kg man energy takes twice as long in each case\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4-15 ,Page No.199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "E=75;#in Cal/day\n",
+ "\n",
+ "#calculation\n",
+ "Ereduced=E*365.0;\n",
+ "#The metabolizable energy content of 1 kg of body fat is 33,100 kJ\n",
+ "Ec=33100.0;\n",
+ "mfat=Ereduced/Ec*4.1868;\n",
+ "print'weight this person will lose in one year %f kg'%round(mfat,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "weight this person will lose in one year 3.460000 kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter5.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter5.ipynb new file mode 100755 index 00000000..da9be875 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter5.ipynb @@ -0,0 +1,614 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: Mass and Energy Analysis of Control Volumes"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-1 ,Page No.224"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#given data\n",
+ "V=10.0;#volumne of bucket in galon\n",
+ "t=50;#time taken to fill the bucket in sec\n",
+ "p=1;#density of water in kg/L\n",
+ "re=0.8/2/100;#radius of nozzle exit in m\n",
+ "\n",
+ "#calculations\n",
+ "Vd=V/t*3.7854;#factor 0f 3.7854 for gal to L\n",
+ "print'volumne flow rate through hose %f L/s'%round(Vd,3);\n",
+ "m=p*Vd;\n",
+ "print'mass flow rate through hose %f kg/s'%round(m,3);\n",
+ "Ae=math.pi*re**2;\n",
+ "Ve=Vd/Ae/1000;#factor of 1000 for L to m^3\n",
+ "print'average velocity at the nozzle %f m/s'%round(Ve,1);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "volumne flow rate through hose 0.757000 L/s\n",
+ "mass flow rate through hose 0.757000 kg/s\n",
+ "average velocity at the nozzle 15.100000 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-2 ,Page No.225"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from scipy.integrate import quad \n",
+ "from pylab import *\n",
+ "\n",
+ "#given data\n",
+ "Dtank=3*12;#diameter of tank in inches\n",
+ "Djet=0.5;#diameter of water jet in inches\n",
+ "h0=2;#bottom reference in ft\n",
+ "h1=4;#height of water tank in ft\n",
+ "\n",
+ "#constants used \n",
+ "g=32.2;#in ft/s^2\n",
+ "\n",
+ "#calculations\n",
+ "#min - mout = dmCV/dt\n",
+ "#mout = p*(2*g*h*Ajet)^2\n",
+ "#mCV = p*Atank*h\n",
+ "#from these we get dt = Dtank^2/Djet^2 * (dh/(2*g*h)^2)\n",
+ "def intgrnd1(h): \n",
+ " return (Dtank**2/Djet**2*(1/sqrt(2*g*h)))\n",
+ "t, err = quad(intgrnd1, h0, h1) \n",
+ "t=(t/60);#in min\n",
+ "print'time taken to drop to 2 ft %f min'%round(t,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "time taken to drop to 2 ft 12.600000 min\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-3 ,Page No.229"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P=150;#operating pressure in kPa\n",
+ "Vliquid=0.6/1000.0;#amount of liquid in the cooker in m^3\n",
+ "t=40.0*60;#period of operation in sec\n",
+ "Ac=8*10**-6;#exit area of opening in m^2\n",
+ "\n",
+ "#from Table A-5\n",
+ "#from P = 150 kPa\n",
+ "h=2693.1;\n",
+ "ug=2519.2;\n",
+ "vf=0.001053;\n",
+ "vg=1.1594;\n",
+ "\n",
+ "#calculations\n",
+ "m=Vliquid/vf;\n",
+ "md=m/t;\n",
+ "print'mass flow rate %f kg/s'%md;\n",
+ "V=md*vg/(Ac);\n",
+ "print'exit velocity %f m/s'%round(V,1);\n",
+ "Eflow=h-ug;\n",
+ "Et=h;\n",
+ "print'flow energy %f kJ/kg'%round(Eflow,1);\n",
+ "print'total energy %f kJ/kg'%round(Et,1);\n",
+ "Emass=md*Et;\n",
+ "print'rate at which energy leaves the cooker %f kW'%round(Emass,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "mass flow rate 0.000237 kg/s\n",
+ "exit velocity 34.400000 m/s\n",
+ "flow energy 173.900000 kJ/kg\n",
+ "total energy 2693.100000 kJ/kg\n",
+ "rate at which energy leaves the cooker 0.639000 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-4 ,Page No.234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T1=283;#temperature of air in K\n",
+ "P1=80;#entering pressure in kPa\n",
+ "V1=200;#velocity ar inlet in m/s\n",
+ "A1=0.4;#inlet area in m^2\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kPa-m^3/kg-K\n",
+ "\n",
+ "#calulations\n",
+ "v1=R*T1/P1;\n",
+ "m=V1*A1/v1;\n",
+ "print'mass flow rate of air %f kg/s'%round(m,1);\n",
+ "# Ein - Eout = dEsystem / dt\n",
+ "#from Table A-17\n",
+ "h1=283.14;\n",
+ "V2=0;\n",
+ "h2=h1-(V2^2 - V1^2)/2/1000;#factor of 1000 to convert to kJ/kg\n",
+ "#from Table A-17 at this value of h2\n",
+ "T2=303;\n",
+ "print'the temperature %i K is'%T2;\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "mass flow rate of air 78.800000 kg/s\n",
+ "the temperature 303 K is\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-5 ,Page No.235"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=250;#inlet pressure in psia\n",
+ "T1=700;#inlet temp in F\n",
+ "A1=0.2;#inlet area in ft^2\n",
+ "qout=1.2;#heat losses in Btu/lbm\n",
+ "m=10;#mass flow rate in lbm/sec\n",
+ "P2=200;#nozzle pressure in kPa\n",
+ "V2=900;#nozzle velocity in m/s\n",
+ "\n",
+ "#from Table A-6E\n",
+ "v1=2.6883;\n",
+ "h1=1371.4;\n",
+ "\n",
+ "#calculations\n",
+ "V1=m*v1/A1;\n",
+ "print'the inlet velocit %f f/s'%round(V1,1);\n",
+ "# Ein - Eout = dEsystem / dt\n",
+ "h2=h1-qout-(V2**2 - V1**2)/2/25037;#factor of 25037 to convert to Btu/lbm\n",
+ "#at this value h2, from Tablw A-6E\n",
+ "T2=662;\n",
+ "print'exit temperature %i F'%T2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the inlet velocit 134.400000 f/s\n",
+ "exit temperature 662 F\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-6 ,Page No.236"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T1=280;#intial pressure in kPa\n",
+ "P1=100;#intial temp in K\n",
+ "m=0.02;#mass flow rate in kg/s\n",
+ "qout=16;#heat losses in kJ/kg\n",
+ "P2=600;#final pressure in kPa\n",
+ "T2=400;#final temp in K\n",
+ "\n",
+ "#from Table A-17\n",
+ "h1=280.13;\n",
+ "h2=400.98;\n",
+ "\n",
+ "#calculations\n",
+ "# Ein - Eout = dEsystem / dt\n",
+ "Win=m*qout+m*(h2-h1);\n",
+ "print'the input power of compressor %f kW'%round(Win,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the input power of compressor 2.740000 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-7 ,Page No.237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=2;#inlet pressure in MPa\n",
+ "T1=400;#inlet temp in K\n",
+ "V1=50.0;#inlet velocity in m/s\n",
+ "z1=10;#inlet height in m\n",
+ "P2=15;#final pressure in MPa\n",
+ "x2=0.9;#final dryness fraction\n",
+ "V2=180.0;#final velocity in m/s\n",
+ "z2=6;#final height in m\n",
+ "Wout=5*1000;#power output in kW\n",
+ "\n",
+ "#from Table A-6\n",
+ "h1=3248.4;\n",
+ "#similarly for P2\n",
+ "hf=225.94;\n",
+ "hfg=2372.3;\n",
+ "\n",
+ "#constants used \n",
+ "g=9.8;#in m/s^2\n",
+ "\n",
+ "#calcualtions\n",
+ "h2=hf+x2*hfg;\n",
+ "print'difference in enthalpies %f kJ/kg'%round((h2-h1),2);\n",
+ "print'difference in kinetic energy %f kJ/kg'%round((V2**2-V1**2)/2/1000,2);#factor of 1000 to convert to kJ/kg\n",
+ "print'difference in potential energy %f kJ/kg'%round(g*(z2-z1)/1000,2);#factor of 1000 to convert to kJ/kg\n",
+ "wout=-((h2-h1)+(V2**2-V1**2)/2/1000+g*(z2-z1)/1000);#factor of 1000 to convert to kJ/kg\n",
+ "print'work done per unit of mass %f kJ/kg'%round(wout,2);\n",
+ "m=Wout/wout;\n",
+ "print'mass flow rate %f kg/s'%round(m,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "difference in enthalpies -887.390000 kJ/kg\n",
+ "difference in kinetic energy 14.950000 kJ/kg\n",
+ "difference in potential energy -0.040000 kJ/kg\n",
+ "work done per unit of mass 872.480000 kJ/kg\n",
+ "mass flow rate 5.730000 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-8 ,Page No.239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=0.8;#entering pressure in MPa\n",
+ "P2=0.12;#throttled pressure in MPa\n",
+ "\n",
+ "#from Table A-12\n",
+ "#sat. liq at P1\n",
+ "T1=31.31;\n",
+ "h1=95.47;\n",
+ "#since process is insentropic and at P2\n",
+ "h2=h1;\n",
+ "hf=22.49;\n",
+ "hg=236.97;\n",
+ "T2=-22.32;\n",
+ "\n",
+ "#calculations\n",
+ "x2=(h2-hf)/(hg-hf);\n",
+ "print'the final state is %f'%round(x2,3);\n",
+ "dT=T2-T1;\n",
+ "print'temperature drop %f C'%round(dT,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final state is 0.340000\n",
+ "temperature drop -53.630000 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-9 ,Page No.241"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T1=140;#inlet temp of hot water in F\n",
+ "T2=50;#inlet temp of cold water in F\n",
+ "T3=110;#steady state output temp in F\n",
+ "P=20;#operating pressure in psia\n",
+ "\n",
+ "#for a compressed liq at given temp\n",
+ "h1=107.99;\n",
+ "h2=18.07;\n",
+ "h3=78.02;\n",
+ "\n",
+ "#calculations\n",
+ "#Mass balance min = mout So, m1+m2 = m3\n",
+ "#Energy balance Ein = Eout So, m1*h1 + m2*h2 = m3*h3\n",
+ "#combining realations\n",
+ "#m1*h1 + m2*h2 = (m1+m2)*h3\n",
+ "#dividing by m2 and y=m1/m2\n",
+ "#we get, yh1 + h2 = (y+1)*h3\n",
+ "y=(h3-h2)/(h1-h3);\n",
+ "print'the ratio of mass flow rates %f'%round(y,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the ratio of mass flow rates 2.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-10 ,Page No.242"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T1=15;#water inlet temp in C\n",
+ "P1=300;#water inlet pressure in kPa\n",
+ "T2=25;#water outlet temp in C\n",
+ "T3=70;#R-134a inlet temp in C\n",
+ "P3=1000;#R-134a inlet pressure in kPa\n",
+ "T4=35;#R-134a outlet temp in C\n",
+ "mr=6;#mass flow rate in kg/min\n",
+ "\n",
+ "#from Table A-4, A-13 and A-11\n",
+ "h1=62.982;\n",
+ "h2=104.83;\n",
+ "h3=303.85;\n",
+ "h4=100.87;\n",
+ "\n",
+ "#calculations\n",
+ "#mass balance m1=m2=mw and m3=m4=mr\n",
+ "#energy balance m1*h1 + m3*h3 = m2*h2 + m4*h4\n",
+ "#combining them mw*(h1-h2) = mr*(h4-h3)\n",
+ "mw= mr*(h4-h3)/(h1-h2);\n",
+ "print'mass flow rate of cooling water %f kg/min'%round(mw,1);\n",
+ "Qin=mw*(h2-h1);\n",
+ "print'heat transfer rate %i kJ/min'%round(Qin)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "mass flow rate of cooling water 29.100000 kg/min\n",
+ "heat transfer rate 1218 kJ/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-11 ,Page No.245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T1=17+273;#inlet temp in K\n",
+ "P1=100;#inlet pressure in kPa\n",
+ "V1=150;#inlet volumetric rate in m^3/min\n",
+ "Win=15;#rated power in kW\n",
+ "Qout=200/1000;#heat lost in kJ/s\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kPa-m^3/kg-K\n",
+ "cp=1.005;#in kJ/kg C\n",
+ "\n",
+ "#calculations\n",
+ "v1=R*T1/P1;\n",
+ "m=V1/v1/60;#factor of 6 to convert to s\n",
+ "# Win - Qout = m*cp*(T2-T1)\n",
+ "T2= T1 + (Win - Qout)/(m*cp);\n",
+ "print'exit temperature %f C'%round((T2-273),2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "exit temperature 21.970000 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5-13 ,Page No.250"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "V=6.0/1000;#volumne of cooker in m^3\n",
+ "Pgage=75;#operating pressure in kPa\n",
+ "Patm=100;#atmospheric pressure in kPa\n",
+ "m1=1;#mass of water in kg\n",
+ "Qind=0.5;#heat supplying rate in kJ/sec ; d stands for .\n",
+ "t=30*60;#operating time in s\n",
+ "\n",
+ "#calculation\n",
+ "Pabs=Pgage+Patm;\n",
+ "#from Table A-5, ths saturation temp \n",
+ "T=116.04;\n",
+ "print'the temperature at which cooking takes place %f C'%T;\n",
+ "#mass balance me=(m1-m2)cv\n",
+ "#energy balance Qin - mehe = (m2u2 - m1u1)cv\n",
+ "Qin=Qind*t;\n",
+ "#from Table A-5\n",
+ "he=2700.2;\n",
+ "vf=0.001;\n",
+ "vg=1.004;\n",
+ "uf=486.82;\n",
+ "ufg=2037.7;\n",
+ "v1=V/m1;\n",
+ "x1=(v1-vf)/(vg-vf);\n",
+ "u1=uf+x1*ufg;\n",
+ "U=m1*u1;\n",
+ "#Qin = (m1 - V/v2)*he + (V/v2*u2 - m1*u1)\n",
+ "#v2=vf + x2*(vg-vf)\n",
+ "#u2=uf + x2*ufg\n",
+ "#combining these equations we get\n",
+ "#solved using EES\n",
+ "x2=0.009;\n",
+ "v2=vf + x2*(vg-vf);\n",
+ "m2=V/v2;\n",
+ "print'amount of water left %f kg'%round(m2,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the temperature at which cooking takes place 116.040000 C\n",
+ "amount of water left 0.600000 kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter6.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter6.ipynb new file mode 100755 index 00000000..0cebc0e1 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter6.ipynb @@ -0,0 +1,315 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6: The Second Law of Thermodynamics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6-1 ,Page No.286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "QH=80.0;#rate of heat transfer in MW\n",
+ "QL=50.0;#rate of waste heat rejection in MW\n",
+ "\n",
+ "#calculations\n",
+ "Wnet=QH-QL;\n",
+ "print'net power output %i MW'%Wnet\n",
+ "nth=Wnet/QH;\n",
+ "print'the thermal efficiency is %f '%round(nth,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "net power output 30 MW\n",
+ "the thermal efficiency is 0.375000 \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6-2 ,Page No.286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "Wnet=65;#power output in hp\n",
+ "nth=0.24;#effficiency of car\n",
+ "HV=19000;#heating value in Btu/lbm\n",
+ "\n",
+ "#calculations\n",
+ "QH=Wnet/nth*2545;#factor of 2545 to convert to Btu/h\n",
+ "m=QH/HV;\n",
+ "print'the engine must burn at fuel rate %f lbm/h'%round(m,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the engine must burn at fuel rate 36.300000 lbm/h\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6-3 ,Page No.291"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "Wnet=2.0;#power input in kW\n",
+ "QL=360.0;#rate of heat rejection in kJ/min\n",
+ "\n",
+ "#calculations\n",
+ "COPR=QL/Wnet/60;#factor of 60 to convert kW to kJ/min\n",
+ "print'coefficient of performance of refrigerator is %i'%COPR;\n",
+ "QH=QL+Wnet*60;#factor of 60 to convert kW to kJ/min\n",
+ "print'heat rejection rate %i kJ/min'%QH\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "coefficient of performance of refrigerator is 3\n",
+ "heat rejection rate 480 kJ/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6-4 ,Page No.291"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "COP=2.5;#COP in the given conditions of heat pump\n",
+ "QH=80000.0;#heat loss rate in kJ/hr\n",
+ "\n",
+ "#calculations\n",
+ "Wnet=QH/COP;\n",
+ "print'the power consumed %i kJ/h'%Wnet\n",
+ "QL=QH-Wnet;\n",
+ "print'the rate at which heat is absorbed %i kJ/h'%QL\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the power consumed 32000 kJ/h\n",
+ "the rate at which heat is absorbed 48000 kJ/h\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6-5 ,Page No.306"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "QH=500.0;#heat recieved per cycle in kJ\n",
+ "TL=30+273.0;#low temperature source in C\n",
+ "TH=652+273.0;#high temperature source in C\n",
+ "\n",
+ "#calculations\n",
+ "nth=1-TL/TH;\n",
+ "print'the thermal efficiency of carnot engine is %f'%round(nth,3);\n",
+ "QL=TL*QH/TH;\n",
+ "print'the amount of heat rejected to the sink per cycle %i kJ'%round(QL)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the thermal efficiency of carnot engine is 0.672000\n",
+ "the amount of heat rejected to the sink per cycle 164 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6-6 ,Page No.310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "COP=13.5;#COP of refrigerator\n",
+ "TH=75+460.0;#room temperature in R\n",
+ "TL=35+460.0;#refrigerated temp in R\n",
+ "\n",
+ "#calculations\n",
+ "COPR=1/(TH/TL-1);\n",
+ "if COPR>=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 <vg\n",
+ "x2=(v2-vf)/(vg-vf);\n",
+ "s2=sf+x2*sfg;\n",
+ "dS=m*(s2-s1);\n",
+ "print'entropy change in the process %f kJ/k'%round(dS,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "entropy change in the process -1.175000 kJ/k\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-4 ,Page No.342"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "m=3;#mass of water in lbm\n",
+ "P1=20;#pressure in psia\n",
+ "T1=70+460;#temperature in R\n",
+ "Qin=3450;#heat added in Btu\n",
+ "\n",
+ "#from Table A-6E\n",
+ "#at P1 and T1\n",
+ "s1=0.07459;\n",
+ "h1=38.08;\n",
+ "\n",
+ "#calculations\n",
+ "#Ein - Eout = dEsystem\n",
+ "#Qin = m*(h2 - h1)\n",
+ "h2=Qin/m+h1;\n",
+ "#from Table A-6E\n",
+ "#At P2 and h2\n",
+ "s2=1.7761;\n",
+ "dS=m*(s2-s1);\n",
+ "print'entropy change %f Btu/R'%round(dS,3);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "entropy change 5.105000 Btu/R\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-5 ,Page No.343"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=5.0;#entry pressure in MPa\n",
+ "T1=450.0;#entry temperature in C\n",
+ "P2=1.4;#pressure at exit MPa\n",
+ "\n",
+ "#calculations\n",
+ "#Ein - Eout = dEsystem/dt\n",
+ "#Ein = Eout\n",
+ "#Wout = m*(h1-h2)\n",
+ "#At P1 and T1\n",
+ "h1=3317.2;\n",
+ "s1=6.8210;\n",
+ "s2=s1;\n",
+ "#At P2 and s2\n",
+ "h2=2967.4;\n",
+ "Wout=h1-h2;\n",
+ "print'work output per unit mass %f kJ/kg'%round(Wout,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "work output per unit mass 349.800000 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-7 ,Page No.352"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "#given values\n",
+ "P1=1;#pressure at state 1 in kPa\n",
+ "T1=110.0;#temperature at state 1 in K\n",
+ "P2=5;#pressure at state 2 in kPa\n",
+ "T2=120.0;#temperature at state 2 in K\n",
+ "\n",
+ "#from Table \n",
+ "#At P1 and T1\n",
+ "s1=4.875;\n",
+ "cp1=3.471;\n",
+ "#at P2 and T2\n",
+ "s2=5.145;\n",
+ "cp2=3.486;\n",
+ "\n",
+ "#calculations\n",
+ "#part - a\n",
+ "dSa=s2-s1;\n",
+ "print'change in entropy %f kJ/kg K using tabulated properties'%round(dSa,3);\n",
+ "#part - b\n",
+ "cavg=(cp1+cp2)/2.0;\n",
+ "dSb=cavg*log(T2/T1);\n",
+ "print'change in entropy %f kJ/kg K approximating liquid methane as an incompressible substance'%round(dSb,3);\n",
+ "E=(dSb-dSa)/dSa;\n",
+ "print'Error is %f'%round(E,4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "change in entropy 0.270000 kJ/kg K using tabulated properties\n",
+ "change in entropy 0.303000 kJ/kg K approximating liquid methane as an incompressible substance\n",
+ "Error is 0.121000\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-8 ,Page No.353"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Annual power savings has a 0.005% error due to approximation in textbook\n",
+ "\n",
+ "#given data\n",
+ "P1=5;#pressure at state 1 in MPa\n",
+ "V1=0.280;#volimetric flow rate in m^3/s\n",
+ "T1=115;#temperature at state 1 in K\n",
+ "P2=1;#pressure at state 2 in MPa\n",
+ "dt=8760;#time in h/yr\n",
+ "UC=0.075;#unit cost in $\n",
+ "\n",
+ "#from Table\n",
+ "#at P1 and T1\n",
+ "h1=232.3;\n",
+ "s1=4.9945;\n",
+ "p1=422.15;\n",
+ "s2=s1;\n",
+ "#at P2 and s2\n",
+ "h2=222.8;\n",
+ "\n",
+ "#calculations\n",
+ "m=p1*V1;\n",
+ "#Ein - Eout = dEsystem/dt\n",
+ "#Ein = Eout\n",
+ "#Wout = m*(h1-h2)\n",
+ "Wout = m*(h1-h2);\n",
+ "print'maximum amount of power that can be produced %i kW'%round(Wout)\n",
+ "APP=Wout*dt;#annual power production\n",
+ "APS=APP*UC;#annual power savings\n",
+ "print'Annual power savings $%i/yr'%round(APS)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum amount of power that can be produced 1123 kW\n",
+ "Annual power savings $737758/yr\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-9 ,Page No.357"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "\n",
+ "#given data\n",
+ "P1=100.0;#inlet pressure in kPa\n",
+ "T1=290.0;#inlet temperature in K\n",
+ "P2=600.0;#outlet temperature in kPa\n",
+ "T2=330.0;#outlet temperature in K\n",
+ "\n",
+ "#from Table A-17\n",
+ "s02=1.79783;\n",
+ "s01=1.66802;\n",
+ "#Table A-2b\n",
+ "cpavg=1.006;\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kJ/kg -K\n",
+ "\n",
+ "#calculations\n",
+ "#part-a\n",
+ "s21=s02-s01-R*log(P2/P1);#stands for s2 - s1\n",
+ "print'entropy change using property values from air table %f kJ/kg-K'%round(s21,4);\n",
+ "s21=cpavg*log(T2/T1)-R*log(P2/P1);#stands for s2 - s1\n",
+ "print'entropy change using average specific heat %f kJ/kg-K'%round(s21,4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "entropy change using property values from air table -0.384400 kJ/kg-K\n",
+ "entropy change using average specific heat -0.384200 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-10 ,Page No.360"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=95;#intial pressure in kPa\n",
+ "T1=295;#intial temperature in K\n",
+ "r=8;#ratio of V1/V2\n",
+ "\n",
+ "#calculations\n",
+ "#for closed systems V2/V1 = v2/v1\n",
+ "#At T1\n",
+ "vr1=647.9;\n",
+ "vr2=vr1/r;\n",
+ "#at vr2\n",
+ "T2=662.7;\n",
+ "print'the final temperature %f K'%T2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final temperature 662.700000 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-11 ,Page No.361"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=14.0;#intial pressure in psia\n",
+ "T1=50+460.0;#intial temperature in R\n",
+ "T2=320+460.0;#final temperature in R\n",
+ "\n",
+ "#constants used\n",
+ "k=1.667;\n",
+ "\n",
+ "#calculations\n",
+ "P2=P1*(T2/T1)**(k/(k-1));\n",
+ "print'exit pressure %f psia'%round(P2,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "exit pressure 40.500000 psia\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-12 ,Page No.364"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P2=1000;#final pressure in MPa\n",
+ "P1=100;#intial pressure in MPa\n",
+ "\n",
+ "#from Table A-5\n",
+ "#At P2\n",
+ "v1=0.001043;\n",
+ "\n",
+ "#calculations\n",
+ "Wrev=v1*(P2-P1);\n",
+ "print'compressor work as saturated liquid at inlet %f kJ/kg'%round(Wrev,2)\n",
+ "#from Table A-5\n",
+ "#at P1 as sat. vapour\n",
+ "h1=2675.0;\n",
+ "s1=7.3589;\n",
+ "s2=s1\n",
+ "#from Table A-6\n",
+ "#at P2 and s2\n",
+ "h2=3194.5;\n",
+ "Wrev=h2-h1;\n",
+ "print'compressor work as saturated vapor at inlet %f kJ/kg'%round(Wrev,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "compressor work as saturated liquid at inlet 0.940000 kJ/kg\n",
+ "compressor work as saturated vapor at inlet 519.500000 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-13 ,Page No.368"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import sqrt\n",
+ "#given data\n",
+ "P1=100;#intial pressure in kPa\n",
+ "T1=300;#intial temperature in K\n",
+ "P2=900;#final pressure in kPa\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kJ/kg -K\n",
+ "\n",
+ "#calculations\n",
+ "#part - a\n",
+ "k=1.4;\n",
+ "Wcomp=k*R*T1/(k-1)*((P2/P1)**((k-1)/k)-1);\n",
+ "print'compression work in case of isentropic compression %f kJ/kg'%round(Wcomp,1);\n",
+ "#part - b\n",
+ "n=1.3;\n",
+ "Wcomp=n*R*T1/(n-1)*((P2/P1)**((n-1)/n)-1);\n",
+ "print'compression work in case of polytropic compression %f kJ/kg'%round(Wcomp,1);\n",
+ "#part - c\n",
+ "Wcomp=R*T1*log(P2/P1);\n",
+ "print'compression work in case of isothermal compression %f kJ/kg'%round(Wcomp,1);\n",
+ "#part - d\n",
+ "Ps=sqrt(P1*P2);\n",
+ "Wcomp=2*n*R*T1/(n-1)*((Ps/P1)**((n-1)/n)-1);\n",
+ "print'compression work in case of two-stage compression with intercooling %f kJ/kg'%round(Wcomp,1);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "compression work in case of isentropic compression 263.200000 kJ/kg\n",
+ "compression work in case of polytropic compression 246.400000 kJ/kg\n",
+ "compression work in case of isothermal compression 189.200000 kJ/kg\n",
+ "compression work in case of two-stage compression with intercooling 215.300000 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-14 ,Page No.371"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=3000;#intial pressure in kPa\n",
+ "T1=400;#intial temperature in C\n",
+ "P2=50;#final pressure in kPa\n",
+ "T2=100;#final temperature in C\n",
+ "Wout=2000;#power output in kW\n",
+ "\n",
+ "#from Table A-6\n",
+ "#at P1\n",
+ "h1=3231.7;\n",
+ "s1=6.9235;\n",
+ "#at 2a\n",
+ "h2a=2682.4;\n",
+ "#from Table A-6\n",
+ "#at 2s\n",
+ "s2s=s1;\n",
+ "sf=1.0912;\n",
+ "sg=7.5937;\n",
+ "hf=340.54;\n",
+ "hfg=2304.7\n",
+ "x2s=(s2s-sf)/(sg-sf);\n",
+ "h2s=hf+x2s*hfg;\n",
+ "nT=(h1-h2a)/(h1-h2s);\n",
+ "print'isentropic efficiency is %f'%round(nT,3)\n",
+ "#Ein = Eout\n",
+ "m=Wout/(h1-h2a);\n",
+ "print'mass flow rate %f kg/s'%round(m,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "isentropic efficiency is 0.667000\n",
+ "mass flow rate 3.640000 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-15 ,Page No.374"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=100;#intial pressure in kPa\n",
+ "T1=285;#intial temperature in K\n",
+ "P2=800;#final pressure in kPa\n",
+ "m=0.2;#mass flow rate in kg/s\n",
+ "nc=0.8;#isentropic efficiency\n",
+ "\n",
+ "#from Table A-17\n",
+ "#at T1\n",
+ "h1=285.14;\n",
+ "Pr1=1.1584;\n",
+ "\n",
+ "#calcualtions\n",
+ "Pr2=Pr1*(P2/P1);\n",
+ "#at Pr2\n",
+ "h2s=517.05;\n",
+ "h2a=(h2s-h1)/nc+h1;\n",
+ "#at h2a\n",
+ "T2a=569.5;\n",
+ "print'exit temperature of air %f K'%T2a;\n",
+ "#Ein = Eout\n",
+ "Wa=m*(h2a-h1);\n",
+ "print'required power input %i kW'%round(Wa)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "exit temperature of air 569.500000 K\n",
+ "required power input 58 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-16 ,Page No.375"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import sqrt\n",
+ "\n",
+ "#given data\n",
+ "P1=200.0;#intial pressure in kPa\n",
+ "T1=950.0;#intial temperature in K\n",
+ "P2=80.0;#final pressure in kPa\n",
+ "nN=0.92;#isentropic efficiency\n",
+ "\n",
+ "#from Table A-2b\n",
+ "cp=1.099;\n",
+ "k=1.354;\n",
+ "\n",
+ "#calculations\n",
+ "T2s=T1*(P2/P1)**((k-1)/k);\n",
+ "#ein = eout\n",
+ "V2s=sqrt(2*cp*(T1-T2s)*1000);#factor of 1000 for conversion to m^2/s^2\n",
+ "print'maximum possible exit velocity %i m/s'%(V2s);\n",
+ "T2a=T1-nN*(T1-T2s);\n",
+ "print'exit temperature %i K'%round(T2a);\n",
+ "V2a=sqrt(nN*V2s**2);\n",
+ "print'actual exit velocity %i m/s'%(V2a)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum possible exit velocity 666 m/s\n",
+ "exit temperature 764 K\n",
+ "actual exit velocity 639 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 42
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ " Example 7-17 ,Page No.382"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "Qin=1035.0;#rate of heat transfer in W\n",
+ "Tin=20+273.0;#inner temperature in K\n",
+ "Qout=Qin;\n",
+ "Tout=5+273.0;#outer temperature in K\n",
+ "\n",
+ "#calculations\n",
+ "# Sin - Sout + Sgen = dSsystem/dt\n",
+ "Sgen=(Qout/Tout)-(Qin/Tin);\n",
+ "print'entropy generation in the wall %f W/K'%round(Sgen,3);\n",
+ "Ts1=300.0;Ts2=273.0;#Boundary temperatures\n",
+ "Sgen=(Qout/Ts2)-(Qin/Ts1);\n",
+ "print'total entropy generation %f W/K'%round(Sgen,3);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "entropy generation in the wall 0.191000 W/K\n",
+ "total entropy generation 0.341000 W/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-18 ,Page No.383"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=7;#intial pressure in MPa\n",
+ "T1=450;#intial temperature in K\n",
+ "P2=3;#final pressure in MPa\n",
+ "\n",
+ "#from steam tables\n",
+ "#at P1 and T1\n",
+ "h1=3288.3;\n",
+ "s1=6.6353;\n",
+ "#at P2\n",
+ "h2=h1;\n",
+ "s2=7.0046;\n",
+ "\n",
+ "#calculations\n",
+ "# Sin - Sout + Sgen = dSsystem/dt\n",
+ "Sgen=s2-s1;\n",
+ "print'the entropy generated %f kJ/kg-K'%round(Sgen,4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the entropy generated 0.369300 kJ/kg-K\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-19 ,Page No.385"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "\n",
+ "#given data\n",
+ "m=50;#mass of iron block in kg\n",
+ "T1=500.0;#temperature of iron block in K\n",
+ "T2=285.0;#temperature of lake in K\n",
+ "\n",
+ "#from Table A-3\n",
+ "Cavg=0.45;\n",
+ "\n",
+ "#calculations\n",
+ "dSiron=m*Cavg*log(T2/T1);\n",
+ "print'entropy change of the iron block %f kJ/K'%round(dSiron,2);\n",
+ "# Ein - Eout = dEsystem\n",
+ "Qout=m*Cavg*(T1-T2);\n",
+ "dSlake=Qout/T2;\n",
+ "print'entropy change of the lake %f kJ/K'%round(dSlake,2);\n",
+ "# Sin - Sout + Sgen = dSsystem/dt\n",
+ "Sgen=(Qout/T2)+dSiron;\n",
+ "print'entropy change in the process %f kJ/K'%round(Sgen,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "entropy change of the iron block -12.650000 kJ/K\n",
+ "entropy change of the lake 16.970000 kJ/K\n",
+ "entropy change in the process 4.330000 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-20 ,Page No.386"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P=20;#pressure of water in psia\n",
+ "T1=50+460.0;#temperature of water in R\n",
+ "T2=240.0;#steam temperature in F\n",
+ "T3=130.0;#leaving temperauture in F\n",
+ "m1=300.0;#mass flow rate in lbm/min\n",
+ "Qout=180.0;#heat losses in Btu/min\n",
+ "\n",
+ "#from steam tables\n",
+ "#at P and T1\n",
+ "h1=18.07;\n",
+ "s1=0.03609;\n",
+ "#at P and T2\n",
+ "h2=1162.3;\n",
+ "s2=1.7406;\n",
+ "#at P and T3\n",
+ "h3=97.99;\n",
+ "s3=0.18174;\n",
+ "\n",
+ "#calculations\n",
+ "# Qout = m1*h1 + m2*h2 - (m1+m2)*h3\n",
+ "m2= (Qout-m1*h1+m1*h3)/(h2-h3);\n",
+ "m3=m1+m2;\n",
+ "# Sin - sout + Sgen = dSsystem/dt\n",
+ "Sgen=m3*s3-m1*s1-m2*s2+Qout/T1;\n",
+ "print'the rate of entropy generation %f Btu/min R'%round(Sgen,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the rate of entropy generation 8.670000 Btu/min R\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-21 ,Page No.388"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T=100+273.0;#temperature of water in K\n",
+ "Q=-600.0;#heat transferred in kJ\n",
+ "Tb=25+273.0;#temperature of surroundings in K\n",
+ "\n",
+ "#calculation\n",
+ "dSsys=Q/T;\n",
+ "print'entropy change of water %f kJ/K'%round(dSsys,2);\n",
+ "# Sin - sout + Sgen = dSsystem\n",
+ "Sgen= -Q/Tb + dSsys;\n",
+ "print'total entropy generation %f kJ/K'%round(Sgen,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "entropy change of water -1.610000 kJ/K\n",
+ "total entropy generation 0.400000 kJ/K\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-22 ,Page No.394"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import pi,sqrt\n",
+ "\n",
+ "#given data\n",
+ "T1=20+273.0;#average temperature of inlet in C\n",
+ "T2=24+273.0;#average temperature of compressed air in C\n",
+ "P1=101.0;#pressure of air inlet in kPa\n",
+ "P2=801.0;#pressure of compressed air in kPa\n",
+ "D=3.0/1000.0;#ihole diameter n m\n",
+ "Cdischarge=0.65;#discharge coefficient\n",
+ "ncomp=0.8;#compressor efficiency\n",
+ "nmotor=0.92;#motor efficiency\n",
+ "UC=0.078;#unit cost in $/kWh\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kJ/kg K\n",
+ "k=1.4;\n",
+ "n=1.4;\n",
+ "\n",
+ "#calculations\n",
+ "Win=n*R*T1/(ncomp*(n-1))*((P2/P1)**((n-1)/n)-1);\n",
+ "A=pi*D**2/4;\n",
+ "mair=Cdischarge*(2/(k+1))**(1/(k-1))*P2*A/(R*T2)*sqrt(k*R*1000*2/(k+1)*T2);#factor of 1000 to m^2/s^2\n",
+ "PW=mair*Win;#Power wasted\n",
+ "ES=PW*4200/nmotor;#4200 is operating hours ES stands for Energy savings\n",
+ "print'Energy savings %i kWh/yr'%round(ES);\n",
+ "CS=ES*UC;\n",
+ "print'cost savings %i S/yr'%round(CS)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Energy savings 11698 kWh/yr\n",
+ "cost savings 912 S/yr\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7-23 ,Page No.398"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P1=85.6;#pressure of air inlet in kPa\n",
+ "P2=985.6;#pressure of actual compressed air in kPa\n",
+ "P2r=885.6;#pressure of required compressed air in kPa\n",
+ "CC=12000;#current cost in $/yr\n",
+ "\n",
+ "#constants used\n",
+ "n=1.4;\n",
+ "\n",
+ "#calulation\n",
+ "freduction=1-(((P2r/P1)**((n-1)/n)-1)/((P2/P1)**((n-1)/n)-1));\n",
+ "CS=CC*freduction;\n",
+ "print'cost savings %i Dollar/yr'%(round(CS))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "cost savings 719 Dollar/yr\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter8.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter8.ipynb new file mode 100755 index 00000000..e91e1b78 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter8.ipynb @@ -0,0 +1,764 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8: Exergy: A Measure of Work Potential"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-1 ,Page No.426"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import pi\n",
+ "\n",
+ "# given data\n",
+ "D=12.0;#diameter of rotor in m\n",
+ "V=10.0;#average velocity in m/s\n",
+ "\n",
+ "# density of air at 25C & 1atm\n",
+ "p=1.18;\n",
+ "\n",
+ "#calculations\n",
+ "ke=(V**2)/2/1000;#factor of 1000 for converting J into kJ\n",
+ "m=p*pi*(D**2)*V/4.0; \n",
+ "MP=m*(ke);\n",
+ "print'Maximum power %f kW'%round(MP,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum power 66.700000 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-2 ,Page No.427"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given values\n",
+ "TH=2000.0;#temperature of large furnace in R\n",
+ "T0=77+460.0;#temperature of enviroment in R\n",
+ "Qin=3000.0;#heat rate in Btu/sec\n",
+ "\n",
+ "#calculation\n",
+ "nth=1-(T0/TH);\n",
+ "Wmax=nth*Qin;\n",
+ "Wmax=round(Wmax)\n",
+ "print'the rate of energy flow %i Btu/s'%round(Wmax)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the rate of energy flow 2195 Btu/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-3 ,Page No.429"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "Tsink=300.0;#temperature of sink in K\n",
+ "Tsource=1200.0;#temperature of source in K\n",
+ "Qin=500.0;#heat rate in kJ/s\n",
+ "Wuout=180;#power output in W\n",
+ "\n",
+ "#calculations\n",
+ "Wrev=(1-Tsink/Tsource)*Qin;\n",
+ "print'The reversible power %i kW'%round(Wrev);\n",
+ "I=Wrev-Wuout;\n",
+ "print'the irreversiblity rate %i kW'%round(I)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The reversible power 375 kW\n",
+ "the irreversiblity rate 195 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-4 ,Page No.429"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from scipy.integrate import quad \n",
+ "from pylab import *\n",
+ "\n",
+ "#given data\n",
+ "m=500.0;#mass of iron block in kg\n",
+ "T1=473.0;#temperature of iron block in K\n",
+ "T0=300.0;#temperature of surrondings in K\n",
+ "\n",
+ "\n",
+ "#from Table A-3\n",
+ "cavg=0.45;\n",
+ "\n",
+ "#calculations\n",
+ "def intgrnd1(T): \n",
+ " return ((1-T0/T)*(-m*cavg))#intergrant\n",
+ "Wrev, err = quad(intgrnd1,T1,T0) ;\n",
+ "Qtotal=m*cavg*(T1-T0);\n",
+ "print'The reversible power %i kJ'%round(Wrev);\n",
+ "Wu=0;\n",
+ "I=Wrev-Wu;\n",
+ "print'the irreversiblity rate %i kJ'%round(I)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The reversible power 8191 kJ\n",
+ "the irreversiblity rate 8191 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-5 ,Page No.431"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "Wrev=8191.0;#reversible work from Ex - 8.4\n",
+ "Wtotal=38925.0;#total work is equivalent to total heat lost to heat engine from Ex - 8.4\n",
+ "TL=278.0;#outdoor temperature in K\n",
+ "TH=300.0;#temperature of house in K\n",
+ "\n",
+ "#calculations\n",
+ "Wrm=Wtotal-Wrev;#work remaining\n",
+ "COPHP=1/(1-TL/TH);\n",
+ "Wd=COPHP*Wrev;#work delivered\n",
+ "PS=Wd+Wrm;\n",
+ "PS=round(PS/1000);#factor of 1000 for converting kJ into MJ\n",
+ "print'Maximum amount of heat that can be supplied %i MJ'%PS"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum amount of heat that can be supplied 142 MJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-6 ,Page No.434"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "COP=1.0;# the efficiency that the dealer is referring to is the first law efficiency, meaning that for each unit of electric energy (work) consumed, the heater will supply the house with 1 unit of energy (heat). That is,the advertised heater has a COP of 1\n",
+ "TL=283.0;#outdoor temperature in K\n",
+ "TH=294.0;#indoor temperature in K\n",
+ "\n",
+ "#calculations\n",
+ "COPHP=1/(1-TL/TH);\n",
+ "nII=COP/COPHP;\n",
+ "print'the second law efficiency %f'%round(nII,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the second law efficiency 0.037000\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-7 ,Page No.438"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "\n",
+ "#given data\n",
+ "P1=1000.0;#pressure of compressed air in KPa\n",
+ "V=200.0;#volumne of rigid tank in m^3\n",
+ "T1=300.0;#temperature of enviroment in K\n",
+ "T0=T1;#state of air in tank\n",
+ "P0=100.0;#pressure of enviroment in KPa\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kPa m^3/kg K\n",
+ "\n",
+ "#calculations\n",
+ "m1=P1*V/(R*T1);\n",
+ "O1=R*T0*(P0/P1-1)+R*T0*log(P1/P0);# O refers to exergy\n",
+ "X1=m1*O1/1000;#factor of 1000 for converting kJ into MJ\n",
+ "print'work obtained %i MJ'%round(X1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "work obtained 281 MJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-8 ,Page No.439"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T0=20+273;#temperature of enviroment in K\n",
+ "P1=0.14;#intail pressure in MPa\n",
+ "T1=-10;#intail temperature in K\n",
+ "P2=0.8;#final pressure in MPa\n",
+ "T2=50;#final temperature in K\n",
+ "\n",
+ "#the properties of refrigerant\n",
+ "#at inlet\n",
+ "h1=246.36;\n",
+ "s1=0.9724;\n",
+ "#at outlet\n",
+ "h2=286.69;\n",
+ "s2=0.9802;\n",
+ "dO=h2-h1-T0*(s2-s1);# O refers to exergy\n",
+ "print'the exergy change of the refrigerant %i kJ/kg'%round(dO)\n",
+ "wmin=dO;\n",
+ "print'the minimum work input that needs to be supplied is %i kJ/kg'%wmin"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the exergy change of the refrigerant 38 kJ/kg\n",
+ "the minimum work input that needs to be supplied is 38 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-10 ,Page No.447"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given values\n",
+ "Q=1035.0;#rate of heat transfer in W\n",
+ "T0=273.0;#outdoor temperature in C\n",
+ "Tin=293.0;#inner wall surface temperature in K\n",
+ "Tout=278.0;#outer wall surface temperature in K\n",
+ "T1=300.0;#indoor temperature in C\n",
+ "\n",
+ "#calculations\n",
+ "#Xin - Xout - Xdestroyed = dX/dt\n",
+ "Xdestroyed=Q*(1-T0/Tin)-Q*(1-T0/Tout);\n",
+ "Xdestroyed=round(Xdestroyed);\n",
+ "print'the rate of exergy destroyed %i W'%round(Xdestroyed);\n",
+ "#the total rate of exergy destroyed\n",
+ "Xdestroyed=Q*(1-T0/T1)-Q*(1-T0/T0);\n",
+ "print'the total of exergy destroyed %f W'%round(Xdestroyed,1);"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the rate of exergy destroyed 52 W\n",
+ "the total of exergy destroyed 93.100000 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-11 ,Page No.448"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "m=0.05;#mass of steam in kg\n",
+ "P1=1000;#intial pressure in MPa\n",
+ "T1=300+273;#intial temperature in K\n",
+ "P2=200;#final pressure in MPa\n",
+ "T2=150+273;#final temperature in K\n",
+ "P0=100;#pressure of surroundings in KPa\n",
+ "T0=25+273;#temperature of surroundings in K\n",
+ "Qout=2;#heat losses in kJ\n",
+ "\n",
+ "#from Table A-6 & A-4\n",
+ "u1=2793.7;\n",
+ "v1=0.25799;\n",
+ "s1=7.1246;\n",
+ "u2=2577.1;\n",
+ "v2=0.95986;\n",
+ "s2=7.2810;\n",
+ "u0=104.83;\n",
+ "v0=0.00103;\n",
+ "s0=0.3672;\n",
+ "\n",
+ "#calculations\n",
+ "X1=m*(u1-u0-T0*(s1-s0)+P0*(v1-v0));\n",
+ "X2=m*(u2-u0-T0*(s2-s0)+P0*(v2-v0));\n",
+ "print'exergy of intial state %i kJ'%round(X1);\n",
+ "print'exergy of final state %f kJ'%round(X2,1);\n",
+ "dX=X2-X1;\n",
+ "print'exergy change in system %f kJ'%round(dX,1);\n",
+ "Wout=-Qout-m*(u2-u1);\n",
+ "Wu=Wout-P0*m*(v2-v1);\n",
+ "Xdestroyed=X1-X2-Wu;\n",
+ "print'the exergy destroyed %f kJ'%round(Xdestroyed,1);\n",
+ "nII=Wu/(X1-X2);\n",
+ "print'second law efficiency of this process is %f'%round(nII,3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "exergy of intial state 35 kJ\n",
+ "exergy of final state 25.400000 kJ\n",
+ "exergy change in system -9.700000 kJ\n",
+ "the exergy destroyed 4.300000 kJ\n",
+ "second law efficiency of this process is 0.551000\n"
+ ]
+ }
+ ],
+ "prompt_number": 42
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-12 ,Page No.451"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from scipy.integrate import quad \n",
+ "from pylab import *\n",
+ "\n",
+ "#given data\n",
+ "m=2.0;#mass of air in lbm\n",
+ "T0=70+460.0;#intial temperature in R\n",
+ "P1=20.0;#intial pressure in psia\n",
+ "T1=70+460.0;#temperature of surroundings in R\n",
+ "T2=130+460.0;#final temperature in R\n",
+ "\n",
+ "#constants used\n",
+ "Cv=0.172;#in Btu/lbm - F\n",
+ "\n",
+ "#calculations\n",
+ "Xdestroyed=T0*m*Cv*log(T2/T1);\n",
+ "print'exergy destroyed %f Btu'%round(Xdestroyed,1);\n",
+ "def intgrnd1(T): \n",
+ " return ((1-T0/T)*m*Cv)#intergrant\n",
+ "Wrev, err = quad(intgrnd1,T1,T2) ;\n",
+ "print'the reversible work %f Btu'%round(Wrev,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "exergy destroyed 19.600000 Btu\n",
+ "the reversible work 1.100000 Btu\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-13 ,Page No.453"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T0=20+273.0;#temperature of surrounding in K\n",
+ "P0=100.0;#pressure of surrounding in kPa\n",
+ "Tiw=30+273.0;#temperature of water in K\n",
+ "mw=100.0;#mass of water in kg\n",
+ "Tii=350+273.0;#temperature of block in K\n",
+ "mi=5.0;#mass of block in kg\n",
+ "\n",
+ "#constants used(Table A-3)\n",
+ "cw=4.18;#specific heat of water in kJ/kg C\n",
+ "ci=0.45;#specific heat of iron in kJ/kg C\n",
+ "\n",
+ "#calculations\n",
+ "Tfk=(mi*ci*Tii+mw*cw*Tiw)/(mw*cw+mi*ci);\n",
+ "Tfc=Tfk-273;#in C\n",
+ "print'the final equilibrium temperature %f C'%round(Tfc,1);\n",
+ "X1i=mi*ci*(Tii-T0-T0*log(Tii/T0));\n",
+ "X1w=mw*cw*(Tiw-T0-T0*log(Tiw/T0));\n",
+ "X1t=X1i+X1w;#total exergy \n",
+ "print'intial exergy of combined systems %i kJ'%round(X1t);\n",
+ "X2i=mi*ci*(Tfk-T0-T0*log(Tfk/T0));\n",
+ "X2w=mw*cw*(Tfk-T0-T0*log(Tfk/T0));\n",
+ "X2t=X2i+X2w;#total exergy \n",
+ "print'intial exergy of combined systems %f kJ'%round(X2t,1);\n",
+ "Xdestroyed=X1t-X2t;\n",
+ "print'the wasted work %f kJ'%round(Xdestroyed,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final equilibrium temperature 31.700000 C\n",
+ "intial exergy of combined systems 315 kJ\n",
+ "intial exergy of combined systems 95.800000 kJ\n",
+ "the wasted work 219.100000 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 46
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-14 ,Page No.455"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "TR=1200.0;#temperature of furnace \n",
+ "T0=300;#temperature of surrounding in K\n",
+ "P0=100;#pressure of surrounding in kPa\n",
+ "Tsys=400.0;#temperature of argon in K\n",
+ "P1=350;#temperature of argon in K\n",
+ "V1=0.01;#intail volumne in m^3\n",
+ "V2=2*V1;#final volumne\n",
+ "\n",
+ "#calculations\n",
+ "W=P1*V1*log(V2/V1);\n",
+ "Wsurr=P0*(V2-V1);\n",
+ "Wu=W-Wsurr;\n",
+ "print'the useful work output %f kJ'%round(Wu,2);\n",
+ "# Qin - W = m*Cv*dT, Since dt=0\n",
+ "Q=W;\n",
+ "Sgen=Q/Tsys-Q/TR;\n",
+ "Xdestroyed=T0*Sgen;\n",
+ "print'the exergy destroyed %f kJ/K'%round(Xdestroyed,2);\n",
+ "Wrev=T0*Q/Tsys-Wsurr+(1-T0/TR)*Q;\n",
+ "print'the reversible work is done in the process %f kJ'%round(Wrev,2);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the useful work output 1.430000 kJ\n",
+ "the exergy destroyed 1.210000 kJ/K\n",
+ "the reversible work is done in the process 2.640000 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-15 ,Page No.460"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculation error in textbook in part - b which changes all the following answers\n",
+ "\n",
+ "#given data\n",
+ "m=8.0;#mass flow rate in kg/s\n",
+ "T0=298.0;#temperature of surrounding in K\n",
+ "P0=100.0;#pressure of surrounding in kPa\n",
+ "P1=3000.0;#inlet pressure in kPa\n",
+ "T1=450.0;#inlet temperature in K\n",
+ "P2=200.0;#outlet pressure in kPa\n",
+ "T2=150.0;#outlet temperature in K\n",
+ "Qout=300.0;#heat rate in kW\n",
+ "\n",
+ "#from Table A-6 and A-4\n",
+ "h1=3344.9;\n",
+ "s1=7.0856;\n",
+ "h2=2769.1;\n",
+ "s2=7.2810;\n",
+ "h0=104.83;\n",
+ "s0=0.3672;\n",
+ "\n",
+ "#calculations\n",
+ "# Ein = Eout\n",
+ "Wout=m*(h1-h2)-Qout;\n",
+ "Wout=round(Wout)\n",
+ "print'the actual power output %i kW'%Wout\n",
+ "# Xin = Xout\n",
+ "Wrev=m*(h1-h2)-(T0*(s1-s2));\n",
+ "Wrev=round(Wrev);\n",
+ "print'the maximum possible work output %i kW'%Wrev;\n",
+ "nII=Wout/Wrev;\n",
+ "print'second law efficiency is %f'%round(nII,3);\n",
+ "Xdestroyed=Wrev-Wout;\n",
+ "print'the exergy destroyed %i kW'%round(Xdestroyed);\n",
+ "X1=h1-h0-T0*(s1-s0);\n",
+ "print'the exergy of the steam at inlet conditions %i kJ/kg'%round(X1);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the actual power output 4306 kW\n",
+ "the maximum possible work output 4665 kW\n",
+ "second law efficiency is 0.923000\n",
+ "the exergy destroyed 359 kW\n",
+ "the exergy of the steam at inlet conditions 1238 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-16 ,Page No.462"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T0=70+460;#temperature of surroundings in R\n",
+ "T1=50;#temperature of water in F\n",
+ "T2=240;#temperature of steam in F\n",
+ "T3=130;#outlet temperature in F\n",
+ "#as dicussed in example 7-20\n",
+ "m1=300;#mass flow rate of water in lbm/min\n",
+ "m2=22.7;#mass flow rate of steam in lbm/min\n",
+ "m3=322.7;#outlet mass flow rate in lbm/min\n",
+ "\n",
+ "#from steam tables\n",
+ "h1=18.07;\n",
+ "s1=0.03609;\n",
+ "h2=1162.3;\n",
+ "s2=1.7406;\n",
+ "h3=97.99;\n",
+ "s3=0.18174;\n",
+ "\n",
+ "#calculations\n",
+ "Wrev=m1*(h1-T0*s1)+m2*(h2-T0*s2)-m3*(h3-T0*s3);\n",
+ "Wrev=round(Wrev);\n",
+ "print'the reversible power %i Btu/min'%round(Wrev)\n",
+ "Xdestroyed=Wrev;\n",
+ "print'the rate of exergy destruction %i Btu/min'%Xdestroyed\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the reversible power 4588 Btu/min\n",
+ "the rate of exergy destruction 4588 Btu/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8-17 ,Page No.463"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "V=200.0;#volumne of rigid tank in m^3\n",
+ "P1=100.0;#intial surroundings in kPa\n",
+ "P2=1000.0;#final pressure in kPa\n",
+ "P0=100.0;#pressure of surroundings in kPa\n",
+ "T=300.0;#temperature of surroundings in K\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kPa m^3/kg K\n",
+ "\n",
+ "#calculations\n",
+ "#Xin - Xout = Xdestroyed = X2 - X1\n",
+ "m2=P2*V/(R*T);\n",
+ "X2=R*T*(log(P2/P0)+P0/P2-1);\n",
+ "Wrev=m2*X2/1000;\n",
+ "Wrev=round(Wrev);\n",
+ "print'Work requirement %i MJ'%Wrev\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work requirement 281 MJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 58
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/Chapter9.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter9.ipynb new file mode 100755 index 00000000..1008c6c0 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/Chapter9.ipynb @@ -0,0 +1,540 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9: Gas Power Cycles"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-2 ,Page No.498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T1=17+273;#temperature of air in K\n",
+ "P1=100;#pressure of air in kPa\n",
+ "r=8.0;#compression ratio i.e v1/v2\n",
+ "qin=800;#heat transfer rate in kJ/kg\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kPa-m^3/kg-K\n",
+ "\n",
+ "#from Table A-17\n",
+ "#at T1\n",
+ "u1=206.91;\n",
+ "vr1=676.1;\n",
+ "\n",
+ "#calculations\n",
+ "#Process 1-2\n",
+ "vr2=vr1/r;\n",
+ "#at this vr2\n",
+ "T2=652.4;\n",
+ "u2=475.11;\n",
+ "P2=P1*(T2/T1)*(r);\n",
+ "#Process 2-3\n",
+ "u3=qin+u2;\n",
+ "#at this u3\n",
+ "T3=1575.1;\n",
+ "vr3=6.108;\n",
+ "P3=P2*(T3/T2)*1;#factor of 1 as v3=v2\n",
+ "print'maximum temperature in the cycle %f K'%T3;\n",
+ "print'maximum pressure %f MPa'%round((P3/1000),3);#factor of 1000 to convert into MPa\n",
+ "#Process 3-4\n",
+ "vr4=r*vr3;\n",
+ "#at this vr4 \n",
+ "T4=795.6;\n",
+ "u4=588.74;\n",
+ "#Process 4-1\n",
+ "qout=u4-u1;\n",
+ "Wnet=qin-qout;\n",
+ "print'net work output %f kJ/kg'%round(Wnet,2);\n",
+ "nth=Wnet/qin;\n",
+ "print'thermal efficiency is %f'%round(nth,3);\n",
+ "v1=R*T1/P1;\n",
+ "MEP=Wnet/(v1*(1-1/r));\n",
+ "MEP=round(MEP);\n",
+ "print'mean effective pressure %i kPa'%(MEP)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum temperature in the cycle 1575.100000 K\n",
+ "maximum pressure 4.345000 MPa\n",
+ "net work output 418.170000 kJ/kg\n",
+ "thermal efficiency is 0.523000\n",
+ "mean effective pressure 574 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-3 ,Page No.501"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "V1=117.0;#intial volumne in in^3\n",
+ "T1=80+460.0;#intial temperature in R\n",
+ "P1=14.7;#intial pressure in psia\n",
+ "r=18.0;#compression ratio\n",
+ "rc=2.0;#cut-off ratio\n",
+ "\n",
+ "#constants used\n",
+ "R=0.3704;#in psia ft^3/lbm R\n",
+ "cp=0.240;#in Btu/lbm R\n",
+ "cv=0.171;#in Btu/lbm R\n",
+ "\n",
+ "#from Table A-2Ea\n",
+ "k=1.4;\n",
+ "\n",
+ "#calculations\n",
+ "V2=V1/r;\n",
+ "V3=rc*V2;\n",
+ "V4=V1;\n",
+ "#Process 1-2\n",
+ "T2=T1*(V1/V2)**(k-1);\n",
+ "P2=P1*(V1/V2)**k;\n",
+ "T2=round(T2);\n",
+ "P2=round(P2);\n",
+ "print('Process 1-2');\n",
+ "print'temperature %i R'%T2;\n",
+ "print'pressure %i psia'%P2;\n",
+ "#Process 2-3\n",
+ "P3=P2;\n",
+ "T3=T2*(V3/V2);\n",
+ "T3=round(T3);\n",
+ "P3=round(P3);\n",
+ "print('Process 2-3');\n",
+ "print'temperature %i R'%T3;\n",
+ "print'pressure %i psia'%P3;\n",
+ "#Process 3-4\n",
+ "T4=T3*(V3/V4)**(k-1);\n",
+ "P4=P3*(V3/V4)**k;\n",
+ "T4=round(T4);\n",
+ "print('Process 3-4');\n",
+ "print'temperature %i R'%T4;\n",
+ "print'pressure %f psia'%round(P4,1);\n",
+ "m=P1*V1/(R*T1)/1728;#factor of 1728 to covert to ft^3 from in^3\n",
+ "Qin=m*cp*(T3-T2);\n",
+ "Qout=m*cv*(T4-T1);\n",
+ "Wnet=Qin-Qout ;\n",
+ "print'work output %f Btu'%round(Wnet,3);\n",
+ "nth=Wnet/Qin;\n",
+ "print'thermal efficiency is %f'%round(nth,3);\n",
+ "MEP=Wnet/(V1-V2)*778.17*12;#factor of 778.17 and 12 to convert to lbf ft and in from Btu and ft respectively\n",
+ "MEP=round(MEP);\n",
+ "print'mean effective pressure %i psia'%MEP"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Process 1-2\n",
+ "temperature 1716 R\n",
+ "pressure 841 psia\n",
+ "Process 2-3\n",
+ "temperature 3432 R\n",
+ "pressure 841 psia\n",
+ "Process 3-4\n",
+ "temperature 1425 R\n",
+ "pressure 38.800000 psia\n",
+ "work output 1.296000 Btu\n",
+ "thermal efficiency is 0.633000\n",
+ "mean effective pressure 110 psia\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-5 ,Page No.511"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "T1=300;#compressor inlet temperature in K\n",
+ "r=8;#pressure ratio\n",
+ "T3=1300;#turbine inlet temperature in K\n",
+ "\n",
+ "#calcualtions\n",
+ "#Process 1-2\n",
+ "#at T1\n",
+ "h1=300.19;\n",
+ "Pr1=1.386;\n",
+ "Pr2=r*Pr1;\n",
+ "#at Pr2\n",
+ "T2=540;\n",
+ "h2=544.35;\n",
+ "print'temperature at exit of compressor %i K'%T2;\n",
+ "#Process 3-4\n",
+ "#at T3\n",
+ "h3=1395.17;\n",
+ "Pr3=330.9;\n",
+ "Pr4=Pr3/r;\n",
+ "#at Pr4\n",
+ "T4=770;\n",
+ "h4=789.37;\n",
+ "print'temperature at turbine exit %i K'%T4;\n",
+ "Win=h2-h1;\n",
+ "Wout=h3-h4;\n",
+ "rbw=Win/Wout;\n",
+ "print'back work ratio is %f'%round(rbw,3);\n",
+ "qin=h3-h2;\n",
+ "Wnet=Wout-Win;\n",
+ "nth=Wnet/qin;\n",
+ "print'thermal efficeincy is %f'%round(nth,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "temperature at exit of compressor 540 K\n",
+ "temperature at turbine exit 770 K\n",
+ "back work ratio is 0.403000\n",
+ "thermal efficeincy is 0.425000\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-6 ,Page No.513"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#from 9.5\n",
+ "Wsc=244.16;#work input of compressor in kJ/kg\n",
+ "Wst=606.60;#work output of turbine in kJ/kg\n",
+ "h1=300.19;#process 1-2 data\n",
+ "h3=1395.17;#process 3-4 data\n",
+ "\n",
+ "#given data\n",
+ "nC=0.8;#compressor effciency \n",
+ "nT=0.85;#turbine efficiency\n",
+ "\n",
+ "#calculations\n",
+ "Win=Wsc/nC;\n",
+ "Wout=nT*Wst;\n",
+ "rbw=Win/Wout;\n",
+ "print'back work ratio is %f'%round(rbw,3);\n",
+ "h2a=h1+Win;\n",
+ "qin=h3-h2a;\n",
+ "Wnet=Wout-Win;\n",
+ "nth=Wnet/qin;\n",
+ "print'thermal efficeincy is %f'%round(nth,3)\n",
+ "h4a=h3-Wout;\n",
+ "#from A-17 at h4a\n",
+ "T4a=853;\n",
+ "print'turbine exit temperature %i K is'%T4a\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "back work ratio is 0.592000\n",
+ "thermal efficeincy is 0.266000\n",
+ "turbine exit temperature 853 K is\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-7 ,Page No.516"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#from 9.6\n",
+ "h2a=605.39;#entalpy of air leaving the compressor in kJ/kg\n",
+ "h4a=880.36;#entalpy of air leaving the turbinein kJ/kg\n",
+ "h3=1395.97;#in kJ/kg\n",
+ "Wnet=210.41;#net woek done in kJ/kg\n",
+ "\n",
+ "#given data\n",
+ "n=0.80;#thermal efficiency\n",
+ "\n",
+ "#calculations\n",
+ "# n = (h5 - h2a) / (h4a - h2a)\n",
+ "h5=(h4a - h2a)*n+h2a;\n",
+ "qin=h3-h5;\n",
+ "nth=Wnet/qin;\n",
+ "print'thermal efficeincy is %f'%round(nth,3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "thermal efficeincy is 0.369000\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-8 ,Page No.519"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import sqrt\n",
+ "\n",
+ "#given data\n",
+ "T1=300;#inlet temperature of compressor in K\n",
+ "T6=1300;#inlet temperature of turbine in K\n",
+ "r=8;#overall compression ratio\n",
+ "\n",
+ "#calculations\n",
+ "#as it is case of intercooling\n",
+ "ri=sqrt(r);#ri stands for P2/P1 = P4/P3 = P6/P7 = P8/P9\n",
+ "#from A-17 at T1\n",
+ "h1=300.19;\n",
+ "Pr1=1.386;\n",
+ "Pr2=ri*Pr1;\n",
+ "#from A-17 at Pr2\n",
+ "T2=403.3;\n",
+ "h2=403.31;\n",
+ "#from A-17 at T6\n",
+ "h6=1395.97;\n",
+ "Pr6=330.9;\n",
+ "Pr7=Pr6/ri;\n",
+ "#from A-17 at Pr7\n",
+ "T7=1006.4;\n",
+ "h7=1053.33;\n",
+ "#at inlets\n",
+ "T3=T1;h3=h1;T8=T6;h8=h6;\n",
+ "#et exits\n",
+ "T4=T2;h4=h2;T9=T7;h9=h7;h5=h7;\n",
+ "Win=2*(h2-h1);\n",
+ "Wout=2*(h6-h7);\n",
+ "Wnet=Wout-Win;\n",
+ "qin=(h6-h4)+(h8-h7);\n",
+ "rbw=Win/Wout;\n",
+ "print'back work ratio is %f'%round(rbw,3);\n",
+ "nth=Wnet/qin;\n",
+ "print'thermal efficeincy is %f'%round(nth,3)\n",
+ "#part - b\n",
+ "print('part - b');\n",
+ "qin=(h6-h5)+(h8-h7);\n",
+ "nth=Wnet/qin;\n",
+ "print'thermal efficeincy is %f'%round(nth,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "back work ratio is 0.301000\n",
+ "thermal efficeincy is 0.359000\n",
+ "part - b\n",
+ "thermal efficeincy is 0.699000\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-9 ,Page No.523"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import sqrt\n",
+ "\n",
+ "#given data\n",
+ "m=100;\n",
+ "P1=5;#air pressue in psia\n",
+ "T1=-40+460;#air temperature in R\n",
+ "T4=2000+460;#turbine inlet temperature in R\n",
+ "V1=850;#aircraft velocity in ft/sec\n",
+ "rp=10;#pressure ratio\n",
+ "\n",
+ "#constants used\n",
+ "cp=0.240;#in Btu/lbm F\n",
+ "k=1.4;\n",
+ "\n",
+ "#calculations\n",
+ "#Process 1-2\n",
+ "T2=T1+V1**2/(2*cp)/25037;#factor of 25037 to covert to Btu/lbm\n",
+ "P2=P1*(T2/T1)**(k/(k-1));\n",
+ "#Process 2-3 \n",
+ "P3=rp*P2;\n",
+ "P4=P3;\n",
+ "T3=T2*(P3/P2)**((k-1)/k);\n",
+ "#Win=Wout\n",
+ "T5=T4-T3+T2;\n",
+ "P5=P4*(T5/T4)**(k/(k-1));\n",
+ "T5=round(T5);\n",
+ "print'temperature at turbine exit %i R'%T5;\n",
+ "print'pressure at turbine exit %f psia'%round(P5,1);\n",
+ "#Process 5-6\n",
+ "P6=P1;\n",
+ "T6=T5*(P6/P5)**((k-1)/k);\n",
+ "T6=round(T6);#round off\n",
+ "V6=sqrt(2*cp*(T5-T6)*25037);#factor of 25037 to covert to (ft/s)^2\n",
+ "print'the velocity of nozzle exit %i ft/s'%(round(V6));\n",
+ "Wp=m*(V6-V1)*V1/25037;#factor of 25037 to covert to Btu/lbm\n",
+ "Qin=m*cp*(T4-T3);\n",
+ "nP=Wp/Qin;\n",
+ "print'propulsive efficiency is %f percent'%round(nP*100,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "temperature at turbine exit 2013 R\n",
+ "pressure at turbine exit 39.600000 psia\n",
+ "the velocity of nozzle exit 3285 ft/s\n",
+ "propulsive efficiency is 22.500000 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9-10 ,Page No.529"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "\n",
+ "#from 9.2\n",
+ "r=8;#compression ratio i.e v1/v2\n",
+ "T0=290.0;#temperature of air in K\n",
+ "T1=290.0;#temperature in the begining of the isentropic compression process in K\n",
+ "T2=652.4;#temperature in the end of the isentropic compression process in K\n",
+ "T3=1575.1;#temperature after process 2-3 in K\n",
+ "P2=1.7997;#pressure in the end of the isentropic compression process in MPa\n",
+ "P3=4.345;#pressure after process 2-3 in MPa\n",
+ "qin=800.0;#heat transfer rate in kJ/kg\n",
+ "qout=381.83;#heat rejection in kJ/kg\n",
+ "wnet=418.17;#net work in kJ/kg\n",
+ "\n",
+ "#given data\n",
+ "Tsource=1700;#temperature of working fluid at source in K\n",
+ "\n",
+ "#constants used\n",
+ "R=0.287;#in kPa-m^3/kg-K\n",
+ "\n",
+ "#calculations\n",
+ "#s1=s2 ; s3=s4\n",
+ "s03=3.5045;\n",
+ "s02=2.4975;\n",
+ "s32=(s03-s02)-R*log(P3/P2);#s32 stands for s3-s2\n",
+ "xdest23=T0*(s32-qin/Tsource);\n",
+ "Tsink=T1;\n",
+ "xdest41=T0*(-s32+qout/Tsink);\n",
+ "xdestcycle=xdest23+xdest41;\n",
+ "print'exergy destrustion associated with Otto cycle %f kJ/kg'%round(xdestcycle,1);\n",
+ "# X4 = (u4 - u0 )- T0*(s4 - s0) + P0(v4 - v0)\n",
+ "# s4 - s0 = s4 - s1 = s32\n",
+ "# u4 - u0 = u4 - u1 = qout\n",
+ "# v4 - v0 = v4 - v1 = 0\n",
+ "#hence x4 is\n",
+ "X4=qout-T0*s32;\n",
+ "print'exergy destruction of purge stream %f kJ/kg'%round(X4,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "exergy destrustion associated with Otto cycle 245.400000 kJ/kg\n",
+ "exergy destruction of purge stream 163.200000 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/README.txt b/Thermodynamics_An_Engineering_Approach/README.txt new file mode 100755 index 00000000..2482fb63 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/README.txt @@ -0,0 +1,10 @@ +Contributed By: Harshit Bajpai +Course: btech +College/Institute/Organization: Visvesvaraya National Institute Of Technology, Nagpur +Department/Designation: Chemical Engineering +Book Title: Thermodynamics An Engineering Approach +Author: Michael A. Boles, Yunus A. Cengel +Publisher: McGraw-Hill College, Boston, MA, +Year of publication: 2006 +Isbn: 0072884959 +Edition: 5
\ No newline at end of file diff --git a/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot.png b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot.png Binary files differnew file mode 100755 index 00000000..ae3f5718 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot.png diff --git a/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot_1.png b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot_1.png Binary files differnew file mode 100755 index 00000000..ae3f5718 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_10_Ex_10-1_Screenshot_1.png diff --git a/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot.png b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot.png Binary files differnew file mode 100755 index 00000000..a7d400a8 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot.png diff --git a/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot_1.png b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot_1.png Binary files differnew file mode 100755 index 00000000..a7d400a8 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_14_Ex_14-2_Screenshot_1.png diff --git a/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot.png b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot.png Binary files differnew file mode 100755 index 00000000..16c5fdb6 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot.png diff --git a/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot_1.png b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot_1.png Binary files differnew file mode 100755 index 00000000..16c5fdb6 --- /dev/null +++ b/Thermodynamics_An_Engineering_Approach/screenshots/Chapter_8_Ex_8-4_Screenshot_1.png |