{
 "metadata": {
  "name": "",
  "signature": "sha256:7c51eb85c2f5974253c21c1966c99eb7233e433431ba178d1ba6aaccb3adc83a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 :  Flow Over Weirs Notches"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.1 page no : 103"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "#initialisation of variables\n",
      "p = 70. \t\t\t#per cent\n",
      "Cd = 0.6\n",
      "Q = 50. \t\t\t#million gallons\n",
      "H = 2. \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",
      "Q1 = p*Q*10**6*10/(100*w*24*3600)\n",
      "L = Q1*3/(2*Cd*math.sqrt(2*g)*H**1.5)\n",
      "#RESULTS\n",
      "print  'length of the weir  = %.2f ft '%(L)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "length of the weir  = 7.15 ft \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.2 page no : 104"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "L = 15. \t\t\t#ft\n",
      "H = 1. \t\t\t#ft\n",
      "Cd = 0.6\n",
      "v = 80. \t\t\t#ft/min\n",
      "g = 32.2 \t\t\t#ft/sec62\n",
      "w = 62.4 \t\t\t#lb/ft**3\n",
      "#CALCULATIONS\n",
      "vo = v/60\n",
      "Q = 2*Cd*math.sqrt(2*g)*L*((1+(vo**2/(2*g)))**1.5-(vo**2/(2*g))**1.5)*w*100/(3*550)\n",
      "#RESULTS\n",
      "print  'HP  = %.f HP '%(Q)\n",
      "\n",
      "# This is accurate answer. Please calcualte manually."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "HP  = 567 HP \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.3 pageno :  104"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "L = 11. \t\t\t#ft\n",
      "H = 0.7 \t\t\t#ft\n",
      "Cd = 0.6\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "h = 1.95 \t\t\t#ft\n",
      "Q = 20.65 \t\t\t#cuses\n",
      "Q1 = 21.2 \t\t\t#cfs\n",
      "\n",
      "#CALCULATIONS\n",
      "Q = 2*Cd*math.sqrt(2*g)*L*H**1.5/3\n",
      "vo = Q/(h*L)\n",
      "h1 = vo**2/(2*g)\n",
      "Q1 = 2*Cd*math.sqrt(2*g)*L*((H+(vo**2/(2*g)))**1.5-(vo**2/(2*g))**1.5)/3\n",
      "v1 = Q1/(L*h)\n",
      "Q2 = 2*Cd*math.sqrt(2*g)*L*((H+(v1**2/(2*g)))**1.5-(v1**2/(2*g))**1.5)/3\n",
      "p = (Q2-Q1)*100/Q1\n",
      "\n",
      "#RESULTS\n",
      "print \"Head to velocity approach = %.1f cu ft/sec\"%Q1\n",
      "print \"Q2 = %.2f cu ft/sec\"%Q2\n",
      "print  'discharge percent  = %.3f per cent '%(p)\n",
      "\n",
      "# Note : answers may vary because of rounding error. Please calculate manually."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Head to velocity approach = 21.3 cu ft/sec\n",
        "Q2 = 21.29 cu ft/sec\n",
        "discharge percent  = 0.148 per cent \n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.4 page no : 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "b = 3. \t\t\t#ft\n",
      "H = 1 \t\t\t#ft\n",
      "Q = 9 \t\t\t#cfs\n",
      "Q1 = 1.105      # log Q from fig.\n",
      "h = 0.1 \t\t# log H from fig. ft\n",
      "#CALCULATIONS\n",
      "K = Q/b\n",
      "n = (Q1-math.log10(3*K))/h\n",
      "#RESULTS\n",
      "print  'K  = %.f  '%(K)\n",
      "print  'n  = %.1f  '%(n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "K  = 3  \n",
        "n  = 1.5  \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.5 page no : 108"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "Cd = 0.62\n",
      "L = 7.573 \t\t\t#ft\n",
      "H = 1.2 \t\t\t#ft\n",
      "S = 2.85 \t\t\t#ft\n",
      "#CALCULATIONS\n",
      "Q1 = 2*Cd*math.sqrt(2*g)*L*H**1.5/3\n",
      "Q2 = 3.33*L*H**1.5\n",
      "Q3 = math.sqrt(2*g)*L*H**1.5*(0.405+(0.00984/H))\n",
      "He = H+0.004\n",
      "Q4 = (3.227+0.435*(He/S))*L*He**1.5\n",
      "#RESULTS\n",
      "print  'Q  = %.2f cuses '%(Q1)\n",
      "print  'Q  = %.2f cuses '%(Q2)\n",
      "print  'Q  = %.2f cuses '%(Q3)\n",
      "print  'Q  = %.2f cuses '%(Q4)\n",
      "\n",
      "# Note : answers may vari because of rounding error. Please check manually."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Q  = 33.02 cuses \n",
        "Q  = 33.15 cuses \n",
        "Q  = 33.01 cuses \n",
        "Q  = 34.12 cuses \n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.6 pageno : 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "H = 2.5 \t\t\t#ft\n",
      "L = 10 \t\t\t#ft\n",
      "A = 10 \t\t\t#miles\n",
      "p = 30 \t\t\t#per cent\n",
      "a = 2 \t\t\t#in/hr\n",
      "w = 2 \t\t\t#ft\n",
      "#CALCULATIONS\n",
      "Q = L*1760**2*3**2*a*p/(60*60*12*100)\n",
      "n = ((Q/(3.33*H**1.5))-(L-0.1*w*H))/(L-0.1*w*H)\n",
      "#RESULTS\n",
      "print  'n  = %.f  '%(n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "n  = 30  \n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.7 page no : 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "L = 2.5 \t\t\t#ft\n",
      "H = 1 \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "Cd = 0.61\n",
      "L1 = 1.75 \t\t\t#ft\n",
      "L2 = 2.25 \t\t\t#ft\n",
      "#CALCULATIONS\n",
      "Q1 = 2*Cd*math.sqrt(2*g)*L*H/3\n",
      "Q2 = 2*Cd*math.sqrt(2*g)*L1*(L1**1.5-1)/3\n",
      "Q3 = 2*Cd*math.sqrt(2*g)*H*(L2**1.5-L1**1.5)/3\n",
      "Q = Q1+Q2+Q3\n",
      "#RESULTS\n",
      "print  'Total discharge  = %.1f cfs '%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total discharge  = 19.1 cfs \n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.8 page no : 110"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "h1 = 16.63 \t\t\t#cm\n",
      "h2 = 10.18 \t\t\t#cm\n",
      "h3 = 16.53 \t\t\t#cm\n",
      "#CALCULATIONS\n",
      "H1 = h1-h2\n",
      "H2 = h3-h2\n",
      "p = (H1**1.5-H2**1.5)*100/H1**1.5\n",
      "#RESULTS\n",
      "print  'Percent decrease in discharge  = %.2f %% '%(p)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percent decrease in discharge  = 2.32 % \n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.9 pageno : 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "Cd = 0.6\n",
      "a = 20000 \t\t\t#yd**2\n",
      "H2 = 12 \t\t\t#in\n",
      "L = 5 \t\t\t#ft\n",
      "H1 = 2 \t\t\t#ft\n",
      "g =32.2 \t\t\t#ft/s**2\n",
      "#CALCULATIONS\n",
      "t = 2*a*9*(L-H1)*((1/math.sqrt(H2/12))-(1/math.sqrt(H1)))/(2*60*Cd*math.sqrt(2*g)*L)\n",
      "#RESULTS\n",
      "print  'time required to lower level of reservoir  = %.2f min '%(t)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time required to lower level of reservoir  = 109.49 min \n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.10 pageno : 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "L = 3. \t\t\t#ft\n",
      "H = 6. \t\t\t#in\n",
      "Cd = 0.62\n",
      "Cd1 = 0.59\n",
      "a = 45. \t\t\t#degrees\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "H = ((2./3)*Cd*math.sqrt(2*g)*L*(H/12)**1.5/((8./15)*Cd1*math.sqrt(2*g)))**0.4\n",
      "#RESULTS\n",
      "print  'depth of water  = %.3f ft '%(H)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "depth of water  = 1.142 ft \n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.11 page no : 114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "V = 20. \t\t\t#litres\n",
      "g = 981. \t\t\t#cm/sec**2\n",
      "Cd = 0.593\n",
      "r = 2.5\n",
      "r1 = 1.5\n",
      "e = 2. \t\t\t#mm\n",
      "Cd1 = 0.623\n",
      "L = 30. \t\t\t#cm\n",
      "#CALCULATIONS\n",
      "H = (V*1000*15/(8*Cd*math.sqrt(2*g)))**0.4\n",
      "dH1 = e/10.\n",
      "p = r*dH1*100/H\n",
      "H1 = (V*3*1000/(2*Cd1*math.sqrt(2*g)*L))**(2./3)\n",
      "p1 = r1*dH1*100/H1\n",
      "#RESULTS\n",
      "print  'percentage error of discharge over the weir  = %.2f %% '%(p)\n",
      "print  'percentage error of discharge over the weir  = %.2f %% '%(p1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "percentage error of discharge over the weir  = 2.74 % \n",
        "percentage error of discharge over the weir  = 2.74 % \n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.12 page no : 116"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "L = 16. \t\t\t#in\n",
      "H = 9. \t\t\t#in\n",
      "h = 18. \t\t\t#in\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "w = 2. \t\t\t#ft\n",
      "Cd = 0.63\n",
      "W = 62.4 \t\t\t#lbs/ft**3\n",
      "#CALCULATIONS\n",
      "Q = 2*Cd*math.sqrt(2*g)*(L/12)*(H/12)**1.5/3\n",
      "v = Q/(w*(h/12))\n",
      "H1 = v**2/(2*g)\n",
      "Q1 = 2*Cd*math.sqrt(2*g)*(L/12)*(((H/12)+H1)**1.5-H1**1.5)*W*6/3.\n",
      "#RESULTS\n",
      "print  'Discharge  = %.f gpm '%(Q1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 1122 gpm \n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.13 pageno : 118"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "L = 100 \t\t\t#ft\n",
      "H = 2.25 \t\t\t#ft\n",
      "Cd = 0.95\n",
      "w = 120 \t\t\t#ft\n",
      "h = 2 \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "Q = round(3.087*Cd*L*H**1.5)\n",
      "v0 = round(Q/(w*(h+H)),2)\n",
      "Q1 = 3.087*Cd*L*((H+(v0**2/(2*g)))**1.5-(v0**2/(2*g))**1.5)\n",
      "#RESULTS\n",
      "print  'Discharge  = %.0f cuses '%(Q1)\n",
      "\n",
      "# Note: answer is slightly different because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 1024 cuses \n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.14 pageno : 119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "L = 6 \t\t\t#ft\n",
      "H1 = 0.5 \t\t\t#ft\n",
      "H2 = 0.25 \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "Cd1 = 0.58\n",
      "Cd2 = 0.8\n",
      "w = 6.24 \t\t\t#lb/ft**3\n",
      "#CALCULATIONS\n",
      "Q1 = 2*Cd1*math.sqrt(2*g)*L*(H1-H2)**1.5/3\n",
      "Q2 = Cd2*L*H2*math.sqrt(2*g*(H1-H2))\n",
      "Q = round((Q1+Q2)*w*3600,-3)\n",
      "#RESULTS\n",
      "print  'Discharge  = %.f gph '%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge  = 160000 gph \n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.15 pageno : 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "W = 100 \t\t\t#ft\n",
      "h = 10 \t\t\t#ft\n",
      "v = 4 \t\t\t#ft/sec\n",
      "h1 = 3 \t\t\t#ft\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "H = 5.4 \t\t\t#ft\n",
      "Cd1 = 0.58\n",
      "Cd2 = 0.8\n",
      "#CALCULATIONS\n",
      "v0 = (W*h*v)/(W*(h+h1))\n",
      "h0  =v0**2/(2*g)\n",
      "H2 = (W*h*v-(2*Cd1*W*math.sqrt(2*g)*((h1+h0)**1.5-h0**1.5)/3))/(Cd2*W*math.sqrt(2*g*(h1+h0)))\n",
      "dh = h-H2\n",
      "#RESULTS\n",
      "print  'height of anicut which is drowned  = %.f ft '%(dh)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "height of anicut which is drowned  = 8 ft \n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.16 page no : 123"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "x = 6. \t\t\t#in\n",
      "l = 200. \t\t\t#ft\n",
      "d = 10. \t\t\t#ft\n",
      "v = 4. \t\t\t#ft/sec\n",
      "Ce = 0.95\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "#CALCULATIONS\n",
      "l1 = math.sqrt(l**2/(Ce**2*(((x/12)*2*g/v**2)+(d**2/(d+(x/12))**2))))\n",
      "#RESULTS\n",
      "print  'length  = %.f ft '%(l1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "length  = 123 ft \n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4.17 page no : 124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "g = 32.2 \t\t\t#ft/sec**2\n",
      "H = 25. \t\t\t#ft\n",
      "l = 2.5 \t\t\t#ft\n",
      "b = 5. \t\t\t#ft\n",
      "Cd = 0.64\n",
      "Q = 3200. \t\t\t#cuses\n",
      "L =150. \t\t\t#ft\n",
      "C =3.2\n",
      "depth =0.5 \t\t\t#ft\n",
      "A1 =5000000. \t\t\t#sq yards\n",
      "#CALCULATIONS\n",
      "Q1 = Cd*l*b*math.sqrt(2*g*H)\n",
      "n = Q/Q1\n",
      "h = (Q/(3.2*L))**(2./3)\n",
      "hr =h-depth\n",
      "Area =A1*9\n",
      "V = round(Area*hr,-6)\n",
      "#RESULTS\n",
      "print  'number of spilways  = %.f  '%(n)\n",
      "print \"Volume of extra water stored  = %d cu ft\"%(V)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "number of spilways  = 10  \n",
        "Volume of extra water stored  = 137000000 cu ft\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}