{
 "metadata": {
  "name": "",
  "signature": "sha256:0a4301c920a86f7888d81f22a80d24105313c5ae1dd42947a9f33bfe49dcea1b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11 : Steady Flow in Open Channels"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.1 Page No : 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\t\n",
      "#Initialization of variables\n",
      "y = 3.4 \t#ft\n",
      "n = 0.016\n",
      "\t\n",
      "#calculations\n",
      "A = (10+2*y)*y\n",
      "P = 10+ 2*math.sqrt(5) *y\n",
      "Rh = A/P\n",
      "f = 116*n**2 /Rh**(1./3)\n",
      "e =  14.8*Rh/ 10**(1./2/math.sqrt(f))\n",
      "\t\n",
      "#Results\n",
      "print \"absolute roughness of pipe  =  %.4f ft\"%(e)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "absolute roughness of pipe  =  0.0159 ft\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.2 Page No : 362"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "y = 1.495 \t#ft\n",
      "Q = 14.  \t#cfs\n",
      "g = 32.2\n",
      "\t\n",
      "#calculations\n",
      "yc = (Q**2 /g *2)**(1./5)\n",
      "\t\n",
      "#Results\n",
      "print \"yc  =  %.2f ft is greater than uniform flow depth. Hence flow is supercritical\"%(yc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "yc  =  1.65 ft is greater than uniform flow depth. Hence flow is supercritical\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.3 Page No : 366"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "q = 27./4\n",
      "g = 32.2\n",
      "Q = 27. \t#cfs\n",
      "d = 2.   \t#ft\n",
      "dz1 = 0.3 \t#ft\n",
      "\t\n",
      "#calculations\n",
      "yc = (q**2 /g)**(1./3)\n",
      "V2 = Q/(4*yc)\n",
      "V1 = Q/(4*d)\n",
      "dz  =  d+ V1**2 /(2*g) - V2**2/(2*g) - yc\n",
      "y2 = 1.6 \t#ft\n",
      "drop  =  d-(y2+dz1)\n",
      "dz2 = 0.6 \t#ft\n",
      "up = 2.12 \t#ft\n",
      "down = 0.66 \t#ft\n",
      "\t\n",
      "#Results\n",
      "print \"yc  =  %.2f ft. Since, depth is greater than critical depth, the flow is subcritical\"%(yc)\n",
      "print \" Drop in water height  =  %.2f ft\"%(drop)\n",
      "print \" Drop upstream  =  %.2f ft and Downstream  =  %.2f ft\"%(up,down)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "yc  =  1.12 ft. Since, depth is greater than critical depth, the flow is subcritical\n",
        " Drop in water height  =  0.10 ft\n",
        " Drop upstream  =  2.12 ft and Downstream  =  0.66 ft\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.5 Page No : 381"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "y0 = 2.17 \t#ft\n",
      "q = 400./10 #flow rate\n",
      "g = 32.2\n",
      "d = 4.8 \t#ft\n",
      "S0 = 0.0016\n",
      "\t\n",
      "#calculations\n",
      "yc = round((q**2 /g)**(1./3),2)\n",
      "y2 = round(y0/2 *(-1 + math.sqrt(1+ 8*q**2 /(g*y0**3))),2)\n",
      "y1 = round(d/2 *(-1 + math.sqrt(1+ 8*q**2/(g*d**3))),2)\n",
      "E1 = round(y0 + (q/y0)**2 /(2*g),2)\n",
      "E2 = round(y1+ (q/y1)**2 /(2*g),2)\n",
      "Vm = 0.5*(q/y0 + q/y1)\n",
      "Rm = 0.5*(y0/1.434 + y1/1.552)\n",
      "S = (0.013*Vm/(1.49*Rm**(2./3)))**2\n",
      "dx = (E1-E2)/(S-S0)\n",
      "E1d = E2\n",
      "E2d = d+ (q/4.8)**2 /(2*g)\n",
      "HPl = 62.4*q*10*(E1d-E2d)/550\n",
      "\n",
      "#Results\n",
      "print \"Power loss  =  %.2f \"%(HPl)\n",
      "#The answer is a bit different from the textbook due to rounding off error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power loss  =  7.79 \n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11.6 Page No : 386"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import *\n",
      "\t\n",
      "#Initialization of variables\n",
      "y1 = array([1.5, 1.48])\n",
      "V1 = array([2.22, 2.29])\n",
      "d = 1.2\n",
      "\t\n",
      "#calculations\n",
      "q = y1*V1\n",
      "V2 = q/d\n",
      "Vm = array([2.5, 2.56])\n",
      "Rh1 = array([0.9, 0.89])\n",
      "Rh2 = array([0.88, 0.78])\n",
      "Rhm = (Rh1+Rh2)/2\n",
      "S = (q*Vm/ Rhm**(2./3))**2\n",
      "dx = [358 ,226]\n",
      "yavg = (y1[0] + y1[1])/2\n",
      "qavg = (q[0] + q[1])/2\n",
      "B = 4.5\n",
      "Q = qavg*B\n",
      "\t\n",
      "#Results\n",
      "print \"Flow rate  =  %.1f m**3/s\"%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow rate  =  15.1 m**3/s\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}