{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 10 : Fluid flow in ducts"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.1 - Page No :405\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "T = 30.;          \t\t\t #[degC] - temperature\n",
      "d = 8.265*10**-4;  \t\t\t #[m] - diameter of the capillary viscometer\n",
      "deltapbyL = -0.9364;  \t\t #[psi/ft] - pressure drop per unit length\n",
      "\n",
      "# Calculations\n",
      "deltapbyL = deltapbyL*(2.2631*10**4);  \t\t\t #[kg/m**2*sec**2] - pressure drop per unit length\n",
      "Q = 28.36*(10**-6)*(1./60);\n",
      "p = (0.88412-(0.92248*10**-3)*T)*10**3;  \t\t\t #[kg/m**3] - density\n",
      "s = (math.pi*(d**2))/4.;\n",
      "U = Q/s;\n",
      "tauw = (d/4.)*(-deltapbyL);\n",
      "shearrate = (8*U)/d;\n",
      "mu = tauw/(shearrate);\n",
      "\n",
      "# Results\n",
      "print \" The viscosity is  mu = %.3ef kg/m*sec = %.4f cP\"%(mu,mu*10**3);\n",
      "print \" Finally, it is important to check the reynolds number to make sure the above equation applies\"\n",
      "Nre = (d*U*p)/(mu);\n",
      "print \" Nre = %d\"%Nre\n",
      "print \" The flow is well within the laminar region and therefore the above equation applies\";\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The viscosity is  mu = 5.135e-04f kg/m*sec = 0.5135 cP\n",
        " Finally, it is important to check the reynolds number to make sure the above equation applies\n",
        " Nre = 1214\n",
        " The flow is well within the laminar region and therefore the above equation applies\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.2 - Page No :407\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Nreold = 1214.;\n",
      "Uold = 0.8810;\n",
      "Nre = 13700.;\n",
      "U = Uold*(Nre/Nreold);\n",
      "Lbyd = 744.;\n",
      "T = 30.; \n",
      "\n",
      "# Calculations\n",
      "# umsing the newton raphson method to calculate the value of f from the equation - 1/(f**(1/2)) = 4*math.log(Nre*(f**(1/2)))-0.4\n",
      "f = 0.007119;\n",
      "p = (0.88412-(0.92248*10**-3)*T)*10**3;  \t\t\t #[kg/m**3] - density\n",
      "tauw = (1./2)*p*(U**2)*f;\n",
      "deltap = tauw*(4.)*(Lbyd);\n",
      "d = 0.03254/12;  \t\t\t #[ft]\n",
      "L = Lbyd*d;\n",
      "\n",
      "# Results\n",
      "print \" Pressure drop is  -deltap = %.3e N/m**2 = %.1f kpa = 130 psi\"%(deltap,deltap*10**-3);  \n",
      "print \" A pressure drop of 130 psi on a tube of length of %.3f ft is high and \\\n",
      "\\nshows the impracticality of flows at high reynolds number in smaller tubes\"%(L);\n",
      "\n",
      "# Answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure drop is  -deltap = 8.968e+05 N/m**2 = 896.8 kpa = 130 psi\n",
        " A pressure drop of 130 psi on a tube of length of 2.017 ft is high and \n",
        "shows the impracticality of flows at high reynolds number in smaller tubes\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.3 - Page No :414\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "u = 1./60;  \t\t\t #[m/sec] - velocity\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "mu = 1*10.**-3;  \t\t #[kg/m*sec] - vismath.cosity\n",
      "d = 6*10.**-2;  \t\t #[m] - insid_e diameter of tube\n",
      "L = 300.;  \t\t\t     #[m] - length of the tube\n",
      "\n",
      "# Calculations\n",
      "Nre = (d*u*p)/(mu);\n",
      "f = 16./Nre;\n",
      "deltap = (4.*f)*(L/d)*((p*(u**2))/2.);\n",
      "\n",
      "# Results\n",
      "print \"Nre = \",Nre,\"therefore the flow is laminar\"\n",
      "print \"f = \" , f\n",
      "print \"Pressure drop -delta P = %.2f N/m**2  =  %.4f kPa  =  %.3e psi\"%(deltap,deltap*10**-3,deltap*1.453*10**-4);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nre =  1000.0 therefore the flow is laminar\n",
        "f =  0.016\n",
        "Pressure drop -delta P = 44.44 N/m**2  =  0.0444 kPa  =  6.458e-03 psi\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.4 - Page No :415\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "from numpy import *\n",
      "\n",
      "# Variables\n",
      "# given\n",
      "d = 6.*10**-2;  \t\t\t #[m] - insid_e diameter of tube\n",
      "p = 1000.;        \t\t\t #[kg/m**3] - density\n",
      "# for smooth pipe\n",
      "Nre = array([10**4, 10**5]);\n",
      "f = array([0.0076, 0.0045]);\n",
      "mu = 10.**-3;     \t\t\t #[kg/m**2*s]\n",
      "U = (Nre*mu)/(d*p);\n",
      "L = 300.;  \t\t\t #[m] - length of the tube\n",
      "\n",
      "# Calculations\n",
      "deltap = zeros(2)\n",
      "for i in range(2):\n",
      "    deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2.);\n",
      "\n",
      "\n",
      "# Results\n",
      "print \"for smooth pipe\"\n",
      "print \"   Nre      f         -deltap\";\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[0],f[0],deltap[0])\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[1],f[1],deltap[1])\n",
      "\n",
      "# for commercial steel\n",
      "Nre = array([10**4, 10**5]);\n",
      "f = array([0.008 ,0.0053]);\n",
      "U = (Nre*mu)/(d*p);\n",
      "L = 300.;  \t\t\t #[m] - length of the tube\n",
      "for i in range(2):\n",
      "    deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);\n",
      "\n",
      "print \"\\nfor commercial steel pipe\"\n",
      "print \"   Nre      f         -deltap\";\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[0],f[0],deltap[0])\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[1],f[1],deltap[1])\n",
      "\n",
      "# for cast iron pipe\n",
      "Nre = array([10**4 ,10**5]);\n",
      "f = array([0.009 ,0.0073]);\n",
      "U = (Nre*mu)/(d*p);\n",
      "L = 300.;  \t\t\t #[m] - length of the tube\n",
      "for i in range(2):\n",
      "    deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);\n",
      "\n",
      "print \"\\nfor cast iron pipe\"\n",
      "print \"   Nre      f         -deltap\";\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[0],f[0],deltap[0])\n",
      "print \" %6.0f    %6.4f     %6.3f\"%(Nre[1],f[1],deltap[1])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for smooth pipe\n",
        "   Nre      f         -deltap\n",
        "  10000    0.0076     2111.111\n",
        " 100000    0.0045     125000.000\n",
        "\n",
        "for commercial steel pipe\n",
        "   Nre      f         -deltap\n",
        "  10000    0.0080     2222.222\n",
        " 100000    0.0053     147222.222\n",
        "\n",
        "for cast iron pipe\n",
        "   Nre      f         -deltap\n",
        "  10000    0.0090     2500.000\n",
        " 100000    0.0073     202777.778\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.5 - Page No :417\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "L = 300.;  \t\t\t #[m] - length of pipe\n",
      "d = 0.06;  \t\t\t #[m] - insid_e diameter\n",
      "deltap = 147.*10**3;  \t\t #[Pa] - pressure the pump can supply\n",
      "ebyd = 0.000762;  \t\t\t # relative roughness\n",
      "p = 1000.;  \t\t\t     #[kg/m**3] - density\n",
      "mu = 1.*10**-3;  \t\t\t #[kg/m*sec] - viscosity\n",
      "tauw = (d*(deltap))/(4.*L);\n",
      "\n",
      "# using the hit and trial method for estimation of flow velocity\n",
      "# Calculations\n",
      "# let \n",
      "f = 0.005;\n",
      "U = ((2*tauw)/(p*f))**(1./2);\n",
      "Nre = (d*U*p)/mu;\n",
      "\n",
      "# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n",
      "f = 0.0054;\n",
      "U = ((2*tauw)/(p*f))**(1./2);\n",
      "Nre = (d*U*p)/mu;\n",
      "\t\t\t # from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n",
      "f = 0.0053;\n",
      "U = ((2*tauw)/(p*f))**(1./2);\n",
      "Nre = (d*U*p)/mu;\n",
      "\n",
      "# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n",
      "f = 0.0053;\n",
      "# At this point the value of f is deemed unchanged from the last iteration .Hence, the values obtained after the third iteration are the converged values\n",
      "\n",
      "# Results\n",
      "print \" The maximum flow velocity is  U = %f m/sec\"%(U);\n",
      "\n",
      "# Answer may vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The maximum flow velocity is  U = 1.665408 m/sec\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.6 - Page No :419\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "L = 300.;  \t\t\t #[m] - length of pipe\n",
      "d = 0.06;  \t\t\t #[m] - insid_e diameter\n",
      "deltap = 147.*10**3;  \t #[Pa] - pressure the pump can supply\n",
      "ebyd = 0.000762;  \t\t # relative roughness\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "\n",
      "# Calculations\n",
      "mu = 1*10**-3;  \t\t\t #[kg/m*sec] - viscosity\n",
      "Nvk = ((d*p)/mu)*((d*(deltap))/(2*L*p))**(1./2);\n",
      "\n",
      "# From the fig  at given von karman no and relative roughness the value of f is-\n",
      "f = 0.0055;\n",
      "Nre = Nvk/(f**(1./2))\n",
      "U = (Nre*mu)/(d*p);\n",
      "\n",
      "# Results\n",
      "print \"von karman no. %.0f\"%Nvk\n",
      "print \" Average velocity = %.2f m/sec\"%(U);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "von karman no. 7275\n",
        " Average velocity = 1.63 m/sec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.7 - Page No :422\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "L = 300.;  \t\t\t #[m] - length of pipe\n",
      "d = 0.06;  \t\t\t #[m] - insid_e diameter\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "mu = 1.*10**-3;  \t\t\t #[kg/m*sec] - viscosity\n",
      "\n",
      "# Calculations\n",
      "Nre = array([10.**4, 10.**5]);\n",
      "U = (Nre*mu)/(d*p);\n",
      "velocityhead = (U**2)/2.;\n",
      "N = (L/d)/45.;  \t\t\t # no of velocity heads\n",
      "deltap = p*N*(velocityhead);\n",
      "\n",
      "# Results\n",
      "for i in range(2):\n",
      "    print \"Nre = \",Nre[i]\n",
      "    print \" velocity head  = %.5f m**2/sec**2\"%(velocityhead[i]);\n",
      "    print \" -deltap  =  %.3f kPa  =  %.3f psi\"%(deltap[i]*10**-3,deltap[i]*1.453*10**-4);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nre =  10000.0\n",
        " velocity head  = 0.01389 m**2/sec**2\n",
        " -deltap  =  1.543 kPa  =  0.224 psi\n",
        "Nre =  100000.0\n",
        " velocity head  = 1.38889 m**2/sec**2\n",
        " -deltap  =  154.321 kPa  =  22.423 psi\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.8 - Page No :439\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "mu = 6.72*10**-4;  \t\t #[lb/ft*sec] - viscosity\n",
      "p = 62.4;  \t\t\t     #[lb/ft**3] - density\n",
      "S = 0.03322;  \t\t\t #[ft**2] - flow area\n",
      "d = 0.206;  \t\t\t #[ft]\n",
      "e = 1.5*10**-4;  \t\t # absolute roughness for steel pipe\n",
      "ebyd = e/d;\n",
      "Nre = 10.**5;\n",
      "\n",
      "# friction factor as read from fig in book for the given reynolds no. and relative roughness is-\n",
      "f = 0.0053;\n",
      "U = (Nre*mu)/(p*d);\n",
      "Q = U*S;\n",
      "gc = 32.174;\n",
      "\n",
      "# Calculations\n",
      "# (a) equivalent length method\n",
      "deltapbyL = f*(4/d)*(p*(U**2))*(1/(2*gc))*(6.93*10**-3);\n",
      "\n",
      "# using L = Lpipe+Lfittings+Lloss;\n",
      "Lfittings = 2342.1*d;\n",
      "kc = 0.50;  \t\t\t #  due to contraction loss\n",
      "ke = 1.;  \t\t\t # due to enlargement loss\n",
      "Lloss = (kc+ke)*(1./(4*f))*d;\n",
      "Lpipe = 137.;\n",
      "L = Lpipe+Lfittings+Lloss;\n",
      "deltap = deltapbyL*L;\n",
      "patm = 14.696;  \t\t\t #[psi] - atmospheric pressure\n",
      "p1 = patm+deltap;\n",
      "print \" a)The inlet pressure is p1 = %.1f psi\"%(p1);\n",
      "\n",
      "# (b) loss coefficient method\n",
      "# using the equation deltap/p = -(Fpipe+Ffittings+Floss)\n",
      "L = 137.;\n",
      "kfittings = 52.39;\n",
      "sigmaF = ((4.*f*(L/d))+kc+ke+kfittings)*((U**2)/(2*gc));\n",
      "deltap = (p*sigmaF)/(144.);\n",
      "p1 = patm+deltap;\n",
      "\n",
      "# Results\n",
      "print \" b)The inlet pressure is  p1 = %.1f psi\"%(p1);\n",
      "print \" Computation of the pressure drop by the loss coefficient method differs from the equivalent length \\\n",
      " \\nmethod by less than 1 psi\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " a)The inlet pressure is p1 = 26.7 psi\n",
        " b)The inlet pressure is  p1 = 27.2 psi\n",
        " Computation of the pressure drop by the loss coefficient method differs from the equivalent length  \n",
        "method by less than 1 psi\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.9 - Page No :443\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "L1 = 50.;  \t\t\t #[m] - length of first pipe\n",
      "L2 = 150.;  \t\t\t #[m] - length of second pipe\n",
      "L3 = 100.;  \t\t\t #[m] - length of third pipe\n",
      "d1 = 0.04;  \t\t\t #[m] - diameter of first pipe\n",
      "d2 = 0.06;  \t\t\t #[m] - diameter of second pipe\n",
      "d3 = 0.08;  \t\t\t #[m] - diameter of third pipe\n",
      "deltap = -1.47*10**5;  \t\t\t #[kg/m*sec] - pressure drop\n",
      "mu = 1*10.**-3;  \t\t\t #[kg/m*sec] - viscosity\n",
      "p = 1000.;  \t\t\t #[kg/m**3] - density\n",
      "\n",
      "# Calculation and Results\n",
      "# for branch 1\n",
      "S = (math.pi*(d1**2))/4;\n",
      "Nvk = ((d1*p)/mu)*(-(d1*deltap)/(2*L1*p))**(1./2);\n",
      "f = (1./(4*math.log10(Nvk)-0.4))**2;\n",
      "U = (((-deltap)/p)*(d1/L1)*(2./4)*(1./f))**(1./2);\n",
      "w1 = p*U*S;\n",
      "print \" For first branch w1 = %.2f kg/sec\"%(w1);\n",
      "\t\t\t # for branch 2\n",
      "S = (math.pi*(d2**2))/4;\n",
      "Nvk = ((d2*p)/mu)*(-(d2*deltap)/(2*L2*p))**(1./2);\n",
      "f = (1./(4*math.log10(Nvk)-0.4))**2;\n",
      "U = (((-deltap)/p)*(d2/L2)*(2./4)*(1./f))**(1./2);\n",
      "w2 = p*U*S;\n",
      "print \" For second branch w2 = %.2f kg/sec\"%(w2);\n",
      "\t\t\t # for branch 3\n",
      "S = (math.pi*(d3**2))/4;\n",
      "Nvk = ((d3*p)/mu)*(-(d3*deltap)/(2*L3*p))**(1./2);\n",
      "f = (1./(4*math.log10(Nvk)-0.4))**2;\n",
      "U = (((-deltap)/p)*(d3/L3)*(2./4)*(1./f))**(1./2);\n",
      "w3 = p*U*S;\n",
      "print \" For third branch w3 = %.2f kg/sec\"%(w3);\n",
      "\n",
      "# total flow rate w = w1+w2+w3\n",
      "w = w1+w2+w3;\n",
      "print \" total flow rate is w = %.1f kg/sec\"%(w);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " For first branch w1 = 4.74 kg/sec\n",
        " For second branch w2 = 7.59 kg/sec\n",
        " For third branch w3 = 20.42 kg/sec\n",
        " total flow rate is w = 32.7 kg/sec\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.11 - Page No : 447\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "sp = 1.1;\n",
      "p = sp*62.4;  \t\t\t #[lb/ft**3] - density\n",
      "mu = 2*6.72*10**-4;  \t #[lb/ft*sec] - viscosity\n",
      "Q = 400.;  \t\t\t     #[gpm] - volumetric flow rate\n",
      "e = 1.5*10**4;  \t\t #roughness of steel pipe\n",
      "gc = 32.174;\n",
      "kexit = 1.;\n",
      "kentrance = 0.5;\n",
      "\n",
      "# Calculations\n",
      "# 4 in schedule pipe\n",
      "d = 4.026/12;  \t\t\t #[ft]\n",
      "U4 = Q/39.6;  \t\t\t #[ft/sec]\n",
      "Lgv = 13.08;\n",
      "Lglv = 114.1;\n",
      "Le = 40.26;\n",
      "Lpipe_4 = 22.;\n",
      "Lfittings_4 = Lgv+Lglv+Le;\n",
      "Lloss = 0;\n",
      "L_4 = Lpipe_4+Lfittings_4+Lloss;\n",
      "Nre_4 = (d*U4*p)/mu;\n",
      "f = 0.00475;\n",
      "Fpipe_4 = ((4*f*L_4)/d)*(U4**2)*(1/(2*gc));\n",
      "Floss_4 = ((kentrance+0)*(U4**2))/(2*gc);\n",
      "\n",
      "# 5 in schedule pipe\n",
      "d = 5.047/12;\n",
      "U5 = Q/62.3;\n",
      "Lgv = 10.94;\n",
      "Le = 75.71;\n",
      "Lpipe_5 = 100.;\n",
      "Lfittings_5 = Lgv+Le;\n",
      "Lloss = 0.;\n",
      "L_5 = Lpipe_5+Lfittings_5+Lloss;\n",
      "Nre = (d*U5*p)/mu;\n",
      "f = 0.00470;\n",
      "Fpipe_5 = ((4*f*L_5)/d)*(U5**2)*(1./(2*gc));\n",
      "Floss_5 = ((kexit+0)*(U5**2))/(2*gc);\n",
      "\n",
      "# 6 in schedule pipe\n",
      "d = 6.065/12;\n",
      "U6 = Q/90.;\n",
      "Lgv = 6.570;\n",
      "Le = 30.36;\n",
      "Lpipe_6 = 4.;\n",
      "Lfittings_6 = Lgv+Le;\n",
      "Lloss = 0.;\n",
      "L_6 = Lpipe_6+Lfittings_6+Lloss;\n",
      "Nre = (d*U6*p)/mu;\n",
      "f = 0.00487;\n",
      "Fpipe_6 = ((4*f*L_6)/d)*(U6**2)*(1./(2*gc));\n",
      "kc = 0.50;\n",
      "Floss_6 = kc*((U6**2)/(2*gc));\n",
      "Ffittings = 0.;\n",
      "deltap_6 = p*(Fpipe_6+Ffittings+Floss_6);\n",
      "\n",
      "# 3/4 in 18 gauge tube\n",
      "d = 0.652112/12;\n",
      "L_3by4 = 15.;\n",
      "U_3by4 = (Q*0.962)/100.;\n",
      "Floss_3by4 = 100.*(kexit+kentrance)*((U_3by4**2.)/2.);\n",
      "Nre = d*U_3by4*p*(1./mu);\n",
      "f = 0.08*((Nre)**(-1./4))+0.012*((d)**(1./2));\n",
      "deltap_3by4 = ((4*f*p*L_3by4)/d)*((U_3by4**2)/(2*gc));\n",
      "Fpipe_3by4 = 100.*((4.*f*L_3by4)/d)*((U_3by4**2.)/(2.*gc));\n",
      "deltap_spraysystem = 25.; \t\t\t #[psi]\n",
      "Fspraysystem = (deltap_spraysystem/p)*(144.);\n",
      "delta_p = (p*(kexit+kentrance))*((U_3by4**2.)/(2.*gc))\n",
      "Fpipe = Fpipe_4+Fpipe_5+Fpipe_6;\n",
      "Floss = Floss_4+Floss_5+Floss_6+Floss_3by4;\n",
      "ws = 0. + (((15.**2)-0)/(2*gc))+38.9+382.5;\n",
      "w = (Q*p)/(7.48);\n",
      "Ws = (ws*w)/(33000.);\n",
      "efficiency = 0.6;\n",
      "Ws_actual = Ws/efficiency\n",
      "\n",
      "# Results\n",
      "print \" The power supplied to the pump is  %.1f hp\"%(Ws_actual);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The power supplied to the pump is  78.8 hp\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.12 - Page No :454\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "kexit = 1.;\n",
      "kentrance = 0.5;\n",
      "Q = 400.;  \t\t\t #[gpm] - volumetric flow rate\n",
      "gc = 32.174;\n",
      "\n",
      "# for 4 inch pipe\n",
      "d = 4.026;  \t\t #[inch]\n",
      "L = 22.;  \t\t\t #[ft]\n",
      "Lbyd = (L*12)/(d);\n",
      "\n",
      "# Calculation and Results\n",
      "# adding the contributions due to fittings \n",
      "Lbyd = Lbyd+3*13+340+4*30;\n",
      "N = Lbyd/45.;\n",
      "N = N+kentrance+0;\n",
      "U4 = Q/39.6;  \t\t\t #[ft/sec]\n",
      "Fpipe_4 = (N*(U4**2))/(2*gc);\n",
      "print \" F4 in.pipes  =  %.2f ft*lbf/lbm\"%(Fpipe_4);\n",
      "\n",
      "# for 5 inch pipe\n",
      "L = 100.;  \t\t\t     #[ft]\n",
      "d = 5.047;  \t\t\t #[inch]\n",
      "Lbyd = (L*12.)/(d);\n",
      "\n",
      "# valves contributes 26 diameters and six elbows contribute 30 diameters ecah;therefore\n",
      "Lbyd = Lbyd+26+6*30;\n",
      "N = Lbyd/45.;  \t\t\t # no. of velocity heads\n",
      "N = N+kexit+kentrance;\n",
      "U5 = Q/62.3;\n",
      "Fpipe_5 = (N*(U5**2))/(2*gc);\n",
      "print \" F5 in.pipes  =  %.2f ft*lbf/lbm\"%(Fpipe_5);\n",
      "\n",
      "# for 6 inch pipe\n",
      "d = 6.065;  \t\t #[inch]\n",
      "L = 5.;  \t\t\t #[ft]\n",
      "Lbyd = (L*12.)/(d);\n",
      "\n",
      "# adding the contributions due to fittings \n",
      "Lbyd = Lbyd+1*13+2*30;\n",
      "N = Lbyd/45;\n",
      "N = N+0+kentrance;\n",
      "U6 = Q/90.;\n",
      "Fpipe_6 = (N*(U6**2))/(2*gc);\n",
      "print \" F6 in.pipes  =  %.3f ft*lbf/lbm\"%(Fpipe_6);\n",
      "F_largepipes = Fpipe_4+Fpipe_5+Fpipe_6;\n",
      "print \" Flarge pipes  =  %.2f ft*lbf/lbm\"%(F_largepipes);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " F4 in.pipes  =  20.69 ft*lbf/lbm\n",
        " F5 in.pipes  =  7.28 ft*lbf/lbm\n",
        " F6 in.pipes  =  0.719 ft*lbf/lbm\n",
        " Flarge pipes  =  28.68 ft*lbf/lbm\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.14 - Page No :459\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "l = 0.09238;\n",
      "rh = 0.1624*l;\n",
      "L = 300.;\n",
      "de = 4.*rh;\n",
      "p = 1000.;  \t\t\t #[kg/m**3]\n",
      "mu = 10.**-3;  \t\t\t #[kg/m*sec]\n",
      "Uavg = 1.667;\n",
      "\n",
      "# Calculations\n",
      "Nre = (de*Uavg*p)/mu;\n",
      "f = 0.0053;\n",
      "deltap = ((4.*f*L)/de)*(p*(Uavg**2)*(1./2));\n",
      "\n",
      "# Results\n",
      "print \" Pressure drop -deltap  =  %.3e kg/m*s  =  %.3e N/m**2  =  %.1f kPa\"%(deltap,deltap,deltap*10**-3);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure drop -deltap  =  1.473e+05 kg/m*s  =  1.473e+05 N/m**2  =  147.3 kPa\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.15 - Page No :466\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "Q = 400.;         \t\t\t #[gpm]\n",
      "p = 1.1*62.4;  \t    \t\t #[lbm/ft**3]\n",
      "mu = 2.*(6.72*10**-4);  \t #[lb/ft*sec]\n",
      "e = 1.5*10**4;\n",
      "\n",
      "# Calculations\n",
      "# 4 inch schedule pipe\n",
      "d = 0.3355;\n",
      "S = (math.pi*(d**2))/4;\n",
      "U4 = Q/39.6;\n",
      "ebyd = e/d;\n",
      "w = 3671./60;\n",
      "pm = 13.45*62.4;\n",
      "g = 32.1;\n",
      "gc = 32.174;\n",
      "deltaz = 2.5;\n",
      "deltap = (g/gc)*(pm-p)*(deltaz);\n",
      "betaa = ((1.)/(1.+((2*p*gc)*(deltap))*(((0.61*S)/w)**2)))**(1./4);\n",
      "d2 = betaa*d;\n",
      "Nre2 = (4*w)/(math.pi*d2*mu);\n",
      "a = (1./30)*4.026;\n",
      "b = (1./4)*(2.013-1.21);\n",
      "c = (1./8)*(2.42);\n",
      "if a<b :\n",
      "    if a<c :\n",
      "        opt = a;\n",
      "    else:\n",
      "        opt = c;\n",
      "else:\n",
      "    if b<c:\n",
      "        opt = b;\n",
      "    else:\n",
      "        opt = c;\n",
      "\n",
      "# Results\n",
      "print \" The pertinent orifice details are  orifice diameter  =  %.3f in  corner taps, \\\n",
      " \\n square edge orifice plate not over %.3f in thick\"%(d2*12,opt);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The pertinent orifice details are  orifice diameter  =  2.425 in  corner taps,  \n",
        " square edge orifice plate not over 0.134 in thick\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.16 - Page No :470\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Q = 400.;     \t    \t\t        #[gpm]\n",
      "p = 1.1*62.4;     \t\t\t        #[lbm/ft**3]\n",
      "mu = 2*(6.72*10**-4);  \t\t\t    #[lb/ft*sec]\n",
      "e = 1.5*10**4;\n",
      "\n",
      "# Calculations\n",
      "# 4 inch schedule pipe\n",
      "d = 0.3355;\n",
      "S = (math.pi*(d**2))/4;\n",
      "U4 = Q/39.6;\n",
      "ebyd = e/d;\n",
      "w = 3671./60;\n",
      "pm = 13.45*62.4;\n",
      "g = 32.1;\n",
      "gc = 32.174;\n",
      "Nre = (d*U4*p)/mu;\n",
      "if Nre>10**4:\n",
      "    c = 0.98;\n",
      "\n",
      "deltaz = 2.5;\n",
      "deltap = (g/gc)*(pm-p)*(deltaz);\n",
      "betaa = ((1.)/(1+((2*p*gc)*(deltap))*(((c*S)/w)**2)))**(1./4);\n",
      "d2 = betaa*d;\n",
      "\n",
      "# Results\n",
      "print \" The pertinentr details of the venturi design are Throat diameter  =  %.2f inch \\\n",
      "\\n Approach angle   =  25 Divergence angle  =  7\"%(d2*12);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The pertinentr details of the venturi design are Throat diameter  =  1.95 inch \n",
        " Approach angle   =  25 Divergence angle  =  7\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 10.17 - Page No :477\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Uzmax = 3.455;  \t\t\t #[ft/sec]\n",
      "m = 32;\n",
      "a1 = -0.3527;\n",
      "a2 = -0.6473;\n",
      "rbyro = 0.880;\n",
      "\n",
      "# Calculations\n",
      "UzbyUzmax = 1+a1*(rbyro**2)+a2*(rbyro**(2*m));\n",
      "Uz = Uzmax*(UzbyUzmax);\n",
      "Uzavg = (4./9)*Uzmax+(5./18)*(Uz+Uz);\n",
      "\n",
      "# Results\n",
      "print \" the average velocity is  Uzavg  =  %.2f ft/sec  \\\n",
      "\\n Thus, in this Example  there is an  inherent error of 5.5 percent, even before any experimental errors are introduced\"%(Uzavg);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the average velocity is  Uzavg  =  2.93 ft/sec  \n",
        " Thus, in this Example  there is an  inherent error of 5.5 percent, even before any experimental errors are introduced\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}