{
 "metadata": {
  "name": "",
  "signature": "sha256:912103c870040cf2e80e26b9450874f8f07874fb3d9db28d3d6ce1077a023edc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Steady, One-Dimensional, Reversible Flow"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1 Page No : 157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#initialisation of variables\n",
      "g= 32.2 \t#ft/sec**2 gravitational acceleration\n",
      "h= 4.    \t#ft diameter\n",
      "d2= 0.16 \t#ft\n",
      "d1= 0.3 \t#ft\n",
      "dp= 13.6 \t#lbf/in**2 mercury\n",
      "\t\n",
      "#CALCULATIONS\n",
      "Q= (math.pi/4)*math.sqrt(2*g*dp*h/((1/d2**4)-(1/d1**4)))\n",
      "\t\n",
      "#RESULTS\n",
      "print  'Volumetric flow rate = %.2f ft**3/sec'%(Q)\n",
      "\n",
      "# note: book answer is not accurate."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric flow rate = 1.24 ft**3/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2 Page No : 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\n",
      "#initialisation of variables\n",
      "w= 0.0765 \t#lbm/ft**3 density\n",
      "v1= 120. \t#ft/sec velocity\n",
      "go = 62.4   \t#lmb/ft**3\n",
      "\t\n",
      "#CALCULATIONS\n",
      "dp= (w*v1**2)/(2*go)\n",
      "\t\n",
      "#RESULTS\n",
      "print  'Difference in pressure= %.2f lbf/ft**2'%(dp)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Difference in pressure= 8.83 lbf/ft**2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3 Page No : 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#initialisation of variables\n",
      "r=1.4\n",
      "g= 32.2 \t#ft/sec**2 gas\n",
      "R= 53.3 \t#lbf ft/lbm\n",
      "T1= 760. \t#R  Temperature\n",
      "p2= 2.   \t#lbf/in**2\n",
      "p1= 3. \t    #lbf/in**2\n",
      "\t\n",
      "#CALCULATIONS\n",
      "V2= math.sqrt(2*r*R*g*T1*(1-(p2/p1)**((r-1)/r))/(r-1))\n",
      "\t\n",
      "#RESULTS\n",
      "print  'Velocity in working section = %.f ft/sec'%(V2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity in working section = 999 ft/sec\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4 Page No : 166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#initialisation of variables\n",
      "y = 1.4\n",
      "g = 32.2 \t#ft/sec**2\n",
      "R = 53.3 \t#lbf ft/lbm\n",
      "T = 32.   \t#C air\n",
      "T1 = 2000. \t#R air\n",
      "y1 = 1.32\n",
      "p = 1440.     \t#lbf/in**2\n",
      "v1 = 1.2306 \t    #ft**3/lbm\n",
      "v2 = 1.2546 \t    #ft**3/lbm\n",
      "bm = 3.13*10**5 \t#lbf/in**2\n",
      "w = 62.4 \t    #lbf/ft**3\n",
      "\t\n",
      "#CALCULATIONS\n",
      "a1= math.sqrt(y*R*(460+T)*g)\n",
      "a2= math.sqrt(y1*R*T1*g)\n",
      "r2= p/(v1-v2)\n",
      "a3= math.sqrt(-g*(v1+v2)**2*0.5**2*r2)\n",
      "a4= math.sqrt(bm*144*g/w)\n",
      "\t\n",
      "#RESULTS\n",
      "print  ' Acoustic veloctiy in air at 32 F = %.f ft/sec'%(a1)\n",
      "print  ' Acoustic veloctiy in air at 2000 R = %.f ft/sec'%(a2)\n",
      "print  ' Acoustic veloctiy in steam at 480 F = %.f ft/sec'%(a3)\n",
      "print  ' Acoustic veloctiy in water at 60 F = %.f ft/sec'%(a4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Acoustic veloctiy in air at 32 F = 1087 ft/sec\n",
        " Acoustic veloctiy in air at 2000 R = 2129 ft/sec\n",
        " Acoustic veloctiy in steam at 480 F = 1727 ft/sec\n",
        " Acoustic veloctiy in water at 60 F = 4823 ft/sec\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5 Page No : 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\n",
      "#initialisation of variables\n",
      "r= 1.4\n",
      "ma2= 2.5 \t#ft/sec\n",
      "g= 32.17 \t#ft/sec**2\n",
      "p2= 1.   \t#lbf/in**2\n",
      "ps= 17.08 \t#lbf/in**2\n",
      "ps2= 75. \t#lbf/in**2\n",
      "Ts= 720. \t#R\n",
      "R= 53.3 \t#lbf ft/lbm gas\n",
      "A= 4.    \t#ft**2 flow area\n",
      "ps3= 0.4 \t#lbf/in**2\n",
      "A2= 0.685 \t#ft**2\n",
      "P= 5.    \t#per cent throat area\n",
      "\t\n",
      "#CALCULATIONS\n",
      "R1= (1+0.5*(r-1)*ma2**2)**(r/(r-1))\n",
      "R2= (2*(r/(r-1))*(p2/ps)**(2/(r))*(1-(p2/ps)**((r-1)/r)))**0.5\n",
      "m2= R2*ps2*144*(g/(R*Ts))**0.5*0.1\n",
      "m= m2*A\n",
      "At= A*R2/A2\n",
      "m1= m*(1-(P/100))\n",
      "mrp= (1-(P/100))*R2\n",
      "\t\n",
      "#RESULTS\n",
      "print  ' Mass flow rate= %.1f lbm/sec'%(m)\n",
      "print  ' Area of throat= %.3f ft**2'%(At)\n",
      "print  ' Mass flow rate= %.1f lbm/sec'%(m1)\n",
      "print  ' Mass flow rate parameter = %.4f'%(mrp)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass flow rate= 32.5 lbm/sec\n",
        " Area of throat= 1.517 ft**2\n",
        " Mass flow rate= 30.9 lbm/sec\n",
        " Mass flow rate parameter = 0.2468\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7 Page No : 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\n",
      "#initialisation of variables\n",
      "r1= 10.  \t#ft point - 1\n",
      "r2= 0.2 \t#miles point - 2\n",
      "w= 0.0765 \t#lbm/ft**2 density\n",
      "g= 32.2 \t#ft/sec**2\n",
      "V1= 1.   \t#ft/sec velocity\n",
      "\t\n",
      "#CALCULATIONS\n",
      "k= r2*5280*V1 \n",
      "dp= w*k**2*10*((1/r1)**2-(1/(5280*r2))**2)/(2*g)\n",
      "\t\n",
      "#RESULTS\n",
      "print  'k = %.f ft**2/sec'%(k)\n",
      "print  ' pressure difference = %.1f lbf/ft**2'%(dp)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "k = 1056 ft**2/sec\n",
        " pressure difference = 132.5 lbf/ft**2\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9 Page No : 186"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\n",
      "#initialisation of variables\n",
      "w= 12.   \t#ft wide\n",
      "q= 300.  \t#ft**3/sec rate\n",
      "h= 10.   \t#ft depth upstream of the gate\n",
      "g= 32.2 \t#ft/sec**2\n",
      "R= 2.6\n",
      "\t\n",
      "#CALCULATIONS\n",
      "hc= ((q/12)**2/g)**(1./3)\n",
      "r= h/hc\n",
      "h1= hc*(((h/hc)+0.5*(hc/h)**2)-0.5*R**2)\n",
      "\t\n",
      "#RESULTS\n",
      "print  ' hc = %.2f ft'%(hc)\n",
      "print  ' stream depth = %.3f ft'%(h1)\n",
      "#rounding-off error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " hc = 2.69 ft\n",
        " stream depth = 1.013 ft\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.10 Page No : 190"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\n",
      "#initialisation of variables\n",
      "Q= 400. \t#ft**3/sec flow rate\n",
      "b1= 25. \t#ft channel width\n",
      "b2= 20. \t#ft channel width\n",
      "h1= 6.   \t#ft stream depth\n",
      "z1= 2.5 \t#ft elevation of channel bottom\n",
      "z2= 3.3 \t#ft elevation of channel bottom\n",
      "g= 32.2 \t#ft/sec**2\n",
      "\t\n",
      "#CALCULATIONS\n",
      "hc1= (Q**2/(g*b1**2))**(1./3)\n",
      "hc2= (Q**2/(g*b2**2))**(1./3)\n",
      "r= (hc1/hc2)*((h1/hc1)+0.5*(hc1/h1)**2)+((z1-z2)/hc2)\n",
      "\t\n",
      "#RESULTS\n",
      "print  ' hc1 = %.3f ft'%(hc1)\n",
      "print  ' hc2 = %.3f ft'%(hc2)\n",
      "print  ' Ratio = %.3f '%(r)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " hc1 = 1.996 ft\n",
        " hc2 = 2.316 ft\n",
        " Ratio = 2.293 \n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}