{
 "metadata": {
  "name": "",
  "signature": "sha256:2a190d13b5257d1faa42fcfeeabd3d60753568985b5980f046c77d0ac8fde0a3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11 : Flow Measurement"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.1 Page No : 321"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "staticPHead = 5.;\t\t\t#meter\n",
      "stagnationPHead = 6.;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "h = stagnationPHead-staticPHead;\t\t\t#meter\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cv = 0.98;\t\t\t#Coeff of pilot tube\n",
      "V = Cv*math.sqrt(2*g*h);\t\t\t#m/s\n",
      "\n",
      "# Results\n",
      "print \"Velocity of flow in m/sec : %.2f\"%V\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of flow in m/sec : 4.34\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.2 Page No : 321"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cv = 0.975;\t\t\t#Coeff of pilot tube\n",
      "h = 100./1000;\t\t\t#meter\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Sm = 13.6;\t\t\t#Sp. gravity\n",
      "S = 0.86;\t\t\t#gravity of turpinre\n",
      "\n",
      "# Calculations\n",
      "V = Cv*math.sqrt(2*g*h*(Sm/S-1));\t\t\t#m/s\n",
      "\n",
      "# Results\n",
      "print \"Velocity in m/sec : %.3f\"%V\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity in m/sec : 5.256\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3 Page No : 325"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\n",
      "# Variables :\n",
      "l = 2.;\t\t\t#meter\n",
      "d0 = 0;\t\t\t#meter\n",
      "d1 = 0.3;\t\t\t#meter\n",
      "d2 = 1.0;\t\t\t#meter\n",
      "d3 = 1.2;\t\t\t#meter\n",
      "d4 = 1.6;\t\t\t#meter\n",
      "d5 = 2.0;\t\t\t#meter\n",
      "d6 = 1.4;\t\t\t#meter\n",
      "d7 = 1.0;\t\t\t#meter\n",
      "d8 = 0.4;\t\t\t#meter\n",
      "d9 = 0.3;\t\t\t#meter\n",
      "d10 = 0.2;\t\t\t#meter\n",
      "V0 = 0;\t\t\t#meter\n",
      "V1 = 0.5;\t\t\t#meter\n",
      "V2 = 0.7;\t\t\t#meter\n",
      "V3 = 0.8;\t\t\t#meter\n",
      "V4 = 1.0;\t\t\t#meter\n",
      "V5 = 1.2;\t\t\t#meter\n",
      "V6 = 0.9;\t\t\t#meter\n",
      "V7 = 0.8;\t\t\t#meter\n",
      "V8 = 0.6;\t\t\t#meter\n",
      "V9 = 0.5;\t\t\t#meter\n",
      "V10 = 0.3;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "Q = l/3*(d0*V0+4*d1*V1+2*d2*V2+4*d3*V3+2*d4*V4+4*d5*V5+2*d6*V6+4*d7*V7+2*d8*V8+4*d9*V9+2*d10*V10+d0*V0);\t\t\t#cum/sec\n",
      "\n",
      "# Results\n",
      "print \"Rate of discharge in cum/sec : \",Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of discharge in cum/sec :  17.04\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.4 Page No : 329"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cd = 0.62;\t\t\t#consmath.tant\n",
      "H = 0.12;\t\t\t#meter\n",
      "L = 0.3;\t\t\t#meter\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "\n",
      "# Calculations\n",
      "Q = 2./3*Cd*math.sqrt(2*g)*L*H**(3./2);\t\t\t#m**3/s\n",
      "\n",
      "# Results\n",
      "print \"Discharge in m**3/sec : %.4f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge in m**3/sec : 0.0228\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.5 Page No : 329"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cd = 0.66;\t\t\t#consmath.tant\n",
      "H = 0.15;\t\t\t#meter\n",
      "L = 0.40;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Q = 2./3*Cd*math.sqrt(2*g)*L*H**(3./2);\t\t\t#m**3/s\n",
      "\n",
      "# Results\n",
      "print \"Discharge in m**3/sec : %.5f\"%Q\n",
      "print \"Discharge in litres/sec : %.2f\"%(Q*10**3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge in m**3/sec : 0.04529\n",
        "Discharge in litres/sec : 45.29\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.6 Page No : 331"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cd = 0.62;\t\t\t#consmath.tant\n",
      "H = 200./1000;\t\t\t#meter\n",
      "theta = 90.;\t\t\t#degree\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "\n",
      "# Calculations\n",
      "Q = 8./15*Cd*math.sqrt(2*g)*math.tan(math.radians(theta/2))*H**(5./2);\t\t\t#m**3/s\n",
      "Q = Q*1000*60;\t\t\t#litres/minute\n",
      "\n",
      "# Results\n",
      "print \"Discharge in litres/minute : %.f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge in litres/minute : 1572\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.7 Page No : 331"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cd = 0.62;\t\t\t#consmath.tant\n",
      "Q = 250;\t\t\t#litres/sec\n",
      "Q = Q*10**-3;\t\t\t#m**3/s\n",
      "theta = 90;\t\t\t#degree\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "d = 1.3;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "H = (Q/8*15/Cd/math.sqrt(2*g)/math.tan(math.radians(theta/2)))**(2./5);\t\t\t#m\n",
      "h = d-H;\t\t\t#meter\n",
      "\n",
      "# Results\n",
      "print \"Position above the bed in meter : %.3f\"%h\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Position above the bed in meter : 0.807\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.8 Page No : 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cd = 0.65;\t\t\t#consmath.tant\n",
      "A = 220;\t\t\t#m**2\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "l = 30./100;\t\t\t#meter\n",
      "H1 = 16.8/100;\t\t\t#meter\n",
      "H2 = 6.8/100;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "def f1(h): \n",
      "\t return h**(-3./2)\n",
      "\n",
      "T = A/(2./3*Cd*l*math.sqrt(2*g))* quad(f1,H2,H1)[0]\n",
      "\n",
      "# Results\n",
      "print \"Time taken is \",(math.floor(T/60)),\" minute \",round((T/60-math.floor(T/60))*60),\" sec.\"\n",
      "\n",
      "# note : answer might be vary because of quad function."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken is  17.0  minute  46.0  sec.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.9 Page No : 337"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "H = 0.40;\t\t\t#meter\n",
      "L = 5;\t\t\t#meter\n",
      "print (\"(i) End contractions are Suppressed : \");\n",
      "\n",
      "# Calculations and Results\n",
      "Q = 1.84*L*H**(3./2);\t\t\t#m**3/s\n",
      "print \"Discharge in m**3/sec : %.4f\"%Q\n",
      "print \"Discharge in litres/sec : %.1f\"%(Q*1000)\n",
      "\n",
      "print (\"(ii) End contractions are Considered : \");\n",
      "n = 2;\n",
      "Q = 1.84*(L-0.1*n*H)*H**(3./2);\t\t\t#m**3/s\n",
      "print \"Discharge in m**3/sec : %.5f\"%Q\n",
      "print \"Discharge in litres/sec : %.2f\"%(Q*1000)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i) End contractions are Suppressed : \n",
        "Discharge in m**3/sec : 2.3274\n",
        "Discharge in litres/sec : 2327.4\n",
        "(ii) End contractions are Considered : \n",
        "Discharge in m**3/sec : 2.29020\n",
        "Discharge in litres/sec : 2290.20\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.10 Page No : 339"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cd = 0.62;\t\t\t#Coeff of discharge\n",
      "H = 250./1000;\t\t\t#meter\n",
      "L = 400./1000;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "g = 9.81;\t\t\t#gravity acceleration\n",
      "Q = 2./3*Cd*math.sqrt(2*g)*L*H**(3./2);\t\t\t#m**3/s or cumec\n",
      "\n",
      "# Results\n",
      "print \"Discharge in cumec : %.4f\"%Q\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge in cumec : 0.0915\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.11 Page No : 339"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "B = 1.3;\t\t\t#meter\n",
      "H1 = 6-(1.8+1.5);\t\t\t#meter\n",
      "H2 = 6-1.5;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "Q = 2./3*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2));\t\t\t#m**3/sec\n",
      "\n",
      "# Results\n",
      "print \"Discharge through the orifice in m**3/sec : %.1f\"%Q\n",
      "\n",
      "# note : answer is in m**3/sec."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge through the orifice in m**3/sec : 11.8\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.12  Page No : 342"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Cd = 0.60;\t\t\t#Coeff of discharge\n",
      "L = 36.;\t\t\t#meter\n",
      "H = 1.1;\t\t\t#meter\n",
      "A = 50.;\t\t\t#m**2\n",
      "g = 9.81;\t\t\t#gravity acceleration\n",
      "\n",
      "# Calculations and Results\n",
      "Qmax = 1.705*Cd*L*H**(3./2);\t\t\t#m**3/s\n",
      "print \"Maximum Discharge in m**3/sec : %.3f\"%Qmax\n",
      "\n",
      "Va = Qmax/A;\t\t\t#m/s(velocity of approach)\n",
      "Q = 1.705*Cd*L*((H+Va**2/2/g)**(3./2)-(Va**2/2/g)**(3./2));\t\t\t#m**3/s\n",
      "print \"New discharge considering velocity of approach in m**3/sec : %.2f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum Discharge in m**3/sec : 42.488\n",
        "New discharge considering velocity of approach in m**3/sec : 44.38\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.13 Page No : 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "w = 1.5;\t\t\t#m\n",
      "d = 0.75;\t\t\t#m\n",
      "Cd = 0.64;\t\t\t#Coeff of discharge\n",
      "QT = 45.;\t\t\t#cumec\n",
      "h = 8.;\t\t\t#meter\n",
      "A = w*d;\t\t\t#m**2\n",
      "g = 9.81;\t\t\t#gravity acceleration\n",
      "\n",
      "# Calculations\n",
      "Q = Cd*A*math.sqrt(2*g*h);\t\t\t#m**3/sec\n",
      "n = QT/Q;\t\t\t#no. of spillways\n",
      "\n",
      "# Results\n",
      "print \"No. of spillways : \",round(n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "No. of spillways :  5.0\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.14 Page No : 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "B = 1;\t\t\t#meter\n",
      "b = 0.4;\t\t\t#meter\n",
      "H = 0.57;\t\t\t#meter\n",
      "h = 0.5;\t\t\t#meter\n",
      "A = B*H;\t\t\t#m**2\n",
      "g = 9.81;\t\t\t#gravity consmath.tant\n",
      "a = b*h;\t\t\t#m**2\n",
      "\n",
      "# Calculations\n",
      "Q = A*a/math.sqrt(A**2-a**2)*math.sqrt(2*g*(H-h));\t\t\t#m**3/sec\n",
      "\n",
      "# Results\n",
      "print \"Discharge in m**3/sec : %.2f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge in m**3/sec : 0.25\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}