{
 "metadata": {
  "name": "",
  "signature": "sha256:544ece9b951b876154e126766a7294917ced3584a3b83e52cd96ba339ae7b10b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Orifices"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1 Page No : 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Do = 25.;\t\t\t#mm\n",
      "Dc = 20.;\t\t\t#mm\n",
      "H = 85.;\t\t\t#mm\n",
      "x = 335.;\t\t\t#mm\n",
      "y = 350.;\t\t\t#mm\n",
      "\n",
      "# Calculations and Results\n",
      "a = math.pi/4*Do**2;\t\t\t#m**2\n",
      "ac = math.pi/4*Dc**2;\t\t\t#m**2\n",
      "Cc = ac/a;\n",
      "print \"Coefficient of contraction : \",Cc\n",
      "\n",
      "Cv = math.sqrt(x**2/4/H/y);\n",
      "print \"Coefficient of velocity : %.3f\"%Cv\n",
      "\n",
      "Cd = Cc*Cv;\n",
      "print \"Coefficient of discharge : %.2f\"%Cd\n",
      "\n",
      "Cr = (1/Cv**2-1);\n",
      "print \"Coefficient of Resistance : %.2f\"%Cr\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of contraction :  0.64\n",
        "Coefficient of velocity : 0.971\n",
        "Coefficient of discharge : 0.62\n",
        "Coefficient of Resistance : 0.06\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2 Page No : 179"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "Do = 0.125;\t\t\t#m\n",
      "H = 10.5;\t\t\t#mm\n",
      "Q = 6500.;\t\t\t#litres/minute\n",
      "Q = Q/60./1000;\t\t\t#cumec\n",
      "x = 6.;\t\t\t#m\n",
      "y = 1.;\t\t\t#m\n",
      "g = 9.81;\t\t\t#gravity consmath.tant\n",
      "\n",
      "# Calculations and Results\n",
      "a = math.pi/4*Do**2;\t\t\t#m**2\n",
      "Qth = a*math.sqrt(2*g*H);\t\t\t#cumec\n",
      "Cd = Q/Qth;\t\t\t#\n",
      "print \"Coefficient of discharge : %.2f\"%Cd\n",
      "Cv = math.sqrt(x**2/4/H/y);\n",
      "print \"Coefficient of velocity : %.3f\"%Cv\n",
      "\n",
      "Cc = Cd/Cv;\n",
      "print \"Coefficient of contraction : %.3f\"%Cc\n",
      "\n",
      "Cr = (1/Cv**2-1);\n",
      "print \"Coefficient of Resistance : %.3f\"%Cr\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of discharge : 0.62\n",
        "Coefficient of velocity : 0.926\n",
        "Coefficient of contraction : 0.664\n",
        "Coefficient of Resistance : 0.167\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3 Page No :  181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "h = 102.;\t\t\t#mm\n",
      "H = 105.;\t\t\t#mm\n",
      "\n",
      "# Calculations\n",
      "Cv = math.sqrt(2*g*h)/math.sqrt(2*g*H);\n",
      "\n",
      "# Results\n",
      "print \"Coefficient of velocity : %.2f\"%Cv\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of velocity : 0.99\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4 Page No :  181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\t\t\t\n",
      "# Variables :\n",
      "Q = 180./62;\t\t\t#litres/sec\n",
      "Q = Q/1000;\t\t\t#cumec\n",
      "Dc = 25./1000;\t\t\t#m\n",
      "H = 1.9;\t\t\t#m\n",
      "\n",
      "# Calculations\n",
      "ac = math.pi/4*Dc**2;\t\t\t#m**2\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cv = Q/math.sqrt(2*g*H)/ac;\n",
      "\n",
      "# Results\n",
      "print \"Coefficient of velocity : %.2f\"%Cv\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of velocity : 0.97\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5 Page No : 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "d = 30./1000;\t\t\t#meter\n",
      "wl = 2;\t\t\t#kgm\n",
      "w1 = 148.6/60;\t\t\t#kg/sec\n",
      "y = 1.65;\t\t\t#meter\n",
      "H = 1.3;\t\t\t#meter\n",
      "\n",
      "# Calculations and Results\n",
      "Cv = wl/w1/y*math.sqrt(g)/math.sqrt(2*H);\n",
      "print \"Coefficient of velocity : %.3f\"%Cv\n",
      "\n",
      "Q = w1/1000;\t\t\t#Cumec\n",
      "a = math.pi/4*d**2;\t\t\t#meter**2\n",
      "Qth = a*math.sqrt(2*g*H);\t\t\t#Cumec\n",
      "Cd = Q/Qth;\t\t\t#coeff. of discharge\n",
      "print \"Coefficient of discharge : %.3f\"%Cd\n",
      "\n",
      "Cc = Cd/Cv;\t\t\t#coeff. of contraction\n",
      "print \"Coefficient of contraction : %.3f\"%Cc\n",
      "\n",
      "#Answer in the book are not accurate.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of velocity : 0.951\n",
        "Coefficient of discharge : 0.694\n",
        "Coefficient of contraction : 0.730\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6 Page No : 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "a = 9*10**-4;\t\t\t#m**2\n",
      "H = 3;\t\t\t#meter\n",
      "x = 2.5;\t\t\t#meter\n",
      "y = 54./100;\t\t\t#meter\n",
      "Qactual = 250*10**-3/60;\t\t\t#Cumec\n",
      "\n",
      "# Calculations and Results\n",
      "Qth = a*math.sqrt(2*g*H);\t\t\t#Cumec\n",
      "Cd = Qactual/Qth;\t\t\t#coeff. of discharge\n",
      "print \"Coefficient of discharge : %.3f\"%Cd\n",
      "\n",
      "Cv = math.sqrt(x**2)/math.sqrt(4*H*y);\t\t\t#velocity\n",
      "print \"Coefficient of velocity : %.3f\"%Cv\n",
      "\n",
      "Cc = Cd/Cv;\t\t\t#coeff. of contraction\n",
      "print \"Coefficient of contraction : %.3f\"%Cc\n",
      "\n",
      "#Answer in the book are not accurate.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of discharge : 0.603\n",
        "Coefficient of velocity : 0.982\n",
        "Coefficient of contraction : 0.614\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7 Page No : 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "d = 20./1000;\t\t\t#meter\n",
      "a = math.pi/4*d**2;\t\t\t#m**2\n",
      "H = 1;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "Qactual = 0.85*10**-3;\t\t\t#m**3/sec\n",
      "v = math.sqrt(2*g*H);\t\t\t#m/sec\n",
      "Qth = a*v;\t\t\t#Cumec\n",
      "Cd = Qactual/Qth;\t\t\t#coeff. of discharge\n",
      "\n",
      "# Results\n",
      "print \"Coefficient of discharge : %.2f\"%Cd\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of discharge : 0.61\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8 Page No : 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "d = 1.5;\t\t\t#meter\n",
      "h = 1.;\t\t\t#meter\n",
      "Volume = math.pi/4*d**2*h;\t\t\t#m**3\n",
      "time = 25.;\t\t\t#sec\n",
      "Qactual = Volume/time;\t\t\t#Cumec\n",
      "H = 10.;\t\t\t#meter\n",
      "do = 10./100;\t\t\t#meter\n",
      "x = 4.3;\t\t\t#meter\n",
      "y = 0.5;\t\t\t#meter\n",
      "\n",
      "# Calculations and Results\n",
      "ao = math.pi/4*do**2;\t\t\t#m**2\n",
      "Qth = ao*math.sqrt(2*g*H);\t\t\t#cumec\n",
      "Cd = Qactual/Qth;\t\t\t#Coeff. ofdischarge\n",
      "print \"Coefficient of discharge : %.3f\"%Cd\n",
      "\n",
      "Cv = math.sqrt(x**2)/math.sqrt(4*H*y);\t\t\t#Coefficient of velocity\n",
      "print \"Coefficient of velocity : %.3f\"%Cv\n",
      "\n",
      "Cc = Cd/Cv;\t\t\t#coeff. of contraction\n",
      "print \"Coefficient of contraction : %.2f\"%Cc\n",
      "\n",
      "Cr_dash = (1/Cv**2-1);\t\t\t#coeff. of Resistance\n",
      "print \"Coefficient. of Resistance : %.2f\"%Cr_dash\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of discharge : 0.643\n",
        "Coefficient of velocity : 0.962\n",
        "Coefficient of contraction : 0.67\n",
        "Coefficient. of Resistance : 0.08\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9 Page No : 187"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "do = 2.5/100;\t\t\t#meter\n",
      "H = 75./100;\t\t\t#meter\n",
      "x = 30./100;\t\t\t#meter\n",
      "y = 3.2/100;\t\t\t#meter\n",
      "\n",
      "# Calculations and Results\n",
      "Qactual = 1.186*10**-3;\t\t\t#Cumec\n",
      "ao = math.pi/4*do**2;\t\t\t#m**2\n",
      "Qth = ao*math.sqrt(2*g*H);\t\t\t#cumec\n",
      "Cd = Qactual/Qth;\t\t\t#Coeff. ofdischarge\n",
      "print \"Coefficient of discharge : %.2f\"%Cd\n",
      "\n",
      "Cv = math.sqrt(x**2)/math.sqrt(4*H*y);\t\t\t#Coefficient of velocity\n",
      "print \"Coefficient of velocity : %.4f\"%Cv\n",
      "\n",
      "Cc = Cd/Cv;\t\t\t#coeff. of contraction\n",
      "print \"Coefficient of contraction : %.3f\"%Cc\n",
      "\n",
      "Cr_dash = (1/Cv**2-1);\t\t\t#coeff. of Resistance\n",
      "print \"Coefficient. of Resistance : %.3f\"%Cr_dash\n",
      "\n",
      "#Answers in the book are not accurate.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Coefficient of discharge : 0.63\n",
        "Coefficient of velocity : 0.9682\n",
        "Coefficient of contraction : 0.651\n",
        "Coefficient. of Resistance : 0.067\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.10 Page No : 187"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "H1 = 4-1;\t\t\t#meter\n",
      "H2 = 4.;\t\t\t#meter\n",
      "Cv1 = 0.9;\t\t\t#Coefficient of velocity\n",
      "Cv2 = 0.9;\t\t\t#Coefficient of velocity\n",
      "\n",
      "# Calculations\n",
      "#Cv1 = Cv2 & x1 = x2 at meeting point\n",
      "#x1/math.sqrt(4*H1*y1) = x2/math.sqrt(4*H2*y2)\n",
      "y1BYy2 = H2/H1;\n",
      "#y1 = 1+y2;\n",
      "y2 = 1/(y1BYy2-1);\t\t\t#meter\n",
      "y1 = y1BYy2*y2;\t\t\t#meter\n",
      "x1 = Cv1*math.sqrt(4*H1*y1);\t\t\t#meter\n",
      "\n",
      "# Results\n",
      "print \"Meeting point horizontal & vertical co-ordinates are(x1 & y1 in meter) : %.2f\"%x1,y1\n",
      "\n",
      "#Answer in the book are not accurate.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Meeting point horizontal & vertical co-ordinates are(x1 & y1 in meter) : 6.24 4.0\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.11 Page No : 191"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "B = 1.3;\t\t\t#meter\n",
      "H1 = 6-(1.8+1.5);\t\t\t#meter\n",
      "H2 = 6-1.5;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "Q = 2./3*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2));\t\t\t#m**3/sec\n",
      "\n",
      "# Results\n",
      "print \"Discharge through the orifice in m**3/sec : %.4f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge through the orifice in m**3/sec : 11.7685\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.12 Page No :  192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cd = 0.62;\t\t\t#Coefficient of discharge\n",
      "B = 2.;\t\t\t#meter\n",
      "H1 = 3.;\t\t\t#meter\n",
      "H2 = 3+1.5;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "Q = 2./3*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2));\t\t\t#m**3/sec or cumec\n",
      "\n",
      "# Results\n",
      "print \"Discharge through the orifice in cumec : %.3f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge through the orifice in cumec : 15.928\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.13 Page No : 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "B = 1.6;\t\t\t#meter\n",
      "H1 = 1500./1000;\t\t\t#meter\n",
      "H2 = (1500.+1250)/1000;\t\t\t#meter\n",
      "\n",
      "# Calculations and Results\n",
      "Q = 2./3*Cd*B*math.sqrt(2*g)*(H2**(3./2)-H1**(3./2));\t\t\t#m**3/sec or cumec\n",
      "print \"Discharge through the opening in cumec : %.3f\"%Q\n",
      "\t\t\t#For small opening\n",
      "H = 1.5+1.25/2;\t\t\t#meter\n",
      "D = 1.25;\t\t\t#meter\n",
      "Qdash = Cd*(B*D)*math.sqrt(2*g*H);\t\t\t#cumec\n",
      "Error = (Qdash-Q)/Q*100;\t\t\t#%\n",
      "print \"%% of error : %.3f\"%Error\n",
      "\n",
      "#Answer is wrong in the book.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge through the opening in cumec : 7.720\n",
        "% of error : 0.368\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.14 Page No : 195"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "B = 1600./1000;\t\t\t#meter\n",
      "D = 1250./1000;\t\t\t#meter\n",
      "ao = 1.6*1.25;\t\t\t#m**2\n",
      "H1 = 2+1.25/2;\t\t\t#meter\n",
      "H2 = 0.8+1.25/2;\t\t\t#meter\n",
      "H = H1-H2;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "Q = Cd*ao*math.sqrt(2*g*H);\t\t\t#m**3/sec or Cumec\n",
      "\n",
      "# Results\n",
      "print \"Discharge in Cumec : %.3f\"%Q\n",
      "\n",
      "#Answer is wrong in the book.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge in Cumec : 5.823\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.15 Page No : 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "B = 1600./1000;\t\t\t#meter\n",
      "D = 1250./1000;\t\t\t#meter\n",
      "ao = 1.6*1.25;\t\t\t#m**2\n",
      "H1 = 2+1.25;\t\t\t#meter\n",
      "H2 = 2;\t\t\t#meter\n",
      "H = H1-0.8;\t\t\t#meter\n",
      "\n",
      "# Calculations\n",
      "Q = 2./3*Cd*B*math.sqrt(2*g)*(H**(3./2)-H2**(3./2))+Cd*B*(H1-H)*math.sqrt(2*g*H);\t\t\t#m**3/sec or Cumec\n",
      "\n",
      "# Results\n",
      "print \"Discharge through the orifice in Cumec : %.2f\"%Q\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Discharge through the orifice in Cumec : 8.18\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.16 Page No : 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "d = 4;\t\t\t#meter\n",
      "d0 = 0.5;\t\t\t#meter\n",
      "H1 = 5;\t\t\t#meter\n",
      "H2 = 2;\t\t\t#meter\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "ao = math.pi/4*d0**2;\t\t\t#m**2\n",
      "A = math.pi/4*d**2;\t\t\t#m**2\n",
      "\n",
      "# Calculations and Results\n",
      "t = 2*A/Cd/ao/math.sqrt(2*g)*(math.sqrt(H1)-math.sqrt(H2))\n",
      "print \"Time taken to fall from 5m to 2m(in seconds) : %.1f\"%t\n",
      "\t\t\t#For emptying H2 = 0;\n",
      "H2 = 0;\t\t\t#meter\n",
      "t = 2*A/Cd/ao/math.sqrt(2*g)*(math.sqrt(H1)-math.sqrt(H2))\n",
      "print \"Time taken for completely emptying(in seconds) : %.1f\"%t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken to fall from 5m to 2m(in seconds) : 39.6\n",
        "Time taken for completely emptying(in seconds) : 107.7\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.17 Page No : 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "d = 1.2;\t\t\t#meter\n",
      "do = 50./1000;\t\t\t#meter\n",
      "H = 3.;\t\t\t#meter\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "\n",
      "# Calculations\n",
      "ao = math.pi/4*do**2;\t\t\t#m**2\n",
      "A = math.pi/4*d**2;\t\t\t#m**2\n",
      "t = 2*A*math.sqrt(H)/Cd/ao/math.sqrt(2*g);\t\t\t#sec\n",
      "\n",
      "# Results\n",
      "print \"Time taken for emptying the tank is \",math.floor(t/60),\" minute %.1f\"%((t/60-math.floor(t/60))*60),\" seconds.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken for emptying the tank is  12.0  minute 30.8  seconds.\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.18 Page No : 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "A = 3.2;\t\t\t#m**2\n",
      "a = 10*10**-4;\t\t\t#m**2\n",
      "H1 = 5;\t\t\t#meter\n",
      "H2 = 2.5;\t\t\t#meter\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "\n",
      "# Calculations\n",
      "t = 2*A*(math.sqrt(H1)-math.sqrt(H2))/Cd/a/math.sqrt(2*g);\t\t\t#sec\n",
      "\n",
      "# Results\n",
      "print \"Time taken is \",(math.floor(t/60)),\" minute \",round((t/60-math.floor(t/60))*60),\" seconds.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken is  26.0  minute  17.0  seconds.\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.19 Page No : 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "import datetime\n",
      "\t\t\t\n",
      "# Variables :\n",
      "g = 9.81;\t\t\t#consmath.tant\n",
      "A = 3.2;\t\t\t#m**2\n",
      "a = 10*10**-4;\t\t\t#m**2\n",
      "H = 5;\t\t\t#meter\n",
      "Cd = 0.6;\t\t\t#Coefficient of discharge\n",
      "\n",
      "# Calculations\n",
      "t = 2.*A*math.sqrt(H)/Cd/a/math.sqrt(2*g);\t\t\t#sec\n",
      "\n",
      "# Results\n",
      "print \"Time taken is : in hours, minutes, seconds\", datetime.timedelta(seconds=t)\n",
      "#(math.floor(t/3600)),\" hour \",round((t/3600-math.floor(t/3600))*60),\" minute \",(((t/3600-t/3600)*60-(t/3600-t/3600)*60)*60),\" seconds.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken is : in hours, minutes, seconds 1:29:44.733625\n"
       ]
      }
     ],
     "prompt_number": 24
    }
   ],
   "metadata": {}
  }
 ]
}