{
 "metadata": {
  "name": "",
  "signature": "sha256:b340580fbd227dce130b380a32e6ef916d9ee3613549fbd41c895ab6ef6ec7e3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 : Steady Incompressible Flow in Pressure Conduits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1 Page No : 205"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "s = 0.85\n",
      "v = 1.8*10**-5 \t#m**2 /s\n",
      "d = 10.          \t#cm\n",
      "flow = 0.5 \t        #L/s\n",
      "\t\n",
      "#calculations\n",
      "Q = flow*10**3\n",
      "A = math.pi*d**2 /4\n",
      "V = Q/A\n",
      "V = V/10**2\n",
      "R = d*10**-2 *V/v\n",
      "\t\n",
      "#Results\n",
      "print \"reynolds number  =  %.f. Hence the flow is laminar\"%(R)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "reynolds number  =  354. Hence the flow is laminar\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2 Page No : 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\t\n",
      "#Initialization of variables\n",
      "Vc = 12.7 \t#cm/s\n",
      "r = 2.   \t#cm\n",
      "r2 = 5.  \t#cm\n",
      "R = 354.\n",
      "rho = 0.85\n",
      "V = 6.37 \t#cm/s\n",
      "D = 0.1 \t#m\n",
      "\t\n",
      "#calculations\n",
      "k = Vc/r2**2\n",
      "f = 64/R\n",
      "T0 = f/4 *rho*V**2 /2\n",
      "T02 = T0/10\n",
      "hr = f*(V*10**-2)**2 /(2*9.81*D)\n",
      "\t\n",
      "#Results\n",
      "print \"Friction factor  =  %.2f\"%(f)\n",
      "print \" Shear stress at the pipe wall  =  %.3f N/m**2\"%(T02)\n",
      "print \" Head loss per pipe length  =  %.5f m/m\"%(hr)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Friction factor  =  0.18\n",
        " Shear stress at the pipe wall  =  0.078 N/m**2\n",
        " Head loss per pipe length  =  0.00037 m/m\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3 Page No : 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "Q = 2. \n",
      "A = 0.196    \t#cm**2\n",
      "D = 0.5 \t    #ft\n",
      "rho = 0.9*1.94\n",
      "mu = 0.0008 \t#viscosity - lb s/ft**2\n",
      "hl = 25.\n",
      "g = 32.2 \t    #ft/sec**2\n",
      "L = 200. \t    #ft\n",
      "r = 2.   \t    #in\n",
      "\t\n",
      "#calculations\n",
      "V = Q/A\n",
      "R = D*V*rho/mu\n",
      "f = hl*D*2*g/(L*V**2)\n",
      "umax = V*(1+1.33*math.sqrt(f))\n",
      "T0 = f*rho*V**2 /8\n",
      "u2 = umax - 5.75* math.sqrt(T0/rho) *math.log10(D*12/r)\n",
      "\t\n",
      "#Results\n",
      "print \"Center line velocity  =  %.1f fps\"%(umax)\n",
      "print \" Shear stress  =  %.2f lb/ft**2\"%(T0)\n",
      "print \" Velcoity at 2 in from center line  =  %.2f fps\"%(u2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Center line velocity  =  12.9 fps\n",
        " Shear stress  =  0.88 lb/ft**2\n",
        " Velcoity at 2 in from center line  =  10.93 fps\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4 Page No : 228"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "f = 0.0131\n",
      "d = 0.5 \t#m\n",
      "\t\n",
      "#calculations\n",
      "V = 2.12 \t#m/s\n",
      "R = 10**6\n",
      "Q = math.pi*d**2 /4 *V \n",
      "d1 = 32.8*10**-6 /(V* math.sqrt(f))\n",
      "\n",
      "#Results\n",
      "print \"flow rate  =  %.3f m**3/s\"%(Q)\n",
      "print \" nominal thickness  =  %.3e m\"%(d1)\n",
      "\n",
      "# note : rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "flow rate  =  0.416 m**3/s\n",
        " nominal thickness  =  1.352e-04 m\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5 Page No : 241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "dz = 260. \t#ft\n",
      "ke = 0.5\n",
      "f = 0.02\n",
      "l = 5000. \t#length of pipe - ft\n",
      "D = 10. \t#in\n",
      "A2 = 0.545\n",
      "\t\n",
      "#calculations\n",
      "V2by2g = dz/(1 + ke + f*l/(D/12))\n",
      "V2 = V2by2g*2*32.2\n",
      "V = math.sqrt(V2)\n",
      "DV = D*V\n",
      "Q = math.pi/4 *(D/12)**2 *V\n",
      "\t\n",
      "#Results\n",
      "print \"Flow rate  =  %.2f cfs\"%(Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow rate  =  6.40 cfs\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.6 Page No : 242"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "z = 260. \t#ft\n",
      "f = 0.02\n",
      "\t\n",
      "#calculations\n",
      "V2by2g = z/(1.11*256 + 6000*f)\n",
      "V2 = V2by2g*2*32.2\n",
      "V = math.sqrt(V2)\n",
      "Q = 0.545*V\n",
      "V3 = 16*V\n",
      "H = z-f*6000*V2by2g\n",
      "V3 = 16*V\n",
      "\n",
      "#Results\n",
      "print \"rate of discharge  =  %.2f cfs\"%(Q)\n",
      "print \"V3 = %.1f fps\"%V3\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rate of discharge  =  3.51 cfs\n",
        "V3 = 103.0 fps\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7 Page No : 246"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\t\n",
      "#Initialization of variables\n",
      "g = 52.\n",
      "Hp = 2.\n",
      "\t\n",
      "#calculations\n",
      "Q = 3.48 \t#cfs\n",
      "V6 = 3.48/0.196\n",
      "P = -20.9 \t#ft\n",
      "P2 = P*(g/144)\n",
      "\t\n",
      "#Results\n",
      "print \"Flow rate  =  %.2f cfs\"%(Q)\n",
      "print \" Pressure in the pipe  =  %.2f psi\"%(P2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow rate  =  3.48 cfs\n",
        " Pressure in the pipe  =  -7.55 psi\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8 Page No : 250"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Initialization of variables\n",
      "h = 10. \t#m\n",
      "g = 9.81 \t#m/s**2\n",
      "f1 = 0.019\n",
      "f2 = 0.021\n",
      "f3 = 0.020\n",
      "z1 = 300. \t#m\n",
      "z2 = 150. \t#m\n",
      "z3 = 250. \t#m\n",
      "d1 = 0.3 \t#m\n",
      "d2 = 0.2 \t#m\n",
      "d3 = 0.25 \t#m\n",
      "\t\n",
      "#calculations\n",
      "print (\"part(a)\")\n",
      "Vbyg = h/(f1*z1/d1 +f2*z2/d2 *(d1/d2)**4 + f3*z3/d3 *(d1/d3)**4)\n",
      "V1 = math.sqrt(2*g*Vbyg)\n",
      "Q = math.pi/4 *d1**2 *V1\n",
      "print \" Flow rate  =  %.3f m**3/s\"%(Q)\n",
      "print ('Part(b)')\n",
      "Le2 = z2*f2/f1 *(d1/d2)**5\n",
      "Le3 = z3*f3/f1 *(d1/d3)**5\n",
      "Le1 = z1\n",
      "Le = Le1+Le2+Le3\n",
      "V1byg = h*d1/Le/f1\n",
      "V2 = math.sqrt(2*g*V1byg)\n",
      "Q1 = math.pi/4 *d1**2 *V2\n",
      "print \" Flow rate  =  %.3f m**3/s\"%(Q1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "part(a)\n",
        " Flow rate  =  0.084 m**3/s\n",
        "Part(b)\n",
        " Flow rate  =  0.084 m**3/s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.9 Page No : 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "d1 = 6./12 \t#ft\n",
      "d2 = 4./12 \t#ft\n",
      "d3 = 8./12 \t#ft\n",
      "l1 = 2000. \t#ft\n",
      "l2 = 1600. \t#ft\n",
      "l3 = 4000. \t#ft\n",
      "f1 = 0.020\n",
      "f2 = 0.032\n",
      "f3 = 0.024\n",
      "El1 = 200.\n",
      "El2 = 50.\n",
      "El3 = 120.\n",
      "g = 32.2\n",
      "\t\n",
      "#calculations\n",
      "Vc = math.sqrt(2*g*(El1-El2)/288.9)\n",
      "Qc = math.pi/4 *d3**2 *Vc\n",
      "Va = 1.346*Vc\n",
      "Qa = math.pi/4 *d1**2 *Va\n",
      "Vb = (d3**2 *Vc - d1**2 *Va)/d2**2\n",
      "Qb = math.pi/4 *d2**2 *Vb\n",
      "P = 62.4/144 *(El1 - El3 - f1*l1/d1 *Va**2 /(2*g))\n",
      "\t\n",
      "#Results\n",
      "print \"Flowrate at A  =  %.3f cfs\"%(Qa)\n",
      "print \"Flowrate at B  =  %.3f cfs\"%(Qb)\n",
      "print \"Flowrate at C  =  %.3f cfs\"%(Qc)\n",
      "print \"Pressure at P  =  %.2f psi\"%(P)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flowrate at A  =  1.528 cfs\n",
        "Flowrate at B  =  0.490 cfs\n",
        "Flowrate at C  =  2.018 cfs\n",
        "Pressure at P  =  2.06 psi\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}