{
 "metadata": {
  "name": "",
  "signature": "sha256:f2115f2ad7692dfe801ea214554c915af4da1fd1ef8995d6587f66bc81d26a08"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9 : Forces on bodies immersed in fluids"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 9.1 pageno : 166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "rho = 1.2\n",
      "mu = 1.85/100000\n",
      "pi = 3.1428\n",
      "d = 3.\n",
      "v = 50.*1000/3600\n",
      "\n",
      "#calculation part 1\n",
      "Re = d*rho*v/mu\n",
      "\n",
      "#from chart of drag coeff. vs Re\n",
      "Cd = 0.2                    #coeff. of drag\n",
      "Ad = pi*d**2/4.             #projected area\n",
      "Fd = Ad*Cd*rho*v**2/2.\n",
      "print  \"The drag force on sphere in N\",Fd \n",
      "\n",
      "#part 2\n",
      "v = 2.\n",
      "l = 0.25\n",
      "Re = l*v*rho/mu\n",
      "zi = 4*pi*(l**3*3./4/pi)**(2/3.)/6./l**2            #sphericity\n",
      "\n",
      "#using graph\n",
      "Cd = 2.\n",
      "Ad = l**2\n",
      "Fd = Ad*Cd*rho*v**2/2.\n",
      "print  \"The drag force on cube in N\",Fd \n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The drag force on sphere in N 163.6875\n",
        "The drag force on cube in N 0.3\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 9.2 page no : 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "rho = 1.2\n",
      "mu = 1.85/100000\n",
      "pi = 3.1428\n",
      "g = 9.81\n",
      "d = 1.38\n",
      "t = 0.1                 #thickness\n",
      "v = 30*1000/3600.\n",
      "T = 26.2                #Tension\n",
      "m = 0.51                #mass\n",
      "theta = 60.*pi/180.\n",
      "\n",
      "#calculation\n",
      "Fd = T*math.cos(theta)\n",
      "print \"Drag force in N: %.4f\"% Fd\n",
      "A = pi*d**2/4.\n",
      "Ad = A*math.cos(theta)              #area component to drag\n",
      "Cd = 2*Fd/Ad/rho/v**2               #coeff of drag\n",
      "print  \"The drag coefficient: %.4f\"% Cd \n",
      "Fg = m*g                            #force of gravity\n",
      "Fb = rho*pi*d**2/4.*t*g              #buoyant force\n",
      "Fl = Fg-Fb+T*math.sin(theta)\n",
      "print \"The lift force in N : %.4f\"%Fl\n",
      "Al = A*math.sin(theta)\n",
      "Cl = 2*Fl/Al/rho/v**2\n",
      "print \"The coefficient of lift: %.4f\"%Cl \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Drag force in N: 13.0909\n",
        "The drag coefficient: 0.4202\n",
        "The lift force in N : 25.9368\n",
        "The coefficient of lift: 0.4803\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 9.3 page no : 171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "rhog = 1200.            #density of glycerol\n",
      "mu = 1.45\n",
      "pi = 3.1428\n",
      "g = 9.81\n",
      "rhos = 2280.             #density of sphere\n",
      "v = 0.04                #terminal velocity\n",
      "a = 2*mu*g*(rhos-rhog)/v**3./3./rhog**2         #a = Cd/2/Re\n",
      "\n",
      "#using graph of Cd/2/Re vs Re\n",
      "Re = 0.32\n",
      "d = Re*mu/v/rhog\n",
      "print  \"Diameter of sphere in (m): %.4f\"%d \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diameter of sphere in (m): 0.0097\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 9.4 page no : 173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "rhoa = 1.218            #density of air\n",
      "mu = 1.73/100000\n",
      "pi = 3.1428\n",
      "g = 9.81\n",
      "rhog = 1200.\n",
      "rhop = 2280.            #density of polythene\n",
      "d = 0.0034              #diameter\n",
      "a = 4*d**3*(rhop-rhoa)*rhoa*g/3/mu**2       #a = Cd*Re**2\n",
      "\n",
      "#using graph of Cd*Re**2 vs Re\n",
      "Re = 2200.\n",
      "v = Re*mu/d/rhog\n",
      "print  \"The terminal velocity in (m/s) %f\"%v \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The terminal velocity in (m/s) 0.009328\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "example 9.6 page no : 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "# Initialization of Variable\n",
      "pi = 3.1428\n",
      "rho = 825\n",
      "mu = 1.21\n",
      "g = 9.81\n",
      "l = 0.02\n",
      "de = 0.02           #dia exterior\n",
      "di = 0.012          #dia interior\n",
      "\n",
      "# Initialization of Variable\n",
      "rho = 998.              #density of water\n",
      "mu = 1.25/1000          #viscosity of water\n",
      "w = 100.                #mass of water\n",
      "pi = 3.1428\n",
      "g = 9.81\n",
      "rhog = 2280.            #density of glass\n",
      "wg = 60.                #mass of glass\n",
      "d = 45.*10**-6           #diameter of glass sphere\n",
      "\n",
      "#claculation\n",
      "rhom = (w+wg)/(w/rho+wg/rhog)       #density of mixure\n",
      "e = w/rho/(w/rho+wg/rhog)           #volume fraction of watter\n",
      "\n",
      "#using charts\n",
      "zi = math.exp(-4.19*(1.-e))\n",
      "\n",
      "K = d*(g*rho*(rhog-rho)*zi**2/mu**2)**(1./3)        #stoke's law coeff.\n",
      "print K\n",
      "if K<3.3:\n",
      "    print \"settling occurs in stoke-s law range\"\n",
      "    U = g*d**2*e*zi*(rhog-rhom)/18/mu\n",
      "    print \"settling velocity in m/s: %f\"%U\n",
      "else:\n",
      "    print \"settling does not occurs in stoke-s law range\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.504080734813\n",
        "settling occurs in stoke-s law range\n",
        "settling velocity in m/s: 0.000297\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "\n",
      "example 9.7 page no : 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "from numpy import linspace\n",
      "\n",
      "\n",
      "# Initialization of Variable\n",
      "rhog = 1200.            #density of glycerol\n",
      "mu = 1.45               #viscosity of glycerol\n",
      "pi = 3.1428\n",
      "g = 9.81\n",
      "rhos = 2280.            #density of sphere\n",
      "d = 8/1000.\n",
      "s = 0.\n",
      "uf = 0.8*0.026\n",
      "\n",
      "#calculation\n",
      "def intre():\n",
      "    s = 0.\n",
      "    u = linspace(0,uf,1000)\n",
      "    for i in range(0,1000):\n",
      "        y = ((pi/6*d**3*rhos*g-pi*d**3/6*rhog*g-0.5*pi*d**2/4*24*mu/d/rhog*rhog*u[i])/pi*6/d**3/rhos)**(-1)*uf/1000\n",
      "        s = s+y\n",
      "    a = s\n",
      "    return a\n",
      "\n",
      "t = intre()\n",
      "print \"Time taken by particle to reach 80%% of its velocity in (s): %f\"%t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken by particle to reach 80% of its velocity in (s): 0.009020\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}