{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Varying Flow in Open Channels"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.1.1 pageno : 413"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#initialisation of variables\n",
      "\n",
      "b= 15. \t\t\t#in\n",
      "h= 1.25 \t\t\t#in\n",
      "h1= 2.75 \t\t\t#in\n",
      "g= 32.2 \t\t\t#ft/sec**2\n",
      "\n",
      "#CACULAIONS\n",
      "Q= 3.09*(b/12.)*(h/12.)**1.5\n",
      "u1= Q*144./(b*h1)\n",
      "H= (u1**2./(2.*g))*12.\n",
      "h2= H+h\n",
      "Q1= 3.09*(b/12)*(h2/12.)**1.5\n",
      "\n",
      "#RESULTS\n",
      "print ' Q = %.2f ft**3/sec'%Q\n",
      "print  ' Rate of flow= %.4f ft**3/sec'%(Q1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Q = 0.13 ft**3/sec\n",
        " Rate of flow= 0.1359 ft**3/sec\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.3.1 pageno : 418"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "C= 100. \t\t\t#ft**0.5/sec\n",
      "m= 2. \t\t\t#ft\n",
      "i= 0.0003\n",
      "y1= 2.6 \t\t\t#ft\n",
      "y2= 2.5 \t\t\t#ft\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "u= C*math.sqrt(m*i)\n",
      "f= u**2./(2.*32.2)\n",
      "x= i/(1-f)\n",
      "x1= round((y1-y2)/x,-1)\n",
      "\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  ' Distance= %.f ft'%(x1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Distance= 300 ft\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.4.1 pageno : 420"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "\n",
      "u1= 0.5 \t\t\t#ft**3/sec\n",
      "b= 5. \t\t\t#ft\n",
      "w= 4. \t\t\t#ft\n",
      "g= 32.2\t\t\t#ft/sec**2\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "u= u1*12.*12/(b*w)\n",
      "s= math.sqrt(g*w/12.)\n",
      "F= u/s\n",
      "r= 0.5*(math.sqrt(1.+8*F**2)-1)\n",
      "y= r*w\n",
      "yc= (((w*y*(y+w)))/2.)**(1/3.)\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "print  ' critical depth= %.2f in'%(yc)\n",
      "\n",
      "# answer may vary because of rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " critical depth= 4.26 in\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.4.2 page no : 421"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#initialisation of variables\n",
      "\n",
      "w= 2. \t\t\t#ft\n",
      "F= 3.\n",
      "d= 2. \t\t\t#ft\n",
      "g= 32.2 \t\t\t#ft/sec**2\n",
      "w1= 62.3 \t\t\t#lbf/ft**3\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "r= 0.5*(math.sqrt(1+8.*F**2.)-1)\n",
      "y1= w/r\n",
      "dy= w-y1\n",
      "h1= dy**3/(4*w*y1)\n",
      "u1= F*math.sqrt(g*y1)\n",
      "W= w1*y1*u1*d*h1/550.\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  ' Horse-power dissipated = %.2f h.p'%(W)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Horse-power dissipated = 1.11 h.p\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.5.1 page no : 425"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "\n",
      "Q= 20. \t\t\t#ft/sec\n",
      "h= 12. \t\t\t#in\n",
      "g= 32.2 \t\t\t#ft/sec**2\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "F= Q/math.sqrt(g*h/12.)\n",
      "r= 0.5*(math.sqrt(1+8.*F**2)-1)\n",
      "y= h*r/12.\n",
      "s=(y-(h/12.))**3*12./(4.*h*y)\n",
      "Q1= s*62.3*Q/550.\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  ' Rate of flow= %.2f in'%(Q1)\n",
      "\n",
      "# Answers may vary because of rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Rate of flow= 5.43 in\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.6.1 pageno : 427"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "#initialisation of variables\n",
      "\n",
      "d= 0.94\n",
      "b= 20. \t\t\t#ft\n",
      "h= 5. \t\t\t#ft\n",
      "w= 40. \t\t\t#ft\n",
      "g= 32.2 \t\t\t#ft/sec**2\n",
      "\t\t\t\n",
      "#CALCULATIONS\n",
      "Q= 0.309*d*b*h**1.5\n",
      "u=Q/(h*w)\n",
      "h1= h+(u**2/(2*g))\n",
      "Q1= 0.309*d*b*h1**1.5\n",
      "\t\t\t\n",
      "#RESULTS\n",
      "print  ' Rate of flow= %.1f ft**3/sec'%(Q1)\n",
      "\n",
      "# Answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Rate of flow= 65.0 ft**3/sec\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}