{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 : Units and Dimensions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.1 page no : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "# Variables \n",
      "V1 = 15.            #ft**3/min volumetric flow rate\n",
      "ft = 0.3048         #m relationship\n",
      "min = 60.           #secs relationship\n",
      "\n",
      "# Calculation \n",
      "V = V1*ft**3/min;\n",
      "\n",
      "# Result \n",
      "print \"Volumetric flowrate = %.3e m**3/s\"%V\n",
      "D = 1000            #kg/m**3\n",
      "M = V * D;\n",
      "print \"mass flowrate = %.3f kg/s\"%M\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric flowrate = 7.079e-03 m**3/s\n",
        "mass flowrate = 7.079 kg/s\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.2 page no : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables \n",
      "ft = 0.3048;            #m \n",
      "lb = 0.4536;            #kg\n",
      "\n",
      "# Calculation \n",
      "P = ft*lb;\n",
      "\n",
      "# Result \n",
      "print \"1 poundal is 1 ft*lb/s**2 = %.4f N\"%P\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1 poundal is 1 ft*lb/s**2 = 0.1383 N\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.3 page no : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables \n",
      "kgf = 9.80665;          #N KGF\n",
      "\n",
      "# Calculation and Result \n",
      "cm = 10**-2;            #m\n",
      "P = kgf/cm**2;\n",
      "print \"1 kgf/cm**2 = %0.3e N/m**2\"%P\n",
      "lbf = 32.174;           #lb*ft#s**2\n",
      "lb = 0.4535924;         #kg\n",
      "ft = 0.3048;            #m\n",
      "in_ = 0.0254;            #m\n",
      "P1 = lbf*lb*ft/in_**2;\n",
      "print \"1 lbf/in**2 = %.2f N/m**2\"%P1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1 kgf/cm**2 = 9.807e+04 N/m**2\n",
        "1 lbf/in**2 = 6894.75 N/m**2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.4 page no : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables \n",
      "Q1 = 10000.             #kJ/hr rate of heat transfer\n",
      "kJ = 1000.              #J \n",
      "hr = 3600.              #s \n",
      "\n",
      "# Calculation \n",
      "Q = Q1*kJ/hr;           #J/s\n",
      "print \"Q = %.2f J/s\"%Q\n",
      "x = 0.1;                #m\n",
      "A = 1.                  #m**2\n",
      "T = 800.                #K\n",
      "k = x*Q/(A*T);\n",
      "\n",
      "# Result \n",
      "print \"thermal conductivity = %.3f W/(m*k)\"%k\n",
      "J = 1/4.1868            #cal\n",
      "k1 = k*J*hr/1000\n",
      "print \"thermal conductivity = %.3F kcal/(h*m*C)\"%k1\n",
      "\n",
      "# note : answers may vary because of rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Q = 2777.78 J/s\n",
        "thermal conductivity = 0.347 W/(m*k)\n",
        "thermal conductivity = 0.299 kcal/(h*m*C)\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.5 page no : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables \n",
      "F = 300.                #N weight of object\n",
      "a = 9.81;               #m/s**2 gravity\n",
      "\n",
      "# Calculation \n",
      "m = F/a;                #kg\n",
      "\n",
      "# Result \n",
      "print \"mass in kg = %.2f kg\"%m\n",
      "lb = 4.535924/10;       #kG\n",
      "m1 = m/lb\n",
      "print \"mass in pounds = %.2f LB\"%m1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mass in kg = 30.58 kg\n",
        "mass in pounds = 67.42 LB\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.6 page no : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables \n",
      "z = 15.                 #m height\n",
      "PE = 2000.;             #J potential energy\n",
      "g = 9.8067;             #m/s**2 \n",
      "\n",
      "# Calculation \n",
      "m = PE/(z*g);\n",
      "\n",
      "# Result \n",
      "print \"mass = %.3f kg\"%m\n",
      "v = 50;                 #m/s\n",
      "KE = 1./2*m*(v**2)/1000.;\n",
      "print \"kinetic energy = %.3f kj\"%KE\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mass = 13.596 kg\n",
        "kinetic energy = 16.995 kj\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.7 page no : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables \n",
      "g = 9.81;                   #m/s**2 gravity\n",
      "m = 100 * 0.4536;           #kg     weight  \n",
      "P = 101325.;                #N/m**2  standard atomosphere\n",
      "D1 = 4.;                    #inch\n",
      "\n",
      "# Calculation \n",
      "D = D1 * 2.54 * 10**-2;     #m\n",
      "A = 3.1415 * (D**2)/4;      #m**2\n",
      "F1 = P * A;                 #N\n",
      "F2 = m * g;                 #N\n",
      "F = F1 + F2;\n",
      "\n",
      "# Result \n",
      "print \"Total force acting on the gas = %.2f N\"%F\n",
      "P1 = F / A;                 #N/m**2\n",
      "P2 = P1/100000.;            #bar\n",
      "P3 = P1/(6.894757 * 10**3); #psi\n",
      "print \"Pressure in N/m**2 = %.3e N/m**2\"%P1\n",
      "print \"Pressure in bar = %.3f bar\"%P2\n",
      "print \"Pressure in psi = %.2f psi\"%P3\n",
      "d = 0.4;                    #m\n",
      "W = F * d;\n",
      "print \"Work done = %.2f J\"%W\n",
      "PE = m * g * d;\n",
      "print \"Change in potential energy = %.2f J\"%PE\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total force acting on the gas = 1266.43 N\n",
        "Pressure in N/m**2 = 1.562e+05 N/m**2\n",
        "Pressure in bar = 1.562 bar\n",
        "Pressure in psi = 22.66 psi\n",
        "Work done = 506.57 J\n",
        "Change in potential energy = 177.99 J\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.8 page no : 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables \n",
      "#kG = (6.7 * 10**-4) * (( G * (ds + dt) / ds)**0.8) / ((ds**0.4)*(dG**0.2))\n",
      "\n",
      "#kG - lbmol/(h ft**2 atm), G - lb/(ft**2 h), ds, dG, dt - feet\n",
      "#kG1 - kmol/(m**2 h atm), G1 - kg/(m**2 h), ds1, dG1, dt1 - m\n",
      "G = 0.2048;             #G1 * lb/(ft**2 h)  velocity\n",
      "d = 3.2808;             #d1 * ft   clearance between grids\n",
      "ds = d;                 # clearance between grids\n",
      "dt = d;                 # clearance between grids\n",
      "dG = d;                 # clearance between grids\n",
      "kG = 4.885;             #kG1 (lbmol/(h ft**2 atm) = 4.885 * kmol/(m**2 h atm))\n",
      "\n",
      "# Calculation \n",
      "C = (6.7 * 10**-4) * (( G * d / ds)**0.8) / ((ds**0.4)*(dG**0.2))* kG;\n",
      "\n",
      "# Result \n",
      "print \"Co-efficient = %.2e (kmol)(kg)**-0.8 (m)**0.2 (h)**-0.2 (atm)**-1\"%C\n",
      "# this is the constant for the equation\n",
      "# the equation thus becomes,\n",
      "# kG1 = C * (( G1 * (ds1 + dt1) / ds1)**0.8) / ((ds1**0.4)*(dG1**0.2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Co-efficient = 4.51e-04 (kmol)(kg)**-0.8 (m)**0.2 (h)**-0.2 (atm)**-1\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2.9 page no : 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from sympy import Symbol\n",
      "\n",
      "# Variables \n",
      "#Cp = 7.13 + 0.577 * (10**-3) * t + 0.0248 * (10**-6) * t**2 \n",
      "\n",
      "#Cp - Btu/lb-mol F, t - F\n",
      "#Cp1 - kJ/kmol K , t1 - K\n",
      "a = 7.13                          # first term\n",
      "b = 0.577 * 10**-3                # second term\n",
      "c = 0.0248 * 10**-6               # third term\n",
      "#t = 1.8 * t1 - 459.67\n",
      "Cp = 4.1868;            #Cp1 (Btu/lb-mol F = 4.1868 * (kJ/kmol K) )\n",
      "t = Symbol('T')\n",
      "#substituting the above, we get,\n",
      "#Cp1 = 28.763 + 4.763 * (10**-3) * t1 + 0.3366 * (10**-6) * t**2\n",
      "a1 = 28.763\n",
      "\n",
      "# Calculation \n",
      "b1 = 4.763 * (10**-3)\n",
      "c1 = 0.3366 * (10**-6)\n",
      "\n",
      "Cp = a1 + b1*t + c1*t**2\n",
      "# Result \n",
      "print \"a1 = \",a1\n",
      "print \"b1 = \",b1\n",
      "print \"c1 = \",c1\n",
      "# this are the co efficents for the following equation;\n",
      "# Cp1 = a1 + b1 * t1 + c1 * (t1)**2\n",
      "print \"Equation Cp = \",Cp"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a1 =  28.763\n",
        "b1 =  0.004763\n",
        "c1 =  3.366e-07\n",
        "Equation Cp =  3.366e-7*T**2 + 0.004763*T + 28.763\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}