{
 "metadata": {
  "name": "",
  "signature": "sha256:0b768eee327c152542090a0f937dd89a2c22ad814a4f647a6c9e07a61c4c86d1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 : Flow Through Open Channels"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.1 Page No : 140"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 6.          # m width\n",
      "i = 1./1000     # slope\n",
      "d = 2.          # m, depth of water\n",
      "C = 50          # Constant \n",
      "\n",
      "# Calculations \n",
      "A = b*d\n",
      "m = A/(b+2*d)\n",
      "Q = A*C*((i*m)**0.5)\n",
      "\n",
      "# Results \n",
      "print \"flow rate assuming chezys consmath.tant eqaul to 50 in m3/sec\",round(Q,4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "flow rate assuming chezys consmath.tant eqaul to 50 in m3/sec 20.7846\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.2 Page No : 140"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 5.          #m wide\n",
      "d = 3.          #m deep\n",
      "i = 1./1000     #slope \n",
      "C = 55.         #constant\n",
      "\n",
      "# Calculations \n",
      "A = b*d\n",
      "m = A/(b+2*d)\n",
      "Q = A*C*((i*m)**0.5)\n",
      "v = Q/A\n",
      "\n",
      "# Results \n",
      "print \"flow rate assuming chezys constant eqaul to 55 in m3/sec & velocity of flow in m/sec : \",v,Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "flow rate assuming chezys constant eqaul to 55 in m3/sec & velocity of flow in m/sec :  2.03100960116 30.4651440174\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.3 Page No : 141"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 2.5       #m wide\n",
      "d = 2.5       #m depth\n",
      "C = 56.       #constant\n",
      "A = b*(7.5+d)*0.5\n",
      "\n",
      "# Calculations \n",
      "P = 2.5+((b*b+d*d)**0.5)*2\n",
      "m = A/P\n",
      "i = 1./1200\n",
      "Q = A*C*((m*i)**0.5)\n",
      "\n",
      "# Results \n",
      "print \"the diacharge through the channel in litres/sec\",round((Q*1000),4)\n",
      "\n",
      "# note : rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the diacharge through the channel in litres/sec 23093.0995\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.4 Page No : 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\n",
      "# Variables\n",
      "b = 3.5           #m, width\n",
      "i = 1./1000       # slope\n",
      "d = 1.5           #m, depth of flow\n",
      "C = 60.           # degree C\n",
      "y = 60.           #Constant\n",
      "\n",
      "# Calculations \n",
      "x = 1.5/math.tan(math.radians(y))\n",
      "w = b+x*2\n",
      "A = (w+b)*0.5*d\n",
      "P = b+2*((x*x+d*d)**0.5)\n",
      "m = A/P\n",
      "Q = A*C*((m*i)**0.5)\n",
      "\n",
      "# Results \n",
      "print \"discharge carried by the canal in litres/sec : %.2f\"%(Q*1000)\n",
      "\n",
      "# note : rounding off error.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "discharge carried by the canal in litres/sec : 12049.94\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5 Page No : 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 9.           #m, width\n",
      "i = 1./3000      #slope   \n",
      "d = 1.2          #m, water depth\n",
      "\n",
      "# Calculations \n",
      "w = b+d\n",
      "A = (w+b)*0.5*d\n",
      "P = b+2*((d*d+d*d*0.25)**0.5)\n",
      "m = A/P\n",
      "C = 50.\n",
      "V = C*((m*i)**0.5)\n",
      "Q = V*A\n",
      "\n",
      "# Results \n",
      "print \"average velocity of flow, rate of flow\",round(V,7),round((Q*1000),3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "average velocity of flow, rate of flow 0.9064695 10442.529\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.6 Page No : 143"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Q = 0.1      \n",
      "b = 0.6      #m, width\n",
      "C = 56       # constant\n",
      "d = 0.3     #m, depth of flow\n",
      "\n",
      "# Calculations \n",
      "a = b*d\n",
      "v = Q/a\n",
      "p = b+2*d\n",
      "m = a/p\n",
      "i = (v*v)/(C*C*m)\n",
      "k = a*C*(m**0.5)\n",
      "\n",
      "# Results \n",
      "print \"bottom slope neccessary for uniform flow,conveyance of the channel section\",round(i,7),round(k,7)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "bottom slope neccessary for uniform flow,conveyance of the channel section 0.0006561 3.9039672\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.7 Page No : 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "i = 1./1000     #slope\n",
      "d = 1.5         #m, depth of water\n",
      "Cd = 0.55       #co-effient\n",
      "a = d*d\n",
      "C = 40.        # constant\n",
      "g = 9.81\n",
      "\n",
      "# Calculations \n",
      "m = d\n",
      "Q = a*C*((d*i)**0.5)\n",
      "H = (3*Q/(Cd*2*((2*g)**0.5)))**0.4\n",
      "height = d+3-H\n",
      "\n",
      "# Results \n",
      "print \"height of the dam in m\",round(height,3)\n",
      "\n",
      "# note : book answer is wrong. kindly check."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "height of the dam in m 3.143\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.8 Page No : 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 1.4        #m, width\n",
      "d = 1.4        #m, depth\n",
      "n = 1./4       # side slope \n",
      "i = 1./700     #bad slope\n",
      "\n",
      "# Calculations \n",
      "N = 0.025\n",
      "a = d*(b+(n*d))\n",
      "p = b+(2*d*((n*n+1)**0.5))\n",
      "m = a/p\n",
      "q = (a*(m**0.6666)*(i**0.5))/N\n",
      "\n",
      "# Results \n",
      "print \"discharge from the trapezoidal channel in litres/sec\",round((q*1000),3)\n",
      "\n",
      "# note : rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "discharge from the trapezoidal channel in litres/sec 2551.276\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.9 Page No : 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Q = 0.3                        #m**3/s rate\n",
      "D = 1.5                        #m diameter\n",
      "N = 0.02                       #N \n",
      "A = 3.142*D*D/(4*2)\n",
      "p = 3.142*D/2\n",
      "\n",
      "# Calculations \n",
      "m = A/p\n",
      "i = ((Q*N)/(A*(m**0.6666)))**2\n",
      "\n",
      "# Results \n",
      "print \"the slope of the sewer\",round(i,7)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the slope of the sewer 0.0001705\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.10 Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "D = 2.4         #m diameter\n",
      "d = 1.5         #m, depth of water  \n",
      "i = 1./1500     #gradient \n",
      "N = 0.02        # N Manning formula\n",
      "\n",
      "# Calculations \n",
      "a = (d-(D/2))/(D/2)\n",
      "z = math.degrees(math.acos(a))\n",
      "z1 = math.radians(180 - z)\n",
      "P = D*z1\n",
      "A = D*D*0.25*(z1-(math.sin(2*z1)/2))\n",
      "m = A/P\n",
      "Q = (A*(m**0.6666)*(i**0.5))/N\n",
      "\n",
      "# Results \n",
      "print \"the discharge through the sewer in m**3/s :  %.5f\"%Q\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the discharge through the sewer in m**3/s :  2.96839\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.11 Page No : 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 1.5          #m, wide\n",
      "d = 0.8          #m, depth\n",
      "Q = 0.75         #m**3/s\n",
      "i = 1./2500      #slope \n",
      "\n",
      "# Calculations \n",
      "A = b*d\n",
      "P = b+(2*d)\n",
      "m = A/P\n",
      "C = Q/(((m*i)**0.5)*A)\n",
      "z = (157.6/C)-1.81\n",
      "K = z*(m**0.5)\n",
      "\n",
      "# Results \n",
      "print \"Chezys constant and coefficient of roughness\",round(C,2),round(K,3)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Chezys constant and coefficient of roughness 50.23 0.826\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.12 Page No : 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 10.              #m wide\n",
      "d = 4.               #m, depth of water\n",
      "i = 1./1000          #slope\n",
      "N = 0.03             #N Kutter's fprmula\n",
      "\n",
      "# Calculations \n",
      "A = b*d\n",
      "P = b+(2*d)\n",
      "m = A/P\n",
      "z1 = 23+(0.00155/i)+(1/N)\n",
      "z2 = 1+((23+(0.00155/i))*(N/(m**0.5)))\n",
      "C = z1/z2\n",
      "Q = A*C*((m*i)**0.5)\n",
      "\n",
      "# Results \n",
      "print \"discharge through the recmath.tangular channel in litres/sec\",round((Q*1000),3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "discharge through the recmath.tangular channel in litres/sec 73053.236\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.13 Page No : 150"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "b = 4.              #m wide\n",
      "d = 1.5             #m, depth of water\n",
      "i = 1./1000         #slope\n",
      "C = 55.             # constant\n",
      "\n",
      "# Calculations and Results\n",
      "A = b*d\n",
      "P = b+(2*d)\n",
      "m = A/P\n",
      "Q = A*C*((m*i)**0.5)\n",
      "d1 = (A/2)**0.5\n",
      "b1 = d1*2\n",
      "print \"the new dimension of the channel\",round(b1,3),round(d1,3)\n",
      "\n",
      "P1 = b1+(2*d1)\n",
      "m1 = A/P1\n",
      "Q1 = A*C*((m1*i)**0.5)\n",
      "Qf = Q1-Q\n",
      "print \"increase in discharge in m3/sec\",round(Qf,3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the new dimension of the channel 3.464 1.732\n",
        "increase in discharge in m3/sec 0.05\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.14 Page No : 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "i = 1./2500     #slope\n",
      "N = 0.02        # N, Manning's formula  \n",
      "Q = 14.         #m**3/s\n",
      "\n",
      "# Calculations \n",
      "n = 1./(math.radians(math.tan(60)))\n",
      "a = (3**0.5)\n",
      "d = ((Q*N*(2**0.6666))/((i**0.5)*a))**(3./8)\n",
      "b = d*2/(3**0.5)\n",
      "\n",
      "# Results \n",
      "print \"dimension of the channel\",round(b,4),round(d,4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dimension of the channel 3.0065 2.6037\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.15 Page No : 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Q = 20.2           #m**3/s\n",
      "i = 1./2500        #slope\n",
      "C = 60.            #Constant \n",
      "\n",
      "# Calculations \n",
      "n = 1./(math.radians(math.tan(60)))\n",
      "a = (3**0.5)\n",
      "d = ((Q*(2**0.5))/(C*a*(i**0.5)))**0.4\n",
      "b = 2*d/(a)\n",
      "\n",
      "# Results \n",
      "print \"dimension of the cross section in m\",round(b,4),round(d,4)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dimension of the cross section in m 3.294 2.8527\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.16 Page No : 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Q = 10.        #m**3/s\n",
      "V = 2.         #m/s, velocity\n",
      "A = Q/V         \n",
      "n = 1.         #m length  \n",
      "\n",
      "# Calculations \n",
      "d = (A/1.828)**0.5\n",
      "b = 0.828*d\n",
      "A1 = (b+(2*d*((n*n+1)**0.5)))\n",
      "print \"area in m2 of lining required for 1m canal lenght\",round(A1,3)\n",
      "\n",
      "# note : rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "area in m2 of lining required for 1m canal lenght 6.047\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.17 Page No : 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "n = 1.             \n",
      "Q = 14.            #m**3/s\n",
      "i = 1./1000        #slope\n",
      "C = 44.            #constant\n",
      "a = 1.828           \n",
      "\n",
      "# Calculations \n",
      "d = ((Q*(2**0.5))/(C*a*(i**0.5)))**0.4\n",
      "b = d*0.828\n",
      "cost = (b+n*d)*4\n",
      "A = 1.828*d*d\n",
      "C1 = 70.\n",
      "d1 = ((Q*(2**0.5))/(C1*a*(i**0.5)))**0.4\n",
      "b1 = 0.828*d1\n",
      "cost1 = (b1+n*d1)*4\n",
      "costl = (b1+(2*d1*((n*n+1)**0.5)))\n",
      "totalcost =  cost1+costl\n",
      "\n",
      "# Results \n",
      "print \"lined channel is cheaper ,dimension in m\",round(b1,4),round(d1,3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "lined channel is cheaper ,dimension in m 1.5626 1.887\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.18 Page No : 156"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "d = 1.2            #m diameter\n",
      "i = 1./1500        #slope \n",
      "C = 52.            #constant\n",
      "z = 1.9-1./1          \n",
      "\n",
      "# Calculations \n",
      "z1 = math.acos(z)\n",
      "x = math.pi-z1\n",
      "A = d*d*0.25*(x-(math.sin(2*x)/2))\n",
      "P = d*x\n",
      "m = A/P\n",
      "Q = A*C*((m*i)**0.5)\n",
      "\n",
      "# Results \n",
      "print \"the maximium discharge through the channel in litres/sec\",round((Q*1000),3)\n",
      "\n",
      "# note : rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the maximium discharge through the channel in litres/sec 873.637\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}