{
 "metadata": {
  "name": "",
  "signature": "sha256:98b9b2cc3c2bb837908ed50b11e73842e607c874a3e8f477bc1209f33ea8918d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 : Flow of Water Through Orifices and Mouthpieces"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1 Page No : 98"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "M = 31*10 \t\t#lbs\n",
      "P = 3.6 \t\t#lbs\n",
      "t = 60. \t\t#sec\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "H = 9. \t\t#ft\n",
      "d = 1. \t\t#in\n",
      "w = 6.24 \t\t#gallons\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "v = P*g*t/M\n",
      "V = math.sqrt(2*g*H)\n",
      "Cv = v/V\n",
      "V1 = math.pi*(d/12)**2*V*60*w/4\n",
      "Cd = M/(10*V1)\n",
      "Cc = Cd/Cv\n",
      "Cr = (1/Cv**2)-1\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Coefficient of resistance  = %.2f '%(Cr)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of resistance  = 0.15 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2 Page No : 100"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "M = 1.65 \t\t#lbs\n",
      "Q = 31. \t\t#gallons per min\n",
      "d = 1. \t\t#in\n",
      "h = 4. \t\t#ft\n",
      "t = 60. \t\t#sec\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "Q1 = 6.24 \t\t#gallons per min\n",
      "c = 0.36\n",
      "P = 3.6         # lbs\n",
      "H = 9. \n",
      "\n",
      "#CALCULATIONS\n",
      "v = P*g*t/(Q*10)\n",
      "V = math.sqrt(2*g*H)\n",
      "Cv = (v/V)\n",
      "vf = V*math.pi*(d/12)**2*60*Q1/4\n",
      "Cd = Q/vf\n",
      "Cc = Cd/Cv\n",
      "Cr = (1/Cv**2)-1\n",
      "\n",
      "#RESULTS\n",
      "print  'velocity of jet  = %.2f ft/sec'%(v)\n",
      "print  'theoretical velocity of jet  = %.2f ft/sec'%(V)\n",
      "print  'Cv  = %.2f '%(Cv)\n",
      "print  'volume flow  = %.2f gallons per minute'%(vf)\n",
      "print  'Cd  = %.2f '%(Cd)\n",
      "print  'Cc  = %.2f '%(Cc)\n",
      "print  'Coefficient of resistance  = %.2f '%(Cr)\n",
      "\n",
      "# Note : Answer for theoretical velocity is wrong in book. Please check."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "velocity of jet  = 22.44 ft/sec\n",
        "theoretical velocity of jet  = 24.07 ft/sec\n",
        "Cv  = 0.93 \n",
        "volume flow  = 49.16 gallons per minute\n",
        "Cd  = 0.63 \n",
        "Cc  = 0.68 \n",
        "Coefficient of resistance  = 0.15 \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3 Page No : 101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "x = 11.5 \t\t#in\n",
      "y = 1.2 \t\t#in\n",
      "H = 29. \t\t#in\n",
      "q = 6.24 \t\t#gallons per minute\n",
      "d = 1.  \t\t#in\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "Q = 16. \t\t#gallons per min\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "Cv = math.sqrt(x**2/(4*H*y))\n",
      "Q1 = math.pi*(d/12)**2*math.sqrt(2*g*H/12)*q*60/4\n",
      "Cd = Q/Q1\n",
      "Cc = Cd/Cv\n",
      "Cr = (1/Cv**2)-1\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Coefficient of resistance  = %.2f '%(Cr)\n",
      "\n",
      "# rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of resistance  = 0.05 \n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4 Page No : 102"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "x = 3.2 \t\t#ft\n",
      "d = 8. \t\t#ft\n",
      "W = 5.12 \t\t#lb\n",
      "A = 1./144\n",
      "H = 4. \t\t#ft\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "Q = 251.5 \t\t#lbs/min\n",
      "w = 62.4 \t\t#lbs/ft**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "F = W*x/d\n",
      "v = W*x*g*60/(d*Q)\n",
      "V = math.sqrt(2*g*H)\n",
      "Cv = v/V\n",
      "Q1 = A*V*60*w\n",
      "Cd = Q/Q1\n",
      "Cc = Cd/Cv\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Cc  = %.2f '%(Cc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cc  = 0.61 \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 Page No : 106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "d = 8. \t\t#in\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "Cd = 1/math.sqrt(1+((1./(8.**2/100)))-1)\n",
      "area = math.pi/4 * (2./12)**2\n",
      "Discharge = area * Cd * math.sqrt(2*32.2*4) \t\t\n",
      "\n",
      "#RESULTS\n",
      "print  'Cd  = %.2f '%(Cd)\n",
      "print \"Discharge = %.1f cubic ft./sec.\"%Discharge\n",
      "\n",
      "# note : rounding off error. please check."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cd  = 0.80 \n",
        "Discharge = 0.3 cubic ft./sec.\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6 Page No : 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "d =2.   \t\t#in\n",
      "h = 6. \t    \t#ft\n",
      "H = 26. \t\t#ft\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "R = 6.\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "v2 = math.sqrt(2*g*(H+h))\n",
      "Q = math.pi*(d/12)**2*v2/4\n",
      "v3 = math.sqrt(2*g*h)\n",
      "r = v2/v3\n",
      "d3 = math.sqrt(r*d**2)\n",
      "v4 = math.sqrt(v2**2/R)\n",
      "d4 = math.sqrt(d**2*(v2/v4))\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'diameter  = %.2f in'%(d4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "diameter  = 3.13 in\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7 Page No : 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "r = 9./16\n",
      "r1 = 7./16\n",
      "h = 26. \t\t#ft\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "r2 = 1/((r**2)+(0.25*r1**2))\n",
      "H1 = h/(r2-1)\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'maximu head of the tank  = %.3f ft of water'%(H1)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximu head of the tank  = 14.897 ft of water\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8 pageno : 114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variables\n",
      "A = 30.*15       # sq ft\n",
      "a = 2.           # sq ft\n",
      "H1 = 5.           # ft\n",
      "H2 = 0.   \n",
      "\n",
      "# calculation\n",
      "T = a*A*H1**(1./2)/(.62*a*8.02)\n",
      "\n",
      "# result\n",
      "print \"Time of emptying pool : T = %.1f seconds\"%T\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time of emptying pool : T = 202.4 seconds\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 Page No : 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "H1 = 9. \t\t#ft\n",
      "A = 2.  \t\t#ft**2\n",
      "H2 = 4. \t\t#ft\n",
      "d = 2.25 \t\t#in\n",
      "t = 60. \t\t#sec\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "a = (d/12)**2\n",
      "Cd = (2*A*(H1-H2)**0.5)/(t*a*math.sqrt(2*g))\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'coefficient of dicharge  = %.3f '%(Cd)\n",
      "\n",
      "\n",
      "#ANSWER GIVEN IN THE TEXTBBOK IS WRONG..VERIFIED WITH CALCULATOR\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "coefficient of dicharge  = 0.528 \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10 Page No : 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "d = 1.  \t\t#ft\n",
      "h1 = 10. \t\t#ft\n",
      "h2 = 2. \t\t#ft\n",
      "Cd = 0.6\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "t = 12.6\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "A = math.pi*d**2/4\n",
      "a = 1./144\n",
      "T1 = (A/(a*Cd*math.sqrt(2*g)))*(1./3)*(h1**1.5-(h1-h2)**1.5-h2**1.5)+t\n",
      "T2 = 2*A*(h2**0.5)/(Cd*a*math.sqrt(2*g))\n",
      "T = T1+T2\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Total time  = %.2f sec'%(T)\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total time  = 127.32 sec\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11 Page No : 117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad\n",
      "\n",
      "#initialisation of variables\n",
      "l = 600. \t\t#ft\n",
      "w = 400. \t\t#ft\n",
      "s = 1.\n",
      "h = 20. \t\t#ft\n",
      "d = 3. \t    \t#ft\n",
      "dh = 10. \t\t#ft\n",
      "Cd = 0.7\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "k = 240000.\n",
      "k1 = 2000.\n",
      "k2 = 4.\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "def f(x):\n",
      "    return (k/math.sqrt(x) + k1*math.sqrt(x) + k2*x**(3./2))\n",
      "\n",
      "T1 = 1./(Cd * math.pi/4 * 9 * 8.02) * quad(f,10,20)[0]\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Time taken for 10 feet fall  = %.f sec'%(T1)\n",
      "\n",
      "# note : quad() gives accurate answer. so answer is slightly different."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken for 10 feet fall  = 17846 sec\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 Page No : 118"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "Cd = 0.6\n",
      "H1 = 8. \t\t#ft\n",
      "H2 = 3. \t\t#ft\n",
      "l = 90. \t\t#ft\n",
      "b = 30. \t\t#ft\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "A = 2.   \t\t#ft**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "T1 = 2*l*b*(H1**0.5-(H1-H2)**0.5)/(Cd*math.sqrt(2*g)*A)\n",
      "T2 = (l*b*2/10)*(2./3)*(H1-H2)**1.5/(Cd*math.sqrt(2*g)*A)\n",
      "T = T1+T2\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Time it take to emptify the swimming bath  = %.1f sec'%(T)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time it take to emptify the swimming bath  = 750.1 sec\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13 Page No : 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "Cd = 0.8\n",
      "g = 32.2 \t\t#f/sec**2\n",
      "d = 3.  \t\t#in\n",
      "x = 6. \t    \t#ft\n",
      "l = 25. \t\t#ft\n",
      "d1 = 8. \t\t#ft\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "A = math.pi*(d/12)**2/4\n",
      "T = (2*l/(Cd*A*math.sqrt(2*g)))*(-2./3)*((d1-x)**1.5-d1**1.5)\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Time it take to emptify the boiler  = %.f sec'%(T+6)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time it take to emptify the boiler  = 2100 sec\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14 Page No : 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "l = 30. \t\t#ft\n",
      "w = 10. \t\t#ft\n",
      "d = 4.  \t\t#in\n",
      "h1 = 10. \t\t#ft\n",
      "h2 = 2. \t\t#ft\n",
      "Cd = 0.97\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "A1 = w*3*l/4\n",
      "A2 = l*w/4\n",
      "A = math.pi*(d/12)**2/4\n",
      "T = 2*A1*(math.sqrt(h1)-math.sqrt(h2))*10/(Cd*A*math.sqrt(2*g)*(l+w))\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Time it take to reduce the height  = %.f sec'%(round(T,-1))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time it take to reduce the height  = 290 sec\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15 Page No : 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "A1 = 1000. \t\t#ft**2\n",
      "A2 = 1000. \t\t#ft**2\n",
      "a = 2. \t\t#ft**2\n",
      "H1 = 9. \t\t#ft\n",
      "H2 = 4. \t\t#ft\n",
      "Cd =0.8\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "T = a*1000*(math.sqrt(H1)-math.sqrt(H2))/(Cd*a**2*math.sqrt(2*g))\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Time it take to reduce the height  = %.1f sec'%(T)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time it take to reduce the height  = 77.9 sec\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16 Page No : 128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "l = 70. \t\t#ft\n",
      "b = 10. \t\t#ft\n",
      "Hl = 10. \t\t#ft\n",
      "H1 = 6. \t\t#ft\n",
      "h1 = 4. \t\t#ft\n",
      "h2 = 2. \t\t#ft\n",
      "w = 2. \t\t#ft\n",
      "h3 = 3. \t\t#ft\n",
      "Cd = 0.6\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "t = (l*b)*(Hl+H1)/(Cd*h2*w*h1*math.sqrt(2*g*H1))\n",
      "t1 = 2*l*b*math.sqrt(Hl)/(Cd*h2*w*h3*math.sqrt(2*g))\n",
      "\t\t\n",
      "#RESULTS\n",
      "# 2nd ans is wrong in book\n",
      "print  'Time of filling = %.2f sec'%(t)\n",
      "print  ' Time of emptying = %.2f sec'%(t1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time of filling = 59.35 sec\n",
        " Time of emptying = 76.62 sec\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17 Page No : 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from sympy import Symbol,solve\n",
      "\t\t\n",
      "#initialisation of variables\n",
      "HL = 12.5 \t\t#ft\n",
      "H1 = 10.5 \t\t#ft\n",
      "Cd = 0.62\n",
      "h = 4.   \t\t#ft\n",
      "l = 3. \t    \t#ft\n",
      "n = 2.\n",
      "t = 5. \t\t    #min\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "a1 = n*l*l\n",
      "A = Symbol('A')\n",
      "ans = solve( (2*A/(Cd*a1*26)) + 2*A*math.sqrt(H1)/(Cd*a1*8.02) - 300 )\n",
      "A = ans[0]\n",
      "\n",
      "#RESULTS\n",
      "print  'Area = %.f sq ft'%(A)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Area = 3783 sq ft\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.18 Page No : 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "Cd = 0.62\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "l = 200. \t\t#ft\n",
      "w = 25. \t\t#ft\n",
      "a1 = 5. \t\t#ft**2\n",
      "h = 20. \t\t#ft\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "t = 2*l*w*math.sqrt(h-(h/a1))/(Cd*math.sqrt(2*g)*a1)\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'tme rquired to fill the lock = %.f sec'%(t)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "tme rquired to fill the lock = 1608 sec\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.19 Page No : 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "L = 150. \t\t#ft\n",
      "w = 20. \t\t#ft\n",
      "t = 5.  \t\t#min\n",
      "h = 5. \t    \t#ft\n",
      "Cd = 0.6 \n",
      "Hl = 9. \t\t#ft\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "T = 2*L*w*math.sqrt(Hl)/(Cd*t*60*math.sqrt(2*g))\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Area of sumberged slice = %.1f sq ft'%(T)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Area of sumberged slice = 12.5 sq ft\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20 Page No : 132"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "L = 3. \t\t#ft\n",
      "H1 = 1.5 \t\t#ft\n",
      "H2 = 0.75 \t\t#ft\n",
      "Cd = 0.62\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "Q = 2*Cd*60*L*math.sqrt(2*g)*(H1**1.5-H2**1.5)/3\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Discharge per minute = %.1f cubic ft per minute'%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge per minute = 709.1 cubic ft per minute\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21 Page No : 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\n",
      "#initialisation of variables\n",
      "Cd = 0.62\n",
      "H1 = 6. \t\t#ft\n",
      "H2 = 3. \t\t#ft\n",
      "H = 4.   \t\t#ft\n",
      "g = 32.2 \t\t#ft/sec**2\n",
      "\t\t\n",
      "#CALCULATIONS\n",
      "Q1 = 2*Cd*H*math.sqrt(2*g)*(H**1.5-H2**1.5)/3\n",
      "Q2 = Cd*H*(H1-H)*math.sqrt(2*g*H)\n",
      "Q = Q1+Q2\n",
      "\t\t\n",
      "#RESULTS\n",
      "print  'Total discharge = %.f cuses'%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total discharge = 117 cuses\n"
       ]
      }
     ],
     "prompt_number": 21
    }
   ],
   "metadata": {}
  }
 ]
}