{
 "metadata": {
  "name": "",
  "signature": "sha256:a18675a96e26e95bc119a7095e6c5f784a91bb484f337fa10d53e05acf798c32"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9 : Potential Flow"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4 Page No : 339"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "#Initialization of variables\n",
      "k = 1.5\n",
      "r = 40. \t    \t\t#cm\n",
      "theta = 45. \t\t\t#degrees\n",
      "\t\t\t\n",
      "#calculations\n",
      "vr =  -2*k*r*math.cos(math.radians(2*theta))\n",
      "vt =  2*k*r*math.sin(math.radians(2*theta))\n",
      "\t\t\t\n",
      "#results\n",
      "print \"velocity in radial direction  =  %d cm/s\"%(vr)\n",
      "print \" velcoity in angular direction  =  %d cm/s\"%(vt)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "velocity in radial direction  =  0 cm/s\n",
        " velcoity in angular direction  =  120 cm/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.14 Page No : 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "#Initialization of variables\n",
      "T = 4.5                 #m^2/s\n",
      "a = 0.6                 #diameter - m\n",
      "u = 5. \t\t        \t#velocity - m/s\n",
      "rho = 1000. \t\t\t#kg/m**3\n",
      "\t\t\t\n",
      "#calculations\n",
      "sint = 0.5*(1- T/(2*math.pi*a*u))\n",
      "theta =  math.degrees(math.asin((sint)))\n",
      "dp =  0.5*rho*u**2 *(1 - (2 + T/(2*math.pi*a*u))**2)\n",
      "\t\t\t\n",
      "#results\n",
      "print \"Angle  =  %.1f or %.1f degrees\"%(theta,180-theta)\n",
      "print \" Min guage pressure  =  %.2f kN/m**2\"%(dp/1000)\n",
      "\n",
      "#The answer in textbook is wrong. please check"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Angle  =  22.4 or 157.6 degrees\n",
        " Min guage pressure  =  -50.15 kN/m**2\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.15 Page No : 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\n",
      "#Initialization of variables\n",
      "T = 6*math.pi\n",
      "r = 1./3\n",
      "\t\t\t\n",
      "#calculations\n",
      "vab = T/(4*math.pi)\n",
      "vba =  T/(2*math.pi)\n",
      "w = vab/r\n",
      "\t\t\t\n",
      "#results\n",
      "print \"rate of rotation  =  %.1f rad/s\"%(w)\n",
      "print \"speed of A by B  =  %.1f m/s\"%(vab)\n",
      "print \"speed of B by A  =  %.1f m/s\"%(vba)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rate of rotation  =  4.5 rad/s\n",
        "speed of A by B  =  1.5 m/s\n",
        "speed of B by A  =  3.0 m/s\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}