diff options
Diffstat (limited to 'Thermodynamics_by_F_P_Durham/chapter2.ipynb')
-rwxr-xr-x | Thermodynamics_by_F_P_Durham/chapter2.ipynb | 285 |
1 files changed, 285 insertions, 0 deletions
diff --git a/Thermodynamics_by_F_P_Durham/chapter2.ipynb b/Thermodynamics_by_F_P_Durham/chapter2.ipynb new file mode 100755 index 00000000..33489895 --- /dev/null +++ b/Thermodynamics_by_F_P_Durham/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 |