{
 "metadata": {
  "name": "",
  "signature": "sha256:0059190c3ee26fe93a1d293531a49cd3a6e92d5339c0638feafb8d9d1d250c2e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 : Pipe Flow of Liquids"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "\n",
      "example 1.1 page no : 1"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "mu = 6.3/100; #viscosity\n",
      "rho = 1170.;  #density\n",
      "d = .3;       #diameter of pipe\n",
      "b = 0.142;    #conversion factor\n",
      "pi=3.14;\n",
      "\n",
      "#calculation\n",
      "Q = 150000.*b/24./3600    #flow rate\n",
      "u = Q/pi/d**2.*4           #flow speed\n",
      "Re = rho*u*d/mu\n",
      "if Re>4000:\n",
      "    print \"the system is in turbulent motion as reynolds no is greater than 4000: %.3f\"%Re\n",
      "elif Re<2100 :\n",
      "    print \"the system is in laminar motion\" ,Re\n",
      "else:\n",
      "    print \"the system is in transition motion\",Re\n",
      "\n",
      "mu = 5.29/1000;\n",
      "d = 0.06;\n",
      "G = 0.32;     #mass flow rate\n",
      "Re = 4*G/pi/d/mu;\n",
      "\n",
      "if Re>4000 :\n",
      "    print \"the system is in turbulent motion as reynolds no is greater than 4000: \",Re\n",
      "elif Re<2100 :\n",
      "    print \"the system is in laminar motion as Re is less than 2100 : %.3f\" %Re\n",
      "else:\n",
      "    print  \"the system is in transition motion\",Re\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the system is in turbulent motion as reynolds no is greater than 4000: 19441.074\n",
        "the system is in laminar motion as Re is less than 2100 : 1284.320\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "\n",
      "example 1.2  page no : 2"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "\n",
      "# Initialization of Variable\n",
      "G=21.2;     #mass flow rate\n",
      "rho=1120;   #density\n",
      "d=0.075;    #diameter\n",
      "l=50.;\n",
      "g=9.81;\n",
      "pi=3.14;\n",
      "delz=24./100;       #head difference\n",
      "\n",
      "#calculation\n",
      "delP=delz*rho*g;    #differece of pressure\n",
      "u=4*G/pi/d**2/rho;\n",
      "phi=delP/rho*d/l/u**2./4*50;\n",
      "print \"The Stanton-Pannel friction factor per unit of length: %f\"%phi\n",
      "R=phi*rho*u**2;\n",
      "print  \"shear stress exerted by liquid on the pipe wall in (N/m**2) : %.3f\"% R\n",
      "F=pi*d*l*R;\n",
      "print \"Total shear force exerted on the pipe in (N): %.3f\"%F\n",
      "Re=(.0396/phi)**4;#reynold's no.\n",
      "mu=rho*u*d/Re;\n",
      "print \"viscosity of liquid in (kg/m/s):%f\" %mu\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Stanton-Pannel friction factor per unit of length: 0.002402\n",
        "shear stress exerted by liquid on the pipe wall in (N/m**2) : 49.442\n",
        "Total shear force exerted on the pipe in (N): 582.184\n",
        "viscosity of liquid in (kg/m/s):0.004877\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 1.3 page no : 4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "pi=3.14;\n",
      "g=9.81;\n",
      "d=0.00125;\n",
      "Re=2100;\n",
      "l=0.035;\n",
      "rhoc=779.       #density of cyclohexane\n",
      "rhow=999.       #density of water\n",
      "muc=1.02/1000;  #viscosity of cyclo hexane\n",
      "\n",
      "#calculation\n",
      "u=Re*muc/rhoc/d;    #speed\n",
      "Q=pi*d**2*u/4;      #volumetric flow rate\n",
      "delP=32*muc*u*l/d**2;#pressure difference\n",
      "delz=delP/(rhow-rhoc)/g;\n",
      "print  \"the difference between the rise levels of manometer in (cm): %.4f\"%(delz*100 )\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the difference between the rise levels of manometer in (cm): 74.5210\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "\n",
      "example 1.4 page no : 6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "d=0.05;\n",
      "l=12.;\n",
      "per=100.-2;\n",
      "pi=3.1428\n",
      "\n",
      "#calculation\n",
      "s=math.sqrt(per/100/4*d**2);#radius of core of pure material\n",
      "V=pi*d**2./4.*l/(2.*(1-(2.*s)**2/d**2));\n",
      "print  \"The volume of pure material so that 2%% technical material appears at the end in (m**3): %.3f\"%V\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume of pure material so that 2% technical material appears at the end in (m**3): 0.589\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 1.5 page no : 7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "\n",
      "# Initialization of Variable\n",
      "\n",
      "a=1./2*(1-1/math.sqrt(2.));\n",
      "print  \"The percent value of d for which where pitot tube is kept show average velocity \\\n",
      "in streamline flow in (%%) : %.4f\"%(a*100)\n",
      "\n",
      "a=(49./60)**7/2.\n",
      "print  \"The percent value of d for which where pitot tube is kept show average velocity in \\\n",
      "turbulent flow in (%%) : %.4f\"%(a*100)\n",
      "\n",
      "#on equating coefficient of r\n",
      "y=a*2;      #y=a/100*2*r\n",
      "s=1-y;      #s=r-y\n",
      "\n",
      "#on equating coeff. of 1/4/mu*del(P)/del(l)\n",
      "E=(1-s**2-.5)/.5;\n",
      "print \"The error shown by pitot tube at new position if value of streamlined flow flow was\\\n",
      "to be obtained in (%%) : %.4f\"%E\n",
      "print \"The - sign indicates that it will print lay reduced velocity than what actually is\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percent value of d for which where pitot tube is kept show average velocity in streamline flow in (%) : 14.6447\n",
        "The percent value of d for which where pitot tube is kept show average velocity in turbulent flow in (%) : 12.1139\n",
        "The error shown by pitot tube at new position if value of streamlined flow flow wasto be obtained in (%) : -0.1483\n",
        "The - sign indicates that it will print lay reduced velocity than what actually is\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "\n",
      "example 1.6 page no : 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Initialization of Variable\n",
      "rhon = 1068.                #density of nitric acid\n",
      "mun = 1.06/1000.            #viscosity of nitric acid\n",
      "g = 9.81\n",
      "l = 278.\n",
      "d = 0.032\n",
      "alpha = 1.\n",
      "h2 = 57.4                   #height to be raised\n",
      "h1 = 5.                     #height from which to be raised\n",
      "e = .0035/1000.             #roughness\n",
      "G = 2.35                    #mass flow rate\n",
      "pi = 3.14\n",
      "#calculations\n",
      "#part 1\n",
      "u = 4.*G/rhon/pi/d**2\n",
      "Re = rhon*d*u/mun\n",
      "rr = e/d                    #relative roughness\n",
      "\n",
      "#Reading's from Moody's Chart\n",
      "phi = .00225                #friction coeff.\n",
      "W = u**2/2.+g*(h2-h1)+4*phi*l*u**2/d       #The work done/kg of fluid flow in J/kg\n",
      "V = abs(W)*G\n",
      "print   \"The Power required to pump acid in kW  : %.4f\"%(abs(V)/1000)\n",
      "\n",
      "#part 2\n",
      "P2 = -u**2*rhon/2.+g*(h1)*rhon+abs(W+2)*rhon\n",
      "print \"The gauge pressure at pump outlet when piping is new in (kPa) : %.4f\"%(P2/1000)\n",
      "\n",
      "#part 3\n",
      "e = .05/1000\n",
      "Re = rhon*d*u/mun\n",
      "rr = e/d\n",
      "\n",
      "#Reading's from Moody's Chart\n",
      "phi = 0.0029\n",
      "W = u**2/2+g*(h2-h1)+4*phi*l*u**2/d\n",
      "Vnew = abs(W)*G\n",
      "Pi = (Vnew-V)/V*100.\n",
      "print \"The increase in power required to transfer in old pipe in (%%): %.4f\"%Pi\n",
      "\n",
      "#part 4\n",
      "P2 = -u**2*rhon/2+g*(h1)*rhon+abs(W+2)*rhon\n",
      "print \"The gauge pressure at pump outlet when piping is old in (kPa) :%.4f\"%(P2/1000)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Power required to pump acid in kW  : 2.5936\n",
        "The gauge pressure at pump outlet when piping is new in (kPa) : 1229.2152\n",
        "The increase in power required to transfer in old pipe in (%): 15.3353\n",
        "The gauge pressure at pump outlet when piping is old in (kPa) :1409.9715\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 1.7 page no : 12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "rho=990.;\n",
      "mu=5.88/10000;\n",
      "g=9.81;\n",
      "pi=3.14;\n",
      "temp=46.+273\n",
      "e=1.8/10000         #absolute roughness\n",
      "Q=4800./1000./3600;\n",
      "l=155.;\n",
      "h=10.5;\n",
      "d=0.038;\n",
      "delh=1.54           #head loss at heat exchanger\n",
      "effi=0.6            #efficiency\n",
      "\n",
      "#calculations\n",
      "\n",
      "u=Q*4./pi/d**2;\n",
      "Re=rho*d*u/mu;\n",
      "rr=e/d              #relative roughness\n",
      "\n",
      "#from moody's diagram\n",
      "phi=0.0038          #friction factor\n",
      "alpha=1.             #constant\n",
      "leff=l+h+200*d+90*d;\n",
      "Phe=g*delh          #pressure head lost at heat exchanger\n",
      "W=u**2/2/alpha+Phe+g*h+4*phi*leff*u**2/d;       #work done by pump\n",
      "G=Q*rho;            #mass flow rate\n",
      "P=W*G;              #power required by pump\n",
      "Pd=P/effi           #power required to drive pump\n",
      "print \"power required to drive pump in (kW) : %.4f\"%(Pd/1000)\n",
      "\n",
      "P2=(-u**2/2/alpha+W)*rho;\n",
      "print \"The gauge pressure in (kPa): %.4f\"%(P2/1000)\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power required to drive pump in (kW) : 0.4763\n",
        "The gauge pressure in (kPa): 213.6461\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 1.8 page no : 15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "rho=908.;\n",
      "mu=3.9/100;\n",
      "g=9.81;\n",
      "pi=3.14;\n",
      "d=0.105;\n",
      "l=87.;\n",
      "h=16.8;\n",
      "e=0.046/1000;           #absolute roughness\n",
      "\n",
      "#calculations\n",
      "\n",
      "#part1\n",
      "P=-rho*g*h;             #change in pressure\n",
      "a=-P*rho*d**3/4/l/mu**2         #a=phi*Re**2\n",
      "\n",
      "#using graph given in book(appendix)\n",
      "Re=8000.\n",
      "u=mu*Re/rho/d\n",
      "Q=u*pi*d**2/4.\n",
      "print \"Volumetric flow rate initial (m**3/s): %.4f\"%Q\n",
      "\n",
      "#part 2\n",
      "W=320.;\n",
      "Pd=W*rho;               #pressure drop by pump\n",
      "P=P-Pd;\n",
      "a=-P*rho*d**3./4./l/mu**2           #a=phi*Re**2\n",
      "\n",
      "#using graph given in book(appendix)\n",
      "Re=15000.;\n",
      "u=mu*Re/rho/d;\n",
      "Q=u*pi*d**2./4;\n",
      "print \"Volumetric flow rate final(part 2) (m**3/s) : %.4f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric flow rate initial (m**3/s): 0.0283\n",
        "Volumetric flow rate final(part 2) (m**3/s) : 0.0531\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 1.9 pageno : 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "from numpy import linspace\n",
      "# Initialization of Variable\n",
      "rho=1000.;\n",
      "mu=1.25/1000;\n",
      "g=9.81;\n",
      "pi=3.14\n",
      "d = 0.105\n",
      "d1=0.28;            #diameter of tank\n",
      "d2=0.0042;          #diameter of pipe\n",
      "l=0.52;             #length of pipe\n",
      "rr=1.2/1000./d;      #relative roughness\n",
      "phid=0.00475;\n",
      "print \"It is derived from tyhe graph giben in appedix and can be seen \\\n",
      "is arying b/w 0.0047 & 0.0048 dependent on D which varies from 0.25 to 0.45 : %f\"%phid\n",
      "\n",
      "#calculations\n",
      "def intregrate():\n",
      "    s=0\n",
      "    for i in range(0,1000):\n",
      "        D=linspace(0.25,0.45,1000);\n",
      "        y=math.sqrt(((pi*d1**2./pi/d2**2)**2-1)/2/9.81+(4*phid*l*(pi*d1**2/pi \\\n",
      "        /d2**2)**2)/d2/9.81)*((0.52+D[i])**-0.5)*2/10000;\n",
      "        s=s+y;\n",
      "    a=s;\n",
      "    return a\n",
      "\n",
      "b=intregrate();\n",
      "print \"Time required to water level to fall in the tank in (s): %.4f\"%b\n",
      "\n",
      "    \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "It is derived from tyhe graph giben in appedix and can be seen is arying b/w 0.0047 & 0.0048 dependent on D which varies from 0.25 to 0.45 : 0.004750\n",
        "Time required to water level to fall in the tank in (s): 514.7299\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 1.10 pageno : 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "rho=1000.;\n",
      "mu=1.42/1000;\n",
      "g=9.81;\n",
      "pi=3.14;\n",
      "l=485.;\n",
      "h=4.5\n",
      "e=8.2/100000;\n",
      "Q=1500.*4.545/1000/3600;\n",
      "\n",
      "print \"assume d as 6cm\"\n",
      "d=0.06;\n",
      "u=4*Q/pi/d**2;\n",
      "Re=rho*d*u/mu;\n",
      "rr=e/d;             #relative roughness\n",
      "\n",
      "#using moody's chart\n",
      "phi=0.0033          #friction coeff.\n",
      "d=(64*phi*l*Q**2/pi**2/g/h)**0.2;\n",
      "print  \"The calculated d after (1st iteration which is close to what we\\\n",
      " assume so we do not do any more iteration) in(cm) %d \"%(d*100)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "assume d as 6cm\n",
        "The calculated d after (1st iteration which is close to what we assume so we do not do any more iteration) in(cm) 6 \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}