{
 "metadata": {
  "name": "",
  "signature": "sha256:8b08667e1cca98a07d013ad939243dc9add7485e8e9e19c3e7221c1a62e2d3d1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 : Fluid Measurements"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1 Page No : 417"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "P1 = 10. \t#psia\n",
      "Q = 0.6 \t#cfs\n",
      "A1 = 0.0491 #ft**2\n",
      "g = 32.2\n",
      "V = 39.2\t#fps\n",
      "A0 = 0.0218 #ft**2\n",
      "d1 = 2. \t#in\n",
      "d2 = 3. \t#in\n",
      "\t\n",
      "#calculations\n",
      "Phead = P1*144/62.4\n",
      "V1 = Q/A1\n",
      "V2i =  math.sqrt(2*g*(Phead + V1**2 /(2*g)))\n",
      "Cv = V/V2i\n",
      "A2 = Q/V\n",
      "Cc = A2/A0\n",
      "Cd = Cc*Cv\n",
      "hL = (1/Cv**2 -1)*(1- (d1/d2)**4)*V**2 /(2*g)\n",
      "\t\n",
      "#Results\n",
      "print \" Cc  =  %.2f \"%(Cc)\n",
      "print \" Cd =  %.2f\"%(Cd)\n",
      "print \" Cv =  %.2f\"%(Cv)\n",
      "print \" Head loss  =  %.2f ft\"%(hL)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Cc  =  0.70 \n",
        " Cd =  0.68\n",
        " Cv =  0.97\n",
        " Head loss  =  1.23 ft\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2 Page No : 425"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "d = 2.  \t#in\n",
      "g = 32.2\n",
      "d1 = 3. \t#in\n",
      "k = 1.06\n",
      "\t\n",
      "#calculations\n",
      "A2 = math.pi/4 *d**2 /144\n",
      "dp = d/12\n",
      "Q = k*A2*math.sqrt(2*g*dp)\n",
      "A = math.pi/4 *(d1/12)**2\n",
      "V1 = Q/A\n",
      "K2 = 1.04\n",
      "Q2 = K2/k *Q\n",
      "\t\n",
      "#Results\n",
      "print \"Flow rate  =  %.4f cfs\"%(Q2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Flow rate  =  0.0743 cfs\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3 Page No : 428"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "P1 = 700. \t#kN/m**2\n",
      "P2 = 400. \t#kN/m**2\n",
      "D2 = 12.5 \t#cm\n",
      "D1 = 25. \t#cm\n",
      "C = 0.985\n",
      "g = 9.81\n",
      "R = 287. \t#m**2/s**2 K\n",
      "T = 273.+20 \t#K\n",
      "\t\n",
      "#calculations\n",
      "Pr = P2/P1\n",
      "Dr = D2/D1\n",
      "Y = 0.72\n",
      "gam1 = P1*g/(R*T)\n",
      "G = C*Y*math.pi/4 *(D2/100)**2 *math.sqrt(2*g*gam1*(P1-P2)/(1- Dr**4))\n",
      "\t\n",
      "#Results\n",
      "print \"Weight flow rate  =  %.4f kN/s\"%(G)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Weight flow rate  =  0.1971 kN/s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.4 Page No : 432"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\n",
      "#Initialization of variables\n",
      "V = 3. \t#fps\n",
      "y = 1. \t#ft\n",
      "L = 4. \t#ft\n",
      "\t\n",
      "#calculations\n",
      "H =  (V*y/3.33)**(2./3)\n",
      "P = L-H\n",
      "\t\n",
      "#Results\n",
      "print \"Height of weir  =  %.2f ft\"%(P)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Height of weir  =  3.07 ft\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}