{
 "metadata": {
  "name": "",
  "signature": "sha256:e77c0ecf71b6b19d4b74c1b5653eedac5bf7ec259a0d03cbae3bef3229b3cdac"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 : Hydrodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.1  pageno : 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "\n",
      "import math \n",
      "\n",
      "Q = 0.8 \t\t\t#ft**3/sec\n",
      "w = 62.4 \t\t\t#lb/sec\n",
      "d1 = 3. \t\t\t#in\n",
      "d2 = 1.5 \t\t\t#in\n",
      "#CALCULATIONS\n",
      "Q1 = Q*w*60/10.\n",
      "a1 = math.pi*(d1/12.)**2/4.\n",
      "a2 = math.pi*(d2/12.)**2/4.\n",
      "v1 = Q/a1\n",
      "v2 = Q/a2\n",
      "\n",
      "#RESULTS\n",
      "print 'Q = %.f gpm'%Q1\n",
      "print  'v1  = %.1f ft/sec '%(v1)\n",
      "print  'v2  = %.1f ft/sec '%(v2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Q = 300 gpm\n",
        "v1  = 16.3 ft/sec \n",
        "v2  = 65.2 ft/sec \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.2 page no : 45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "import math \n",
      "d1 = 12. \t\t\t#in\n",
      "d2 = 9. \t\t\t#in\n",
      "z1 = 10. \t\t\t#ft\n",
      "z2 = 10. \t\t\t#ft\n",
      "p1 = 15. \t\t\t#lb/in**2\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "Q = 2. \t\t\t#cuses\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "v1 = Q/(math.pi*(d1/12.)**2/4.)\n",
      "v2 = Q/(math.pi*(d2/12.)**2/4.)\n",
      "p2 = w*(z1-z2+(p1*144/w)+(v1**2/(2*g))-(v2**2/(2*g)))/144\n",
      "#RESULTS\n",
      "print  'p2  = %.2f lb/in**2 '%(p2)\n",
      "\n",
      "# note : answer is slightly differet because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "p2  = 14.91 lb/in**2 \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.3 page no : 46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "import math \n",
      "d0 = 4. \t\t\t#ft\n",
      "d2 = 2. \t\t\t#ft\n",
      "z0  = 0 \t\t\t#ft\n",
      "z1 = 5. \t\t\t#ft\n",
      "z2 = 13. \t\t\t#ft\n",
      "h = 9.5 \t\t\t#in\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "w1 = 30. \t\t\t#lb/ft**3\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "r = 0.1\n",
      "#CALCULATIONS\n",
      "p2 = -h*34/w1\n",
      "v2 = math.sqrt(2*g*(z1-p2-z2)/(1+r))\n",
      "Q = math.pi*(d2/12)**2*v2*w*60/(10*4)\n",
      "#RESULTS\n",
      "print  'Discharge  = %.f gpm '%(Q)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 104 gpm \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.4 pageno :47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "import math \n",
      "d1 = 2 \t\t\t#ft\n",
      "d2 = 3 \t\t\t#ft\n",
      "v1 = 20 \t\t\t#ft/sec\n",
      "z1 = 20 \t\t\t#ft\n",
      "z2 = 0 \t\t\t#ft\n",
      "h = 5 \t\t\t#ft\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "Hl = v1**2*0.15/(2*g)\n",
      "a1 = math.pi*d1**2/4\n",
      "a2 = math.pi*d2**2/4\n",
      "v2 = a1*v1/a2\n",
      "p1 = ((h-z1+(v2**2)/(2*g))-(0.85*v1**2/(2*g)))\n",
      "#RESULTS\n",
      "print  'water pressure at top  = %.2f ft of water '%(p1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "water pressure at top  = -19.05 ft of water \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.5 page no : 50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "import math \n",
      "d1 = 15. \t\t\t#in\n",
      "d2 = 6.\t\t\t#in\n",
      "h = 10. \t\t\t#in of mercury\n",
      "C = 0.98\n",
      "sm = 13.6\n",
      "w = 12.\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "a1 = math.pi*(d1/12)**2/4\n",
      "a2 = math.pi*(d2/12)**2/4\n",
      "h1 = h*(sm-1)/w\n",
      "Q = round(C*(a1*a2/(math.sqrt(a1**2-a2**2)))*math.sqrt(2*g)*math.sqrt(h1)*6.24*60*60,-2)\n",
      "\n",
      "#RESULTS\n",
      "print  'Discharge  = %.f gph '%(Q)\n",
      "\n",
      "# answer is different because of rounding error. Please calculate manually."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 113900 gph \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.6 page no : 52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "import math \n",
      "d1 = 8. \t\t\t#in\n",
      "d2 = 4. \t\t\t#in\n",
      "h = 10. \t\t\t#in of mercury\n",
      "Cd = 0.98\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "sm = 13.56\n",
      "#CALCULATIONS\n",
      "a1 = math.pi*(d1/12)**2/4\n",
      "a2 = math.pi*(d2/12)**2/4\n",
      "h1 = h*(sm-1)/12\n",
      "Q = a1*a2*math.sqrt(2*g)*math.sqrt(h1)/math.sqrt(a1**2-a2**2)\n",
      "Qactual = Cd*Q\n",
      "#RESULTS\n",
      "print  'Actual discharge  = %.2f cusecs '%(Qactual)\n",
      "\n",
      "# Note : Answer is slightly different because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Actual discharge  = 2.29 cusecs \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.7 page no : 54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "import math \n",
      "h = 6.8 \t\t\t#in of mercury\n",
      "sm = 13.6\n",
      "ssw = 1.026\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "V = math.sqrt(2*g*h*(sm-ssw)/12)*3600/5280\n",
      "#RESULTS\n",
      "print  'speed of submarine  = %.1f miles per hour '%(V)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "speed of submarine  = 14.6 miles per hour \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.8 page no : 58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "import math \n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "d1 = 2. \t\t\t#in\n",
      "d2 = 12. \t\t\t#in\n",
      "r = 1.4\n",
      "n = 0.905\n",
      "Q = 2995. \t\t\t#lb/ft**2\n",
      "w = 0.083 \t\t\t#lb/ft**3\n",
      "#CALCULATIONS\n",
      "V1 = round(1/w,2)\n",
      "n1 = round(n**((r-1)/r),2)\n",
      "n2 = n**(2/r)\n",
      "Q = math.pi*(d1/12)**2*math.sqrt(2*g*Q*(1-n1)*r/((r-1)*n2*(1-(d1/d2)**2)))\n",
      "\n",
      "#RESULTS\n",
      "print  'Volume of air passing through the Venturimeter  = %.1f cuses '%(Q)\n",
      "\n",
      "# note : answer is different because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume of air passing through the Venturimeter  = 13.5 cuses \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}