{ "metadata": { "name": "", "signature": "sha256:42cfbfc48c9b3ca6e29fe9ce57a8f8178b8196338db5580ed101d28c1267ac0e" }, "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 : 240" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "i = 1./4500\n", "w =3. \t\t#ft\n", "d = 3. \t\t#ft\n", "k = 0.003\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "A = 0.5*math.pi*d**2/4\n", "P = math.pi*d/2\n", "m = A/P\n", "f = k*(1+(0.1/m))\n", "C = math.sqrt(2*g/f)\n", "V = C*math.sqrt(m*i)\n", "Q = A*V\n", "\t\t\n", "#RESULTS\n", "print 'Discharge = %.2f cuses'%(Q)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Discharge = 6.28 cuses\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.2 Page No : 241" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "b = 40. \t\t#ft\n", "d = 4. \t\t#ft\n", "k = 0.004\n", "g = 32.2 \t\t#ft/sec**2\n", "Q = 500. \t\t#cuses\n", "\t\t\n", "#CALCULATIONS\n", "A = b*d\n", "P = b+2*d\n", "m = A/P\n", "f = k*math.sqrt(1+(0.2/m))\n", "C = math.sqrt(2*g/f)\n", "V = Q/A\n", "i = V**2/(C**2*m)\n", "D = 5280*i\n", "\t\t\n", "#RESULTS\n", "print 'fall in feet per mile = %.1f ft'%(D)\n", "\n", "# rounding off error" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "fall in feet per mile = 1.0 ft\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.3 Page No : 242" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "b = 40. \t\t#ft\n", "d = 4. \t\t#ft\n", "n = 1.\n", "k = 0.005\n", "i = 1./3250\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "A = (b+d)*d\n", "P = round(b+2*d*math.sqrt(n**2+1),2)\n", "m = round(A/P,2)\n", "f = k*(1+(0.8/m))\n", "C = round(math.sqrt(2*g/f),2)\n", "V = C*math.sqrt(m*i)\n", "Q = V*A\n", "\n", "#RESULTS\n", "print 'Discharge = %.f cuses'%(Q)\n", "\n", "# book answer is wrong. please check." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Discharge = 584 cuses\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.4 Page No : 243" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\t\t\n", "#initialisation of variables\n", "Q = 400. \t\t#cuses\n", "V = 2. \t\t#ft/sec\n", "d = 3. \t \t#ft\n", "n = 1.\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "A = Q/V\n", "w = A/d\n", "W = w-d\n", "P = W+2*d*math.sqrt(n**2+1)\n", "m = A/P\n", "f = 0.006*(1+(4/m))\n", "C = math.sqrt(2*g/f)\n", "i = (V/C)**2/m\n", "\t\t\n", "#RESULTS\n", "print ' slope = %.5f '%(i)\n", "\n", "\t\t#ANSWER IN TEXTBOOK IS NOT GIVEN IN DECIMALS\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " slope = 0.00033 \n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.5 Page No : 244" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "Q = 600. \t\t#cuses\n", "V = 3. \t\t#ft/sec\n", "n = 1.\n", "i = 1./3200\n", "C = 80.\n", "d = 6. \t\t#ft\n", "\t\t\n", "#CALCULATIONS\n", "A = Q/V\n", "m = V**2/(C**2*i)\n", "b = (A/d)-d\n", "\t\t\n", "#RESULTS\n", "print 'width = %.1f ft'%(b)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "width = 27.3 ft\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.6 Page No : 245" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\t\t\n", "#initialisation of variables\n", "Q = 20. \t\t#gallons / day\n", "i = 50000. \t\t#inhabitants\n", "p = 10. \t\t#percent\n", "t = 24. \t\t#hrs\n", "T = 0.25 \t\t#in\n", "a = 2000. \t\t#acres\n", "\t\t\n", "#CALCULATIONS\n", "q = Q*i*p/(100*60*60*6.24)\n", "A = T*43560*a/12\n", "Q1 = A/(t*60*60)\n", "Q2 = q+Q1\n", "\t\t\n", "#RESULTS\n", "print 'total discharge = %.2f cuses'%(Q2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "total discharge = 25.46 cuses\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.7 Page No : 249" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "Q = 400. \t\t#cuses\n", "V = 8. \t \t#ft/sec\n", "C = 150.\n", "\t\t\n", "#CALCULATIONS\n", "A = Q/V\n", "d = math.sqrt(A/2)\n", "i = V**2/(C**2*(d/2))\n", "\t\t\n", "#RESULTS\n", "print 'slope %.4f '%(i)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "slope 0.0011 \n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.8 Page No : 250" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "Q = 100. \t\t#cuses\n", "V = 2. \t\t#ft/sec\n", "n = 1.5\n", "k = 0.006\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "A = Q/V\n", "d = math.sqrt(A/((2*math.sqrt(n**2+1))-n))\n", "m = A/d\n", "mb = m-n*d\n", "bt = m+n*d\n", "m1 = d/2\n", "f = k*(1+(4/m1))\n", "C = math.sqrt(2*g/f)\n", "i = V**2/(C**2*m1)\n", "\t\t\n", "#RESULTS\n", "print 'slope %.5f '%(i)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "slope 0.00040 \n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.9 Page No : 251" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "i = 1./1000\n", "d = 4. \t\t#ft\n", "C = 125.\n", "k = 0.95\n", "o = 5.372\n", "\t\t\n", "#CALCULATIONS\n", "h = k*d\n", "A = d**2*(o- math.sin(math.radians(o*180/math.pi)))/8\n", "P = (d/2)*o\n", "m = A/P\n", "V = C*math.sqrt(m*i)\n", "Q = V*A\n", "\t\t\n", "#RESULTS\n", "print 'Discharge = %.2f cuses'%(Q)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Discharge = 52.18 cuses\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.10 Page No : 254" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#initialisation of variables\n", "Cd = 0.95\n", "m = 300. \t\t#ft\n", "V = 8. \t\t#ft/sec\n", "d = 6. \t\t#ft\n", "n = 6.\n", "s = 40. \t\t#ft\n", "g = 32.2 \t\t#ft/sec**2\n", "dh = 0.11\n", "\t\t\n", "#CALCULATIONS\n", "h = (V**2/(g+(d/3)))*(1.1*(m/(s*n))**2-1)\n", "h1 = (V**2/(2*g))*(1.1*(m/(s*n))**2-(d/(s/n)))+dh\n", "\t\t\n", "#RESULTS\n", "print 'afflux upstream = %.2f ft'%(h1)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "afflux upstream = 0.92 ft\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.11 Page No : 255" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "V = 8. \t\t#ft/sec\n", "g = 32.2 \t\t#ft/sec**2\n", "d = 10. \t\t#ft\n", "l = 2. \t \t#ft\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "a = math.sqrt(((l*g*l/V**2)+(d/12)**2)/1.1)\n", "V1 = V*d/12\n", "va = math.sqrt(2*g*0.69)\n", "v1 = math.sqrt(2*g*(l+0.69))\n", "\t\t\n", "#RESULTS\n", "print 'total head producing velocity = %.1f ft/sec'%(v1)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "total head producing velocity = 13.2 ft/sec\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.13 Page No : 261" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "d = 8. \t\t#ft\n", "V = 6. \t\t#ft/sec\n", "g = 32. \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "h = (V*d/4)**2/g\n", "#d2 = (-4/2)+math.sqrt((2*(d/2)*(V*(d/2))/g)+((d/2)**2/4))\n", "d2 = round((-4./2) + math.sqrt(2*4*12**2/g + 4**2/4. ),3)\n", "x = (d/2)/d2\n", "l = ((1/(x**1.5))-1)**0.81\n", "Lw = l*(d/2)*10.3\n", "\n", "#RESULTS\n", "print 'height of standing wave = %.1f ft'%(Lw)\n", "\n", "# note : answer are different because of rounding off error. this answer is accurate.\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "height of standing wave = 7.6 ft\n" ] } ], "prompt_number": 20 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.14 Page No : 264" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \t\t\n", "\n", "#initialisation of variables\n", "w = 9. \t\t#in\n", "wc = 6. \t\t#in\n", "d = 8. \t\t#in\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "Q = 3.09*(wc/12)*(d/12)**1.5\n", "V = Q*144/(w*d)\n", "H = (d/12)+(V**2/(2*g))\n", "Q = 3.09*(wc/12)*H**1.5\n", "\t\t\n", "#RESULTS\n", "print 'Discharge = %.2f cuses'%(Q)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Discharge = 0.93 cuses\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.15 Page No : 265" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "from sympy import Symbol,solve\n", "\t\t\n", "#initialisation of variables\n", "i = 1./6400\n", "b = 40. \t\t#ft\n", "d = 5. \t\t#ft\n", "C = 140.\n", "h = 6. \t\t#ft\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "A = b*d\n", "P = b+2*d\n", "m = A/P\n", "v = C*math.sqrt(m*i)\n", "V = v*(d/h)\n", "Q = v*b*d\n", "x = h-(Q/(3.09*(b/2)))**(2./3)-(V**2/(2*g))\n", "\n", "#RESULTS\n", "print 'height of pump = %.2f ft'%(x)\n", "\n", "# rounding off error. please check." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "height of pump = 0.82 ft\n" ] } ], "prompt_number": 38 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.16 Page No : 268" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "w = 40. \t\t#ft\n", "h = 5. \t\t#ft\n", "P =50. \t\t# lb/ft**2\n", "i = 1./6400\n", "h1 = 10. \t\t#ft\n", "H = 100. \t\t#ft\n", "g = 32.2 \t\t#ft/sec**2\n", "\n", "#CALCULATIONS\n", "m = w*h/P\n", "v = 140*math.sqrt(m*i)\n", "v1 = v*h/h1\n", "h2 = w*h1/(H-w)\n", "a = v1**2/(140**2*h2)\n", "s = (i-a)*1000/(1-(v1**2/(g*h1)))\n", "dh = h1-s\n", "\t\t\n", "#RESULTS\n", "print 'depth of water = %.3f ft'%(dh)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "depth of water = 9.866 ft\n" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.17 Page No : 269" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\n", "#initialisation of variables\n", "h = 9. \t\t#ft\n", "h1 = 9.5 \t\t#ft\n", "i = round(1./6400,6)\n", "h2 = 40. \t\t#ft\n", "h3 = 59. \t\t#ft\n", "h4 = 5. \t\t#ft\n", "g = 32.2 \t\t#ft/sec**2\n", "\t\t\n", "#CALCULATIONS\n", "m = round(h2*h1/h3,1)\n", "v = 3.5 * h4/h1 #140*math.sqrt(m*i)*(h4/h1)\n", "a = round(v**2/(140**2*m),6)\n", "s = (i-a)/(1-0.11)\n", "x = 1/s\n", " \n", "#RESULTS\n", "print 'distance upstream from the dam = %.f ft'%(x)\n", "\n", "# answer is different because value of s is 0.000156 and in book it is taken as 0.00013 so rounding off error\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "distance upstream from the dam = 6899 ft\n" ] } ], "prompt_number": 48 } ], "metadata": {} } ] }