diff options
author | Trupti Kini | 2016-09-24 23:30:26 +0600 |
---|---|---|
committer | Trupti Kini | 2016-09-24 23:30:26 +0600 |
commit | a15adea19e43548c8ba5fbc11a97f84dad2ada3a (patch) | |
tree | efcd8d1507d6daaaa069d0786f53793c89240eea /Thermodynamics_by_Gaggioli_and_Obert | |
parent | 67b852f00a31161aa8cb648515fbef95adfa5afc (diff) | |
download | Python-Textbook-Companions-a15adea19e43548c8ba5fbc11a97f84dad2ada3a.tar.gz Python-Textbook-Companions-a15adea19e43548c8ba5fbc11a97f84dad2ada3a.tar.bz2 Python-Textbook-Companions-a15adea19e43548c8ba5fbc11a97f84dad2ada3a.zip |
Added(A)/Deleted(D) following books
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter10_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter11_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter12_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter13_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter14_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter15_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter16_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter2_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter3_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter4_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter5_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter6_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter7_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/Chapter8_1.ipynb
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/screenshots/2correlationCoeff_1.png
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/screenshots/2expansionofSignal_1.png
A Modern_Digital_And_Analog_Communication_System_by_B._P._Lathi/screenshots/2timeInvertedsignal_1.png
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter10_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter11_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter15_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter1_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter2_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter3_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter5_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter6_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter7_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter8_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/Chapter9_1.ipynb
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/screenshots/ctftch1.png
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/screenshots/fourierTransch1.png
A Principle_of_Communication_Engineering_by_A._Singh_and_A._K._Chhabra/screenshots/modulatedWaveChap3_1.png
A Thermodynamics_by_Gaggioli_and_Obert/Ch18.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/Ch8.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch1.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch10.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch11.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch12.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch13.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch14.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch15.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch17.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch2.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch3.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch5.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch7.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/ch9.ipynb
A Thermodynamics_by_Gaggioli_and_Obert/screenshots/changeInMoisture14.png
A Thermodynamics_by_Gaggioli_and_Obert/screenshots/degreeOfSaturation14.png
A Thermodynamics_by_Gaggioli_and_Obert/screenshots/humidityratio14.png
Diffstat (limited to 'Thermodynamics_by_Gaggioli_and_Obert')
19 files changed, 5692 insertions, 0 deletions
diff --git a/Thermodynamics_by_Gaggioli_and_Obert/Ch18.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/Ch18.ipynb new file mode 100644 index 00000000..ef61bd07 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/Ch18.ipynb @@ -0,0 +1,394 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 18 Refrigeration" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.1 Pg:784" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From steam tables,\n", + "Coefficient of performance = 12.0 \n", + "\n", + " horsepower required per ton of refrigeration = 0.393 hp/ton refrigeration\n", + "\n", + " Work of compression = -62.8 Btu/lbm\n", + "\n", + " Work of expansion = 1.42 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "Ta=500 #R\n", + "Tr=540 #R\n", + "#calculations\n", + "cop=Ta/(Tr-Ta)\n", + "hp=4.71/cop\n", + "print \"From steam tables,\"\n", + "ha=48.02\n", + "hb=46.6\n", + "hc=824.1\n", + "hd=886.9\n", + "Wc=-(hd-hc)\n", + "We=-(hb-ha)\n", + "#results\n", + "print \"Coefficient of performance = %.1f \"%(cop)\n", + "print \"\\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration\"%(hp)\n", + "print \"\\n Work of compression = %.1f Btu/lbm\"%(Wc)\n", + "print \"\\n Work of expansion = %.2f Btu/lbm\"%(We)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.2 Pg:785" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Coefficient of performance = 8.96\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "x=0.8\n", + "he=26.28 #Btu/lbm\n", + "hb=26.28 #Btu/lbm\n", + "pe=98.76 #psia\n", + "pc=51.68 #psia\n", + "hc=82.71 #Btu/lbm\n", + "hf=86.80+0.95\n", + "#calculations\n", + "dwisen=-(hf-hc)\n", + "dwact=dwisen/x\n", + "hd=hc-dwact\n", + "cop=(hc-hb)/(hd-hc)\n", + "#results\n", + "print \"Coefficient of performance = %.2f\"%(cop)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.3 Pg:785" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Work done = -100.1 Btu/lbm\n", + "\n", + " horsepower required per ton of refrigeration = 0.994 hp/ton refrigeration\n", + "\n", + " Coefficient of performance actual = 4.74 \n", + "\n", + " Ideal cop = 5.737\n", + "\n", + " relative efficiency = 0.826\n", + "\n", + " Mass flow rate = 0.422 lbm/min ton\n", + "\n", + " Compressor capacity = 3.44 cfm/ton\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "hc=613.3#btu/lbm\n", + "hb=138.9#btu/lbm\n", + "ha=138.9#btu/lbm\n", + "hd=713.4 #btu/lbm\n", + "ta=464.7 #R\n", + "t0=545.7 #R\n", + "v=8.150 #ft**3/lbm\n", + "#calculations\n", + "Qa=hc-hb\n", + "Qr=ha-hd\n", + "Wcd=Qa+Qr\n", + "cop=abs(Qa/Wcd)\n", + "hp=abs(4.71/cop)\n", + "carnot=abs(ta/(t0-ta))\n", + "rel=abs(cop/carnot)\n", + "mass=200/Qa\n", + "C=mass*v\n", + "#results\n", + "print \"Work done = %.1f Btu/lbm\"%(Wcd)\n", + "print \"\\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration\"%(hp)\n", + "print \"\\n Coefficient of performance actual = %.2f \"%(cop)\n", + "print \"\\n Ideal cop = %.3f\"%(carnot)\n", + "print \"\\n relative efficiency = %.3f\"%(rel)\n", + "print \"\\n Mass flow rate = %.3f lbm/min ton\"%(mass)\n", + "print \"\\n Compressor capacity = %.2f cfm/ton\"%(C)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.4 Pg:786" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pressure ratio = 5.74\n", + "\n", + " Heat = 25083 Btu/min\n", + "\n", + " Water make up required = 24.24 lbm/min\n", + "\n", + " Volume of vapor entering ejector = 58054 cfm\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "pc=0.6982 #psia\n", + "pe=0.1217 #psia\n", + "m=200 #gal/min\n", + "qual=0.98\n", + "h1=23.07 #Btu/lbm\n", + "h2=8.05 #Btu/lbm\n", + "hw=1071.3\n", + "#calculations\n", + "rp=pc/pe\n", + "m2=m/0.01602 *0.1388 #Conversion of units \n", + "m2=1670\n", + "dh=15.02\n", + "Qa=m2*(h1-h2)\n", + "h3=h2 + qual*hw\n", + "m3=Qa/(h3-h1)\n", + "v=0.016+ qual*2444\n", + "C=m3*v\n", + "#results\n", + "print \"Pressure ratio = %.2f\"%(rp)\n", + "print \"\\n Heat = %d Btu/min\"%(Qa)\n", + "print \"\\n Water make up required = %.2f lbm/min\"%(m3)\n", + "print \"\\n Volume of vapor entering ejector = %d cfm\"%(C)\n", + "print \"The answers are a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.5 Pg:787" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From fig B-4,\n", + "Appropraite notation from textbook has been used\n", + "All are enthalpy values at different stages\n", + "part a\n", + "Work done = -18.08 Btu/lbm\n", + "\n", + " Heat = 47.22 Btu/lbm\n", + "\n", + " horsepower required per ton of refrigeration = 1.803 hp/ton refrigeration\n", + "\n", + " Coefficient of performance actual = 2.61 \n", + "case 2\n", + "\n", + " Work done = -53.6 Btu/lbm\n", + "\n", + " Heat = 146.30 Btu/lbm\n", + "\n", + " horsepower required per ton of refrigeration = 1.726 hp/ton refrigeration\n", + "\n", + " Coefficient of performance actual = 2.73 \n", + "part b\n", + "\n", + " Work done = -22.0 Btu/lbm\n", + "\n", + " Heat = 60.95 Btu/lbm\n", + "\n", + " horsepower required per ton of refrigeration = 1.702 hp/ton refrigeration\n", + "\n", + " Coefficient of performance actual = 2.77 \n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "print \"From fig B-4,\"\n", + "print \"Appropraite notation from textbook has been used\"\n", + "print \"All are enthalpy values at different stages\"\n", + "hc=73.5 #Btu/lbm\n", + "hb=26.28 #Btu/lbm\n", + "hd=91.58 #Btu/lbm\n", + "hc2=190.7 #Btu/lbm\n", + "hd2=244.3 #Btu/lbm\n", + "hb2=44.4 #Btu/lbm\n", + "m1=1 #lbm\n", + "m2=0.461 #lbm\n", + "hc1=73.5 #Btu/lbm\n", + "hd1=83.35 #Btu/lbm \n", + "hc2=190.7 #Btu/lbm \n", + "hd2=244.3 #Btu/lbm\n", + "hb1=12.55 #Btu/lbm \n", + "hc22=197.58 #Btu/lbm \n", + "hd22=224 #Btu/lbm\n", + "#Calculations\n", + "w1=hc-hd\n", + "qa1=hc-hb\n", + "cop1=abs(qa1/(w1))\n", + "hp1=4.71/cop1\n", + "w2=hc2-hd2\n", + "qa2=hc2-hb2\n", + "cop2=abs(qa2/(w2))\n", + "hp2=4.71/cop2\n", + "qa3=m1*(hc1-hb1)\n", + "w3=m1*(hc1-hd1) + m2*(hc22-hd22)\n", + "cop3=abs(qa3/w3)\n", + "hp3=4.71/cop3\n", + "#results\n", + "print \"part a\"\n", + "print \"Work done = %.2f Btu/lbm\"%(w1)\n", + "print \"\\n Heat = %.2f Btu/lbm\"%(qa1)\n", + "print \"\\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration\"%(hp1)\n", + "print \"\\n Coefficient of performance actual = %.2f \"%(cop1)\n", + "print \"case 2\"\n", + "print \"\\n Work done = %.1f Btu/lbm\"%(w2)\n", + "print \"\\n Heat = %.2f Btu/lbm\"%(qa2)\n", + "print \"\\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration\"%(hp2)\n", + "print \"\\n Coefficient of performance actual = %.2f \"%(cop2)\n", + "print \"part b\"\n", + "print \"\\n Work done = %.1f Btu/lbm\"%(w3)\n", + "print \"\\n Heat = %.2f Btu/lbm\"%(qa3)\n", + "print \"\\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration\"%(hp3)\n", + "print \"\\n Coefficient of performance actual = %.2f \"%(cop3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.6 Pg:788" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From fig B-4,\n", + "Appropraite notation from textbook has been used\n", + "All are enthalpy values at different stages\n", + "\n", + " horsepower required per ton of refrigeration = 1.585 hp/ton refrigeration\n", + "\n", + " Coefficient of performance actual = 2.97 \n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "print \"From fig B-4,\"\n", + "print \"Appropraite notation from textbook has been used\"\n", + "print \"All are enthalpy values at different stages\"\n", + "ha=44.36 #Btu/lbm \n", + "hc=18.04 #Btu/lbm\n", + "hj=197.58 #Btu/lbm\n", + "hh=213.5 #Btu/lbm \n", + "hd=hc #Btu/lbm\n", + "he=190.66 #Btu/lbm\n", + "hk=241.25 #Btu/lbm\n", + "#calculations\n", + "m=(hc-ha)/(ha-hj)\n", + "hi=(m*hj+hh)/(1+m)\n", + "Qa=he-hd\n", + "W=he-hh + (1+m)*(hi-hk)\n", + "cop=abs(Qa/W)\n", + "hp=4.71/cop\n", + "#results\n", + "print \"\\n horsepower required per ton of refrigeration = %.3f hp/ton refrigeration\"%(hp)\n", + "print \"\\n Coefficient of performance actual = %.2f \"%(cop)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/Ch8.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/Ch8.ipynb new file mode 100644 index 00000000..2e3ca609 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/Ch8.ipynb @@ -0,0 +1,149 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 8 Second and third law topics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:8.1 Pg:255" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dp by ds at constant volume = 275 F/ft**3/lbm\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "P=500 #psia\n", + "T=700 #F\n", + "J=778\n", + "#calculations\n", + "dpds=1490 *144/J\n", + "#results\n", + "print \"dp by ds at constant volume = %d F/ft**3/lbm\"%(dpds)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:8.2 Pg:256" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Thermal efficiency = 66.5 percent\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from math import log\n", + "#Initialization of variables\n", + "cp=0.25 #Btu/lbm R\n", + "T0=520 #R\n", + "T1=3460 #R\n", + "#calculations\n", + "dq=cp*(T0-T1)\n", + "ds=cp*log(T0/T1)\n", + "dE=dq-T0*ds\n", + "eta=dE/dq\n", + "#results\n", + "print \"Thermal efficiency = %.1f percent\"%(eta*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:8.3 Pg:256" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loss of available energy = -6774 Btu/lbm\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from math import log\n", + "#Initialization of variables\n", + "cp=0.25 #Btu/lbm R\n", + "T0=520 #R\n", + "T1=3460 #R\n", + "dG=21069 #Btu/lbm\n", + "dH=21502 #Btu/lbm\n", + "#calculations\n", + "dq=cp*(T0-T1)\n", + "ds=cp*log(T0/T1)\n", + "dE=dq-T0*ds\n", + "eta=dE/dq\n", + "dw=eta*dH\n", + "de=-dG+dw\n", + "#results\n", + "print \"Loss of available energy = %d Btu/lbm\"%(de)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch1.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch1.ipynb new file mode 100644 index 00000000..56ea81cb --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch1.ipynb @@ -0,0 +1,227 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 Survey Of Units And Dimensions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:1.1 Pg: 19" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Force to accelerate = 3.108 lbf\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "gc=32.1739 #lbm ft/lbf s**2\n", + "m=10 #lbm\n", + "a=10 #ft/s**2\n", + "#calculations\n", + "F=m*a/gc\n", + "#results\n", + "print \"Force to accelerate = %.3f lbf\"%(F)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:1.2 Pg: 19" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Force to accelerate = 10 lbf\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "gc=32.1739 #lbm ft/lbf s**2\n", + "m=10 #lbm\n", + "a=gc #ft/s**2\n", + "#calculations\n", + "F=m*a/gc\n", + "#results\n", + "print \"Force to accelerate = %d lbf\"%(F)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:1.3 Pg: 19" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "velocity = 60 mph\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "v=88 #ft/s\n", + "#calculations\n", + "v2=v*3600/5280\n", + "#results\n", + "print \"velocity = %d mph\"%(v2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:1.4 Pg: 20" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "velocity = 0 mph\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "v=88 #ft/s\n", + "#calculations\n", + "v2=v*1/5280*3600\n", + "#results\n", + "print \"velocity = %d mph\"%(v2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:1.5 Pg: 20" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Force without dimensions = 5.79e-04 lbm/ft sec\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "F=5e-9 #lbf/ft**2 hr\n", + "g=32.1739\n", + "#calculations\n", + "F2=F*3600*g\n", + "#results\n", + "print \"Force without dimensions = %.2e lbm/ft sec\"%(F2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:1.6 Pg: 21" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Density of water in this system = 1.937 lbf/ft**2\n", + "\n", + " Specific weight = 62.305 lbf/ft**2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "rho=62.305 #lbf/ft**2\n", + "g=32.1739 #ft/s**2\n", + "#calculations\n", + "gam=rho/g\n", + "#results\n", + "print \"Density of water in this system = %.3f lbf/ft**2\"%(gam)\n", + "print \"\\n Specific weight = %.3f lbf/ft**2\"%(rho)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch10.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch10.ipynb new file mode 100644 index 00000000..4ac6845c --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch10.ipynb @@ -0,0 +1,157 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 The pvt relationships" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:10.1 Pg:360" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For ideal gas case, Table B-6 and for vanderwaals case, Table B-8 have been used\n", + "\n", + " In vanderwaals equation, pressure = 50.0 atm\n", + "\n", + " In ideal gas case, pressure = 57.8 atm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m=1 #lbm\n", + "T1=212+460 #R\n", + "sv=0.193 #ft**3/lbm\n", + "M=44\n", + "a=924.2 #atm ft**2 /mole**2\n", + "b=0.685 #ft**3/mol\n", + "R=0.73 #atm ft**3/R mol\n", + "#calculations\n", + "v=sv*M\n", + "p=R*T1/v\n", + "p2=R*T1/(v-b) -a/v**2\n", + "#results\n", + "print \"For ideal gas case, Table B-6 and for vanderwaals case, Table B-8 have been used\"\n", + "print \"\\n In vanderwaals equation, pressure = %.1f atm\"%(p2)\n", + "print \"\\n In ideal gas case, pressure = %.1f atm\"%(p)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:10.2 Pg:360" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "volume = 8.481 ft**3/mole\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m=1 #lbm\n", + "p=50.9 #atm\n", + "t=212+460 #R\n", + "R=0.73\n", + "#calculations\n", + "pc=72.9 #atm\n", + "tc=87.9 +460 #R\n", + "pr=p/pc\n", + "Tr=t/tc\n", + "z=0.88\n", + "v=z*R*t/p\n", + "#results\n", + "print \"volume = %.3f ft**3/mole\"%(v)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:10.3 Pg:361" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pressure = 50.8 atm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "t=212+460 #R\n", + "v=0.193 #ft**3/lbm\n", + "M=44\n", + "R=0.73\n", + "#calculations\n", + "tc=87.9+460 #F\n", + "zc=0.275\n", + "vc=1.51 #ft**3/mol\n", + "tr=t/tc\n", + "vr=v*M/vc\n", + "vrd=vr*zc\n", + "z=0.88\n", + "p=z*R*t/(M*v)\n", + "#results\n", + "print \"Pressure = %.1f atm\"%(p)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch11.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch11.ipynb new file mode 100644 index 00000000..001bcdc2 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch11.ipynb @@ -0,0 +1,762 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 11 The ideal gas and mixture relationship" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.1 Pg:415" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Work done = -58682 ft-lbf/lbm\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "n=1.3\n", + "T1=460+60 #R\n", + "P1=14.7 #psia\n", + "P2=125 #psia\n", + "R=1545\n", + "M=29\n", + "#calculations\n", + "T2=T1*(P2/P1)**((n-1)/n)\n", + "wrev=R/M *(T2-T1)/(1-n)\n", + "#results\n", + "print \"Work done = %d ft-lbf/lbm\"%(wrev)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.2 Pg:415" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Change in kinetic energy = 52.3 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "P2=10 #psia\n", + "P1=100 #psia\n", + "T1=900 #R\n", + "w=50 #Btu/lbm\n", + "k=1.39\n", + "cp=0.2418\n", + "#calculations\n", + "T2=T1*(P2/P1)**((k-1)/k)\n", + "T2=477\n", + "KE=-w-cp*(T2-T1)\n", + "#results\n", + "print \"Change in kinetic energy = %.1f Btu/lbm\"%(KE)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.3 Pg:416" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table B-9\n", + "Final temperature = 468 R \n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "T1=900 #R\n", + "P1=100 #psia\n", + "P2=10 #psia\n", + "#calculations\n", + "print \"From table B-9\"\n", + "pr1=8.411\n", + "pr2=pr1*P2/P1\n", + "T2=468 #R\n", + "#results\n", + "print \"Final temperature = %d R \"%(T2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.4 Pg:417" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from table b-9\n", + "final temperature = 1050 R\n", + "\n", + " final pressure = 177.7 psia\n", + "\n", + " work done = -92.85 Btu/lbm\n", + "\n", + " final enthalpy = 253.4 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "cr=6\n", + "p1=14.7 #psia\n", + "t1=60.3 #F\n", + "M=29\n", + "R=1.986\n", + "#calculations\n", + "print \"from table b-9\"\n", + "vr1=158.58 \n", + "u1=88.62 #Btu/lbm\n", + "pr1=1.2147\n", + "vr2=vr1/cr\n", + "T2=1050 #R\n", + "u2=181.47 #Btu/lbm\n", + "pr2=14.686\n", + "p2=p1*(pr2/pr1)\n", + "dw=u1-u2\n", + "h2=u2+T2*R/M\n", + "#results\n", + "print \"final temperature = %d R\"%(T2)\n", + "print \"\\n final pressure = %.1f psia\"%(p2)\n", + "print \"\\n work done = %.2f Btu/lbm\"%(dw)\n", + "print \"\\n final enthalpy = %.1f Btu/lbm\"%(h2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.5 Pg:417" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "part a\n", + "Mole fractions of oxygen and nitrogen are 0.369 and 0.631 respectively\n", + "part b\n", + "Average molecular weight = 29.5 \n", + "part c\n", + "specific gas constant = 0.3639 psia ft**3/lbm R\n", + "part d\n", + "volume of mixture = 94.6 ft**3\n", + "density of mixture is 0.00896 mole/ft**3 and 0.26 lbm/ft**3\n", + "part e\n", + "partial pressures of oxygen and nitrogen are 18.43 psia and 31.57 psia respectively\n", + "part a\n", + "Mole fractions of oxygen and nitrogen are 0.369 and 0.631 respectively\n", + "part b\n", + "Average molecular weight = 29.5 \n", + "part c\n", + "specific gas constant = 52.3960 lbf ft/lbm R\n", + "part d\n", + "volume of mixture = 94.6 ft**3\n", + "\n", + " density of mixture is 0.00896 mole/ft**3 and 0.264 lbm/ft**3\n", + "part e\n", + "partial pressures of oxygen and nitrogen are 18.43 psia and 31.57 psia respectively\n", + "\n", + " partial volumes of oxygen and nitrogen are 34.87 ft**3 and 59.74 ft**3 respectively\n", + "\n", + " Net partial pressure in case of oxygen = 50.00 psia\n", + "\n", + " Net partial volume =94.61 ft**3\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "#Initialization of variables\n", + "m1=10 #lbm\n", + "m2=15 #lnm\n", + "p=50 #psia\n", + "t=60+460 #R\n", + "M1=32\n", + "M2=28.02\n", + "R0=10.73 \n", + "#calculations\n", + "n1=m1/M1\n", + "n2=m2/M2\n", + "x1=n1/(n1+n2)\n", + "x2=n2/(n1+n2)\n", + "M=x1*M1+x2*M2\n", + "R=R0/M\n", + "V=(n1+n2)*R0*t/p\n", + "rho=p/(R0*t)\n", + "rho2=M*rho\n", + "p1=x1*p\n", + "p2=x2*p\n", + "v1=x1*V\n", + "v2=x2*V\n", + "#results\n", + "print \"part a\"\n", + "print \"Mole fractions of oxygen and nitrogen are %.3f and %.3f respectively\"%(x1,x2)\n", + "print \"part b\"\n", + "print \"Average molecular weight = %.1f \"%(M)\n", + "print \"part c\"\n", + "print \"specific gas constant = %.4f psia ft**3/lbm R\"%(R)\n", + "print \"part d\"\n", + "print \"volume of mixture = %.1f ft**3\"%(V)\n", + "print \"density of mixture is %.5f mole/ft**3 and %.2f lbm/ft**3\"%(rho,rho2)\n", + "print \"part e\"\n", + "print \"partial pressures of oxygen and nitrogen are %.2f psia and %.2f psia respectively\"%(p1,p2)\n", + "#Initialization of variables\n", + "m1=10 #lbm\n", + "m2=15 #lnm\n", + "p=50 #psia\n", + "t=60+460 #R\n", + "M1=32\n", + "M2=28.02\n", + "R0=10.73 \n", + "#calculations\n", + "n1=m1/M1\n", + "n2=m2/M2\n", + "x1=n1/(n1+n2)\n", + "x2=n2/(n1+n2)\n", + "M=x1*M1+x2*M2\n", + "R=1545/M\n", + "V=(n1+n2)*R0*t/p\n", + "rho=p/(R0*t)\n", + "rho2=M*rho\n", + "p1=x1*p\n", + "p2=x2*p\n", + "v1=x1*V\n", + "v2=x2*V\n", + "pt=p1+p2\n", + "vt=v1+v2\n", + "#results\n", + "print \"part a\"\n", + "print \"Mole fractions of oxygen and nitrogen are %.3f and %.3f respectively\"%(x1,x2)\n", + "print \"part b\"\n", + "print \"Average molecular weight = %.1f \"%(M)\n", + "print \"part c\"\n", + "print \"specific gas constant = %.4f lbf ft/lbm R\"%(R)\n", + "print \"part d\"\n", + "print \"volume of mixture = %.1f ft**3\"%(V)\n", + "print \"\\n density of mixture is %.5f mole/ft**3 and %.3f lbm/ft**3\"%(rho,rho2)\n", + "print \"part e\"\n", + "print \"partial pressures of oxygen and nitrogen are %.2f psia and %.2f psia respectively\"%(p1,p2)\n", + "print \"\\n partial volumes of oxygen and nitrogen are %.2f ft**3 and %.2f ft**3 respectively\"%(v1,v2)\n", + "print \"\\n Net partial pressure in case of oxygen = %.2f psia\"%(pt)\n", + "print \"\\n Net partial volume =%.2f ft**3\"%(vt)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.6 Pg:418" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From gravimetric analysis, co2 = 17.6 percent , o2 = 4.3 percent and n2 = 78.2 percent\n", + "\n", + " From ultimate analysis, co2 = 0.00 percent , o2 = 4.26 percent and n2 = 78.19 percent\n", + "\n", + " Sum in case 1 = 100.0 percent\n", + "\n", + " Sum in case 2 = 82.4 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m1=5.28\n", + "m2=1.28\n", + "m3=23.52\n", + "#calculations\n", + "m=m1+m2+m3\n", + "x1=m1/m\n", + "x2=m2/m\n", + "x3=m3/m\n", + "C=12/44 *m1/ m\n", + "O=(32/44 *m1 + m2)/m\n", + "N=m3/m\n", + "sum1=(x1+x2+x3)*100\n", + "sum2=(C+N+O)*100\n", + "#results\n", + "print \"From gravimetric analysis, co2 = %.1f percent , o2 = %.1f percent and n2 = %.1f percent\"%(x1*100,x2*100,x3*100)\n", + "print \"\\n From ultimate analysis, co2 = %.2f percent , o2 = %.2f percent and n2 = %.2f percent\"%(C*100,O*100,N*100)\n", + "print \"\\n Sum in case 1 = %.1f percent\"%(sum1)\n", + "print \"\\n Sum in case 2 = %.1f percent\"%(sum2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.7 Pg:419" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Entropy of mixture = 8.27 Btu/R\n", + "\n", + " the answer given in textbook is wrong. please check using a calculator\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from scipy import log\n", + "#Initialization of variables\n", + "x1=1/3\n", + "n1=1\n", + "n2=2\n", + "x2=2/3\n", + "p=12.7 #psia\n", + "cp1=7.01 #Btu/mole R\n", + "cp2=6.94 #Btu/mole R\n", + "R0=1.986\n", + "T2=460+86.6 #R\n", + "T1=460 #R\n", + "p0=14.7 #psia\n", + "#calculations\n", + "p1=x1*p\n", + "p2=x2*p\n", + "ds1= cp1*log(T2/T1) - R0*log(p1/p0)\n", + "ds2= cp2*log(T2/T1) - R0*log(p2/p0)\n", + "S=n1*ds1+n2*ds2\n", + "#results\n", + "print \"Entropy of mixture = %.2f Btu/R\"%(S)\n", + "print \"\\n the answer given in textbook is wrong. please check using a calculator\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.8 Pg:420" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Change in internal energy = -547 Btu\n", + "\n", + " Change in entropy = -1.037 Btu/R\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from scipy import log\n", + "\n", + "#Initialization of variables\n", + "c1=4.97 #Btu/mol R\n", + "c2=5.02 #Btu/mol R\n", + "n1=2\n", + "n2=1\n", + "T1=86.6+460 #R\n", + "T2=50+460 #R\n", + "#calculations\n", + "du=(n1*c1+n2*c2)*(T2-T1)\n", + "ds=(n1*c1+n2*c2)*log(T2/T1)\n", + "#results\n", + "print \"Change in internal energy = %d Btu\"%(du)\n", + "print \"\\n Change in entropy = %.3f Btu/R\"%(ds)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.9 Pg:420" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pressure of mixture = 12.7 psia\n", + "\n", + " Mixing temperature = 86.6 F\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "\n", + "#Initialization of variables\n", + "n1=1\n", + "n2=2\n", + "c1=5.02\n", + "c2=4.97\n", + "t1=60 #F\n", + "t2=100 #F\n", + "R0=10.73\n", + "p1=30 #psia\n", + "p2=10 #psia\n", + "#calcualtions\n", + "t=(n1*c1*t1+n2*c2*t2)/(n1*c1+n2*c2)\n", + "V1= n1*R0*(t1+460)/p1\n", + "V2=n2*R0*(t2+460)/p2\n", + "V=V1+V2\n", + "pm=(n1+n2)*R0*(t+460)/V\n", + "#results\n", + "print \"Pressure of mixture = %.1f psia\"%(pm)\n", + "print \"\\n Mixing temperature = %.1f F\"%(t)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.10 Pg:421" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Change in entropy for gas 1 = 4.242 Btu/R\n", + "\n", + " Change in entropy for gas 1 = 0.331 Btu/R\n", + "\n", + " Net change in entropy = 4.572 Btu/R\n", + "\n", + " In case 2, change in entropy = 4.572 Btu/R\n", + "The answer is a bit different due to rounding off error in the textbook\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from scipy import log\n", + "\n", + "#Initialization of variables\n", + "T2=546.6 #R\n", + "T1=520 #R\n", + "T3=560 #R\n", + "v2=1389.2\n", + "v1=186.2\n", + "R0=1.986\n", + "c1=5.02\n", + "c2=4.97\n", + "n1=1\n", + "n2=2\n", + "v3=1203\n", + "#calculations\n", + "ds1=n1*c1*log(T2/T1) + n1*R0*log(v2/v1)\n", + "ds2=n2*c2*log(T2/T3)+n2*R0*log(v2/v3)\n", + "ds=ds1+ds2\n", + "ds3=n1*c1*log(T2/T1)+n2*c2*log(T2/T3)\n", + "ds4=n2*R0*log(v2/v3)+ n1*R0*log(v2/v1)\n", + "dss=ds3+ds4\n", + "#results\n", + "print \"Change in entropy for gas 1 = %.3f Btu/R\"%(ds1)\n", + "print \"\\n Change in entropy for gas 1 = %.3f Btu/R\"%(ds2)\n", + "print \"\\n Net change in entropy = %.3f Btu/R\"%(ds)\n", + "print \"\\n In case 2, change in entropy = %.3f Btu/R\"%(dss)\n", + "print \"The answer is a bit different due to rounding off error in the textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.11 Pg:42" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Final remperature = 851 R\n", + "\n", + " Change in entropy of air = -0.115 btu/mole R and -0.00395 Btu/R\n", + "\n", + " Change in entropy of water = 0.0757 btu/mole R and 0.00395 Btu/R\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from scipy import log\n", + "\n", + "#Initialization of variables\n", + "m1=1 #lbm\n", + "m2=0.94 #lbm\n", + "M1=29\n", + "M2=18\n", + "p1=50 #psia\n", + "p2=100 #psia\n", + "t1=250 +460 #R\n", + "R0=1.986\n", + "cpa=6.96\n", + "cpb=8.01\n", + "#calculations\n", + "xa = (m1/M1)/((m1/M1)+ m2/M2)\n", + "xb=1-xa\n", + "t2=t1*(p2/p1)**(R0/(xa*cpa+xb*cpb))\n", + "d=R0/(xa*cpa+xb*cpb)\n", + "k=1/(1-d)\n", + "dsa=cpa*log(t2/t1) -R0*log(p2/p1)\n", + "dSa=(m1/M1)*dsa\n", + "dSw=-dSa\n", + "dsw=dSw*M2/m2\n", + "#results\n", + "print \"Final remperature = %d R\"%(t2)\n", + "print \"\\n Change in entropy of air = %.3f btu/mole R and %.5f Btu/R\"%(dsa,dSa)\n", + "print \"\\n Change in entropy of water = %.4f btu/mole R and %.5f Btu/R\"%(dsw,dSw)\n", + "print \"The answers are a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.12 Pg:423" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In case 1, volume occupied = 13.02 ft**3\n", + "\n", + " In case 1, mass of steam = 0.94 lbm steam\n", + "\n", + " In case 2, mass of steam = 0.918 lbm steam\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "\n", + "#Initialization of variables\n", + "T=250 + 460 #R\n", + "p=29.825 #psia\n", + "pt=50 #psia\n", + "vg=13.821 #ft**3/lbm\n", + "M=29\n", + "R=10.73\n", + "#calculations\n", + "pa=pt-p\n", + "V=1/M *R*T/pa\n", + "ma=V/vg\n", + "xa=p/pt\n", + "mb=xa/M *18/(1-xa)\n", + "#results\n", + "print \"In case 1, volume occupied = %.2f ft**3\"%(V)\n", + "print \"\\n In case 1, mass of steam = %.2f lbm steam\"%(ma)\n", + "print \"\\n In case 2, mass of steam = %.3f lbm steam\"%(mb)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.13 Pg:424" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "percentage = 65.0 percent\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "\n", + "#Initialization of variables\n", + "ps=0.64 #psia\n", + "p=14.7 #psia\n", + "M=29\n", + "M2=46\n", + "#calculations\n", + "xa=ps/p\n", + "mb=xa*9/M *M2/(1-xa)\n", + "#results\n", + "print \"percentage = %.1f percent\"%(mb*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.14 Pg:424" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "partial pressure of water vapor = 0.317 psia\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "\n", + "#Initialization of variables\n", + "ps=0.5069 #psia\n", + "p=20 #psia\n", + "m1=0.01\n", + "m2=1\n", + "M1=18\n", + "M2=29\n", + "#calculations\n", + "xw= (m1/M1)/(m1/M1+m2/M2)\n", + "pw=xw*p\n", + "#results\n", + "print \"partial pressure of water vapor = %.3f psia\"%(pw)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch12.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch12.ipynb new file mode 100644 index 00000000..c7c68649 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch12.ipynb @@ -0,0 +1,402 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 12 Non steady flow friction and availibility" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.1 Pg:482" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Work done in case 1 = 572 Btu\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p1=100 #psia\n", + "p2=14.7 #psia\n", + "k=1.4\n", + "T1=700 #R\n", + "R=10.73/29\n", + "V=50\n", + "cv=0.171\n", + "cp=0.24\n", + "R2=1.986/29\n", + "#calculations\n", + "T2=T1/ (p1/p2)**((k-1)/k)\n", + "m1=p1*V/(R*T1)\n", + "m2=p2*V/(R*T2)\n", + "Wrev= cv*(m1*T1 - m2*T2) - (m1-m2)*(T2)*cp\n", + "#results\n", + "print \"Work done in case 1 = %d Btu\"%(Wrev)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.2 Pg:482" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The friction of the process per pound of air = 18.6 Btu/lbm\n", + "\n", + " Loss of available energy = -16.20 Btu/lbm\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from scipy import log\n", + "#Initialization of variables\n", + "p1=100 #psia\n", + "p2=10 #psia\n", + "n=1.3\n", + "T1=800 #R\n", + "cv=0.172\n", + "R=1.986/29\n", + "T0=537 #R\n", + "cp=0.24\n", + "#calculations\n", + "T2=T1*(p2/p1)**((n-1)/n)\n", + "dwir=cv*(T1-T2)\n", + "dwr=R*(T2-T1)/(1-n)\n", + "dq=dwr-dwir\n", + "dI=-T0*(cp*log(T2/T1) - R*log(p2/p1))\n", + "#results\n", + "print \"The friction of the process per pound of air = %.1f Btu/lbm\"%(dq)\n", + "print \"\\n Loss of available energy = %.2f Btu/lbm\"%(dI)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.3 Pg:483" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Friction = 72.9 ft-lbf/lbm\n", + "\n", + " Available energy loss in case a = -72.9 ft-lbf/lbm\n", + "\n", + " Available energy loss in case b = -145.9 ft-lbf/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "ms=10 #lbm\n", + "den=62.3 #lbm/ft**3\n", + "A1=0.0218 #ft**2\n", + "A2=0.00545 #ft**2\n", + "p2=50 #psia\n", + "p1=100 #psia\n", + "gc=32.2 #ft/s**2\n", + "dz=30 #ft\n", + "T0=537 #R\n", + "T1=620 #R\n", + "T2=420 #R\n", + "#calculations\n", + "V1=ms/(A1*den)\n", + "V2=ms/(A2*den)\n", + "df=-144/den*(p2-p1) - (V2**2 -V1**2)/(2*gc) - dz\n", + "dI=-T0/T1 *df\n", + "dI2= -T0/T2 *df\n", + "#results\n", + "print \"Friction = %.1f ft-lbf/lbm\"%(df)\n", + "print \"\\n Available energy loss in case a = %.1f ft-lbf/lbm\"%(dI)\n", + "print \"\\n Available energy loss in case b = %.1f ft-lbf/lbm\"%(dI2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.4 Pg:484" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From fig 12.4,\n", + "Pressure drop = 0.00 lbf/ft**2 100 ft\n", + "The answer in the textbook is wrong. Please use a calculator to verify it.\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "r=2.5 #in\n", + "mf=160 #cfm\n", + "rho=1/14\n", + "mu=0.0000121\n", + "v=14 #ft**3/lbm\n", + "g=32.2 #ft/s**2\n", + "z=100 #ft\n", + "#calculations\n", + "A=3.14*(r/12)**2\n", + "V=mf/A /60\n", + "Re=(2*r/12)*V*rho/mu\n", + "print \"From fig 12.4,\"\n", + "f=0.0225/4\n", + "dp=4*f*(rho)*(V/v)**2 /(2*g*(2*r/12)) *z\n", + "#dp=2.32\n", + "#results\n", + "print \"Pressure drop = %.2f lbf/ft**2 100 ft\"%(dp)\n", + "print \"The answer in the textbook is wrong. Please use a calculator to verify it.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.5 Pg:485" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass rate of air flow = 161 cfm\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "D=0.0724 #ft\n", + "gc=32.2 #ft/s**2\n", + "rho=1.0/14\n", + "L=100 #ft\n", + "mu2=1.46*10**(-10)\n", + "dp=2.32\n", + "dia=5.0 #in\n", + "rho2=48500.0\n", + "vol=14.0 #ft**3/lbm\n", + "#calculations\n", + "ref=D**3 *2*dp*gc*rho/(mu2*L)\n", + "mf=rho2*pi/4 *(dia/12) *sqrt(mu2)\n", + "mfr=mf*vol*60\n", + "#results\n", + "print \"Mass rate of air flow = %d cfm\"%(mfr)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.6 Pg:486" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loss of available energy = -725 Btu/lbm mixture \n", + "\n", + " Effectiveness of combustion = 0.409 \n" + ] + } + ], + "source": [ + "from math import log\n", + "#Initialization of variables\n", + "cp=0.25\n", + "T=3460 #R\n", + "T0=520 #R\n", + "dG=1228 #Btu/lbm\n", + "#calculations\n", + "hf=cp*(T-T0)-T0*cp*log(T/T0)\n", + "dC=hf-dG\n", + "Ec=hf/dG\n", + "#results\n", + "print \"Loss of available energy = %d Btu/lbm mixture \"%(dC)\n", + "print \"\\n Effectiveness of combustion = %.3f \"%(Ec)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.7 Pg:487" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loss of available energy = -219.3 Btu/lbm mixture \n", + "\n", + " Efficiency of cycle = 0.563 \n", + "\n", + " Effectiveness of overall cycle = 0.23\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "cp1=0.25\n", + "T=3460 #R\n", + "T0=946.2 #R\n", + "T00=520 #R\n", + "dG=1228 #Btu/lbm\n", + "cp=0.45\n", + "#calculations\n", + "dqa=cp1*(T-T0)\n", + "w=cp*dqa\n", + "hf=cp1*(T-T00)-T00*cp1*log(T/T00)\n", + "heat=w-hf\n", + "eff=w/hf\n", + "epower=w/dG\n", + "#results\n", + "print \"Loss of available energy = %.1f Btu/lbm mixture \"%(heat)\n", + "print \"\\n Efficiency of cycle = %.3f \"%(eff)\n", + "print \"\\n Effectiveness of overall cycle = %.2f\"%(epower)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:12.8 Pg:487" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "All the values are obtained from Mollier chart,\n", + "Engine efficiency = 74.3 percent\n", + "\n", + " Effectiveness = 80.8 percent\n", + "\n", + " Loss of available energy = -32.6 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p1=400 #psia\n", + "t1=600 #F\n", + "h1=1306.9 #Btu/lbm\n", + "b1=480.9 #Btu/lbm\n", + "p2=50 #psia\n", + "h2=1122 #Btu/lbm\n", + "h3=1169.5 #Btu/lbm\n", + "b3=310.9 #Btu/lbm\n", + "#calculations\n", + "print \"All the values are obtained from Mollier chart,\"\n", + "dw13=h1-h3\n", + "dw12=h1-h2\n", + "dasf=b3-b1\n", + "etae=dw13/dw12\n", + "eta=abs(dw13/dasf)\n", + "dq=dw13+dasf\n", + "#results\n", + "print \"Engine efficiency = %.1f percent\"%(etae*100)\n", + "print \"\\n Effectiveness = %.1f percent\"%(eta*100)\n", + "print \"\\n Loss of available energy = %.1f Btu/lbm\"%(dq)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch13.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch13.ipynb new file mode 100644 index 00000000..efe4a78b --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch13.ipynb @@ -0,0 +1,798 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13 Fluid flow" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.1 Pg:583" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "velocity in ft/s are:\n", + "0.000000 \t1118.735268 \t1663.871913 \t1791.374302 \t2179.668416 \t2779.331106 \t\n", + "\n", + "Area in ft**2 are:\n", + "0.000000 \t0.006600 \t0.005534 \t0.005495 \t0.005760 \t0.007656 \t\n", + "\n", + "The initial values of velocity and area are 0 and infinity respectively. Since, Infinity in calculations stops the code to display an error. It has been mentioned separately.\n" + ] + } + ], + "source": [ + "from numpy import nditer\n", + "from math import sqrt\n", + "#Initialization of variables\n", + "h1=1329.1 #Btu/lbm\n", + "v1=6.218 #ft**3/lbm\n", + "J=778\n", + "g=32.174\n", + "m=1\n", + "#calculations\n", + "p=[80, 60 ,54.6, 40, 20]\n", + "h=[ 1304.1, 1273.8, 1265 ,1234.2, 1174.8]\n", + "v=[ 7.384, 9.208, 9.844 ,12.554, 21.279]\n", + "Fc=1\n", + "V2=[Fc*sqrt(2*J*g*(h1-hh)) for hh in h]\n", + "A=[m*v1/V21 for v1,V21 in nditer([v,V2])]\n", + "V2=[0]+V2\n", + "A=[0]+A\n", + "#results\n", + "print 'velocity in ft/s are:'\n", + "for vv in V2:\n", + " print '%.6f'%vv,'\\t', \n", + "print '\\n\\nArea in ft**2 are:'\n", + "for aa in A:\n", + " print '%.6f'%aa,'\\t',\n", + "print '\\n\\nThe initial values of velocity and area are 0 and infinity respectively. Since, Infinity in calculations stops the code to display an error. It has been mentioned separately.'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.2 Pg:584" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area required = 0.00464 ft**2\n", + "\n", + " Area in case 2 at the exit= 0.00379 ft**2\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#Initialization of variables\n", + "n=1.4\n", + "p1=50 #psia\n", + "J=778\n", + "cp=0.24\n", + "T1=520 #R\n", + "k=n\n", + "R=1545/29\n", + "m=1\n", + "p2=10 #psia\n", + "#calculations\n", + "rpt=(2/(n+1))**(n/(n-1))\n", + "pt=p1*rpt\n", + "Vtrev=223.77*sqrt(cp*T1*(1- rpt**((k-1)/k)))\n", + "v1=R*T1/p1/144\n", + "vt=v1*(p1/pt)**(1/k)\n", + "At=m*vt/Vtrev\n", + "V2rev=223.77*sqrt(cp*T1*(1-(p2/p1)**((k-1)/k)))\n", + "v2=v1*(p1/p2)**(1/k)\n", + "A2=m*v2/V2rev\n", + "#results\n", + "print \"Area required = %.5f ft**2\"%(At)\n", + "print \"\\n Area in case 2 at the exit= %.5f ft**2\"%(A2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.3 Pg:585" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Throat area= 0.0056 ft**2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "J=778\n", + "g=32.2\n", + "pc=54.6 #psia\n", + "h1=1329.1 #Btu/lbm\n", + "h2=1265 #btu/lbm\n", + "V2rev=1790 #ft/s\n", + "cv=0.99\n", + "m=1 #lbm\n", + "cv2=0.96\n", + "#calculations\n", + "V2d=cv*V2rev\n", + "hd=cv**2 *(h1-h2)\n", + "h2d=h1-hd\n", + "v2d=9.946\n", + "A2d=m*v2d/V2d\n", + "#results\n", + "print \"Throat area= %.4f ft**2\"%(A2d)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.4 Pg:585" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "average velocity = 31.3 ft/sec\n", + "\n", + " mass flow rate = 29.0 lbm/sec\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "zm=0.216\n", + "pm=62.3 #lbm/ft**2\n", + "p1=0.0736 #lbm/ft**2\n", + "g=32.2\n", + "d=4\n", + "#calculations\n", + "H=zm*(pm-p1)/12/p1\n", + "V=sqrt(2*g*H)\n", + "m=pi/4 *d**2 *V*p1\n", + "#results\n", + "print \"average velocity = %.1f ft/sec\"%(V)\n", + "print \"\\n mass flow rate = %.1f lbm/sec\"%(m)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.5 Pg:586" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table B-17,\n", + "Area of throat = 0.00596 ft**2\n", + "\n", + " Area of exit = 0.00805 ft**2\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#Initialization of variables\n", + "p0=50 #psia\n", + "T0=520 #R\n", + "rho0=0.259 #lbm/ft**3\n", + "p2=10 #psia\n", + "mf=1 #lbm\n", + "#calculations\n", + "print \"From table B-17,\"\n", + "pr=0.528\n", + "Tr=0.833\n", + "rhor=0.634\n", + "ps=pr*p0\n", + "Ts=Tr*T0\n", + "rhos=rho0*rhor\n", + "Vs=49.1*sqrt(Ts)\n", + "As=mf/(Vs*rhos)\n", + "p2r=p2/p0\n", + "M2=1.71\n", + "V2=1.487*Vs\n", + "T2=0.632*Ts\n", + "A2=As*1.35\n", + "rho2=rhos*0.317\n", + "#results\n", + "print \"Area of throat = %.5f ft**2\"%(As)\n", + "print \"\\n Area of exit = %.5f ft**2\"%(A2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.6 Pg:587" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Length of pipe = 406.3 ft\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "M1=0.2\n", + "M2=0.4\n", + "D=0.5 #ft\n", + "f=0.015\n", + "#calculations\n", + "f1=14.5\n", + "f2=2.31\n", + "dl=(f1-f2)*D/f\n", + "#results\n", + "print \"Length of pipe = %.1f ft\"%(dl)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.7 Pg:588" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from table B-19\n", + "Change in entropy = 0.0224 Btu/lbm R\n" + ] + } + ], + "source": [ + "from math import log\n", + "#Initialization of variables\n", + "py=20 #psia\n", + "px=3.55 #psia\n", + "R=1.986/29\n", + "#calculations\n", + "pr=py/px\n", + "print \"from table B-19\"\n", + "Mx=2\n", + "My=0.577\n", + "pr2=0.721\n", + "ds=R*log(1/pr2)\n", + "#results\n", + "print \"Change in entropy = %.4f Btu/lbm R\"%(ds)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.8 Pg:588" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table B-18 and B-17,\n", + "Mach numbers before and after are 1.64 and 0.658 respectively\n", + "\n", + " Pressure before and after are 11.0 psia and 32.9 psia\n", + "\n", + " Exhaust pressure = 32.3 psia\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "pi=50 #psia\n", + "pe=34.6 #psia\n", + "#calculations\n", + "print \"From table B-18 and B-17,\"\n", + "pr1=1.35\n", + "p0f=pi/pr1\n", + "pfs=0.528*p0f\n", + "per=pe/pfs\n", + "Me=0.6\n", + "p0e=1.19\n", + "pyx=p0e/pr1\n", + "Mx=1.64\n", + "My=0.658\n", + "px=0.22*pi\n", + "py=32.9 #psia\n", + "p2yx=0.852\n", + "pe2=1.65*pfs\n", + "#results\n", + "print \"Mach numbers before and after are %.2f and %.3f respectively\"%(Mx,My)\n", + "print \"\\n Pressure before and after are %.1f psia and %.1f psia\"%(px,py)\n", + "print \"\\n Exhaust pressure = %.1f psia\"%(pe2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.9 Pg:589" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table B-20\n", + "Heat required = 272 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "T1=550 #R\n", + "T2=2660 #R\n", + "ts1=0.207\n", + "ts2=0.833\n", + "cp=0.24\n", + "#calculations\n", + "Ts=T1/ts1\n", + "Ts0=T2/ts2\n", + "print \"From table B-20\"\n", + "tr1=0.529\n", + "tr2=0.174\n", + "dq=cp*Ts0*(tr1-tr2)\n", + "#results\n", + "print \"Heat required = %d Btu/lbm\"%(dq)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.10 Pg:590" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Internal thrust = 3651 lbf\n", + "\n", + " Net thrust = 2593 lbf\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "M1=0.5\n", + "M2=1\n", + "A1=0.5 #ft**2\n", + "A2=1 #ft**2\n", + "p1=14.7 #psia\n", + "p2=14.7 #psia\n", + "k=1.4\n", + "#calculations\n", + "thru=p2*144*A2*(1+k*M2**2)-p1*144*A1*(1+k*M1**2)\n", + "net=thru-p1*144*(A2-A1)\n", + "#results\n", + "print \"Internal thrust = %d lbf\"%(thru)\n", + "print \"\\n Net thrust = %d lbf\"%(net)\n", + "print \"The answers are a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.11 Pg:590" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mass flow rate = 0.572 lbm/sec\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "p1=50 #psia\n", + "pr=0.58\n", + "#calculations\n", + "p=p1*pr\n", + "s1=1.6585\n", + "h1=1174.1 #Btu/lbm\n", + "sf=0.3680\n", + "sfg=1.3313\n", + "hfg=945.3\n", + "vg=13.746\n", + "hf=218.82\n", + "x= (s1-sf)/sfg\n", + "v2=vg*x\n", + "h2=hf+x*hfg\n", + "V2rev=223.77*sqrt(h1-h2)\n", + "m=pi/4 *1/144 *V2rev/v2\n", + "#results\n", + "print \"mass flow rate = %.3f lbm/sec\"%(m)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.12 Pg:591" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass flow rate = 0.597 lbm/sec\n", + "\n", + " Meta stable under cooling = 52 F\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "k=1.31\n", + "p1=7200 #lbf/ft**2\n", + "v1=8.515 #ft**3/lbm\n", + "pr=0.6\n", + "m1=0.574\n", + "T1=741 #R\n", + "#calculations\n", + "V2rev=8.02*sqrt(k/(k-1) *p1*v1*(1- (pr)**((k-1)/k)))\n", + "v2=v1*(1/pr)**(1/k)\n", + "m=pi/4 *1/144 *V2rev/v2\n", + "C=m/m1\n", + "T2=T1*(0.887)\n", + "t=250+460 #R\n", + "dt=t-T2\n", + "#results\n", + "print \"Mass flow rate = %.3f lbm/sec\"%(m)\n", + "print \"\\n Meta stable under cooling = %d F\"%(dt)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.13 Pg:592" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area = 1.344 in**2\n", + "\n", + " diameter = 1.31 in\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "C=0.98\n", + "m=1\n", + "v=12.55 #ft**3/lbm\n", + "V=1372 #ft/s\n", + "#calculations\n", + "A=m*v/(C*V) *144\n", + "D=sqrt(A*4/pi)\n", + "#results\n", + "print \"Area = %.3f in**2\"%(A)\n", + "print \"\\n diameter = %.2f in\"%(D)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.14 Pg:593" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area = 0.92 in**2\n", + "\n", + " diameter = 1.080 in\n" + ] + } + ], + "source": [ + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "nn=0.95\n", + "p1=50 #psia\n", + "p2=30 #psia\n", + "v1=8.515\n", + "m=1 #lbm\n", + "#calculations\n", + "cv=sqrt(nn)\n", + "V2rev=1372\n", + "V2act=cv*V2rev\n", + "n=1.283\n", + "v2=v1*(p1/p2)**(1/n)\n", + "A=m*v2/V2act *144\n", + "D=sqrt(A*4/pi)\n", + "#results\n", + "print \"Area = %.2f in**2\"%(A)\n", + "print \"\\n diameter = %.3f in\"%(D)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.15 Pg:593" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Coefficient of discharge = 0.991 \n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "dFf=110.5 #ft-lbf/lbm\n", + "Vd=1028 #ft/s\n", + "gc=32.2 #ft/s**2\n", + "p0=100 #psia\n", + "k=1.4\n", + "v0=2.08\n", + "p1=55 #psia\n", + "p2=99.2 #psia\n", + "#calculations\n", + "dFe=0.01*Vd**2 /(2*gc)\n", + "dF=dFf+dFe\n", + "V2ig=(p0*144)**(1/k) *v0/(1-1/k) *((p1*144)**(1-1/k) -(p2*144)**(1-1/k))\n", + "C2=(V2ig+dF)/V2ig\n", + "C=sqrt(C2)\n", + "#results\n", + "print \"Coefficient of discharge = %.3f \"%(C)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.16 Pg:594" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Pressure drop in the nozzle = 3.60 lbf/ft**2\n", + "\n", + " Coefficient of discharge = 0.982 \n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from math import pi,sqrt\n", + "#Initialization of variables\n", + "dL=1/6 #ft\n", + "mf=0.430 #lbm/sec\n", + "rho=62.4 \n", + "gc=32.2 #ft/s**2\n", + "d=0.81/12 #ft\n", + "#calculations\n", + "V=mf*4/(rho*pi)\n", + "VD=V/dL**2\n", + "Vd=1.92 #ft/s\n", + "dFf=0.031/(2*gc) *2.31\n", + "dFe=0.04*Vd**2 /(2*gc)\n", + "dF=dFf+dFe\n", + "dp=rho*(3.5/(2*gc) +dF)\n", + "vd22=(2*gc)/rho *dp /(1-(d/dL)**4)\n", + "vd2=sqrt(vd22)\n", + "C=Vd/vd2\n", + "#results\n", + "print \"Pressure drop in the nozzle = %.2f lbf/ft**2\"%(dp)\n", + "print \"\\n Coefficient of discharge = %.3f \"%(C)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.17 Pg:595" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "mass flow rate = 1.176 lbm/sec\n", + "\n", + " Coefficient of discharge = 0.598\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "K=0.6003\n", + "Y1=0.91\n", + "D1=6.065\n", + "D2=1.820\n", + "rho1=0.156\n", + "p1=30\n", + "p2=20.18\n", + "#calculations\n", + "bet=D2/D1\n", + "m=0.525*K*Y1 *D2**2 *sqrt(rho1*(p1-p2))\n", + "C=K*sqrt(1-bet**4)\n", + "#results\n", + "print \"mass flow rate = %.3f lbm/sec\"%(m)\n", + "print \"\\n Coefficient of discharge = %.3f\"%(C)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch14.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch14.ipynb new file mode 100644 index 00000000..51e36300 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch14.ipynb @@ -0,0 +1,602 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 14 Psychrometrics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.1 Pg:659" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from steam tables,\n", + "part a\n", + "partial pressure of water = 0.15207 psia\n", + "\n", + " dew temperature = 46 F\n", + "part b\n", + "density of water = 0.000474 lbm/ft**3\n", + "\n", + " in case 2, density of water = 0.000474 lbm/ft**3\n", + "\n", + " density of air = 0.072765 lbm/ft**3\n", + "part c\n", + "specific humidity = 0.0065 lbm steam/lbm air\n", + "part d\n", + "In method 1, Degree of saturation = 0.293\n", + "\n", + " In method 2, Degree of saturation = 0.293\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "t1=80+460 #R\n", + "ps=0.5069 #psia\n", + "print \"from steam tables,\"\n", + "vs=633.1 #ft**3/lbm\n", + "phi=0.3\n", + "R=85.6\n", + "Ra=53.3\n", + "p=14.696\n", + "#calculations\n", + "tdew=46 #F\n", + "pw=phi*ps\n", + "rhos=1/vs\n", + "rhow=phi*rhos\n", + "rhow2= pw*144/(R*t1)\n", + "pa=p-pw\n", + "rhoa= pa*144/(Ra*t1)\n", + "w=rhow/rhoa\n", + "mu=phi*(p-ps)/(p-pw)\n", + "Ws=0.622*(ps/(p-ps))\n", + "mu2=w/Ws\n", + "#results\n", + "print \"part a\"\n", + "print \"partial pressure of water = %.5f psia\"%(pw)\n", + "print \"\\n dew temperature = %d F\"%(tdew)\n", + "print \"part b\"\n", + "print \"density of water = %.6f lbm/ft**3\"%(rhow)\n", + "print \"\\n in case 2, density of water = %.6f lbm/ft**3\"%(rhow2)\n", + "print \"\\n density of air = %.6f lbm/ft**3\"%(rhoa)\n", + "print \"part c\"\n", + "print \"specific humidity = %.4f lbm steam/lbm air\"%(w)\n", + "print \"part d\"\n", + "print \"In method 1, Degree of saturation = %.3f\"%(mu)\n", + "print \"\\n In method 2, Degree of saturation = %.3f\"%(mu2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.2 Pg:659" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "change in moisture content = 0.008857 lbm water/lbm dry air\n", + "\n", + " in grains, change = 62.00 grains water/lbm dry air\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p=14.696 #psia\n", + "ps=0.0808 #psia\n", + "ps2=0.5069 #psia\n", + "phi2=0.5\n", + "phi=0.6\n", + "grain=7000\n", + "#calculations\n", + "pw=phi*ps\n", + "w1=0.622*pw/(p-pw)\n", + "pw2=phi2*ps2\n", + "w2=0.622*pw2/(p-pw2)\n", + "dw=w2-w1\n", + "dwg=dw*grain\n", + "#results\n", + "print \"change in moisture content = %.6f lbm water/lbm dry air\"%(dw)\n", + "print \"\\n in grains, change = %.2f grains water/lbm dry air\"%(dwg)\n", + "print \"The answers are a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.3 Pg:660" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From steam tables,\n", + "\n", + " humidity ratio = 0.0064 lbm/lbm dry air\n", + "\n", + " relative humidity = 29.7 percent\n", + "\n", + " Dew point = 46 F\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "t1=80 #F\n", + "t2=60 #F\n", + "p=14.696 #psia\n", + "ps=0.507 #psia\n", + "pss=0.256 #psia\n", + "cp=0.24\n", + "print \"From steam tables,\"\n", + "#calculations\n", + "ws=0.622*pss/(p-pss)\n", + "w=(cp*(t2-t1) + ws*1060)/(1060+ 0.45*(t1-t2))\n", + "pw=w*p/(0.622+w)\n", + "phi=pw/ps\n", + "td=46 #F\n", + "#results\n", + "print \"\\n humidity ratio = %.4f lbm/lbm dry air\"%(w)\n", + "print \"\\n relative humidity = %.1f percent\"%(phi*100)\n", + "print \"\\n Dew point = %d F\"%(td)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.4 Pg:661" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In case 1, enthalpy = 26.32 Btu/lbm dry air\n", + "\n", + " In case 1, sigma function = 26.14 Btu/lbm dry air\n", + "\n", + " In case 2, enthalpy = 26.47 Btu/lbm dry air\n", + "\n", + " In case 2, sigma function = 26.15 Btu/lbm dry air\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "W=0.0065 #lbm/lbm of dry air\n", + "t=80 #F\n", + "td=60 #F\n", + "#calculations\n", + "H=0.24*t+W*(1060+0.45*t)\n", + "sig=H-W*(td-32)\n", + "Ws=0.0111\n", + "H2=0.24*td+Ws*(1060+0.45*td)\n", + "sig2=H2-Ws*(td-32)\n", + "#results\n", + "print \"In case 1, enthalpy = %.2f Btu/lbm dry air\"%(H)\n", + "print \"\\n In case 1, sigma function = %.2f Btu/lbm dry air\"%(sig)\n", + "print \"\\n In case 2, enthalpy = %.2f Btu/lbm dry air\"%(H2)\n", + "print \"\\n In case 2, sigma function = %.2f Btu/lbm dry air\"%(sig2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.5 Pg:662" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In case 1, Enthalpy = 9.41 Btu/lbm dry air\n", + "\n", + " In case 2, Enthalpy = 31.15 Btu/lbm dry air\n", + "\n", + " Heat added = 21.49 Btu/lbm dry air\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "t1=30 #F\n", + "t2=60 #F\n", + "t3=80 #F\n", + "W1=0.00206\n", + "W2=0.01090\n", + "#calculations\n", + "cm1=0.24+0.45*W1\n", + "H1=cm1*t1+W1*1060\n", + "cm2=0.24+0.45*W2\n", + "H2=cm2*t3+W2*1060\n", + "hf=t2-32\n", + "dq=H2-H1-(W2-W1)*hf\n", + "#results\n", + "print \"In case 1, Enthalpy = %.2f Btu/lbm dry air\"%(H1)\n", + "print \"\\n In case 2, Enthalpy = %.2f Btu/lbm dry air\"%(H2)\n", + "print \"\\n Heat added = %.2f Btu/lbm dry air\"%(dq)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.6 Pg:663" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "using psychrometric charts,\n", + "part a\n", + "partial pressure of water = 0.15 psia\n", + "\n", + " dew temperature = 46 F\n", + "part b\n", + "density of water = 0.000000 lbm/ft**3\n", + "\n", + " density of air = 0.0728 lbm/ft**3\n", + "part c\n", + "specific humidity = 0.00657 lbm water/lbm air\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "pw=0.15#psia\n", + "print \"using psychrometric charts,\"\n", + "tdew=46 #F\n", + "#calculations\n", + "va=13.74 #ft**3/lbm dry air\n", + "rhoa=1/va\n", + "V=13.74\n", + "mw=46/7000\n", + "rhow=mw/V\n", + "w=0.00657\n", + "#results\n", + "print \"part a\"\n", + "print \"partial pressure of water = %.2f psia\"%(pw)\n", + "print \"\\n dew temperature = %d F\"%(tdew)\n", + "print \"part b\"\n", + "print \"density of water = %.6f lbm/ft**3\"%(rhow)\n", + "print \"\\n density of air = %.4f lbm/ft**3\"%(rhoa)\n", + "print \"part c\"\n", + "print \"specific humidity = %.5f lbm water/lbm air\"%(w)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.7 Pg:664" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From humidity charts,\n", + "Enthalpy change = 21.53 Btu/lbm dry air\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "W1=0.00206 #lbm/lbm dry air\n", + "W2=0.01090 #lbm/lbm dry air\n", + "t=60 #F\n", + "print \"From humidity charts,\"\n", + "#calculations\n", + "dw=W1-W2\n", + "hs=144.4\n", + "hs2=66.8-32\n", + "w1=14.4 #Btu/lbm\n", + "ws1=20 #Btu/lbm\n", + "w2=76.3 #Btu/lbm\n", + "ws2=98.5 #Btu/lbm\n", + "dwh1=-(w1-ws1)/7000 *hs\n", + "H1=9.3+dwh1\n", + "dwh2=(w2-ws2)/7000 *hs2\n", + "H2=31.3+dwh2\n", + "dwc=dw*(t-32)\n", + "dq=H2-H1+dwc\n", + "#results\n", + "print \"Enthalpy change = %.2f Btu/lbm dry air\"%(dq)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.8 Pg:665" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From psychrometric charts at 50 F and 80 F,\n", + "The two initial states have been multiplied by 108/262 and distance 2-3 is located\n", + "humidity = 0.83 \n", + "\n", + " Temperature = 62.5 F\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "print \"From psychrometric charts at 50 F and 80 F,\"\n", + "va1=13 #ft**3/lbm dry air\n", + "va2=13.88 #ft**3/lbm dry air\n", + "flow=2000 #cfm\n", + "#calculations\n", + "ma1= flow/va1\n", + "ma2=flow/va2\n", + "print \"The two initial states have been multiplied by 108/262 and distance 2-3 is located\"\n", + "t=62.5# F\n", + "phi=0.83 #percent\n", + "#results\n", + "print \"humidity = %.2f \"%(phi)\n", + "print \"\\n Temperature = %.1f F\"%(t)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.9 Pg:666" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from psychrometric charts,\n", + "Dry bulb temperature = 71.76 F\n", + "\n", + " percent humidity = 0.80\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "t=90 #F\n", + "ts=67.2 #F\n", + "phi=0.3\n", + "per=0.8\n", + "#calculations\n", + "dep=t-ts\n", + "dt=dep*per\n", + "tf=t-dt\n", + "print \"from psychrometric charts,\"\n", + "phi2=0.8\n", + "#results\n", + "print \"Dry bulb temperature = %.2f F\"%(tf)\n", + "print \"\\n percent humidity = %.2f\"%(phi2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.10 Pg:667" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From psychrometric charts,\n", + "cooling range = 25 F\n", + "\n", + " Approach = 10 F\n", + "\n", + " amount of water cooled per pound of dry air = 1.216 lbm dry air/lbm dry air\n", + "\n", + " percentage of water lost by evaporation = 2.12 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m=1 #lbm\n", + "t1=100 #F\n", + "t2=75 #F\n", + "db=65 #F\n", + "print \"From psychrometric charts,\"\n", + "t11=82 #F\n", + "phi1=0.4\n", + "H1=30 #Btu/lbm dry air\n", + "w1=65 #grains/lbm dry air\n", + "w2=250 #grains/lbm dry air\n", + "#calculations\n", + "cr=t1-t2\n", + "appr=t2-db\n", + "dmf3=(w2-w1)*0.0001427\n", + "hf3=68\n", + "hf4=43\n", + "H2=62.2\n", + "H1=30\n", + "mf4= (H1-H2+ dmf3*hf3)/(hf4-hf3)\n", + "per=dmf3/(dmf3+mf4)\n", + "#results\n", + "print \"cooling range = %d F\"%(cr)\n", + "print \"\\n Approach = %d F\"%(appr)\n", + "print \"\\n amount of water cooled per pound of dry air = %.3f lbm dry air/lbm dry air\"%(mf4)\n", + "print \"\\n percentage of water lost by evaporation = %.2f percent\"%(per*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.11 Pg:668" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "flow rate of air = 449820 lbm/hr.It is equal to 99960 cfm\n", + "\n", + " Total heat transferred = 13494600 Btu/hr\n", + "\n", + " Enthalpy = 30.0 Btu/lbm dry air\n", + "\n", + " Using second method, Enthalpy = 30.0 Btu/lbm\n", + "\n", + " Performance factor = 3.309 \n", + "\n", + " logrithamic mean enthalpy difference = 2.48 . Estimated low percentage = 25 low\n", + "The answers are a bit different due to rounding off error in textbook.\n" + ] + } + ], + "source": [ + "from math import log\n", + "#Initialization of variables\n", + "mfr=1\n", + "water=900 #gallons\n", + "t2=110 #F\n", + "t1=80 #F\n", + "cp1=1\n", + "#calculations\n", + "mfa=mfr*water*8.33*60\n", + "mfc=mfa/(60*0.075)\n", + "qa=mfa*(t2-t1)\n", + "dH=qa/(mfc*4.5)\n", + "dH2=mfr*cp1*(t2-t1)\n", + "H1=23.73\n", + "H2=5.08\n", + "f=3.309\n", + "lnmean=(H1-H2)/log(H1/H2)\n", + "dtt=(t2-t1)/lnmean\n", + "per=25\n", + "#results\n", + "print \"flow rate of air = %d lbm/hr.It is equal to %d cfm\"%(mfa,mfc)\n", + "print \"\\n Total heat transferred = %d Btu/hr\"%(qa)\n", + "print \"\\n Enthalpy = %.1f Btu/lbm dry air\"%(dH)\n", + "print \"\\n Using second method, Enthalpy = %.1f Btu/lbm\"%(dH2)\n", + "print \"\\n Performance factor = %.3f \"%(f)\n", + "print \"\\n logrithamic mean enthalpy difference = %.2f . Estimated low percentage = %d low\"%(dtt,per)\n", + "print \"The answers are a bit different due to rounding off error in textbook.\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch15.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch15.ipynb new file mode 100644 index 00000000..0309850b --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch15.ipynb @@ -0,0 +1,349 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15 Vapor cycle and processes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.1 Pg:697" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from steam tables,\n", + "Thermal efficiency = 45 percent\n", + "\n", + " Furnace efficiency = 33.8 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p1=600 #psia\n", + "p2=0.2563 #psia\n", + "t1=486.21 #F\n", + "t2=60 #F\n", + "fur=0.75\n", + "#calculations\n", + "print \"from steam tables,\"\n", + "h1=1203.2\n", + "hf1=471.6\n", + "hfg1=731.6\n", + "h2=1088\n", + "hf2=28.06\n", + "hfg2=1059.9\n", + "s1=1.4454\n", + "sf1=0.6720\n", + "sfg1=0.7734\n", + "s2=2.0948\n", + "sf2=0.0555\n", + "sfg2=2.0393\n", + "xd=(s1-sf2)/sfg2\n", + "hd=hf2+xd*hfg2\n", + "xa=0.3023\n", + "ha=hf2+xa*hfg2\n", + "wbc=0\n", + "wda=0\n", + "wcd=h1-hd\n", + "wab=ha-hf1\n", + "W=wab+wcd+wbc+wda\n", + "Wrev=hfg1- (t2+459.7)*sfg1\n", + "etat=(t1-t2)/(t1+459.7)\n", + "eta=fur*etat\n", + "#results\n", + "print \"Thermal efficiency = %d percent\"%(etat*100)\n", + "print \"\\n Furnace efficiency = %.1f percent\"%(eta*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.2 Pg:698" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Thermal efficiency = 22.8 percent\n", + "\n", + " Overall efficiency = 17.1 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "dhab=-123.1\n", + "etac=0.5\n", + "ha=348.5\n", + "etaf=0.75\n", + "eta=0.85\n", + "hf=471.6\n", + "hfg=731.6\n", + "hc=1203.2\n", + "dhcd=452.7\n", + "#calculations\n", + "dwabs=dhab/etac\n", + "hbd=ha-dwabs\n", + "dwcds=dhcd*eta\n", + "dqa=hc-hbd\n", + "etat=(dwcds+dwabs)/dqa\n", + "eta=etat*etaf\n", + "#results\n", + "print \"Thermal efficiency = %.1f percent\"%(etat*100)\n", + "print \"\\n Overall efficiency = %.1f percent\"%(eta*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.3 Pg:699" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From steam tables,\n", + "Thermal efficiency = 38.4 percent\n", + "\n", + " Overall efficiency = 32.7 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "t=60 #F\n", + "J=778.16\n", + "p1=600 #psia\n", + "p2=0.2563 #psia\n", + "etaf=0.85 \n", + "#calculations\n", + "print \"From steam tables,\"\n", + "vf=0.01604 #ft**3/lbm\n", + "dw=-vf*(p1-p2)*144/J\n", + "ha=28.06 #Btu/lbm\n", + "hb=29.84 #Btu/lbm\n", + "hd=1203.2 #Btu/lbm\n", + "he=750.5 #Btu/lbm\n", + "dqa=hd-hb\n", + "dqr=ha-he\n", + "dw=dqa+dqr\n", + "dwturb=hd-he\n", + "dwpump=ha-hb\n", + "etat=dw/dqa\n", + "eta=etat*etaf\n", + "#results\n", + "print \"Thermal efficiency = %.1f percent\"%(etat*100)\n", + "print \"\\n Overall efficiency = %.1f percent\"%(eta*100)\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.4 Pg:699" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Thermal efficiency = 32.5 percent\n", + "\n", + " Overall efficiency = 27.7 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "dhab=-1.78\n", + "etac=0.5\n", + "ha=28.06\n", + "eta=0.85\n", + "hf=471.6\n", + "hfg=731.6\n", + "hd=1203.2\n", + "dhcd=452.7\n", + "#calculations\n", + "dwabs=dhab/etac\n", + "hbd=ha-dwabs\n", + "dwcds=dhcd*eta\n", + "dqa=hd-hbd\n", + "etat=(dwcds+dwabs)/dqa\n", + "eta=etat*eta\n", + "#results\n", + "print \"Thermal efficiency = %.1f percent\"%(etat*100)\n", + "print \"\\n Overall efficiency = %.1f percent\"%(eta*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.5 Pg:700" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Thermal efficiency in case 1= 46.5 percent\n", + "\n", + " Thermal efficiency in case 1= 40.9 percent\n", + "\n", + " High pressure work = 187.8 Btu/lbm\n", + "\n", + " Low pressure work = 451.5 Btu/lbm\n", + "\n", + " Net work = 639.3 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "sh=1.6070\n", + "ph=94.8 #psia\n", + "th=324 #F\n", + "tr=60 #F\n", + "hh=1186.2 \n", + "pi=94.8 #psia\n", + "hi=1399.5\n", + "si=1.8265\n", + "#calculations\n", + "Q=hi-hh\n", + "Hr=-(tr+459.7)*(si-sh)\n", + "work= Q+Hr\n", + "eff=work/Q\n", + "Qa1=1557.5\n", + "W1=637.1 \n", + "etat=W1/Qa1\n", + "he=1374\n", + "hj=948\n", + "Whp=he-hh\n", + "Wlp=hi-hj\n", + "Wnet=Whp+Wlp\n", + "#results\n", + "print \"Thermal efficiency in case 1= %.1f percent\"%(eff*100)\n", + "print \"\\n Thermal efficiency in case 1= %.1f percent\"%(etat*100)\n", + "print \"\\n High pressure work = %.1f Btu/lbm\"%(Whp)\n", + "print \"\\n Low pressure work = %.1f Btu/lbm\"%(Wlp)\n", + "print \"\\n Net work = %.1f Btu/lbm\"%(Wnet)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.6 Pg:701" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "thermal efficiency = 42.6 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p2=600 #psia\n", + "p1=44 #psia\n", + "te=486.21 #F\n", + "tb=273.1 #F\n", + "J=778.16\n", + "p3=0.25 #psia\n", + "#calculations\n", + "hc=241.9\n", + "hj=834.6\n", + "y=1-0.805\n", + "v1=0.0172\n", + "v2=0.016\n", + "ha=28.06\n", + "hd=hc+v1*(p2-p1)*144/J\n", + "hb=ha+v2*(p1-p3)*144/J\n", + "hh=1374\n", + "Qa=hh-hd\n", + "Qr=(ha-hj)*(1-y)\n", + "etat=(Qa+Qr)/Qa\n", + "#results\n", + "print \"thermal efficiency = %.1f percent\"%(etat*100)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb new file mode 100644 index 00000000..5fcd8569 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb @@ -0,0 +1,797 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 Combustion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.1 Pg:738" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Molecule is C7 H17\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "per=85\n", + "#calculations\n", + "a=per/12\n", + "b=100-per\n", + "ad=1.13*a\n", + "bd=1.13*b\n", + "#results\n", + "print \"Molecule is C%d H%d\"%(ad,bd+1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.2 Pg:738" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Oxygen = 8.74 and Nitrogen = 32.90\n", + "\n", + "Equation is C7.333 H6 + 8.74 O2 + 32.85 N2 = 7.333 CO2 + 3 H2O + 0.03120 SO2 + 32.90 N2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "per=0.071 #mass fraction of nitrogen\n", + "#calculations\n", + "O2=8.74\n", + "N2=per/2 + 3.76*O2\n", + "Nin=32.85\n", + "CO2=7.333\n", + "H2o=3\n", + "So2=0.0312\n", + "#results\n", + "print \"Oxygen = %.2f and Nitrogen = %.2f\"%(O2,N2)\n", + "print \"\\nEquation is C%.3f H%d + %.2f O2 + %.2f N2 = %.3f CO2 + %d H2O + %.5f SO2 + %.2f N2\"%(CO2,2*H2o,O2,Nin,CO2,H2o,So2,N2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.3 Pg:739" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 12.06 lbm air/lbm fuel\n", + "\n", + "In dry air, Air-fuel ratio = 9.9 lbm air/lbm fuel as fired\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "M=29\n", + "m1=8.74\n", + "m2=32.85\n", + "fuel=100 #lbm\n", + "#calculations\n", + "mass=M*(m1+m2)\n", + "AF=mass/fuel\n", + "a2=9.75\n", + "b2=12.19\n", + "AF2=mass/(fuel+a2+b2)\n", + "#results\n", + "print \"Air fuel ratio = %.2f lbm air/lbm fuel\"%(AF)\n", + "print \"\\nIn dry air, Air-fuel ratio = %.1f lbm air/lbm fuel as fired\"%(AF2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.4 Pg:740" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass of dry flue gases = 12.50 lbm dry flue gas/lbm fuel ash and moisture free\n", + "\n", + " Mass of dry flue gases = 10.25 lbm dry flue gas/lbm fuel as fired \n", + "\n", + " Energy carried away = 187079.8 btu/mol coal as fired which is same as = 1534.2 Btu/lbm mol coal \n", + "The answers are a bit different due to rounding off errors in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m1=322.3 #Mass of Co2\n", + "m2=2 #Mass of SO2\n", + "m3=926 #Mass of N2\n", + "basis=121.94 #Basis taken\n", + "#calculations\n", + "m=m1+m2+m3\n", + "ratio=m/basis\n", + "dh=5777 #Btu/mol\n", + "h1=dh*7.364\n", + "h2=14037\n", + "h3=130501\n", + "H=h1+h2+h3\n", + "hrat=H/basis\n", + "#results\n", + "print \"Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel ash and moisture free\"%(m/100)\n", + "print \"\\n Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel as fired \"%(ratio)\n", + "print \"\\n Energy carried away = %.1f btu/mol coal as fired which is same as = %.1f Btu/lbm mol coal \"%(H, hrat)\n", + "print \"The answers are a bit different due to rounding off errors in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.6 Pg:741" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Final orsat composition is 1 CO2 + 0.22 H20 + 7.52 N2\n", + "\n", + " Percentage of co2 on a wet basis = 11.4 percent\n", + "\n", + " percentage of co2 on a dry basis = 11.74 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p=14.7 #psia\n", + "ps=0.363 #psia\n", + "n2=7.52 #moles\n", + "n1=1 #moles\n", + "#calculations\n", + "x= (n1+n2)*ps/p /(1-ps/p)\n", + "n=n1+n2+x\n", + "y1=n1/n\n", + "y2=n1/(n1+n2)\n", + "#results\n", + "print \"Final orsat composition is %d CO2 + %.2f H20 + %.2f N2\"%(n1, x, n2)\n", + "print \"\\n Percentage of co2 on a wet basis = %.1f percent\"%(y1*100)\n", + "print \"\\n percentage of co2 on a dry basis = %.2f percent\"%(y2*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.7 Pg:742" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.3 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N2=78.1\n", + "M=29\n", + "co2=8.7\n", + "co=8.9\n", + "x4=0.3\n", + "x5=3.7\n", + "x6=14.7\n", + "#calculations\n", + "O2=N2/3.76\n", + "Z=(co2+co+x4)/8\n", + "AF=(O2+N2)*M/(Z*113)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.8 Pg:743" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 10.2 lbm air/lbm fuel as fired\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "basis=100 #lbm\n", + "x1=0.6\n", + "ash=12 #lbm\n", + "N2=79.7\n", + "M=29\n", + "#calculations\n", + "x=ash/x1\n", + "C=(1-x1)*x\n", + "O2=N2/3.76\n", + "a= (14.6+0.2)/(5.83-0.66)\n", + "AF=(O2+N2)*M/(a*100)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel as fired\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.9 Pg:744" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.4 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N2=78.1 #Moles of Nitrogen\n", + "M=29 #Molar mass of Air\n", + "ba=2.12 #Basis\n", + "x4=0.3 #Moles of Ch4\n", + "x5=3.7 #Moles of H2\n", + "x6=14.7 #moles of H2o\n", + "#calculations\n", + "O2=N2/3.76\n", + "O2=N2/3.76\n", + "Z=(x4*4+x5*2+x6*2)/17\n", + "AF=(O2+N2)*M/(Z*113)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.10 Pg:745" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.3 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N2=78.1 #Moles of Nitrogen\n", + "M=29 #Molar mass of Air\n", + "ba=2.12 #Basis\n", + "x4=0.3 #Moles of Ch4\n", + "x5=3.7 #Moles of H2\n", + "x6=14.7 #moles of H2o\n", + "#calculations\n", + "O2=N2/3.76\n", + "c=14.7\n", + "b= x4*4 + x5*2 + x6*2\n", + "a=b/ba\n", + "AF=(O2+N2)*M/(a*12 + b)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.11 Pg:746" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.3 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "co2=8.7 #Moles of CO2\n", + "co=8.9 #Moles of CO\n", + "N2=78.1 #Moles of Nitrogen\n", + "M=29 #Molar mass of Air\n", + "ba=2.12 #Basis\n", + "x4=0.3 #Moles of Ch4\n", + "x5=3.7 #Moles of H2\n", + "x6=14.7 #moles of H2o\n", + "#calculations\n", + "O2=N2/3.76\n", + "c=14.7\n", + "Z=2.238\n", + "X=(Z*17-x4*4-x5*2)/2\n", + "a=co2+co/2+x4+x6/2\n", + "b=3.764*a\n", + "AF=(O2+N2)*M/(Z*113)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.12 Pg:747" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.37\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "x1=8.7 #Moles of Co2\n", + "x2=8.9 #Moles of CO\n", + "x3=0.3 #Moles of O2\n", + "N=78.1 #Moles of N2\n", + "z=113 #Af factor\n", + "M=29 #Molar mass of air\n", + "#calculations\n", + "co2=(x1+x2+x3)*100/(N+x1+x2+x3)\n", + "a=2.325\n", + "AF=103*M/(a*z)\n", + "#results\n", + "print \"Air fuel ratio = %.2f\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.13 Pg:748" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nitrogen = 87.1 percent\n", + "\n", + "Equation is a(96 CH4 + 3 H2+ 1 CO) + 87.1/3.76 O2 + 87.1 N2 = 10.8 CO2 + 1.2 CO + 0.6 H2 + 0.3 CH4 + 87.1 N2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "co=1.2 #Moles of CO\n", + "co2=10.8 #Moles of CO2\n", + "#calculations\n", + "H2=co/2\n", + "ch4=0.3\n", + "N2=88-H2-ch4\n", + "#results\n", + "print \"Nitrogen = %.1f percent\"%(N2)\n", + "print \"\\nEquation is a(96 CH4 + 3 H2+ 1 CO) + %.1f/3.76 O2 + %.1f N2 = %.1f CO2 + %.1f CO + %.1f H2 + %.1f CH4 + %.1f N2\"%(N2,N2,co2,co,H2,ch4,N2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.14 Pg:748" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Higher heating value = -2363996 Btu\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "dH=-2369859 #Btu\n", + "r=1.986 #Gas constant\n", + "dn=5.5 #Change in number of moles\n", + "T=536.7 #R\n", + "#calculations\n", + "dQ=dH+dn*r*T\n", + "#results\n", + "print \"Higher heating value = %d Btu\"%(dQ)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.15 Pg:749" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from steam tables,\n", + "Lower heating value = -2203398 Btu/lbm\n", + "The answers are a bit different due to rounding off error in textbook.\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "M2=18 #Molar mass of water\n", + "M=170 #Molar mass of octane\n", + "p=0.4593 #Pressure of octane #psia\n", + "print \"from steam tables,\"\n", + "vfg=694.9 \n", + "J=778.2\n", + "m=9*18 #Mass of water\n", + "u1=-2363996 #Btu\n", + "#calculations\n", + "hfg=1050.4 #Btu/lbm\n", + "ufg= hfg- p*vfg*144/J\n", + "dU=ufg*m \n", + "Lhv=u1+dU\n", + "#results\n", + "print \"Lower heating value = %d Btu/lbm\"%(Lhv)\n", + "print \"The answers are a bit different due to rounding off error in textbook.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.16 Pg:750" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From Table B-10,\n", + "Heat of reaction = -2202154 Btu\n", + "The answers are a bit different due to rounding off error in textbook.\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "n1=8 #Moles of CO2\n", + "n2=9 #Moles of H2O\n", + "n3=1 #Moles of Octane\n", + "n4=12.5 #Moles of Oxygen\n", + "print \"From Table B-10,\"\n", + "U11=3852 #Internal energy at 1000 R of CO2\n", + "U12=115 #Internal energy at 537 R of CO2\n", + "U21=3009 #Internal energy at 1000 R of H2O\n", + "U22=101 #Internal energy at 537 R of H2O\n", + "U31=24773 #Internal energy at 1000 R of Octane\n", + "U32=640 #Internal energy at 537 R of Octane\n", + "U41=2539 #Internal energy at 1000 R of Oxygen\n", + "U42=83 #Internal energy at 537 R of Oxygen\n", + "H=-2203389 #heat Btu\n", + "#calculations\n", + "dU1=n1*(U11-U12)+n2*(U21-U22)\n", + "dU2=n3*(U31-U32)+n4*(U41-U42)\n", + "Q=H+dU1-dU2\n", + "#results\n", + "print \"Heat of reaction = %d Btu\"%(Q)\n", + "print \"The answers are a bit different due to rounding off error in textbook.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.17 Pg:751" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from table B-10,\n", + "Upon interpolating, T2 = 5271 R\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "n1=8 #Moles of CO2\n", + "n2=9 #Moles of H2O\n", + "n3=47 #Moles of N2\n", + "print \"from table B-10,\"\n", + "h1=118 #Enthalpy of CO2\n", + "h2=104 #Enthalpy of H2O\n", + "h3=82.5 #Enthalpy of N2\n", + "Q=2203279 #Btu\n", + "#calculations\n", + "U11=n1*h1+n2*h2+n3*h3\n", + "U12=U11+Q\n", + "T2=5271 #R\n", + "#results\n", + "print \"Upon interpolating, T2 = %d R\"%(T2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.18 Pg:752" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In case 1, Equilibrium constant = 38.5 \n", + "\n", + "In case 2, Equilibrium constant = 1480.1 \n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "n1=0.95\n", + "n2=0.05\n", + "n3=0.025\n", + "P=147 #psia\n", + "pa=14.7 #psia\n", + "#calculations\n", + "n=n1+n2+n3\n", + "p1=n1/n *P/pa\n", + "p2=n2/n *P/pa\n", + "p3=n3/n *P/pa\n", + "Kp1= p1/(p2*p3**0.5)\n", + "Kp2= p1**2 /(p2**2 *p3)\n", + "#results\n", + "print \"In case 1, Equilibrium constant = %.1f \"%(Kp1)\n", + "print \"\\nIn case 2, Equilibrium constant = %.1f \"%(Kp2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.19 Pg:753" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "percentage of dissociation = 34.3 percent\n", + "\n", + " If pressure =10 . Degree of dissociation = 18 percent\n" + ] + } + ], + "source": [ + "from sympy.abc import x,y\n", + "from sympy import solve,N\n", + "#Initialization of variables\n", + "kp=5 \n", + "#calculations\n", + "vec=solve(24*x**3 + 3*x-2,x)\n", + "x=N(vec[2],6)\n", + "vec2=solve(249*y**3 +3*y-2,y)\n", + "y=N(vec2[2],6)\n", + "#results\n", + "print \"percentage of dissociation = %.1f percent\"%(x*100)\n", + "print \"\\n If pressure =10 . Degree of dissociation = %d percent\"%(y*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Ex:16.20 Pg:754" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Extent of reaction= 78 percent\n" + ] + } + ], + "source": [ + "from sympy.abc import x,y\n", + "from sympy import solve,N\n", + "\n", + "#Initialization of variables\n", + "vec=solve(24*x**3 +48*x**2 + 7*x -4,x)\n", + "x=N(vec[1],6) *100\n", + "#results\n", + "print \"Extent of reaction= %d percent\"%(100-x)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch17.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch17.ipynb new file mode 100644 index 00000000..9b54ad03 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch17.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 17 Gas cycles and processes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.1 Pg:768" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + " Thermal efficiency = 14.9 percent\n", + "\n", + " Moles of fuel burned per mol of air = 0.00177 mol fuel/mol air\n", + "\n", + " Mass ratio in pounds = 0.00866 lbm fuel/lbm air\n", + "\n", + " Air fuel ratio = 115 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "\n", + "#Initialization of variables\n", + "ha=1033 #Btu/mol air\n", + "hbd=2992 #Btu/mol air\n", + "hc=7823 #Btu/mol air\n", + "hdd=5142 #Btu/mol air\n", + "Hv=2733000 #Btu/mol\n", + "M=29\n", + "#calculations\n", + "Wt=hc-hdd\n", + "Wc=ha-hbd\n", + "Net=Wt+Wc\n", + "Heat=hc-hbd\n", + "etat=Net*100/Heat\n", + "molair=Heat/Hv\n", + "mr=molair*142/M\n", + "Af=1/mr\n", + "#results\n", + "print \"\\n Thermal efficiency = %.1f percent\"%(etat)\n", + "print \"\\n Moles of fuel burned per mol of air = %.5f mol fuel/mol air\"%(molair)\n", + "print \"\\n Mass ratio in pounds = %.5f lbm fuel/lbm air\"%(mr)\n", + "print \"\\n Air fuel ratio = %d lbm air/lbm fuel\"%(Af)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch2.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch2.ipynb new file mode 100644 index 00000000..30c440b6 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch2.ipynb @@ -0,0 +1,107 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Fundamental Concepts" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:2.1 Pg:34" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Potential energy = 3217.39 ft-lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "z=100 #ft\n", + "m=32.1739 #lbm\n", + "#calculations\n", + "PE=m*z\n", + "#results\n", + "print \"Potential energy = %.2f ft-lbm\"%(PE)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:2.2 Pg:35" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Absolute energy of this mixture = 5.40e+17 ft-lbf\n", + "\n", + " In case b, there is no change in mass\n", + "\n", + " Change in mass = -3.15e-09 lbm\n", + "The answers are a bit different due to rounding off error in textbook.\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m0=18.016 #lbm\n", + "gc=32.1739 #lbm ft/lbf sec**2\n", + "c=186000*5280\n", + "dU=94.4*10**6 #ft-lbf\n", + "#calculations\n", + "U=m0/gc *c**2\n", + "dm= -dU*gc/c**2\n", + "#results\n", + "print \"Absolute energy of this mixture = %.2e ft-lbf\"%(U)\n", + "print \"\\n In case b, there is no change in mass\"\n", + "print \"\\n Change in mass = %.2e lbm\"%(dm)\n", + "print \"The answers are a bit different due to rounding off error in textbook.\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch3.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch3.ipynb new file mode 100644 index 00000000..9ac141c2 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch3.ipynb @@ -0,0 +1,100 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 3 Temperature and the ideal gas" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:3.2 Pg:59 " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Volume = 379.5 ft**3/mol\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p=14.7 #psia\n", + "R0=1545 \n", + "t=460 +60 #R\n", + "#calculations\n", + "v=R0*t/(p*144)\n", + "#results\n", + "print \"Volume = %.1f ft**3/mol\"%(v)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:3.3 Pg:59" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "density of nitrogen = 0.0932 lbm/ft**3\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p=20.0 #psia\n", + "R0=1545.0 \n", + "t=460 +100 #R\n", + "M=28\n", + "#calculations\n", + "v=R0*t/(p*144*M)\n", + "rho=1/v\n", + "#results\n", + "print \"density of nitrogen = %.4f lbm/ft**3\"%(rho)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch5.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch5.ipynb new file mode 100644 index 00000000..576e9b60 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch5.ipynb @@ -0,0 +1,149 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 The first law and the dynamic open system" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:5.2 Pg:105" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "work done by the system = -9.7 Btu/lbm\n", + "\n", + " Power = -48.6 Btu/s\n" + ] + } + ], + "source": [ + "## Initialization of variables\n", + "rate= 5 #lbm/sec\n", + "Q=50 #Btu/s\n", + "h2=1020 #Btu/lbm\n", + "h1=1000 #Btu/lbm\n", + "V2=50 #ft/s\n", + "V1=100 #ft/s\n", + "J=778\n", + "g=32.2 #ft/s**2\n", + "gc=g\n", + "Z2=0\n", + "Z1=100 #ft\n", + "#calculations\n", + "dw=Q/rate -(h2-h1) -(V2**2- V1**2)/(2*gc*J) -g/gc *(Z2-Z1)/J\n", + "power=dw*rate\n", + "#results\n", + "print \"work done by the system = %.1f Btu/lbm\"%(dw)\n", + "print \"\\n Power = %.1f Btu/s\"%(power)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:5.3 Pg:106" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Area of inlet pipe = 0.75 ft**2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "V=100.0 #ft/s\n", + "v=15 #lbm/ft**3\n", + "m=5 #lbm/s\n", + "#calculations\n", + "A=m*v/V\n", + "#results\n", + "print \"Area of inlet pipe = %.2f ft**2\"%(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:5.4 Pg:106" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table B-4\n", + "Final temperature of the steam = 540 F\n", + "\n", + " Change in temperature = 212 F\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "P=100.0 #psia\n", + "#calculations\n", + "print \"From table B-4\"\n", + "h=1187.2 #Btu/lbm\n", + "t1=328 #F\n", + "t2=540 #F\n", + "dt=t2-t1\n", + "#results\n", + "print \"Final temperature of the steam = %d F\"%(t2)\n", + "print \"\\n Change in temperature = %d F\"%(dt)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch7.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch7.ipynb new file mode 100644 index 00000000..54e86231 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch7.ipynb @@ -0,0 +1,172 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 The second law" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:7.2 Pg:192" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Entropy in ab part = 0.1213 Btu/lbm R\n", + "\n", + " Entropy in ac part = 0.1688 Btu/lbm R\n", + "\n", + " Efficiency = 9.80 percent\n", + "The answers are a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "from math import log\n", + "#Initialization of variables\n", + "cv=0.175 #Btu/lbm R\n", + "R0=1.986\n", + "M=29\n", + "T2=1040 #R\n", + "T1=520 #R\n", + "#calculations\n", + "cp=cv+R0/M\n", + "sab=cv*log(T2/T1)\n", + "sac=cp*log(T2/T1)\n", + "dqab=cv*(T2-T1)\n", + "dqca=cp*(T1-T2)\n", + "dqrev=T2*(sac-sab)\n", + "eta=(dqab+dqrev+dqca)/(dqab+dqrev)\n", + "#results\n", + "print \"Entropy in ab part = %.4f Btu/lbm R\"%(sab)\n", + "print \"\\n Entropy in ac part = %.4f Btu/lbm R\"%(sac)\n", + "print \"\\n Efficiency = %.2f percent\"%(eta*100)\n", + "print \"The answers are a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:7.3 Pg:193" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Change in entropy of the process = 0.0192 Btu/R\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from math import log\n", + "#Initialization of variables\n", + "tc=32 #F\n", + "th=80 #F\n", + "mw=5 #lbm\n", + "mi=1 #lbm\n", + "P=14.7 #psia\n", + "cp=1\n", + "#calculations\n", + "t= (-144*mi+tc*mi+th*mw)/(mw+mi)\n", + "ds1=144/(tc+460)\n", + "ds2=cp*log((460+t)/(460+tc))\n", + "dsice=ds1+ds2\n", + "dswater=mw*cp*log((t+460)/(460+th))\n", + "ds=dsice+dswater\n", + "#results\n", + "print \"Change in entropy of the process = %.4f Btu/R\"%(ds)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:7.4 Pg:194" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Change in available energy = -3.5 Btu/lbm\n", + "\n", + " The available energy of the isolated system decreased in the amount of -36.5 Btu/lbm\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from math import log\n", + "\n", + "#Initialization of variables\n", + "cp=1\n", + "T2=60 #F\n", + "T1=100 #F\n", + "ta=32 #F\n", + "#calculations\n", + "dq=cp*(T2-T1)\n", + "ds=cp*log((460+T2)/(460+T1))\n", + "dE=dq-ds*(ta+460)\n", + "dec=dq-dE\n", + "#results\n", + "print \"Change in available energy = %.1f Btu/lbm\"%(dE)\n", + "print \"\\n The available energy of the isolated system decreased in the amount of %.1f Btu/lbm\"%(dec)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch9.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch9.ipynb new file mode 100644 index 00000000..6a516fc0 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch9.ipynb @@ -0,0 +1,440 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 Properties of the pure substance" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.1 Pg:304" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From steam tables,\n", + "Internal energy = -0.0002625 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "T=32 #F\n", + "m=1 #lbm\n", + "J=778.16\n", + "#calculations\n", + "print \"From steam tables,\"\n", + "hf=0 \n", + "p=0.08854 #psia\n", + "vf=0.01602 #ft**3/lbm\n", + "u=hf-p*144*vf/J\n", + "#results\n", + "print \"Internal energy = %.7f Btu/lbm\"%(u)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.2 Pg:305" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from steam tables,\n", + "Change in entropy = 0.351 Btu/lbm R\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "P=40 #psia\n", + "#calculations\n", + "print \"from steam tables,\"\n", + "hf=200.8 #Btu/lbm\n", + "hg=27 #Btu/lbm\n", + "T=495 #R\n", + "ds=(hf-hg)/T\n", + "#results\n", + "print \"Change in entropy = %.3f Btu/lbm R\"%(ds)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.3 Pg:305" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table B-14,\n", + "specific enthalpy = 36.0 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "x=0.35\n", + "T=18 #F\n", + "#calculations\n", + "print \"From table B-14,\"\n", + "hf=12.12 #Btu/lbm\n", + "hg=80.27 #Btu.lbm\n", + "hfg=-hf+hg\n", + "h=hf+x*hfg\n", + "#results\n", + "print \"specific enthalpy = %.1f Btu/lbm\"%(h)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.4 Pg:306" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table B-14,\n", + "Heat required = 49.71 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "x=0.35\n", + "T=18 #F\n", + "T2=55.5 #F\n", + "#calculations\n", + "print \"From table B-14,\"\n", + "hf=12.12 #Btu/lbm\n", + "hg=80.27 #Btu.lbm\n", + "hfg=-hf+hg\n", + "h=hf+x*hfg\n", + "h2=85.68 #Btu/lbm\n", + "dh=h2-h\n", + "#results\n", + "print \"Heat required = %.2f Btu/lbm\"%(dh)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.5 Pg:307" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From mollier chart,\n", + "enthalpy = 120 Btu/lbm\n", + "\n", + " Qulaity = 0.83\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "P=1460 #psia\n", + "T=135 #F\n", + "P2=700 #psia\n", + "#calculations\n", + "print \"From mollier chart,\"\n", + "h=120 #Btu/lbm\n", + "x=0.83\n", + "#results\n", + "print \"enthalpy = %d Btu/lbm\"%(h)\n", + "print \"\\n Qulaity = %.2f\"%(x)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.6 Pg:307" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table 3,\n", + "Heat transferred = 11.4 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m=1 #lbm\n", + "P1=144 #psia\n", + "P2=150 #psia\n", + "T1=360 #F\n", + "J=778.16\n", + "#calculations\n", + "print \"From table 3,\"\n", + "v1=3.160 #ft**3/lbm\n", + "h1=1196.5 #Btu/lbm\n", + "u1=h1-P1*144*v1/J\n", + "h2=1211.4 #Btu/lbm\n", + "u2=h2-P2*144*v1/J\n", + "dq=u2-u1\n", + "#results\n", + "print \"Heat transferred = %.1f Btu/lbm\"%(dq)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.7 Pg:307" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From table 3,\n", + "Work done = -3.0 Btu/lbm\n", + "\n", + " In case 2, work required = -5.0 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "T1=100 #F\n", + "P2=1000 #psia\n", + "x=0.6\n", + "J=778.16\n", + "#calculations\n", + "print \"From table 3,\"\n", + "v=0.01613 #ft**3/lbm\n", + "P1=0.9 #psia\n", + "wrev=-v*(P2-P1)*144/J\n", + "dv=0.000051 #ft**3/lbm\n", + "wcomp=(P2+P1)/2 *dv*144/J\n", + "wact=wrev/x\n", + "#results\n", + "print \"Work done = %.1f Btu/lbm\"%(wrev)\n", + "print \"\\n In case 2, work required = %.1f Btu/lbm\"%(wact)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.8 Pg:308" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from steam table 2,\n", + "Heat transferred = 1120.8 Btu/lbm\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "pa=1000 #atm\n", + "ta=100 #F\n", + "#calculations\n", + "hf=67.97 #Btu/lbm\n", + "w=3 #Btu/lbm\n", + "ha=hf+w\n", + "print \"from steam table 2,\"\n", + "hc=1191.8 #Btu/lbm\n", + "qrev=hc-ha\n", + "#results\n", + "print \"Heat transferred = %.1f Btu/lbm\"%(qrev)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.9 Pg:309" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From steam tables,\n", + "Work done = 266 Btu/lbm\n", + "\n", + " work done in case 2 = 186.8 Btu/lbm\n", + "\n", + " Final state pressure = 3 psia\n", + "The answer is a bit different due to rounding off error in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "P1=144 #psia\n", + "T1=400 #F\n", + "y=0.7\n", + "#calculations\n", + "print \"From steam tables,\"\n", + "h1=1220.4 #Btu/lbm\n", + "s1=1.6050 #Btu/lbm R\n", + "s2=1.6050 #Btu/lbm R\n", + "P2=3 #psia\n", + "sf=0.2008 #Btu/lbm R\n", + "sfg=1.6855 #Btu/lbm R\n", + "x=(s1-sf)/sfg\n", + "hf=109.37 #Btu/lbm\n", + "hfg=1013.2 #Btu/#bm\n", + "h2=hf+x*hfg\n", + "work=h1-h2\n", + "dw=y*work\n", + "h2d=h1-dw\n", + "#results\n", + "print \"Work done = %d Btu/lbm\"%(work)\n", + "print \"\\n work done in case 2 = %.1f Btu/lbm\"%(dw)\n", + "print \"\\n Final state pressure = %d psia\"%(P2)\n", + "print \"The answer is a bit different due to rounding off error in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.10 Pg:309" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From steam tables,\n", + "Quality of wet steam = 99.8 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "pb=14.696 #psia\n", + "pa=150 #psia\n", + "tb=300 #F\n", + "#calculations\n", + "print \"From steam tables,\"\n", + "hb=1192.8 #Btu/lbm\n", + "ha=hb\n", + "hf=330.51 #Btu/lbm\n", + "hfg=863.6 #Btu/lbm\n", + "x=(ha-hf)/hfg\n", + "#results\n", + "print \"Quality of wet steam = %.1f percent\"%(x*100)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Thermodynamics_by_Gaggioli_and_Obert/screenshots/changeInMoisture14.png b/Thermodynamics_by_Gaggioli_and_Obert/screenshots/changeInMoisture14.png Binary files differnew file mode 100644 index 00000000..bc4da4d9 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/screenshots/changeInMoisture14.png diff --git a/Thermodynamics_by_Gaggioli_and_Obert/screenshots/degreeOfSaturation14.png b/Thermodynamics_by_Gaggioli_and_Obert/screenshots/degreeOfSaturation14.png Binary files differnew file mode 100644 index 00000000..7bb12dd0 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/screenshots/degreeOfSaturation14.png diff --git a/Thermodynamics_by_Gaggioli_and_Obert/screenshots/humidityratio14.png b/Thermodynamics_by_Gaggioli_and_Obert/screenshots/humidityratio14.png Binary files differnew file mode 100644 index 00000000..cb399933 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/screenshots/humidityratio14.png |