diff options
Diffstat (limited to 'Testing_Textbook_Companion_Directory')
-rwxr-xr-x | Testing_Textbook_Companion_Directory/chapter2.ipynb | 285 | ||||
-rwxr-xr-x | Testing_Textbook_Companion_Directory/chapter5.ipynb | 171 | ||||
-rwxr-xr-x | Testing_Textbook_Companion_Directory/screenshots/energy.png | bin | 0 -> 34458 bytes | |||
-rwxr-xr-x | Testing_Textbook_Companion_Directory/screenshots/internal-energy.png | bin | 0 -> 44302 bytes | |||
-rwxr-xr-x | Testing_Textbook_Companion_Directory/screenshots/temprature.png | bin | 0 -> 39632 bytes |
5 files changed, 456 insertions, 0 deletions
diff --git a/Testing_Textbook_Companion_Directory/chapter2.ipynb b/Testing_Textbook_Companion_Directory/chapter2.ipynb new file mode 100755 index 00000000..33489895 --- /dev/null +++ b/Testing_Textbook_Companion_Directory/chapter2.ipynb @@ -0,0 +1,285 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4b491165aaa84eef66101894e30c202e368215710941e1135ee996c3417298e7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2: Types of Energy" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1, page no. 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initialization\n", + "k = 20 #lb/in\n", + "x = 3 #in\n", + "\n", + "#calculation\n", + "def fun(x):\n", + " y = k*x\n", + " return y\n", + "\n", + "w = scipy.integrate.quadrature(fun, 0.0, 3.0)\n", + "\n", + "#result\n", + "print \"Work done = %d in-lb\" %(round(w[0]))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = 90 in-lb\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2, page no. 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initialization\n", + "w = 0.1 #lbm\n", + "Pv = 30000 #ft-lb/lbm\n", + "v1 = 14.0 #ft^3 /lbm\n", + "v2 = 3.0 #ft^3/lbm\n", + "\n", + "#calculation\n", + "def func(v):\n", + " W = Pv/v\n", + " return W\n", + "\n", + "temp = scipy.integrate.quadrature(func, v1, v2,)\n", + "Work = w * temp[0]\n", + "\n", + "#result\n", + "#Answer varies a bit from the text due to rounding off of log value\n", + "print \"Work done = %d ft-lb\" %Work" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = -4621 ft-lb\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3, page no. 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initialization of variables\n", + "T1 = 500.0 #R\n", + "T2 = 1000.0 #R\n", + "w = 2.0 #lbm\n", + "\n", + "#calculations\n", + "def c(T):\n", + " cp=0.282+0.00046*T\n", + " return cp\n", + "\n", + "Q = scipy.integrate.quadrature(c, T1, T2,)[0]\n", + "Heat = Q*w\n", + "\n", + "#results\n", + "print \"Heat flow = %d B\" %(Heat)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat flow = 626 B\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4, page no. 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initialization\n", + "T1 = 500.0 #R\n", + "T2 = 1060.0 #R\n", + "w = 1 #lbm\n", + "\n", + "#calculation\n", + "def v(T):\n", + " cv = 0.258-120/T +40000/T**2\n", + " return cv\n", + "\n", + "Q = scipy.integrate.quadrature(v, T1, T2,)[0]\n", + "cvm=Q/(T2-T1)\n", + "\n", + "#result\n", + "print \"The amount of heat: \", round(Q,1), \"B/lbm\"\n", + "print \"Mean specific heat = %.3f B/lbm F\" %cvm" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amount of heat: 96.6 B/lbm\n", + "Mean specific heat = 0.172 B/lbm F\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.5, page no. 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialization\n", + "w=1 #lbm\n", + "Sw=0.3120 #B/lbm R\n", + "Ss=1.7566 #B/lb R\n", + "T=672 #R\n", + "\n", + "#calculation\n", + "Q=T*(Ss-Sw)\n", + "\n", + "\n", + "#result\n", + "print \"Latent heat of water = %d B/lbm\" %Q" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Latent heat of water = 970 B/lbm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6, page no. 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initialization\n", + "w=1 #lbm\n", + "T1=492 #R\n", + "T2=672 #R\n", + "cp=1 #B/lbm F\n", + "\n", + "#calculation\n", + "dQ=cp*(T2-T1)\n", + "def ds(T):\n", + " s=1/T\n", + " return s\n", + "\n", + "entropy = scipy.integrate.quadrature(ds, T1, T2,)[0]\n", + "\n", + "#results\n", + "print \"Entropy change = \", round(entropy, 3), \"B/lbm R\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy change = 0.312 B/lbm R\n" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Testing_Textbook_Companion_Directory/chapter5.ipynb b/Testing_Textbook_Companion_Directory/chapter5.ipynb new file mode 100755 index 00000000..bf944c6e --- /dev/null +++ b/Testing_Textbook_Companion_Directory/chapter5.ipynb @@ -0,0 +1,171 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:080ddee320ed2e8325a1bba2bf7e96e362906d7bc4b7f00bae6953ceccc830a0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5: The Second Law of Thermodynamics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.1, page no. 87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initilisation\n", + "Tr = 540.0 #R\n", + "Te = 2000.0 #R\n", + "m = 200.0 #B/lbm\n", + "\n", + "#calculation\n", + "eta = 1-(Tr/Te)\n", + "Qr = m*(1-eta)\n", + "\n", + "\n", + "#result\n", + "print \"Thermal efficiency is \", eta*100, \"%\"\n", + "print \"Heat rejected = %d B/lbm\" %Qr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thermal efficiency is 73.0 %\n", + "Heat rejected = 54 B/lbm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.2, page no. 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initilisation\n", + "cv=0.171 #B/lbm F\n", + "T2=580 #F\n", + "T1=520 #F\n", + "\n", + "#calculation\n", + "def fun(T):\n", + " cp=cv/T\n", + " return cp\n", + "\n", + "ds = scipy.integrate.quadrature(fun, T1, T2)[0]\n", + "\n", + "#result\n", + "print \"Change in entropy = %.4f B/lbm R\" %ds" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy = 0.0187 B/lbm R\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.3, page no. 95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.integrate\n", + "\n", + "#initilisation\n", + "\n", + "Q = 100.0 #B/lbm\n", + "Cp = 0.24 #B/lbm F\n", + "T1 = 70.0+460.0 #R\n", + "T2 = 550.0+460.0 #R\n", + "Ts = 50.0+460.0 #R\n", + "\n", + "#calculation\n", + "def fun(T):\n", + " cp = Cp/T\n", + " return cp\n", + " \n", + "ds1 = scipy.integrate.quadrature(fun, T1, T2)[0]\n", + "Tf = Q/Cp + T1\n", + "ds2 = scipy.integrate.quadrature(fun, T1, Tf)[0]\n", + "Qr = Ts*(ds2)\n", + "Qa = Q-Qr\n", + "Qun = Ts*(ds1)\n", + "Qa2 = Q-Qun\n", + "\n", + "#result\n", + "print \"Case 1\"\n", + "print \"Change in entropy = %.4f B/lbm R\" %ds1\n", + "print \"case 2\"\n", + "print \"Entropy change = %.4f B/lbm R\" %ds2\n", + "print \"Available energy = %.1f B/lbm\" %Qa\n", + "print \"case 3\"\n", + "print \"Available energy = %.1f B/lbm\" %Qa2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Case 1\n", + "Change in entropy = 0.1548 B/lbm R\n", + "case 2\n", + "Entropy change = 0.1392 B/lbm R\n", + "Available energy = 29.0 B/lbm\n", + "case 3\n", + "Available energy = 21.1 B/lbm\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file diff --git a/Testing_Textbook_Companion_Directory/screenshots/energy.png b/Testing_Textbook_Companion_Directory/screenshots/energy.png Binary files differnew file mode 100755 index 00000000..67a7242e --- /dev/null +++ b/Testing_Textbook_Companion_Directory/screenshots/energy.png diff --git a/Testing_Textbook_Companion_Directory/screenshots/internal-energy.png b/Testing_Textbook_Companion_Directory/screenshots/internal-energy.png Binary files differnew file mode 100755 index 00000000..e2055783 --- /dev/null +++ b/Testing_Textbook_Companion_Directory/screenshots/internal-energy.png diff --git a/Testing_Textbook_Companion_Directory/screenshots/temprature.png b/Testing_Textbook_Companion_Directory/screenshots/temprature.png Binary files differnew file mode 100755 index 00000000..24557a42 --- /dev/null +++ b/Testing_Textbook_Companion_Directory/screenshots/temprature.png |