{
 "metadata": {
  "name": "",
  "signature": "sha256:6e08f75972be45750168908e0258e415f396bd3e7aae6981e62e0a4fd06177dc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9 - Fluid flow about immersed bodies"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1a - Pg 389"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the values of Fd\n",
      "#Initialization of variables\n",
      "import math\n",
      "import numpy\n",
      "rho=2.45 #slugs/ft^3\n",
      "mu=9.2e-3 #lb-sec/ft^2\n",
      "x=3.\n",
      "v=3. #ft/s\n",
      "B=6./12. #ft\n",
      "L=36./12. #ft\n",
      "#calculatons\n",
      "Nr=v*x*rho/mu\n",
      "y=([1.32, 1.46, 1.328])\n",
      "Cd = numpy.zeros(len(y))\n",
      "for i in range (0, len(y)):\n",
      "\tCd[i]=y[i]*math.pow(Nr,(-0.5))\n",
      "Fd = numpy.zeros(len(Cd))\n",
      "for i in range (0, len(y)):\n",
      "\tFd[i]=2*Cd[i]*B*L*(0.5*rho*v*v)\n",
      "\n",
      "#results\n",
      "print '%s' %(\"Drag on the plates using different formulae blasius, parabola and pohlhauser in order\")\n",
      "print '%.3f %.3f %.3f' %(Fd[0],Fd[1],Fd[2])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Drag on the plates using different formulae blasius, parabola and pohlhauser in order\n",
        "0.892 0.986 0.897\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1b - Pg 390"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calcualte the boundary layer thickness and the shearing thickness\n",
      "#Initialization of variables\n",
      "import math\n",
      "import numpy\n",
      "x=36./12.\n",
      "rho=2.45 #slugs/ft^3\n",
      "mu=9.2e-3 #lb-sec/ft^2\n",
      "v=3. #ft/s\n",
      "#calculatons\n",
      "Nr=v*x*rho/mu\n",
      "z=([4.91, 5.48, 4.65])\n",
      "x=36./12.\n",
      "delta = numpy.zeros(len(z))\n",
      "for i in range (0, len(z)):\n",
      "\tdelta[i]=z[i] /math.sqrt(Nr) *x\n",
      "\n",
      "\n",
      "f=([0.332, 0.365, 0.322])\n",
      "T=numpy.zeros(len(f))\n",
      "for i in range (0,len(f)):\n",
      "\tT[i]=f[i]*mu*v/x *math.sqrt(Nr)\n",
      "\n",
      "#results\n",
      "print '%s' %(\"Boundary layer thickness = \")\n",
      "print '%s' %(\"In order of Blasius, parabola and pohlhauser\")\n",
      "print '%.3f %.3f %.3f' %(delta[0],delta[1],delta[2])\n",
      "print '%s' %(\"Shearing stress = \")\n",
      "print '%s' %(\"In order of Blasius, parabola and pohlhauser\")\n",
      "print '%.3f %.3f %.3f' %(T[0],T[1],T[2])\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Boundary layer thickness = \n",
        "In order of Blasius, parabola and pohlhauser\n",
        "0.301 0.336 0.285\n",
        "Shearing stress = \n",
        "In order of Blasius, parabola and pohlhauser\n",
        "0.150 0.164 0.145\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2a - Pg 398"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the total frictional drag and horsepower required\n",
      "#Initialization of variables\n",
      "import math\n",
      "e=0.01 #ft\n",
      "rho=2 #slugs/ft^3\n",
      "mu=2.6e-5 #lb sec/ft^2\n",
      "speed=10. #knots\n",
      "L=250. #ft\n",
      "A=30000. #ft^2\n",
      "#calculations\n",
      "V=speed*1.69\n",
      "Nrl=V*L*rho/mu\n",
      "Cdf=1.32 /math.sqrt(Nrl)\n",
      "Fd=Cdf*A*0.5*rho*V*V\n",
      "hp=Fd*V/550.\n",
      "#results\n",
      "print '%s %d %s' %(\"Total frictional drag =\",Fd,\"lb\")\n",
      "print '%s %.1f %s' %(\"\\n Horsepower required =\",hp,\"hp\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total frictional drag = 627 lb\n",
        "\n",
        " Horsepower required = 19.3 hp\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2b - Pg 397"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the total frictional drag and horsepower required\n",
      "#Initialization of variables\n",
      "import math\n",
      "e=0.01 #ft\n",
      "rho=2 #slugs/ft^3\n",
      "mu=2.6e-5 #lb sec/ft^2\n",
      "speed=10 #knots\n",
      "L=250. #ft\n",
      "A=30000. #ft^2\n",
      "#calculations\n",
      "V=speed*1.69\n",
      "Nrl=V*L*rho/mu\n",
      "Cdf=0.074/math.pow(Nrl,0.2) -1700./Nrl\n",
      "Fd=Cdf*A*0.5*rho*V*V\n",
      "hp=Fd*V/550.\n",
      "#results\n",
      "print '%s %d %s' %(\"Total frictional drag =\",Fd,\"lb\")\n",
      "print '%s %.1f %s' %(\"\\n Horsepower required =\",hp,\"hp\")\n",
      "print '%s' %(\"The answer given in textbook is wrong. please use a calculator\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total frictional drag = 12537 lb\n",
        "\n",
        " Horsepower required = 385.2 hp\n",
        "The answer given in textbook is wrong. please use a calculator\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2c - Pg 398"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the total frictional drag and horsepower required\n",
      "#Initialization of variables\n",
      "import math\n",
      "e=0.01 #ft\n",
      "rho=2. #slugs/ft^3\n",
      "mu=2.6e-5 #lb sec/ft^2\n",
      "speed=10. #knots\n",
      "L=250. #ft\n",
      "A=30000. #ft^2\n",
      "#calculations\n",
      "V=speed*1.69\n",
      "Nrl=V*L*rho/mu\n",
      "Cdf=1/math.pow((1.89 + 1.62*math.log10(L/e)),(2.5))\n",
      "Fd=Cdf*A*0.5*rho*V*V\n",
      "hp=Fd*V/550.\n",
      "#results\n",
      "print '%s %d %s' %(\"Total frictional drag =\",Fd,\"lb\")\n",
      "print '%s %.1f %s' %(\"\\n Horsepower required =\",hp,\"hp\")\n",
      "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total frictional drag = 35117 lb\n",
        "\n",
        " Horsepower required = 1079.1 hp\n",
        "The answers are a bit different from textbook due to rounding off error\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 398"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the drag on the model\n",
      "#Initialization of variables\n",
      "import math\n",
      "V=200. #ft/s\n",
      "L=5. #ft\n",
      "B=2. #ft\n",
      "rho=0.00232 #slug/ft^3\n",
      "mu=3.82e-7 #lb-sec/ft^2\n",
      "p2=14.815 #psia\n",
      "pa=14.7 #psia\n",
      "#calculations\n",
      "Nr=V*L*rho/mu\n",
      "Cdf=0.0032\n",
      "Fdf=Cdf*math.pi*L*B*0.5*rho*V*V\n",
      "Fd=(p2-pa)*math.pi/4. *(B*12)*(B*12) -Fdf\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Drag on the model =\",Fd,\"lb\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Drag on the model = 47.36 lb\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 405"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the velocity of the flow\n",
      "#Initialization of variables\n",
      "import math\n",
      "p1=14.7 #psia\n",
      "z1=3 #ft\n",
      "gam=62.4\n",
      "rho=1.94 #slug/ft^3\n",
      "pa=0.4 #psia\n",
      "za=1 #ft\n",
      "#calculations\n",
      "v3=(pa-p1)*144 + (za-z1)*gam\n",
      "V=math.sqrt(-v3*2/(3*rho))\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Velocity of flow =\",V,\" ft/s\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity of flow = 27.4  ft/s\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 410"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the horsepower required\n",
      "#Initialization of variables\n",
      "import math\n",
      "rpm=60. \n",
      "rho=2. #slugs/ft^3\n",
      "mu=3.5e-5 #lb-sec/ft^2\n",
      "D=4./12. #ft\n",
      "r=2. #ft\n",
      "#calcualtions\n",
      "V=rpm*2*math.pi/60. *2\n",
      "Nr=V*D*rho/mu\n",
      "Cd=1.1\n",
      "Fd=Cd*math.pi/4. *(D)*D *0.5*rho*V*V\n",
      "T=2*Fd*r\n",
      "w=rpm*2*math.pi/60.\n",
      "hp=T*w/550.\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Horsepower required =\",hp,\" hp\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Horsepower required = 0.69  hp\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the terminal velocity\n",
      "#Initialization of variables\n",
      "import math\n",
      "g=32.2 #ft/s^2\n",
      "h=60000. #ft\n",
      "F=2000. #;b\n",
      "d=3. #ft\n",
      "rho=0.00231\n",
      "#calculations\n",
      "V=math.sqrt(2*g*h)\n",
      "print '%s' %(\"By trail and error\")\n",
      "Cd=0.25\n",
      "Nm=0.87\n",
      "A=math.pi/4. *d*d\n",
      "Vt=math.sqrt(2*F/(Cd*A*rho))\n",
      "#results \n",
      "print '%s %.1f %s' %(\"terminal velocity =\",Vt,\" ft/s\")\n",
      "print '%s' %(\"The answers are a bit different from textbook due to rounding off error\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "By trail and error\n",
        "terminal velocity = 989.9  ft/s\n",
        "The answers are a bit different from textbook due to rounding off error\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}