{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 10 : Liquid Flow in Open Channels" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10.1 Pageno : 353" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy import *\n", "\n", "# variables\n", "yo = Symbol(\"yo\")\n", "A = 20*yo\n", "P = 20 + 2*yo\n", "Rh= 20*yo/(20+2*yo)\n", "n = 0.017 # ft\n", "\n", "# calculations\n", "ans = solve((1.49/n)*A*Rh**(2./3)*(0.0001)**(1./2) - 400) #*yo*Rh**(2./3)\n", "\n", "# result\n", "print \"Yo = %.2f ft\"%ans[0]\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Yo = 8.32 ft\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10.2 pageno : 356" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# calculations\n", "Rh = 20*8.34/(20+2*8.34)\n", "\n", "# result\n", "print \"Rh = %.2f ft\"%Rh" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Rh = 4.55 ft\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10.3 pageno : 362" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy import *\n", "\n", "# variables\n", "yo = Symbol(\"yo\")\n", "n = 0.017 #ft 1/6\n", "A = 2*yo**2\n", "Rh = yo/2\n", "\n", "# Calculations\n", "ans = solve((1.49/n)*A*Rh**(2./3) * (0.0001)**(1./2) - 400,yo)\n", "Yo = ans[0]\n", "B = 2*Yo\n", "\n", "#result\n", "print \"Yo**(8/3) = %.f \"%(Yo**(8./3))\n", "print \"Yo = %.2f ft \"%(Yo)\n", "print \"B = %.2f ft \"%(B)\n", "\n", "# note : answer are slightly differenet because of solve method of sympy" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Yo**(8/3) = 362 \n", "Yo = 9.11 ft \n", "B = 18.22 ft \n" ] } ], "prompt_number": 17 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10.4 Page no : 367" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "from sympy import Symbol, solve\n", "\n", "# variables\n", "q = 500./40 # cfs/ft\n", "ye = ((12.5)**2 / 32.2)**(1./3)\n", "n = 0.017\n", "So = Symbol(\"So\")\n", "\n", "# calculations\n", "Sc = 32.2 * n**2 / (2.2 * ye**(1./3))\n", "ans = solve((1.49/n)*160*(3.33)**(2./3)*So**(1./2) - 500)\n", "So = ans[0]\n", "\n", "# result\n", "print \"Sc = %.4f\"%Sc\n", "print \"So = %f\"%So\n", "print \"So is a mild slope since it is less than Se\"\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Sc = 0.0035\n", "So = 0.000256\n", "So is a mild slope since it is less than Se\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10.5 page no : 369" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy import solve,Symbol\n", "import math\n", "\n", "# variables\n", "y = Symbol(\"y\")\n", "A = 10*y + 2*y**2\n", "n = 0.017\n", "b = 10 + 4*y\n", "P = 10 + 2*math.sqrt(5)*y\n", "\n", "# calculations\n", "ans = solve(A**3/b *32.2/1000**2 - 1)\n", "yo = ans[1]\n", "Ae = 97.3 # sqft\n", "be = 29.65 # ft\n", "Rhe = Ae/32 # ft\n", "Sc = 32.2*n**2/2.2 * (Ae/(be*Rhe**(4./3)))\n", "\n", "# result\n", "print \"Yo = %.2f ft\"%yo\n", "print \"Sc = %.5f\"%Sc" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Yo = 4.91 ft\n", "Sc = 0.00315\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10.6 page no : 373" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from sympy import Symbol,solve\n", "\n", "# variables\n", "Q = round((1.49/0.015)*50*(50./20)**(2./3)*(0.001)**(1./2)) # cfs\n", "E = 5.52 # ft\n", "\n", "# calculations and results\n", "Ye = ((Q/10)**2/32.2)**(1./3)\n", "Emin = 3 * Ye/2\n", "\n", "print \"Ye = %.2f ft\"%Ye\n", "print \"Minimum height of hump : Emin = %.2f ft\"%Emin\n", "\n", "Ye = 2 * 5.52/3\n", "b = Symbol(\"b\")\n", "ans = solve( ( (289/b)**2 / 32.2 )**(1./3) - Ye)\n", "b = ans[1]\n", "\n", "print \"Ye = %.2f ft\"%Ye\n", "print \"Maximum width of contraction : b = %.1f ft\"%b" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Ye = 2.96 ft\n", "Minimum height of hump : Emin = 4.44 ft\n", "Ye = 3.68 ft" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "Maximum width of contraction : b = 7.2 ft\n" ] } ], "prompt_number": 37 } ], "metadata": {} } ] }