{
 "metadata": {
  "name": "",
  "signature": "sha256:c5878f9f12f36b5e66b58cd14cae765a8a33d2857e5e7bf610b92f3d0ec0806b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER13 : FLUID MECHANICS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 : Pg 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#example 13.1\n",
      "#calculation of the force exerted by the water on the bottom\n",
      "\n",
      "#given data\n",
      "h=20.*10.**-2.#height(in m) of the flask\n",
      "r=10.*10.**-2.#radius(in m) of the bottom of the flask\n",
      "P0=1.01*10.**5.#atmospheric pressure(in Pa)\n",
      "rho=1000.#density of water(in kg/m**3)\n",
      "g=10.#gravitational acceleration(in m/s**2) of the earth\n",
      "\n",
      "#calculation\n",
      "P=P0+(h*rho*g)#pressure at the bottom\n",
      "A=math.pi*r**2.#area of the bottom \n",
      "F=P*A#force on the bottom\n",
      "\n",
      "print '%s %.2f %s' %('the force exerted by the water on the bottom is',F,'N\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the force exerted by the water on the bottom is 3235.84 N\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 : Pg 262"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#example 13.2\n",
      "#calculation of the volume of the cube outside the water\n",
      "\n",
      "#given data\n",
      "m=700.*10.**-3.#mass(in kg) of the cube\n",
      "l=10.*10.**-2.#length(in m) of the cube\n",
      "rho=1000.#density of water(in kg/m**3)\n",
      "\n",
      "#calculation\n",
      "V=m/rho#weight of displaced water = V*rho*g\n",
      "Vtotal=l**3.#total volume of the cube\n",
      "Vout=Vtotal-V#volume of the cube outside the water\n",
      "\n",
      "print '%s %.2f %s' %('the volume of the cube outside the water is',Vout*10**6,'cm**3')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the volume of the cube outside the water is 300.00 cm**3\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 : Pg 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 13.3\n",
      "#calculation of the speed of the outgoing liquid\n",
      "\n",
      "#given data\n",
      "A1=1.*10.**-4.#area(in m**2) of the inlet of the tube\n",
      "A2=20.*10.**-6.#area(in m**2) of the outlet of the tube\n",
      "v1=2.#speed(in cm/s) of the ingoing liquid\n",
      "\n",
      "#calculation\n",
      "v2=A1*v1/A2#equation of continuity\n",
      "\n",
      "print '%s %.2f %s' %('the speed of the outgoing liquid is',v2,'cm/s\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the speed of the outgoing liquid is 10.00 cm/s\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 : Pg 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 13.4\n",
      "#calculation of the difference in the pressures at A and B point\n",
      "\n",
      "#given data\n",
      "A1=1.*10.**-4.#area(in m**2) at point A of the tube\n",
      "A2=20.*10.**-6.#area(in m**2) at point B of the tube\n",
      "v1=10.*10.**-2.#speed(in m/s) of the ingoing liquid\n",
      "rho=1200.#density of the liquid(in kg/m**3)\n",
      "\n",
      "#calculation\n",
      "v2=A1*v1/A2#equation of continuity\n",
      "#by Bernoulli equtation.....P1 + (rho*g*h1) + (rho*v1**2/2) = P2 + (rho*g*h2) + (rho*v2**2/2)\n",
      "deltaP=(1./2.)*rho*(v2**2.-v1**2.)\n",
      "\n",
      "print '%s %.2f %s' %('the difference in the pressures at A and B point is',deltaP,'Pa\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the difference in the pressures at A and B point is 144.00 Pa\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 : Pg 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#example 13.5\n",
      "#calculation of the speed of the water coming out of the tap\n",
      "\n",
      "#given data\n",
      "h=6.#depth(in m) of the tap\n",
      "g=9.8#gravitational acceleration(in m/s**2) of the earth\n",
      "\n",
      "#calculation\n",
      "v=math.sqrt(2.*g*h)#torricellis theorem\n",
      "\n",
      "print '%s %.2f %s' %('the speed of the water coming out of the tap is',round(v),'m/s\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the speed of the water coming out of the tap is 11.00 m/s\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "WORKED EXAMPLES"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1w : Pg 267"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#example 13.1w\n",
      "#calculation of the force exerted by the mercury on the bottom of the beaker\n",
      "\n",
      "#given data\n",
      "h=10.*10.**-2.#height(in m) of the mercury\n",
      "r=4.*10.**-2.#radius(in m) of the beaker\n",
      "g=10.#gravitational acceleration(in m/s**2) of the earth\n",
      "P0=1.*10.**5.#atmospheric pressure(in Pa)\n",
      "rho=13600.#density of mercury(in kg/m**3)\n",
      "\n",
      "#calculation\n",
      "P=P0+(h*rho*g)#pressure at the bottom\n",
      "A=math.pi*r**2.#area of the bottom \n",
      "F=P*A#force on the bottom\n",
      "\n",
      "print '%s %.2f %s' %('the force exerted by the mercury on the bottom of the beaker is',F,'N\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the force exerted by the mercury on the bottom of the beaker is 571.02 N\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2w : Pg 267"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#example 13.2w\n",
      "#calculation of the height of the atmosphere to exert the same pressure as at the surface of the earth\n",
      "\n",
      "#given data\n",
      "P0=1.*10.**5.#atmospheric pressure(in Pa)\n",
      "rho=1.3#density of air(in kg/m**3)\n",
      "g=9.8#gravitational acceleration(in m/s**2) of the earth\n",
      "\n",
      "#calculation\n",
      "h=P0/(g*rho)\n",
      "\n",
      "print '%s %.2f %s' %(\"the height of the atmosphere to exert the same pressure as at the surface of the earth is\",round(h),\"m\\n\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the height of the atmosphere to exert the same pressure as at the surface of the earth is 7849.00 m\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3w : Pg 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 13.3w\n",
      "#calculation of the height of the water coloumn\n",
      "\n",
      "#given data\n",
      "h1=2.*10.**-2.#difference in the height(in m)\n",
      "s=13.6#specific gravity of mercury\n",
      "\n",
      "#calculation\n",
      "#P = P0 + (h*rho*g)........using this equation\n",
      "h=h1*s#height of the water coloumn\n",
      "\n",
      "print '%s %.2f %s' %('the height of the water coloumn is',h*10**2,'cm\\n',)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the height of the water coloumn is 27.20 cm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5w : Pg 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 13.5w\n",
      "#calculation of the force applied on the water in the thicker arm\n",
      "\n",
      "#given data\n",
      "A1=1.*10.**-4.#area(in m**2) of arm 1\n",
      "A2=10.*10.**-4.#area(in m**2) of arm 2\n",
      "f=5.#force(in N) applied on the water in the thinner arm\n",
      "\n",
      "#calculation\n",
      "#P = P0 + (h*rho*g)........using this equation\n",
      "F=f*A2/A1#force applied on the water in the thicker arm\n",
      "\n",
      "print '%s %.2f %s' %('the force applied on the water in the thicker arm is',F,'N\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the force applied on the water in the thicker arm is 50.00 N\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6w : Pg 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#example 13.6w\n",
      "#calculation of the elongation of the spring\n",
      "\n",
      "#given data\n",
      "m=10.*10.**-3.#mass(in kg) of the copper piece\n",
      "l=1.*10.**-2.#elongation(in m) in the spring\n",
      "g=10.#gravitational acceleration(in m/s**2) of the earth\n",
      "rho=9000.#density of copper(in kg/m**3)\n",
      "rho0=1000.#density of water(in kg/m**3)\n",
      "\n",
      "#calculation\n",
      "k=m*g/l#spring constant\n",
      "V=m/rho#volume of copper\n",
      "Fb=V*rho0*g#force of buoyancy\n",
      "x=((k*l)-Fb)/k#elongation of the spring\n",
      "\n",
      "print '%s %.2f %s' %('the elongation of the spring is',x*10**2,'cm\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the elongation of the spring is 0.89 cm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7w : Pg 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 13.7w\n",
      "#calculation of the maximum weight that can be put on the block without wetting it\n",
      "\n",
      "#given data\n",
      "l=3.*10.**-2.#length(in m) of the edge of the cubical block\n",
      "rho=800.#density of wood(in kg/m**3)\n",
      "k=50.#spring constant(in N/m)\n",
      "g=10.#gravitational acceleration(in m/s**2) of the earth\n",
      "rho0=1000.#density of water(in kg/m**3)\n",
      "\n",
      "#calculation\n",
      "s=rho/rho0#specific gravity\n",
      "hin=l*s#height inside water\n",
      "hout=l-hin#height outside water\n",
      "V=l**3.#volume of the block\n",
      "Fb=V*rho0*g#force of buoyancy\n",
      "Fs=k*hout#force exerted by the spring\n",
      "Wdash=V*rho*g#weight of the block\n",
      "W=Fb+Fs-Wdash#maximum weight\n",
      "\n",
      "print '%s %.2f %s' %('the maximum weight that can be put on the block without wetting it is',W,'N\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the maximum weight that can be put on the block without wetting it is 0.35 N\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8w : Pg 269"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from math import acos,sqrt\n",
      "#example 13.8w\n",
      "#calculation of the angle that the plank makes with the vertical in equilibrium\n",
      "\n",
      "#given data\n",
      "l=1.#length(in m) of the planck\n",
      "h=0.5#height(in m) of the water level in the tank \n",
      "s=0.5#specific gravity of the planck\n",
      "\n",
      "#calculation\n",
      "#A = OC/2 = l/(2*cosd(theta)\n",
      "# mg = 2*l*rho*g\n",
      "#buoyant force   Fb=(2*l*rho*g)/cosd(theta)\n",
      "#m*g*(OB)*sind(theta) = F(OA)*sind(theta)\n",
      "theta=acos(math.sqrt(1./2.))*57.3\n",
      "\n",
      "print '%s %.2f %s' %('the angle that the plank makes with the vertical in equilibrium is',theta,'degree\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the angle that the plank makes with the vertical in equilibrium is 45.00 degree\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10w : Pg 269"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#example 13.10w\n",
      "#calculation of the rate of water flow through the tube\n",
      "\n",
      "#given data\n",
      "A1=30.#area(in cm**2) of the tube at point A\n",
      "A2=15.#area(in cm**2) of the tube at point B\n",
      "deltaP=600.#change in pressure(in N/m**2)\n",
      "rho0=1000.#density of the water(in kg/m**3)\n",
      "\n",
      "#calculation\n",
      "r=A1/A2#ratio of area\n",
      "#from equation of continuity  vB/vA = A1/A2 = r = 2\n",
      "#by Bernoulli equtation.....P1 + (rho*g*h1) + (rho*v1**2/2) = P2 + (rho*g*h2) + (rho*v2**2/2)\n",
      "#take vB = vA*2\n",
      "vA=math.sqrt(deltaP*(r/(r+1.))*(1./rho0))\n",
      "Rflow=vA*A1#rate of water flow \n",
      "\n",
      "print '%s %.2f %s' %('the rate of water flow through the tube is',Rflow*10**2,'cm**3/s\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the rate of water flow through the tube is 1897.37 cm**3/s\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11w : Pg 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#example 13.11w\n",
      "#calculation of the velocity of the water coming out of the opening \n",
      "\n",
      "#given data\n",
      "AA=.5#area(in m**2) of the tank\n",
      "AB=1.*10.**-4.#area(in m**2) of the cross section at the bottom\n",
      "m=20.#mass(in kg) of the load\n",
      "h=50.*10.**-2.#height(in m)of the water level\n",
      "g=10.#gravitational acceleration(in m/s**2) of the earth \n",
      "rho=1000.#density of the water(in kg/m**3)\n",
      "\n",
      "#calculation\n",
      "#from the equation............P = P0 + (h*rho*g)#pressure at the bottom\n",
      "r=m*g/AA#in above equation it is the value of (h*rho*g)\n",
      "#on solving,we get............PA = P0 + (400 N/m**2)\n",
      "#from Bernoulli equtation.....P1 + (rho*g*h1) + (rho*v1**2/2) = P2 + (rho*g*h2) + (rho*v2**2/2)\n",
      "#we get\n",
      "vB=math.sqrt((2.*(r+(rho*g*h)))/rho)\n",
      "\n",
      "print '%s %.2f %s' %('the velocity of the water coming out of the opening is',vB,'m/s\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the velocity of the water coming out of the opening is 3.29 m/s\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}