{
 "metadata": {
  "name": "",
  "signature": "sha256:525b51e826bc42c9a4490de8234c350df60c3a09744a8e35af1f480f12f531bc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11 - Flow of liquids in open channels"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1a - Pg 454"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the discharge using darcy equation\n",
      "#Initialization of variables\n",
      "import math\n",
      "rho=1.94 #slugs/ft^3\n",
      "mu=2.34e-5 #lb-sec/ft^2\n",
      "y=5 #ft\n",
      "T=25 #ft\n",
      "d=10 #ft\n",
      "slope=3./2. \n",
      "g=32.2 #ft/s^2\n",
      "S=0.001\n",
      "#calculations\n",
      "A=y*d+ 2*0.5*y*(slope*y)\n",
      "WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y\n",
      "R=A/WP\n",
      "e=0.01 #ft\n",
      "rr=2*R/e\n",
      "f=0.019\n",
      "C=math.sqrt(8*g/f)\n",
      "V=C*math.sqrt(R*S)\n",
      "Q=V*A\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Discharge using Darcy equation =\",Q,\"ft^3/s\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge using Darcy equation = 569.3 ft^3/s\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1b - Pg 453"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the discharge using kutter ganguillet method\n",
      "#Initialization of variables\n",
      "import math\n",
      "rho=1.94 #slugs/ft^3\n",
      "mu=2.34e-5 #lb-sec/ft^2\n",
      "y=5 #ft\n",
      "T=25 #ft\n",
      "d=10 #ft\n",
      "slope=3./2. \n",
      "g=32.2 #ft/s^2\n",
      "S=0.001\n",
      "n=0.017\n",
      "#calculations\n",
      "A=y*d+ 2*0.5*y*(slope*y)\n",
      "WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y\n",
      "R=A/WP\n",
      "e=0.01 #ft\n",
      "rr=2*R/e\n",
      "f=0.019\n",
      "C=(41.65 + 0.00281/S + 1.811/n)/(1+( 41.65 + 0.00281/S)*n/math.sqrt(R))\n",
      "V=C*math.sqrt(R*S)\n",
      "Q=V*A\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Discharge using kutter ganguillet formula =\",Q,\" ft^3/s\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge using kutter ganguillet formula = 517.0  ft^3/s\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1c - Pg 455"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the discharge using bazin formula\n",
      "#Initialization of variables\n",
      "import math\n",
      "rho=1.94 #slugs/ft^3\n",
      "mu=2.34e-5 #lb-sec/ft^2\n",
      "y=5. #ft\n",
      "T=25. #ft\n",
      "d=10. #ft\n",
      "slope=3./2.\n",
      "g=32.2 #ft/s^2\n",
      "S=0.001\n",
      "m=0.21\n",
      "#calculations\n",
      "A=y*d+ 2*0.5*y*(slope*y)\n",
      "WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y\n",
      "R=A/WP\n",
      "e=0.01 #ft\n",
      "rr=2*R/e\n",
      "f=0.019\n",
      "C=157.6 /(1+ m/math.sqrt(R))\n",
      "V=C*math.sqrt(R*S)\n",
      "Q=V*A\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Discharge using bazin formula =\",Q,\" ft^3/s\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge using bazin formula = 688.7  ft^3/s\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1d - Pg 456"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the discharge using darcy equation\n",
      "#Initialization of variables\n",
      "import math\n",
      "rho=1.94 #slugs/ft^3\n",
      "mu=2.34e-5 #lb-sec/ft^2\n",
      "y=5. #ft\n",
      "T=25. #ft\n",
      "d=10. #ft\n",
      "slope=3./2. \n",
      "g=32.2 #ft/s^2\n",
      "S=0.001\n",
      "n=0.017\n",
      "#calculations\n",
      "A=y*d+ 2*0.5*y*(slope*y)\n",
      "WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y\n",
      "R=A/WP\n",
      "e=0.01 #ft\n",
      "rr=2*R/e\n",
      "f=0.019\n",
      "C=1.486*math.pow(R,(1./6.)) /n\n",
      "V=C*math.sqrt(R*S)\n",
      "Q=V*A\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Discharge using Darcy equation =\",Q,\"ft^3/s\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge using Darcy equation = 516.6 ft^3/s\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1e - Pg 456"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the froude number\n",
      "#Initialization of variables\n",
      "import math\n",
      "rho=1.94 #slugs/ft^3\n",
      "mu=2.34e-5 #lb-sec/ft^2\n",
      "y=5. #ft\n",
      "T=25. #ft\n",
      "d=10. #ft\n",
      "slope=3./2. \n",
      "g=32.2 #ft/s^2\n",
      "S=0.001\n",
      "n=0.017\n",
      "#calculations\n",
      "A=y*d+ 2*0.5*y*(slope*y)\n",
      "WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y\n",
      "R=A/WP\n",
      "e=0.01 #ft\n",
      "rr=2*R/e\n",
      "f=0.019\n",
      "C=(41.65 + 0.00281/S + 1.811/n)/(1+( 41.65 + 0.00281/S)*n/math.sqrt(R))\n",
      "V=C*math.sqrt(R*S)\n",
      "T=d+ 2*(slope*y)\n",
      "yh=A/T\n",
      "Nf=V/(math.sqrt(g*yh))\n",
      "#results\n",
      "print '%s %.2f' %(\"froude number = \",Nf)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "froude number =  0.56\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1f - Pg 456"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the critical depth\n",
      "#Initialization of variables\n",
      "import math\n",
      "rho=1.94 #slugs/ft^3\n",
      "mu=2.34e-5 #lb-sec/ft^2\n",
      "y=5. #ft\n",
      "T=25. #ft\n",
      "d=10. #ft\n",
      "slope=3./2. \n",
      "g=32.2 #ft/s^2\n",
      "S=0.001\n",
      "n=0.017\n",
      "#calculations\n",
      "A=y*d+ 2*0.5*y*(slope*y)\n",
      "WP=d+ 2*math.sqrt(3*3 +2*2) /2 *y\n",
      "R=A/WP\n",
      "e=0.01 #ft\n",
      "rr=2*R/e\n",
      "f=0.019\n",
      "C=(41.65 + 0.00281/S + 1.811/n)/(1+( 41.65 + 0.00281/S)*n/math.sqrt(R))\n",
      "V=C*math.sqrt(R*S)\n",
      "Q=V*A\n",
      "T=d+ 2*(slope*y)\n",
      "yh=A/T\n",
      "yc=2.88  #ft\n",
      "#results\n",
      "print '%s' %(\"yc is obtained using trial and error method\")\n",
      "print '%s %.2f %s' %(\"Critical depth =\",yc,\"ft\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "yc is obtained using trial and error method\n",
        "Critical depth = 2.88 ft\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 459"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the minimum scale ratio\n",
      "#Initialization of variables\n",
      "import math\n",
      "Re=4000.\n",
      "rho=1.94 #slugs/ft^3\n",
      "vm=5.91 #ft/s\n",
      "mu=3.24e-5 #ft-lb/s^2\n",
      "Rm=3.12 #ft\n",
      "#calculations\n",
      "lam3=Re*mu/(vm*4*Rm*rho)\n",
      "lam=math.pow(lam3,(2./3.))\n",
      "#results\n",
      "print '%s %.2e' %(\"Minimum scale ratio = \",lam)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum scale ratio =  9.36e-03\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 462"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the discharge, depth of the channel, froude numbers and also the force applied\n",
      "#Initialization of variables\n",
      "import math\n",
      "yc=2. #ft\n",
      "g=32.2 #ft/s^2\n",
      "d=10. #ft\n",
      "gam=62.4\n",
      "rho=1.94\n",
      "B=10. #ft\n",
      "#calculations\n",
      "Vc=math.sqrt(g*yc)\n",
      "Ac=yc*d\n",
      "Q=Vc*Ac\n",
      "y1=5.88 #ft\n",
      "y2=0.88 #ft\n",
      "V1=2.73 #ft/s\n",
      "V2=18.25 #ft/s\n",
      "Nf1=0.198\n",
      "Nf2=3.43\n",
      "F= 0.5*gam*y1*y1 *B - 0.5*gam*y2*y2 *B - Q*rho*V2 +Q*rho*V1\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Discharge in the channel =\",Q,\"ft^3/s\")\n",
      "print '%s %.2f %s %.2f %s' %(\"\\n Depth of the channel at upstream and downstream =\",y1,\"ft and\",y2, \"ft\")\n",
      "print '%s %.3f %s %.3f' %(\"\\n froude numbers at upstream and downstream =\",Nf1,\" and \",Nf2)\n",
      "print '%s %d %s' %(\"\\n Force applied =\",F,\"lb\")\n",
      "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge in the channel = 160.5 ft^3/s\n",
        "\n",
        " Depth of the channel at upstream and downstream = 5.88 ft and 0.88 ft\n",
        "\n",
        " froude numbers at upstream and downstream = 0.198  and  3.430\n",
        "\n",
        " Force applied = 5713 lb\n",
        "The answers are a bit different from textbook due to rounding off error\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 470"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the distance from vena contracta and also the total distance\n",
      "#Initialization of variables\n",
      "import math\n",
      "S0=0.0009\n",
      "n=0.018\n",
      "w=20 #ft\n",
      "d=0.5 #ft\n",
      "Q=400 #ft^3/s\n",
      "g=32.2 #ft/s^2\n",
      "#calculations\n",
      "y2=4 #ft\n",
      "V2=Q/(w*y2)\n",
      "Nf2=V2/math.sqrt(g*y2)\n",
      "yr=0.5*(math.sqrt(1+ 8*Nf2*Nf2) -1)\n",
      "y1=yr*y2\n",
      "L1=32.5\n",
      "L2=37.1 \n",
      "L3=51.4\n",
      "L=L1+L2+L3\n",
      "#results\n",
      "print '%s %.1f %s %.2f %s' %(\"distance from vena contracta =\",y2,\"ft and\",y1,\"ft\")\n",
      "print '%s %.1f %s' %(\"\\n Total distance =\",L,\" ft\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "distance from vena contracta = 4.0 ft and 1.20 ft\n",
        "\n",
        " Total distance = 121.0  ft\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}