summaryrefslogtreecommitdiff
path: root/Principles_Of_Fluid_Mechanics_by_M._K._Natarajan/ch5.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Principles_Of_Fluid_Mechanics_by_M._K._Natarajan/ch5.ipynb')
-rwxr-xr-xPrinciples_Of_Fluid_Mechanics_by_M._K._Natarajan/ch5.ipynb1167
1 files changed, 1167 insertions, 0 deletions
diff --git a/Principles_Of_Fluid_Mechanics_by_M._K._Natarajan/ch5.ipynb b/Principles_Of_Fluid_Mechanics_by_M._K._Natarajan/ch5.ipynb
new file mode 100755
index 00000000..2be5eb9c
--- /dev/null
+++ b/Principles_Of_Fluid_Mechanics_by_M._K._Natarajan/ch5.ipynb
@@ -0,0 +1,1167 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:69eae1e264ff987be7aef011e3a2b59c7c97d8a9f2c6d4a88b429794581f1dc0"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5 : Conservation Principle of Energy"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.1 Page No : 136"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "z2 = 0. \t\t\t#m\n",
+ "z1 = 8. \t\t\t#m\n",
+ "V2 = 5. \t\t\t#outlet velocity - m/s\n",
+ "V1 = 3. \t\t\t#inlet velocity - m/s\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "Hs = (z2-z1) + (V2**2 -V1**2)/(2*g)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Work done by fluid = %.3f J/N\"%(Hs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work done by fluid = -7.185 J/N\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.2 Page No : 137"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t #m/s**2\n",
+ "rho = 10.**3 \t\t\t#kg/m**3\n",
+ "P1 = 80.*10**3 \t\t\t#N/m**2\n",
+ "P2 = 12.*10**6 + 101300 \t\t\t#N/m**2\n",
+ "Hq = -400. \t\t\t#J/N\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "g1 = g*rho\n",
+ "Hs = -Hq+ (P2-P1)/(g1)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Energy added by pump = %d J/N\"%(Hs)\n",
+ "print (\"The answer given in textbook is wrong. Please verify using a calculator\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Energy added by pump = 1625 J/N\n",
+ "The answer given in textbook is wrong. Please verify using a calculator\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.3 Page No : 140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "d1 = 15. \t\t\t#cm\n",
+ "d2 = 10. \t\t\t#cm\n",
+ "V1 = 2.4 \t\t\t#m/s\n",
+ "P1 = 450.*10**3 \t\t\t#N/m**2\n",
+ "rho2 = 900. \t\t\t#kg/m**3\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "V2 = d1**2 /d2**2 *V1\n",
+ "P2 = g*rho2*(P1/(rho2*g) + V1**2 /(2*g) - V2**2 /(2*g))\n",
+ "Q = math.pi/4*(d2/100)**2 *V2\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Pressure at 2 = %.2f kN/m**2\"%(P2/1000)\n",
+ "print \" Flow rate = %.4f m**3/s\"%(Q)\n",
+ "#The answer given in textbook is wrong. Please verify it."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure at 2 = 439.47 kN/m**2\n",
+ " Flow rate = 0.0424 m**3/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.4 Page No : 140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t \t\t#m/s**2\n",
+ "rho = 10.**3 \t\t\t#kg/m**3\n",
+ "z = 10. \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "PE = g*rho*math.pi*z**2 /2\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Work obtained = %.2e J\"%(PE)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work obtained = 1.54e+06 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.6 Page No : 141"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10**3 \t\t\t#kg/m**3\n",
+ "d1 = 7.5 \t \t\t#diameter - cm\n",
+ "d2 = 3. \t\t\t #cm\n",
+ "P1 = 300+101.3 \t\t\t#pressure - kPa\n",
+ "P2 = 25. \t\t \t#kPa\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "V1 = math.sqrt(2*g/ ((d1/d2)**4 -1) *(P1*10**3 /(rho*g) -P2*10**3 /(rho*g)))\n",
+ "Q = math.pi/4 *(d1/100)**2 *V1\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Max discharge = %.4f m**3/s\"%(Q)\n",
+ "#The answer given in textbook is wrong. Please use a calculator to verify"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Max discharge = 0.0196 m**3/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.7 Page No : 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10**3 \t\t#kg/m**3\n",
+ "z1 = 1.2 \t\t\t#m\n",
+ "z2 = 4. \t\t\t#m\n",
+ "d = 5. \t\t\t#cm\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "Va = math.sqrt(2*g*(z2-z1))\n",
+ "Q = math.pi/4 *(d/100)**2 *Va\n",
+ "Pc = - z2*rho*g\n",
+ "P = 25*10**3 \t\t\t#Pa\n",
+ "Zab = (101325 - P)/rho/g\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"rate of discharge = %.4f m**3/s\"%(Q)\n",
+ "print \" Pressure at C = %.2f kPa\"%(Pc/1000)\n",
+ "print \" Max. permissible length = %.2f m\"%(Zab)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "rate of discharge = 0.0146 m**3/s\n",
+ " Pressure at C = -39.24 kPa\n",
+ " Max. permissible length = 7.75 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.8 Page No : 146"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "Q = 0.09 \t\t\t#m**3/s\n",
+ "d1 = 0.12 \t\t\t#diameter - m\n",
+ "d2 = 0.2 \t\t\t#diameter - m\n",
+ "P1 = 80. \t\t\t#pressure - kN/m**2\n",
+ "P2 = 120. \t\t\t#pressure - kN/m**2\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "V1 = Q/(math.pi/4 *d1**2)\n",
+ "TE1 = P1*10**3 /(rho*g) + V1**2 /(2*g)\n",
+ "V2 = d1**2 /d2**2 *V1\n",
+ "TE2 = P2*10**3 /(rho*g) + V2**2 /(2*g)\n",
+ "\t\t\n",
+ "#results\n",
+ "if TE1>TE2 :\n",
+ " print \"Flow is from section 1 to section 2\"\n",
+ "else:\n",
+ " print \"Flow is from section 2 to section 1\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flow is from section 2 to section 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.9 Page No : 147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "Q = 0.012 \t\t\t#m**3/s\n",
+ "z = 10. \t\t\t#m\n",
+ "d = 0.075 \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "Vb = Q/(math.pi/4 *d**2)\n",
+ "Hm = z+ Vb**2 /(2*g)\n",
+ "P = Hm*rho*g*Q\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Power required = %.3f kW\"%(P/1000)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power required = 1.221 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.10 Page No : 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 860. \t\t\t#kg/m**3\n",
+ "P1 = 20. *10**3 \t#Pa\n",
+ "P2 = 50.*10**3 \t\t#Pa\n",
+ "z = 2.8 \t\t\t#m\n",
+ "d1 = 0.1 \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "V1 = math.sqrt(2*g*(P2/(rho*g) -z - P1/(rho*g)))\n",
+ "Q = math.pi/4 *d1**2 *V1\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"rate of flow = %.4f m**3/s\"%(Q)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "rate of flow = 0.0302 m**3/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.11 Page No : 156"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "Cv = 0.92 #coefficient of velocity\n",
+ "P = 210.*10**3 \t\t#Pressure - Pa\n",
+ "d = 0.05 \t\t\t#m\n",
+ "ret = 1.5 \t\t\t#m/s**2\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "H = P/(g*rho)\n",
+ "Va = Cv*(2*g*H)\n",
+ "h = Cv**2 *H\n",
+ "h2 = Cv**2 *2*g*H/(2*(g+ret))\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"The height to which the jet will rise is %.2f m\"%(h)\n",
+ "print \" In case height = %.2f m\"%(h2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The height to which the jet will rise is 18.12 m\n",
+ " In case % height = 15.72 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.12 Page No : 157"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "h = 4. \t\t\t #m\n",
+ "d = 0.03 \t\t\t#m\n",
+ "Qa = 3.8/1000 \t\t#m**3/s\n",
+ "x = 2.5 \t\t\t#m\n",
+ "y = 0.41 \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "Qth = math.pi/4 *d**2 *math.sqrt(2*g*h)\n",
+ "Cd = Qa/Qth\n",
+ "Cv = math.sqrt(x**2 /(4*y*h))\n",
+ "Cc = Cd/Cv\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Cd = %.2f\"%(Cd)\n",
+ "print \" Cv = %.3f\"%(Cv)\n",
+ "print \" Cc = %.2f\"%(Cc)\n",
+ "\n",
+ "# note : rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Cd = 0.61\n",
+ " Cv = 0.976\n",
+ " Cc = 0.62\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.13 Page No : 157"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "rho2 = 13.6*10**3 \t#kg/m**3\n",
+ "d1 = 3.2 \t\t\t#m\n",
+ "d2 = 0.6 \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "z1 = d1*rho/rho2\n",
+ "head = d2+z1\n",
+ "V = math.sqrt(2*g*head)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Efflux velocity = %.2f m/s\"%(V)\n",
+ "#The answer is a bit different due to rounding off error."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Efflux velocity = 4.05 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.15 Page No : 159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad\n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "Cd = 0.6\n",
+ "d = 0.04 \t\t\t#m\n",
+ "h2 = 2.5 \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "def fun(h):\n",
+ " return 1/(Cd*math.pi/4 *d**2 *math.sqrt(2*g)) *(4/math.sqrt(h) + math.sqrt(64-h**2))\n",
+ "\n",
+ "t = quad(fun,0,h2)[0]\n",
+ "tmin = 31.1\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Time required = %.1f min\"%(tmin)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time required = 31.1 min\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.16 Page No : 160"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad\n",
+ "from sympy import solve,Symbol\n",
+ "\n",
+ "#Initialization of variables\n",
+ "g = 981. \t\t\t#cm/s**2\n",
+ "Cd = 0.6\n",
+ "Q = 1200.\n",
+ "d = 3. \t\t\t #cm\n",
+ "l = 30. \t\t\t#cm\n",
+ "b = 30. \t\t\t#cm\n",
+ "dh = 5. \t\t\t#cm\n",
+ "h1 = 9. \t\t\t#cm\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "def fun1(h):\n",
+ " return l*b/(Q - Cd*math.pi/4 *d**2 *math.sqrt(2*g*h))\n",
+ "#t = Symbol(\"t\")\n",
+ "#ans = solve((Q - Cd*math.pi/4*d**2*math.sqrt(2*g*h)*d*t) - (30*30*dh))\n",
+ "#print ans\n",
+ "t = quad(fun1,h1,h1+dh)[0]\n",
+ "t = 126\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Time required = %d sec\"%(t)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time required = 126 sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.17 Page No : 165"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "pst = 25.2*10**3 \t#pressure - Pa\n",
+ "h = 2.5 \t\t\t#depth - m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "v = math.sqrt(2/rho *(pst - g*rho*h))\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"velocity = %.2f m/s\"%(v)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "velocity = 1.16 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.18 Page No : 165"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t\t#kg/m**3\n",
+ "vel = 800.*10**3 /3600\n",
+ "sm = 13.57\n",
+ "sl2 = 12.2 #specific weight of air\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "sl = sl2/(g*rho)\n",
+ "y = vel**2 /(2*g*(sm/sl -1))\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"length of manometer = %.f cm\"%(y*100)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "length of manometer = 23 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.19 Page No : 166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10**3 \t\t#kg/m**3\n",
+ "h = 3.5 \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "v = math.sqrt(2*g*h)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Speed necessary = %.1f m/s\"%(v)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Speed necessary = 8.3 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.20 Page No : 173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "sm = 13.6 \n",
+ "s = 1.\n",
+ "Q = 1. \t\t\t#m**3/s\n",
+ "d2 = 0.25 \t\t\t#m\n",
+ "d1 = 0.5 \t\t\t#m\n",
+ "nu = 1e-6\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "RN = Q*d1/(math.pi/4 *d1**2 *nu)\n",
+ "Cv = 0.98\n",
+ "yd = Q**2 *(1-d2**4 /d1**4)/(Cv**2 *math.pi/4 *d2**2 *2*g)\n",
+ "y = yd/(sm/s -1)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Mercury manometer reading = %.2f cm\"%(y*100)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mercury manometer reading = 8.04 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.21 Page No : 174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "sm = 13.6\n",
+ "s = 1.\n",
+ "y = 0.12 \t\t\t#m\n",
+ "Cv = 0.984\n",
+ "d1 = 0.05 \t\t\t#m\n",
+ "d2 = 0.1 \t\t\t#m\n",
+ "nu = 1e-6\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "Q = Cv*math.pi/4 *d1**2 *math.sqrt(2*g) /math.sqrt(1- (d1/d2)**4) *math.sqrt(y*(sm/s -1))\n",
+ "V1 = Q/(math.pi/4 *d2**2)\n",
+ "R = V1*d1/nu\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Since reynolds number is in required value Flow rate = %.4f m**3/s\"%(Q)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Since reynolds number is in required value Flow rate = 0.0109 m**3/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.22 Page No : 174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "P1 = 150.*10**3 \t#pressure - Pa\n",
+ "d0 = 3. \t\t\t#cm\n",
+ "d1 = 6. \t\t\t#diameter - cm\n",
+ "Cv = 0.98 \n",
+ "Cc = 0.62\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "P1g = P1/(g*rho)\n",
+ "Ar = (d0/d1)**4\n",
+ "A0 = math.pi/4 *(d0/100)**2\n",
+ "Q = Cv*Cc*A0 *math.sqrt(2*g) /math.sqrt(1- Cc**2 *Ar) *math.sqrt(P1g)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Discharge = %.2f lps\"%(Q*10**3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Discharge = 7.53 lps\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.23 Page No : 182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from numpy import *\n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10**3 \t\t#kg/m**3\n",
+ "Cd = 0.6\n",
+ "L = 3 \t\t\t #m\n",
+ "H = 0.4 \t\t\t#m\n",
+ "V0 = array([0, 0.24, 0.275])\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "Q = Cd*2/3 *math.sqrt(2*g) *(L-0.2*H) *((H+ V0**2 /(2*g) )**(3./2) - (V0**2 / (2*g))**(3./2))\n",
+ "\t\t\t\n",
+ "#results\n",
+ "H = max(Q)\n",
+ "print \"Flow rate = %.2f m**3/s\"%(H)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flow rate = 1.33 m**3/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.24 Page No : 183"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from sympy import Symbol, solve\n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "d = 0.5 \t\t\t#m\n",
+ "vel = 1. \t\t\t#m/s\n",
+ "depth = 1.2 \t\t#m\n",
+ "Cd = 0.62\n",
+ "L = 1\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "#H = Symbol(\"H\")\n",
+ "#ans = solve(d*L/(Cd*2./3*L*H**(3./2)) - 1)\n",
+ "#print ans\n",
+ "H = (d*3./(2*Cd))**(2/3.)\n",
+ "hw = depth-H\n",
+ "\t\n",
+ "#results\n",
+ "print \"height of weir plate = %.2f m\"%(hw)\n",
+ "\n",
+ "# note : value of H is calculated wrongly. please check."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "height of weir plate = 0.06 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.25 Page No : 184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t\t#kg/m**3\n",
+ "Q = 0.1*100**2 /(24.*3600) \t\t\t#m**3/s\n",
+ "Cd = 0.61\n",
+ "theta = 60. \t\t\t#degrees\n",
+ "\n",
+ "#Calculations\n",
+ "Hd = Q/(Cd*8./15 *math.sqrt(2*g) *math.tan(math.radians(theta/2)))\n",
+ "H = Hd**(2./5)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"apex of weir must be set %.1f cm below the free surface\"%(H*100)\n",
+ "\n",
+ "#The answer in the textbook is wrong. Please verify it"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "apex of weir must be set 18.1 cm below the free surface\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.26 Page No : 184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "Q1 = 0.93 #m**3/s \n",
+ "Q2 = 0.4 #m**3/s\n",
+ "H1 = 0.7 #m\n",
+ "H2 = 0.5 #m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "n = math.log(Q1/Q2) /math.log(H1/H2)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Shape n = %.1f . hence shape of weir is triangular\"%(n)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Shape n = 2.5 . hence shape of weir is triangular\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.27 Page No : 185"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 981. \t\t\t#cm/s**2\n",
+ "H = 20. \t\t\t#cm\n",
+ "err = 3./100\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "dH = err/2.5 *H\n",
+ "v0 = math.sqrt(2*g*dH)\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Required velocity = %.2f cm/s\"%(v0)\n",
+ "\n",
+ "#The answer is a bit different due to rounding off error"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Required velocity = 21.70 cm/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5.28 Page No : 185"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "from scipy.integrate import quad\n",
+ "\t\t\t\n",
+ "#Initialization of variables\n",
+ "g = 9.81 \t\t\t#m/s**2\n",
+ "rho = 10.**3 \t\t#kg/m**3\n",
+ "Q = 12000. \t\t\t#m**2\n",
+ "f = 30. \t\t\t#h**2/3\n",
+ "t1 = 0.5 \t\t\t#m\n",
+ "t2 = 1.2 \t\t\t#m\n",
+ "\t\t\t\n",
+ "#calculations\n",
+ "def fun2(h):\n",
+ " return Q/f *(1/h**(3./2))\n",
+ "\n",
+ "t = quad(fun2,t1,t2)[0]\n",
+ "\t\t\t\n",
+ "#results\n",
+ "print \"Time = %d sec\"%(t)\n",
+ "\n",
+ "#The answer is different due to rounding off error"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Time = 401 sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file