{ "metadata": { "name": "", "signature": "sha256:29c2c55c7f92ba07b1426c985419398b6baf83f563e8d0219eeaa4d84ad525c8" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 2 : Fluid Statics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.1 Page No : 44" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "h1 = 1.5 \t\t\t#m\n", "h2 = 2. \t\t\t#m\n", "g1 = 800. \t\t\t#kg/m**3\n", "g2 = 1000. \t\t\t#kg/m**3\n", "g = 9.81\n", "\t\t\t\n", "#calculations\n", "P = h1*g*g1 + h2*g*g2\n", "\t\t\t\n", "#results\n", "print \"Pressure at the bottom of the vessel = %.2f kN/m**2\"%(P/1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure at the bottom of the vessel = 31.39 kN/m**2\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2 Page No : 44" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "depth = 8000. \t\t\t#m\n", "sw = 10.06 \t\t\t#kN/m**3\n", "BM = 2.05*10**9 \t\t\t#N/m**2\n", "\t\t\t\n", "#calculations\n", "g = sw*10**3 /(1- sw*10**3 *depth/BM)\n", "Ph = 2.3*BM*math.log10(BM/(BM-depth*9.81*1025))\n", "\t\t\t\n", "#results\n", "print \"Specific weight = %.2f kN/m**2\"%(g/1000)\n", "print \" Pressure at depth h = %.2f MN/m**2\"%(Ph/10**6)\n", "\n", "# note : rounding off error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Specific weight = 10.47 kN/m**2\n", " Pressure at depth h = 81.97 MN/m**2\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.3 Page No : 55" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "Patm = 101.3/9.81 \t\t\t#m of water\n", "x1 = 0.45 \t\t\t#m\n", "x2 = 0.3 \t\t\t#m\n", "s1 = 920. \t\t\t#Kg/m**3\n", "s2 = 13.6 \t\t\t#Kg/m**3\n", "g = 9.81 \t\t\t#m/s**2\n", "\t\t\t\n", "#calculations\n", "Pa = (s1*x1*g + s2*x2*g)/1000\n", "Pa2 = Pa*10**3/(1000*g)\n", "Pa3 = Pa/(s2)\n", "\t\t\t\n", "#results\n", "print \"Pressure at A = %.1f kPa\"%Pa\n", "print \" Pressure at A = %.3f m of water\"%(Pa2)\n", "print \" Pressure at A = %.3f m of mercury\"%(Pa3)\n", "print \" Pressure at A = %.1f m of water absolute\"%(Pa/1000 +101.3)\n", "print \" Pressure at A = %.3f m of mercury\"%(Pa2+10.3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure at A = 4.1 kPa\n", " Pressure at A = 0.418 m of water\n", " Pressure at A = 0.302 m of mercury\n", " Pressure at A = 101.3 m of water absolute\n", " Pressure at A = 10.718 m of mercury\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4 Page No : 55" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "sg = 1.25 # gravity\n", "d = 0.5 \t\t\t#m\n", "d2 = 13.5*10**-2\t#m\n", "sw = 9.81 \t\t\t#specific weight of water - kN/m**2\n", "\t\t\t\n", "#calculations\n", "sl = sg*sw #specific weight of liquid\n", "sm = 13.6*sw #specfic weight of mercury\n", "Pa = sl*d - sm*d2\n", "\t\t\t\n", "#results\n", "print \"Pressure at A = %.2f kN/m**2 vacuum \"%(-Pa)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure at A = 11.88 kN/m**2 vacuum \n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.5 Page No : 56" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "#Following values are ontained from the figure 2.17\n", "s1 = 0.85\n", "s2 = 13.6\n", "z1 = 30\n", "z2 = 15\n", "z3 = 20\n", "z4 = 35\n", "z5 = 60\n", "\t\t\t\n", "#calculations\n", "dHa = s1*(z1+z5+z3-z4) +s2*z4 -z3+s2*z2-s1*(z1+z2) #Ha-Hb\n", "Pd = 1000*9.81*dHa/100 #Pa-Pb\n", "\t\t\t\n", "#results\n", "print \"Pressure difference = %.2f kN/m**2\"%(Pd/1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Pressure difference = 67.25 kN/m**2\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6 Page No : 57" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "P = 450 \t\t\t#pressure - kN/m**2\n", "alt = 2000 \t\t\t#altitude - m\n", "r = 610 \t\t\t#atmospheric pressure - mm of mercury\n", "\t\t\t\n", "#calculations\n", "Pat = 760-r\n", "Pat2 = Pat*13.6*9.81*10**-3\n", "Pg = Pat2+P\n", "\t\t\t\n", "#results\n", "print \"Gauge reading = %.2f kN/m**2\"%(Pg)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Gauge reading = 470.01 kN/m**2\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.7 Page No : 62" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "g = 9.81 \t\t\t#kN/m**2\n", "hc = 16.25 \t\t\t#m\n", "w = 1.5 \t\t\t#width - m\n", "b = 2.5 \t\t\t#depth - m\n", "f = 0.3 #coefficient of friction\n", "Pi = 50. \t\t\t#weight of gate - kN\n", "\t\t\t\n", "#calculations\n", "P = g*hc*w*b\n", "Preq = Pi+f*P\n", "\t\t\t\n", "#results\n", "print \"Force required to lift the gate = %.2f kN\"%(Preq)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Force required to lift the gate = 229.34 kN\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.8 Page No : 62" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "a = 6. \t\t\t#m\n", "b = 8. \t\t\t#m\n", "\t\t\t\n", "#calculations\n", "Ixy = 9./32 *b**4 /4\n", "xp = Ixy/(2./3 *b *1./2 *a*b)\n", "ICG = 1./36 *a*b**3\n", "yp = 2./3*b + ICG/(2./3 *b* 1./2 *a*b )\n", "\t\t\t\n", "#results\n", "print \"The coordinates of centre of pressure are %.2f,%d\"%(xp,yp)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The coordinates of centre of pressure are 2.25,6\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.9 Page No : 63" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "z = 1.2 \t\t\t#m\n", "y = 1. \t\t\t#m\n", "\t\t\t\n", "#calculations\n", "hp = 0.6 + 1./12 *y*z**3 /(0.6*y*z)\n", "\t\t\t\n", "#results\n", "print \"Position of hinge = %.1f m\"%(hp)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Position of hinge = 0.8 m\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.10 Page No : 64" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "from sympy import *\n", "\t\t\t\n", "#Initialization of variables\n", "r = 0.75 \t\t\t#radius of plane - m\n", "gam = 8. \t\t\t#specific weight of fluid - kN/m**3\n", "\t\t\t\n", "#calculations\n", "P = gam*2./3 *r**3\n", "hp = Symbol('hp')\n", "hp = 4*r/(3*math.pi) + (math.pi/gam - gam/(9*math.pi)) * r**4/(4*r/(3*math.pi) * 1./2*math.pi*r**3)\n", "\n", "\t\t\t\n", "#results\n", "print \" Total pressure = %.2f kN\"%(P)\n", "print \"Total pressure location = %.3f m\"%(hp)\n", "\n", "# note : answer is slightly different because of rounding off error. please check." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Total pressure = 2.25 kN\n", "Total pressure location = 0.483 m\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.11 Page No : 65" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "B = 3. \t\t\t#m\n", "b = 2. \t\t\t#m\n", "h1 = 0.75 \t\t\t#m\n", "h2 = 1. \t\t\t#m\n", "sg = 0.9 #specific gravity\n", "\t\t\t\n", "#calculations\n", "IP = sg*9.81*h2\n", "F1 = 0.5*IP*h2\n", "F2 = IP*h1\n", "F3 = 0.5*(9.81*h1)*h1\n", "F = B*(F1+F2+F3)\n", "ybar = (F1*(h1+ 1./3) + F2* h1/2 + F3* h1/3)/(F1+F2+F3)\n", "\t\t\t\n", "#results\n", "print \"Total force = %.2f kN\"%(F)\n", "print \"Location = %.3f m from the base\"%(ybar)\n", "\n", "# note : rounding off error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Total force = 41.39 kN\n", " Location = 0.577 m from the base\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.12 Page No : 67" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "from scipy.integrate import quad\n", "\t\t\t\n", "#Initialization of variables\n", "g = 1000*9.81 \t\t\t#kg/m**3\n", "hc = 20. \t\t\t#m\n", "Ax = 40.*1 \t\t\t#m**2\n", "y1 = 0. \t\t\t#m\n", "y2 = 40. \t\t\t#m\n", "\t\t\t\n", "#calculations\n", "Fx = g*hc*Ax\n", "def fy(y):\n", " return (12*y)**(1./3)\n", "\n", "Fy = quad(fy,y1,y2)\n", "Fy = g*Fy[0]\n", "F = math.sqrt(Fx**2 +Fy**2)\n", "\t\t\t\n", "#results\n", "print \"Net force = %d kN\"%(F/1000)\n", "#The answer is a bit different due to rounding off error in the textbook" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Net force = 8179 kN\n" ] } ], "prompt_number": 17 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.13 Page No : 68" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "g = 9.81 \t\t\t#kN/m**2\n", "hc = 1. \t\t\t#m\n", "l = 3. \t\t\t#m\n", "b = 0.5 \t\t\t#m\n", "\t\t\t\n", "#calculations\n", "Ax = l*b \t\t\t#m**2\n", "Fx = g*hc*Ax\n", "Fz = g*(0.5* math.pi/4 *b**2)*l\n", "F = math.sqrt(Fx**2 + Fz**2)\n", "theta = math.degrees(math.atan(Fz/Fx))\n", "\t\t\t\n", "#results\n", "print \"Magintude of resultant force = %.3f kN\"%(F)\n", "print \" Direction of the resultant force = %.1f deg\"%(theta)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Magintude of resultant force = 14.996 kN\n", " Direction of the resultant force = 11.1 deg\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.14 Page No : 71" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "r1 = 920. \t\t\t#density of ice - kg/m**3\n", "r2 = 1030. \t\t\t#density of sea water - kg/m**3\n", "\t\t\t\n", "#calculations\n", "VtbyV2 = r2/r1\n", "V1byV2 = VtbyV2-1\n", "V1byVt = 1./(1+1/V1byV2)\n", "\t\t\t\n", "#results\n", "print \"fraction = %.3f \"%(V1byVt)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "fraction = 0.107 \n" ] } ], "prompt_number": 19 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.15 Page No : 72" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "d = 3. \t\t\t #diameter of balloon - m\n", "rh1 = 1.19 \t\t\t#density of air - kg/m**3\n", "rh2 = 0.17 \t\t\t#density of helium - kg/m**3 \n", "g = 9.81 \t\t\t#m/s**2\n", "\t\t\t\n", "#calculations\n", "pay = (rh1-rh2)*g*math.pi/6 *d**3\n", "\t\t\t\n", "#results\n", "print \" Pay load = %.2f N\"%(pay)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Pay load = 141.46 N\n" ] } ], "prompt_number": 20 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.16 Page No : 76" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import roots\t\t\t\n", "#calculations\n", "y = [6,-6,1]\n", "z = roots(y)\n", "\t\t\t\n", "#results\n", "print \"For stability, s must be greater than %.2f and less than %.2f and must be less than 1\"%(z[0],z[1])" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For stability, s must be greater than 0.79 and less than 0.21 and must be less than 1\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.17 Page No : 81" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "ax = 1.5 \t\t\t#m/s**2\n", "g = 9.81 \t\t\t#m/s**2\n", "\t\t\t\n", "#calculations\n", "alpha = math.degrees(math.atan(ax/g))\n", "\t\t\t\n", "#results\n", "print \"The interface is inclined at %.f degrees with the horizontal\"%(alpha)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The interface is inclined at 9 degrees with the horizontal\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.18 Page No : 81" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\t\t\n", "#Initialization of variables\n", "d = 10. \t\t\t#diameter - cm\n", "h = 25. \t\t\t#height - cm\n", "hw = 15. \t\t\t#cm\n", "g = 9.81 \t\t\t#m/s**2\n", "\t\t\t\n", "#calculations\n", "z = d**2 *d*2/d**2\n", "w = math.sqrt(z*2*g/(d/2)**2 *100)\n", "N = w/(2*math.pi) *60\n", "\t\t\t\n", "#results\n", "print \"Speed of rotation = %d rpm\"%(N)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Speed of rotation = 378 rpm\n" ] } ], "prompt_number": 24 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.19 Page No : 82" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "from scipy.integrate import quad\n", "\t\t\t\n", "#Initialization of variables\n", "dia = 1. \t\t\t#diameter - m\n", "h = 3. \t\t\t #height - m\n", "rho = 1000. \t\t#kg/m**3\n", "N = 80. \t\t\t#rpm\n", "g = 9.81 \t\t\t#m/s**2\n", "\n", "#calculation\n", "w = 2*math.pi*N/60\n", "def fun(r):\n", " return 0.5*rho*w**2 *r**3 *2*math.pi\n", "\n", "vec = quad(fun,0,dia/2)\n", "Pt = vec[0] + math.pi/4 *dia**2 *(h-dia)*rho*g\n", "\t\t\t\n", "#results\n", "print \"Total pressure on base = %.2f kN\"%(Pt/1000)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Total pressure on base = 18.85 kN\n" ] } ], "prompt_number": 15 } ], "metadata": {} } ] }