diff options
Diffstat (limited to 'Problems_In_Fluid_Flow/ch5.ipynb')
-rw-r--r-- | Problems_In_Fluid_Flow/ch5.ipynb | 757 |
1 files changed, 757 insertions, 0 deletions
diff --git a/Problems_In_Fluid_Flow/ch5.ipynb b/Problems_In_Fluid_Flow/ch5.ipynb new file mode 100644 index 00000000..2f6c5b6c --- /dev/null +++ b/Problems_In_Fluid_Flow/ch5.ipynb @@ -0,0 +1,757 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Flow measurement in open channel\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.1 page no : 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "volumetric flow rate\n", + "chezy coefficient\n", + "velocity gradient in the channel\n", + "'''\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 999.7;\n", + "g = 9.81;\n", + "mu = 1.308/1000;\n", + "s = 1./6950;\n", + "b = 0.65;\n", + "h = 32.6/100;\n", + "n = 0.016;\n", + "\n", + "#calculation\n", + "A = b*h;\n", + "P = b+2*h;\n", + "m = A/P;\n", + "u = s**.5*m**(2./3)/n;\n", + "Q = A*u\n", + "\n", + "print \"volumetric flow rate (m**3/s): %.4f\"%Q\n", + "C = u/m**0.5/s**0.5;\n", + "print \"chezy coefficient (m**0.5/s): %.4f\"%C\n", + "a = -m*rho*g*s/mu #delu/dely\n", + "print \"velocity gradient in the channel (s**-1): %.4f\"%a\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate (m**3/s): 0.0474\n", + "chezy coefficient (m**0.5/s): 46.1814\n", + "velocity gradient in the channel (s**-1): -175.5764\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.2 page no : 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# find depth of water\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "Q = 0.885\n", + "pi = 3.1428\n", + "s = 1./960\n", + "s = round(s*1000000)/1000000.\n", + "b = 1.36\n", + "n = 0.014\n", + "theta = 55.*pi/180.\n", + "\n", + "#calculation\n", + "\n", + "def flow(x):\n", + " a = (x*(b+x/math.tan(theta)))/(b+2*x/math.sin(theta))\n", + " y = a**(2./3)*s**(1./2)*(x*(b+x/math.tan(theta)))/n-Q\n", + " return y\n", + "x = fsolve(flow,0.1)\n", + "\n", + "print \"depth of water in (m): %.4f\"%x[0]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "depth of water in (m): 0.4813\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.3 page no : 86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# find slope of channel\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "n = 0.011\n", + "h = 0.12\n", + "Q = 25./10000.\n", + "\n", + "#calculation\n", + "def f(x): \n", + "\t return 1./x**2-1\n", + "\t \n", + "x = fsolve(f,0.1)\n", + "theta = 2.*arctan(x)\n", + "A = h*2*h/math.tan(theta/2)/2.\n", + "P = 2.*h*math.sqrt(2.)\n", + "s = Q**2.*n**2.*P**(4./3)/A**(10./3)\n", + "print \"the slope of channel in (radians): %f\"%s\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the slope of channel in (radians): 0.000246\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.4 pageno : 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "maximum velocity\n", + "maximum volumetric flow \n", + "maximum velocity of obtained fluid \n", + "maximum flow rate obtained\n", + "'''\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "\n", + "#part1\n", + "#maximizing eqution in theta & get a function\n", + "def theta(x):\n", + " return (x-.5*math.sin(2.*x))/2/x**2.-(1-math.cos(2.*x))/2/x\n", + "\n", + "x = fsolve(theta,2.2)\n", + "x = round(x*1000.)/1000.\n", + "a = (1-math.cos(x))/2.\n", + "print \"velocity will be maximum when stream depth in times of diameter is %.3f\"%(a)\n", + "\n", + "#part2\n", + "#maximizing eqution in theta & get a function\n", + "def theta2(x):\n", + " return 3*(x-.5*math.sin(2*x))**2*(1.-math.cos(2.*x))/2./x-(x-.5*math.sin(2.*x))**3./2./x**2 \n", + "\n", + "x1 = fsolve(theta2,2.2)\n", + "x1 = round(x1*1000)/1000.\n", + "a = (1-math.cos(x1))/2.\n", + "\n", + "print \"vlumetric flow will be maximum when stream depth in times of diameter is %.3f\"%(a)\n", + "\n", + "#part3\n", + "r = 1.\n", + "A = 1.*x-0.5*math.sin(2*x)\n", + "s = 0.35*3.14/180\n", + "P = 2.*x*r\n", + "C = 78.6\n", + "u = C*(A/P)**0.5*s**0.5\n", + "print \"maximum velocity of obtained fluid (m/s): %.4f\"%u\n", + "\n", + "#part4\n", + "print \"maximum flow rate obtained at angle in (radians): %.4f\"%x1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity will be maximum when stream depth in times of diameter is 0.813\n", + "vlumetric flow will be maximum when stream depth in times of diameter is 0.950\n", + "maximum velocity of obtained fluid (m/s): 4.7913\n", + "maximum flow rate obtained at angle in (radians): 2.6890\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.5 page no : 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "velocity of fluid \n", + "fluid depth over weir in (m)\n", + "fluid depth over weir in if SI units \n", + "base angle of the notch of weir\n", + "'''\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "import numpy\n", + "\n", + "#example 5.5 \n", + "# Initialization of Variable\n", + "g = 9.81\n", + "h = 28./100\n", + "Cd = 0.62\n", + "B = 46./100\n", + "Q = 0.355\n", + "n = 2. #from francis formula\n", + "\n", + "#calcualtion\n", + "\n", + "#part1\n", + "u = math.sqrt(2*g*h)\n", + "print \"velocity of fluid (m/s): %.4f\"%u\n", + "\n", + "#part2a\n", + "H = (3.*Q/2./Cd/B/(2.*g)**0.5)**(2./3)\n", + "\n", + "print \"fluid depth over weir in (m): %.4f\"%H\n", + "\n", + "#part2b\n", + "#using francis formula\n", + "def root(x):\n", + " return Q-1.84*(B-0.1*n*x)*x**1.5\n", + "\n", + "x = fsolve(root,0.2)\n", + "print \"fluid depth over weir in if SI units uesd in (m): %.4f\"%x\n", + "\n", + "#part3\n", + "H = 18.5/100\n", + "Q = 22./1000\n", + "a = 15.*Q/8/Cd/(2*g)**0.5/H**2.5\n", + "theta = 2*numpy.arctan(a)\n", + "print \"base angle of the notch of weir (degrees) %.4f\"%(theta*180/3.14)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity of fluid (m/s): 2.3438\n", + "fluid depth over weir in (m): 0.5622\n", + "fluid depth over weir in if SI units uesd in (m): 0.7196\n", + "base angle of the notch of weir (degrees) 91.2010\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.6 pageno : 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "alternative depth \n", + "maximum volumetric flow\n", + "Froude no.\n", + "% of kinetic energy in initial system\n", + "% of kinetic energy in final system \n", + "'''\n", + "\n", + "import math \n", + "from numpy import poly1d\n", + "#from scipy.optimize import root\n", + "from numpy import *\n", + "# Initialization of Variable\n", + "\n", + "Q = 0.675\n", + "B = 1.65\n", + "D = 19.5/100\n", + "g = 9.81\n", + "\n", + "#caculation\n", + "u = Q/B/D\n", + "u = round(u*1000.)/1000.\n", + "E = D+u**2./2./g\n", + "y = poly1d([1,-E, 0, 8.53/1000],False)\n", + "#y = poly1d([8.53/1000, 0, -E, 1],False)\n", + "x = roots(y)\n", + "print \"alternative depth in (m) %.4f\"%x[0]\n", + "print \"It is shooting flow\"\n", + "Dc = 2./3*E\n", + "Qmax = B*(g*Dc**3)**0.5\n", + "print \"maximum volumetric flow (m**3/s) %.4f\"%Qmax\n", + "Fr = u/math.sqrt(g*D)\n", + "print \"Froude no. %.4f\"%Fr\n", + "a = (E-D)/E\n", + "print \"%% of kinetic energy in initial system %.4f\"%(a*100)\n", + "b = (E-x[0])/E\n", + "print \"%% of kinetic energy in final system %.4f\"%(b*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "alternative depth in (m) 0.3495\n", + "It is shooting flow\n", + "maximum volumetric flow (m**3/s) 0.7639\n", + "Froude no. 1.5169\n", + "% of kinetic energy in initial system 53.4987\n", + "% of kinetic energy in final system 16.6510\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.7 page no : 96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "alternate depths \n", + "slode when depth is 12.9cm\n", + "slode when depth is 45.1cm \n", + "'''\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "\n", + "G = 338. #mass flow rate\n", + "rho = 998.\n", + "q = G/rho\n", + "E = 0.48\n", + "n = 0.015\n", + "g = 9.81\n", + "B = 0.4\n", + "y = poly1d([1, -E, 0 ,5.85/1000 ],False)\n", + "x = roots(y)\n", + "print \"alternate depths (m): %.4f %.4f\"%(x[0],x[1])\n", + "s = (G*n/rho/x[1]/(B*x[1]/(B+2*x[1]))**(2./3))**2\n", + "print \"slode when depth is 12.9cm %.4f\"%s\n", + "s = (G*n/rho/x[0]/(B*x[0]/(B+2*x[0]))**(2./3))**2\n", + "print \"slode when depth is 45.1cm %.4f\"%s\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "alternate depths (m): 0.4513 0.1291\n", + "slode when depth is 12.9cm 0.0461\n", + "slode when depth is 45.1cm 0.0018\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.8 page no : 97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "critical depth\n", + "critical velocity\n", + "Critical volumetric flow\n", + "'''\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "\n", + "pi = 3.14\n", + "theta = pi/3.\n", + "h = 1./math.tan(theta)\n", + "B = 0.845\n", + "E = 0.375\n", + "g = 9.81\n", + "\n", + "#calculation\n", + "#part1\n", + "\n", + "#deducing a polynomial(quadratic) in Dc \n", + "a = 5.*h\n", + "b = 3.*B-4*h*E\n", + "c = -2.*E*B\n", + "y = poly1d([a ,b ,c],False)\n", + "x = roots(y)\n", + "\n", + "print \"critical depth in (m): %.4f\"%x[1]\n", + "\n", + "#part2\n", + "Ac = x[1]*(B+x[1]*math.tan(theta/2))\n", + "Btc = B+x[1]*math.tan(theta/2.)*2\n", + "Dcbar = Ac/Btc\n", + "uc = math.sqrt(g*Dcbar)\n", + "print \"critical velocity (m/s): %.4f\"%uc\n", + "\n", + "#part3\n", + "Qc = Ac*uc\n", + "print \"Critical volumetric flow (m**3/s): %.4f\"%Qc\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical depth in (m): 0.2615\n", + "critical velocity (m/s): 1.4925\n", + "Critical volumetric flow (m**3/s): 0.3887\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.9 page no : 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "volumetric flow rate over flat topped weir over rectangular section in non uniform width\n", + "volumetric flow rate over flat topped weir over rectangular section in uniform width\n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "\n", + "B2 = 1.60 #breadth at 2\n", + "D2 = (1-0.047)*1.27 #depth at 2\n", + "g = 9.81\n", + "B1 = 2.95 #breadth at 1\n", + "D1 = 1.27 #depth at 1\n", + "Z = 0.\n", + "\n", + "#calculation\n", + "Q = B2*D2*(2*g*(D1-D2-Z)/(1-(B2*D2/B1/D1)**2))**0.5\n", + "print \"volumetric flow rate over flat topped weir over rectangular\\\n", + "section in non uniform width(m**3/s) : %.4f\"%Q\n", + "\n", + "#next part\n", + "B2 = 12.8\n", + "D1 = 2.58\n", + "Z = 1.25\n", + "Q = 1.705*B2*(D1-Z)**1.5\n", + "print \"volumetric flow rate over flat topped weir over rectangular section in uniform width (m**3/s): %.4f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate over flat topped weir over rectangularsection in non uniform width(m**3/s) : 2.4480\n", + "volumetric flow rate over flat topped weir over rectangular section in uniform width (m**3/s): 33.4743\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.10 page no : 102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "Normal depth \n", + "Critical depth \n", + "distance in (m) from upstream to that place\n", + "'''\n", + "\n", + "from numpy import linspace\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "pi = 3.14\n", + "n = 0.022\n", + "B = 5.75\n", + "s = 0.15*pi/180\n", + "Q = 16.8\n", + "g = 9.81\n", + "\n", + "def normal(x):\n", + " y = Q-B*x/n*(B*x/(B+2*x))**(2./3)*s**0.5\n", + "\n", + "x = fsolve(normal,1.33)\n", + "print \"Normal depth in (m) : %.4f\"%x[0]\n", + "Dc = (Q**2/g/B**2)**(1./3)\n", + "print \"Critical depth in (m): %.4f\"%Dc\n", + "delD = .1\n", + "D = [1.55,1.65,1.75,1.85,1.95,2.05,2.15,2.25,2.35]\n", + "su = 0\n", + "for i in range(9):\n", + " delL = delD/s*(1-(Dc/D[i])**3.)/(1.-(x/D[i])**3.33)\n", + " su = su+delL\n", + "\n", + "print \"distance in (m) from upstream to that place: %.4f\"%su\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Normal depth in (m) : 1.3300\n", + "Critical depth in (m): 0.9547\n", + "distance in (m) from upstream to that place: 456.5757\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last ten iterations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.11 page no : 105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "critical depth \n", + "normal depth upstream\n", + "normal depth downstream \n", + "conjugate depth for upstream \n", + "conjugate depth for downstream \n", + "distance in (m) of occurence of jump by accurate method\n", + "distance in (m) of occurence of jump by not so accurate method\n", + "power loss in hydraulic jump per unit width\n", + "'''\n", + "\n", + "import math \n", + "from numpy import linspace\n", + "\n", + "# Initialization of Variable\n", + "\n", + "g = 9.81\n", + "q = 1.49\n", + "pi = 3.14\n", + "\n", + "#calculation\n", + "\n", + "#part1\n", + "Dc = (q**2/g)**.333\n", + "print \"critical depth in (m): %.4f\"%Dc\n", + "\n", + "#part2\n", + "n = 0.021\n", + "su = 1.85*pi/180 #slope upstream\n", + "sd = 0.035*pi/180 #slope downstream\n", + "Dnu = (n*q/math.sqrt(su))**(3./5)\n", + "Dnu = round(Dnu*1000)/1000.\n", + "print \"normal depth upstream in (m): %.4f\"%Dnu\n", + "Dnd = (n*q/math.sqrt(sd))**(3./5)\n", + "print \"normal depth downstream in (m): %.4f\"%Dnd\n", + "\n", + "#part3\n", + "D2u = -0.5*Dnu*(1-math.sqrt(1+8*q**2/g/Dnu**3))\n", + "D2u = round(D2u*1000)/1000.\n", + "print \"conjugate depth for upstream in (m): %.4f\"%D2u\n", + "D1d = -0.5*Dnd*(1-math.sqrt(1+8*q**2/g/Dnd**3))\n", + "print \"conjugate depth for downstream in (m): %.4f\"%D1d\n", + "\n", + "#part4\n", + "#accurate method\n", + "delD = .022\n", + "D = linspace(0.987,.022,9)\n", + "\n", + "dis = 0.\n", + "for i in range(8):\n", + " delL = delD/su*(1-(Dc/D[i])**3)/(1-(Dnu/D[i])**3.33)\n", + " dis = dis+delL\n", + "\n", + "print \"distance in (m) of occurence of jump by accurate method: %.4f\"%dis\n", + "\n", + "#not so accurate one\n", + "E1 = D2u+q**2./2./g/D2u**2\n", + "E2 = Dnd+q**2./2./g/Dnd**2\n", + "E2 = round(E2*1000)/1000.\n", + "E1 = round(E1*1000)/1000.\n", + "ahm = (D2u+Dnd)/2 #av. hyd.raulic mean\n", + "afv = .5*(q/D2u+q/Dnd) #av. fluid velocity\n", + "i = (afv*0.021/ahm**(2./3))**2\n", + "l = (E2-E1)/(su-i+0.0002)\n", + "print \"distance in (m) of occurence of jump by not so accurate method: %.4f\"%l\n", + "\n", + "#part5\n", + "rho = 998.\n", + "Eu = Dnu++q**2./2./g/Dnu**2\n", + "Eu = round(Eu*1000)/1000.\n", + "P = rho*g*q*(Eu-E1)\n", + "print \"power loss in hydraulic jump per unit width in (kW): %.4f\"%(P/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical depth in (m): 0.6097\n", + "normal depth upstream in (m): 0.3500\n", + "normal depth downstream in (m): 1.1522\n", + "conjugate depth for upstream in (m): 0.9760\n", + "conjugate depth for downstream in (m): 0.2752\n", + "distance in (m) of occurence of jump by accurate method: 0.6270\n", + "distance in (m) of occurence of jump by not so accurate method: 4.4844\n", + "power loss in hydraulic jump per unit width in (kW): 2.6112\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |