{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 - MOTION OF PARTICLES IN A FLUID"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page 159 Example 3.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " The value of (Ro/pu**2)/Re**2 is  24.197  \n",
      "\n",
      "\n",
      " The terminal velocity of the steel ball is 0.051 m/sec or 51 mm/sec\n"
     ]
    }
   ],
   "source": [
    "d = 0.00040#   #Diameter of the particle in m\n",
    "p1 = 820#      #Density of the fluid in kg/m**3\n",
    "meu = 0.01#    #Viscosity of the fluid in N s/m**2\n",
    "p2 = 7870#    #Density of steel in kg/m**3\n",
    "g = 9.81#     #Acceleartion due to gravity in m/sec**2\n",
    "#Computation of terminal velocity of a spherical particle \n",
    "def galileo_number():\n",
    "\n",
    "    x = (2*d**3*(p2-p1)*p1*g)/(3*(meu)**2)# #x = (Ro/pu**2)*Re**2\n",
    "    return x\n",
    "\n",
    "x = galileo_number()#\n",
    "print\"\\n The value of (Ro/pu**2)/Re**2 is  %.3f  \\n\"%(x)#\n",
    "\n",
    "\n",
    "#From table 3.4 log(x) corresponds to log(Re)=0.222\n",
    "Re = 1.667#\n",
    "def teminal_velocity():\n",
    "    u=(Re*meu)/(p1*d)#\n",
    "    return u\n",
    "\n",
    "u = teminal_velocity()#\n",
    "print\"\\n The terminal velocity of the steel ball is %.3f m/sec or %.0f mm/sec\"%(u,u*1000)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page 159 Example 3.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " The maximum permissible value of Re is 0.500  \n",
      "\n",
      "maximum particle size of galena which will be carried away by water is 37.6 um\n",
      "\n",
      "maximum particle size of limestone which will be carried away by water is 73.5 um\n",
      "\n",
      "\n",
      "In the overflow:\n",
      "\n",
      "Amount of galena is 8.600  g\n",
      "\n",
      "Amount of limestone is 59.200  g\n",
      "\n",
      "concentration of galena is 12.7 per cent\n",
      "\n",
      "\\concentration of galena is 87.316  per cent\n",
      "\n",
      "\n",
      "In the underflow:\n",
      "\n",
      "concentration of galena is 35.4 percent\n",
      "\n",
      "concentration of limestone is 64.6 per cent\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt\n",
    "u_water = 5*10**(-3)#  #The flow velocity of the water in m/sec\n",
    "p_galena = 7500#      #The density of galena is in kg/m**3\n",
    "p_limestone = 2700#   #The density of limestone is in kg/m**3\n",
    "viscosity = 0.001#    #The viscosity of water in N s/m**2\n",
    "\n",
    "#calculating maximum value of reynold's number considering 5mm particle size\n",
    "Re_max = (u_water*1000*0.0001)/(viscosity)#\n",
    "print\"\\n The maximum permissible value of Re is %.3f  \"%(Re_max)#\n",
    "\n",
    "#maximum particle size of galena which will be carried away by water\n",
    "d = sqrt((u_water*(18*viscosity))/((7500-1000)*9.81))#\n",
    "print\"\\nmaximum particle size of galena which will be carried away by water is %.1f um\"%(d*10**(6))#\n",
    "\n",
    "#maximum particle size of limestone which will be carried away by water\n",
    "d1 = sqrt((u_water*(18*viscosity))/((2700-1000)*9.81))#\n",
    "print\"\\nmaximum particle size of limestone which will be carried away by water is %.1f um\"%(d1*10**(6))#\n",
    "\n",
    "\n",
    "#From the given data 43% galena and 74% limestone will be removed .\n",
    "#Given that in the feed there is 20% galena and 80% limestone\n",
    "#Assuming 100g feed\n",
    "print\"\\n\\nIn the overflow:\"\n",
    "print\"\\nAmount of galena is %.3f  g\"%((20*0.43))# \n",
    "print\"\\nAmount of limestone is %.3f  g\"%((80*0.74))#\n",
    "print\"\\nconcentration of galena is %.1f per cent\"%((20*0.43*100)/(20*0.43+80*0.74))#\n",
    "print\"\\n\\concentration of galena is %.3f  per cent\"%((80*0.74*100)/(20*0.43+80*0.74))#\n",
    "print\"\\n\\nIn the underflow:\"\n",
    "print\"\\nconcentration of galena is %.1f percent\"%((20*(1-0.43)*100)/(20*(1-0.43)+80*0.26))\n",
    "print\"\\nconcentration of limestone is %.1f per cent\"%((80*0.26*100)/(20*0.57+80*0.26))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page 167 Example 3.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "    smallest particles \t\t\t largest particles\n",
      "\n",
      "A:   0.000  m**2 \t\t\t\t 0.001  m**2 \n",
      "\n",
      "dp:  0.003  m \t\t\t\t\t 0.028  m\n",
      "\n",
      "dp**3:2.111505*10**(-8)m**3\t\t\t2.112  *10**(-5)m**3\n",
      "\n",
      "v:   6.018  *10**9m**3 \t\t\t\t6.018  *10**7m**3\n",
      "\n",
      "k:   0.285 \t\t\t\t\t0.029  \n",
      "\n",
      "(Ro/pu**2)Reo**2 is 1338 for the smallest particles and 133823 for the largest particles\n",
      "\n",
      "Terminal velocity for the smallest particle is 0.154 m/sec\n",
      "\n",
      "Terminal velocity for the largest particle is 0.160 m/sec\n",
      "\n",
      "\n",
      " Thus it is seen that all the particles settle at approximately the same velocity\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt\n",
    "from __future__ import division\n",
    "min_area =6*10**(-6)#    #minimum area of mica plates in m**2\n",
    "max_area =6*10**(-4)#    #maximum area of mica plates in m**2\n",
    "p_oil = 820#            #density of the oil in kg/m**3\n",
    "Viscosity = 0.01#      #Viscosity is in N s/m**2\n",
    "p_mica = 3000#         #Density of mica in kg/m**3\n",
    "\n",
    "print\"\\n    smallest particles \\t\\t\\t largest particles\"\n",
    "print\"\\nA:   %.3f  m**2 \\t\\t\\t\\t %.3f  m**2 \"%(min_area,max_area)#\n",
    "print\"\\ndp:  %.3f  m \\t\\t\\t\\t\\t %.3f  m\"%(sqrt(4*min_area/(pi)),sqrt(4*max_area/(pi)))#\n",
    "print\"\\ndp**3:%f*10**(-8)m**3\\t\\t\\t%.3f  *10**(-5)m**3\"%(sqrt(4*min_area/(pi))**(3)*10**(8),sqrt(4*max_area/(pi))**(3)*10**5)#\n",
    "print\"\\nv:   %.3f  *10**9m**3 \\t\\t\\t\\t%.3f  *10**7m**3\"%(0.285*sqrt(4*min_area/(pi))**(3)*10**(9),sqrt(4*max_area/(pi))**(3)*(10**7)*0.0285)#\n",
    "print\"\\nk:   %.3f \\t\\t\\t\\t\\t%.3f  \"%(0.285,0.0285)#\n",
    "\n",
    "x1 = (4*0.285/(pi*0.01**2))*(3000-820)*(820*2.103*10**(-8)*9.81)#\n",
    "x2 = (4*0.0285/(pi*0.01**2))*(3000-820)*(820*2.103*10**(-5)*9.81)#\n",
    "print\"\\n(Ro/pu**2)Reo**2 is %d for the smallest particles and %d for the largest particles\"%(x1,x2)#\n",
    "#From table 3.4 Re for smallest particle is 34.9 and that for the largest particle is 361\n",
    "u1 = 34.9*0.01/(820*2.76*10**(-3))#\n",
    "print\"\\nTerminal velocity for the smallest particle is %.3f m/sec\"%(u1)#\n",
    "u2 = 361*0.01/(820*2.76*10**(-2))#\n",
    "print\"\\nTerminal velocity for the largest particle is %.3f m/sec\"%(u2)#\n",
    "print\"\\n\\n Thus it is seen that all the particles settle at approximately the same velocity\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page 181 Example 3.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Reynold no. is 28800\n",
      "\n",
      "Particle velocity is 0.083 m/sec\n",
      "\n",
      "\n",
      "The distance moved with speed less than 0.083m/sec is -0.101m\n",
      "\n",
      " The time taken by particle to move this distance is 0.115sec\n",
      "\n",
      "The distance moved by the particle relative to the walls of the plant 0.239m\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log,cos,sin\n",
    "v_particle = 6#  #velocity of the particle in m/sec\n",
    "v_water = 1.2#   #veloicity of the water in m/sec\n",
    "v_rel = v_particle - v_water##relative velocity of particles relative to the fluid in m/sec\n",
    "Re1 = 6*10**(-3)*v_rel*1000/(1*10**(-3))##Re1 is the reynold's no.\n",
    "print\"\\nReynold no. is %d\"%(Re1)#\n",
    "\n",
    "#When the particle has been retarded to a velocity such that Re=500\n",
    "ydot = (v_rel*500)/Re1#\n",
    "print\"\\nParticle velocity is %.3f m/sec\\n\"%(ydot)#\n",
    "c = 0.33/(6*10**(-3))*(1000/2500)#\n",
    "f = sqrt((3*6*10**(-3)*(2500-1000)*9.81)/1000)#\n",
    "def Fa(t):\n",
    "   y = (-1/22)*(log(cos(0.517*22*t) + 4.8/0.517*sin(0.517*22*t)))#\n",
    "   return y\n",
    " \n",
    "def deriv(t) :\n",
    "    yd= -0.083+(0.517*(9.28*cos(11.37*t) - sin(11.37*t))/(cos(11.37*t) + 9.28*sin(11.37*t)))#\n",
    "    return yd\n",
    "def double_deriv(t):\n",
    "    ydd = -0.517*(11.37)**2*(9.28*cos(11.37*t) - sin(11.37*t))/(cos(11.37*t) + 9.28*sin(11.37*t))#\n",
    "    return ydd\n",
    "\n",
    "told = 0#\n",
    "while 1:\n",
    "    tnew = told - deriv(told)/double_deriv(told)#\n",
    "    if (tnew == told) :\n",
    "        y = Fa(told)#\n",
    "        d = y#\n",
    "        print\"\\nThe distance moved with speed less than 0.083m/sec is %.3fm\"%(d)#\n",
    "        t=told#\n",
    "        print\"\\n The time taken by particle to move this distance is %.3fsec\"%(t)#\n",
    "        break#\n",
    "    \n",
    "    told = tnew#\n",
    "\n",
    "\n",
    "\n",
    "print\"\\nThe distance moved by the particle relative to the walls of the plant %.3fm\"%(1.2*t - d)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Page 183 Example 3.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " By trial and error the solution for d is 0.88 mm\n",
      "\n",
      " The rate of dissolution is -8440340.480   \n",
      "\n",
      " The rate of falling of the particle is -0.047   m/sec\n"
     ]
    }
   ],
   "source": [
    "#rate of dissolution of salt\n",
    "def dissolution(d):\n",
    "   x = (3*10**(-6))-(2*10**(-4)*3.406*10**(5)*d**2)#\n",
    "   return x\n",
    "\n",
    "\n",
    "#rate of falling of the particle in stokes law region\n",
    "def rate_h(d):\n",
    "    y = 3.406*d**(2)/(-3*10**(-6)-68.1*d**2)##y is in m/sec\n",
    "    return y\n",
    "print\"\\n By trial and error the solution for d is 0.88 mm\"\n",
    "print\"\\n The rate of dissolution is %.3f   \"%(dissolution(8.8*10*(-4)))#\n",
    "print\"\\n The rate of falling of the particle is %.3f   m/sec\"%(rate_h(8.8*10**(-4)))#"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
