{
 "metadata": {
  "name": "",
  "signature": "sha256:5e6755c0967514d4a088b6f2680d41d08af3d13ac494e49b4b241d86db6baa26"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2:Properties of Fluids"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2-1, Page Number 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      " \n",
      "#Variable Decleration\n",
      "l=6 #Length in m\n",
      "b=4 #Breadth in m\n",
      "h=5 #Height in m\n",
      "R=0.287 #Gas Constant in kPa.m^3/kg.K\n",
      "P=100 # pressure in kPa\n",
      "T=25 # Temperature in degree Centigrade\n",
      "To=273.15 #Temperature conversion in Kelvin\n",
      "rho_H2O=1000 #Density of water\n",
      "\n",
      "#Calculations\n",
      "rho=P/(R*(T+To)) #Density in kg/m^3\n",
      "SG=rho/rho_H2O #Specific Gravity of Air\n",
      "V=l*b*h #Volume of the room in m^3\n",
      "m=rho*V #mass of air in kg\n",
      "\n",
      "#Results\n",
      "print\"The density of Air is\", round(rho,2), \"kg/m^3\"\n",
      "print\"The Specific Gravity of Air is\",round(SG,5)\n",
      "print\"The mass of air is\",round(m),\"kg\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The density of Air is 1.17 kg/m^3\n",
        "The Specific Gravity of Air is 0.00117\n",
        "The mass of air is 140.0 kg\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2-2, Page Number 42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "T=30 #Temperature in the System in Degree Centigrade\n",
      "#Value from the table for corresponding Temperature\n",
      "P=4.25 #Pressure in kPa\n",
      "\n",
      "#Calculations\n",
      "Pmin=P #Minimum Pressure to avoid Cavitation in kPa\n",
      "\n",
      "#Result\n",
      "print\"The minimum pressure required to avoid cavitation is\",Pmin,\"kPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum pressure required to avoid cavitation is 4.25 kPa\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2-3, Page No:47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#The variables repeat hence a different notation has been used to code the following example\n",
      "#Variable Decleration\n",
      "T1=20 #Temperature of water Initially in Degree Centigrade\n",
      "P1=1 #Pressure initially in atm\n",
      "T2=50 #Temperature of water after heating in Degree Centigrade\n",
      "P2=100 #Pressure after Compression in atm\n",
      "rho=998 # density of water at 1 atm in kg/m^3\n",
      "alpha=4.8*10**-5 #isothermal compressibility of water in atm^-1\n",
      "beta=0.337*10**-3 #Coefficient of volume expansion at avg temp in K^-1\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Part (a)\n",
      "deltarho1=-beta*rho*(T2-T1) #Change in density in kg/m^3\n",
      "rho2a=deltarho1+rho #density of water at 50 degrees in kg/m^3\n",
      "\n",
      "#Part(b)\n",
      "deltarho2=alpha*rho*(P2-P1) #Change in density in kg/m^3\n",
      "rho2b=rho+deltarho2 #density of water at 100atm and 20 degrees in kg/m^3\n",
      "\n",
      "#Result\n",
      "print\"The density changes to\", round(rho2a),\"kg/m^3 when heated to 50 degrees\"\n",
      "print\"The density changes to\",round(rho2b,1),\"kg/m^3 when compressed to 100atm isothermally\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The density changes to 988.0 kg/m^3 when heated to 50 degrees\n",
        "The density changes to 1002.7 kg/m^3 when compressed to 100atm isothermally\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2-4, Page No: 50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "V=200 #Speed of air in m/s\n",
      "T=30 #Temperature in degree centigrade\n",
      "k=1.4 #Specific Heat Ratio\n",
      "R=0.287 #Gas Constant in kJ/kg K\n",
      "To=273.15 #Temperature conversion factor\n",
      "f=1000 #conversion factor in m^2/s^2\n",
      "\n",
      "#Calculations\n",
      "\n",
      "#Part(a)\n",
      "c=(k*R*(T+To)*(f))**0.5 #Speed of sound in m/s\n",
      "\n",
      "#Part(b)\n",
      "Ma=V/c #Mach Number\n",
      "\n",
      "#Result\n",
      "print\"The speed of sound in air at 30degrees is\",round(c),\"m/s\"\n",
      "print\"The mach number is\",round(Ma,3),\" which is subsonic since Ma<1\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The speed of sound in air at 30degrees is 349.0 m/s\n",
        "The mach number is 0.573  which is subsonic since Ma<1\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2-5, Page No:55"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "L=0.4 #Length of viscometer in m\n",
      "T=1.8 #Torque measured in N.m\n",
      "l=0.0015 #Gap between the two cylinders in m\n",
      "R=0.06 #Radius if inner shaft in m\n",
      "ndot=300/60 #speed of the shaft\n",
      "\n",
      "#Calculations\n",
      "mu=(T*l)/(4*pi**2*R**3*ndot*L) #Viscosity in s/m^2\n",
      "\n",
      "#Result\n",
      "print\"The viscosity of the liquid is\",round(mu,3),\"s/m^2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The viscosity of the liquid is 0.158 s/m^2\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2-6, Page No:59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "R=0.3*10**-3 #Radius of glass tube in m\n",
      "sigma_s=0.073 #Surface Tension in water at 20 degrees in N/m\n",
      "phi=0 #Angle made by the water surface in degrees\n",
      "g=9.81 #Acceleration due to gravity in m/s^2\n",
      "rho=1000 #Density of water in kg/m^3\n",
      "\n",
      "#Calculations\n",
      "h_m=(2*sigma_s*cos(phi))/(rho*g*R) #Capillary rise in m\n",
      "h=h_m*100 #Capillary rise in cm\n",
      "\n",
      "#Result\n",
      "print\"The capillary rise is\",round(h),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The capillary rise is 5.0 cm\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No:2.2-7, Page No:60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "rho_water=1000 #Density of water in kg/m^3\n",
      "g=9.81 #Acceleration due to gravity in m/s^2\n",
      "h=0.05 #Capillary Rise in m\n",
      "\n",
      "#Calculations\n",
      "deltaP=(rho_water*g*h)/(1000*100) #Pressure difference in atm\n",
      "\n",
      "#Result\n",
      "print\"The pressure difference is\",round(deltaP,3),\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pressure difference is 0.005 atm\n"
       ]
      }
     ],
     "prompt_number": 23
    }
   ],
   "metadata": {}
  }
 ]
}