{
 "metadata": {
  "name": "",
  "signature": "sha256:efc6f8f4cd32e5126c4de163e157356596c0806f949ff4295acc9cf31cf6d207"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Chapter 7 : Fluid Resistance"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.1 Page no 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import *\n",
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "nu1 = 0.804*10**-6               # viscosity in m**2/s\n",
      "\n",
      "V = 0.3                        # velocity in m/s\n",
      "\n",
      "D = 0.02                       # diameter in m/s\n",
      "\n",
      "\n",
      "rho = 995.7                    # density in kg/m**3\n",
      "\n",
      "\n",
      "mu = 8620*10**-4               # viscosity in Ns/m**2\n",
      "\n",
      "S = 1.26                       # specific gravity\n",
      "\n",
      "nu2 = mu/(S*rho)                # viscosity of glycerine in Ns/m**2\n",
      "\n",
      "\n",
      "R1 = V*D/nu1\n",
      "\n",
      "print \"Reynolds number for water =\",round(R1,0)\n",
      "\n",
      "print \"R > 2000 the flow is turbulent for water\"\n",
      "\n",
      "print \"\\n\"\n",
      "R2 = V*D/nu2\n",
      "\n",
      "print \"Reynolds number for glycerine =\",round(R2,1)\n",
      "\n",
      "print \"R < 2000 the flow is laminar for glycerine\"\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reynolds number for water = 7463.0\n",
        "R > 2000 the flow is turbulent for water\n",
        "\n",
        "\n",
        "Reynolds number for glycerine = 8.7\n",
        "R < 2000 the flow is laminar for glycerine\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.2 Page no 248"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import *\n",
      "\n",
      "from __future__ import division\n",
      "\n",
      "from scipy import *\n",
      "\n",
      "import numpy as np\n",
      "\n",
      "from sympy import *\n",
      "\n",
      "y = Symbol('y')\n",
      "\n",
      "d = 0.0175           # diameter in m\n",
      "\n",
      "s = 0.3              # shear stress at a distance in m\n",
      "\n",
      "tau = 103            # shear stress in Pa\n",
      "\n",
      "rho = 1000           # density in kg/m**3\n",
      "\n",
      "\n",
      "\n",
      "Up = diff(8.5+0.7*log(y),y)\n",
      "\n",
      "print Up\n",
      "\n",
      "Up = (0.7/0.3)                     # for y = 0.3\n",
      "\n",
      "k = sqrt(tau/(rho*s**2*Up**2))\n",
      "\n",
      "print \"Turbulence constant = \",round(k,2)\n",
      "\n",
      "Ml = k*s*100             # mixing length\n",
      "\n",
      "print \"Mixing length = \",round(Ml,1),\"cm\"\n",
      "\n",
      "Eta = rho*(Ml/100)**2*Up\n",
      "\n",
      "print \"Eddy viscosity =\",round(Eta,1),\"Nm/s**2\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.7/y\n",
        "Turbulence constant =  0.46\n",
        "Mixing length =  13.8 cm\n",
        "Eddy viscosity = 44.1 Nm/s**2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.3 Page no 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import *\n",
      "\n",
      "from __future__ import division\n",
      "\n",
      "from pylab import plt\n",
      "\n",
      "from numpy import *\n",
      "\n",
      "from scipy import *\n",
      "\n",
      "from sympy import *\n",
      "\n",
      "import matplotlib.pyplot as plt\n",
      "\n",
      "\n",
      "\n",
      "S = 1.26                  # specific gravity \n",
      "\n",
      "mu = 0.862                # dynamic viscosity in Ns/m**2\n",
      "\n",
      "rho = S *1000             # density in kg/m**3\n",
      "\n",
      "K2 = 0.332\n",
      "\n",
      "V=1                       # velocity in m/s\n",
      "\n",
      "\n",
      "\n",
      "x = [0,0.1,0.5,1.0,2.0];\n",
      "\n",
      "d = 0.1307*np.sqrt(x)*100\n",
      "\n",
      "tauo = K2*rho*V**2/(sqrt(1462)*np.sqrt(x))\n",
      "\n",
      "plt.plot(x, d, 'r')\n",
      "plt.xlabel('x(m)')\n",
      "plt.ylabel('delta(cm),tauo(N/m**2)')\n",
      "\n",
      "plt.plot(x, tauo, 'b')\n",
      "plt.xlabel('x')\n",
      "plt.legend('d''t')\n",
      "plt.show()\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.4 page no 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import numpy as np\n",
      "\n",
      "from math import *\n",
      "\n",
      "from __future__ import division\n",
      "\n",
      "import matplotlib.pyplot as plt\n",
      "\n",
      "from numpy import sqrt\n",
      "\n",
      "\n",
      "rho = 1.197               # air density in kg/m**3\n",
      "\n",
      "mu = 18.22*10**-6         # viscosity in Ns/m**2\n",
      "\n",
      "l = 5                     # length of the plate\n",
      "\n",
      "V = 8                     # velocity in m/s\n",
      "\n",
      "Rec = 5*10**5              # crictical reynolds number\n",
      "\n",
      "l1 = 0.951                # length from 0 to 0.951\n",
      "\n",
      "l2 = 5.0                  # length from 0 to 5\n",
      "\n",
      "l3 = 0.951                # length from 0 to 0.951\n",
      "\n",
      "\n",
      "X = Rec/525576\n",
      "\n",
      "x = [0,0.1,0.3,0.6,0.951];\n",
      "\n",
      "d = 0.0069*np.sqrt(x)*100\n",
      "\n",
      "plt.figure()\n",
      "plt.plot(x, d, 'r')\n",
      "plt.xlabel('x(m)')\n",
      "plt.ylabel('delta(cm)')\n",
      "plt.title('delta v/s x')\n",
      "plt.legend('L')\n",
      "plt.show()\n",
      "\n",
      "X1 = [0.951,1.5,2.0,2.5,3.0,4.0,5.0]\n",
      "\n",
      "Dt = 0.0265*np.power(X1,(4/5))*100\n",
      "\n",
      "plt.figure()\n",
      "plt.plot(X1, Dt, 'g')\n",
      "plt.xlabel('x(m)')\n",
      "plt.ylabel('delta(cm)')\n",
      "plt.title('delta v/s x')\n",
      "plt.legend('T')\n",
      "plt.show()\n",
      "\n",
      "Td = 0.664*sqrt(mu*rho*V**3*l1)+0.036*rho*V**2*l2*(mu/(rho*V*l2))**0.2-0.036*rho*V**2*l3*(mu/(rho*V*l3))**0.2\n",
      "\n",
      "print \"Total Drag = \",round(Td,3),\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total Drag =  0.595 N\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.5 Page no 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from math import *\n",
      "\n",
      "from pylab import plt\n",
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "d = 0.01         # doameter of sphere in m\n",
      "\n",
      "v = 0.05         # velocity in m/s\n",
      "\n",
      "S = 1.26         # specific gravity\n",
      "\n",
      "mu = 0.826       # kinematic viscosity in Ns/m**2\n",
      "\n",
      "rho = S*1000     # density\n",
      "\n",
      "\n",
      "R = rho*v*d/mu\n",
      "\n",
      "\n",
      "Cd = 35\n",
      "\n",
      "Fd = 0.5*Cd*rho*v**2*pi*d**2/4\n",
      "\n",
      "print \"Drag on the sphere = \",round(Fd,4),\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Drag on the sphere =  0.0043 N\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}