{
 "metadata": {
  "name": "",
  "signature": "sha256:55c55de869585c95b66b35484f9ada77cb90e10b18096bd3c44fa78bdf53f425"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : Work and Heat Transfer"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1 Page No : 57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "V1 = 100.; \t\t\t# Initial velocity in m/s\n",
      "g = 9.81; \t\t\t# Acceleration due to gravity in m/s2\n",
      "z1 = 100.; \t\t\t# Initial elevation in m\n",
      "\n",
      "# Calculation\n",
      "V = math.sqrt(((2*g*z1)+(V1)**2)); \t\t\t# Final velocity in m/s2\n",
      "\n",
      "# Results\n",
      "print \"The velocity of the object just before ir hits the ground is %.1f m/s\"%V\n",
      "\n",
      "# note : incorrect answer in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of the object just before ir hits the ground is 109.4 m/s\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2 Page No : 57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "dV = 0.5; \t\t\t# Change in volume in m3\n",
      "P = 101.325e03; \t\t\t# Atmospheric pressure in N/m2\n",
      "\n",
      "# Calculation\n",
      "Wd = P*dV; \t\t\t# Work done in J\n",
      "\n",
      "# Results\n",
      "print \"The amount of work done upon the atmosphere by the ballon is %.2f kJ\"%(Wd/1000)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amount of work done upon the atmosphere by the ballon is 50.66 kJ\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3 Page No : 58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "dV = 0.6; \t\t\t# Change in volume in m3\n",
      "P = 101.325e03; \t# Atmospheric pressure in N/m2\n",
      "\n",
      "# Calculation\n",
      "Wd = P*dV; \t\t\t# Work done in J\n",
      "\n",
      "# Results\n",
      "print \"The print lacement work done by the air is %.1f KJ\"%(Wd/1000)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The print lacement work done by the air is 60.8 KJ\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4 Page No : 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "T = 1.275e-03; \t\t\t# Torque acting against the fluid in N\n",
      "N = 10000.; \t\t\t# Number of revolutions\n",
      "W1 = 2*math.pi*T*N; \t\t\t# Work done by stirring device upon the system\n",
      "P = 101.325e03; \t\t\t# Atmospheric pressure in N/m2\n",
      "d = 0.6; \t\t\t# Piston diameter in m\n",
      "\n",
      "# Calculation\n",
      "A = (math.pi/4.)*(d)**2; \t\t\t# Piston area in m\n",
      "L = 0.80; \t\t\t        # Displacement of diameter in m\n",
      "W2 = (P*A*L)/1000.; \t\t\t# Work done by the system on the surroundings i KJ\n",
      "W = -W1+W2; \t\t\t# Net work tranfer for the system\n",
      "\n",
      "# Results\n",
      "print \"The Net work tranfer for the system is %.1f KJ\"%W\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Net work tranfer for the system is -57.2 KJ\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5 Page No : 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "ad = 5.5e-04; \t\t\t# Area of indicator diagram\n",
      "ld = 0.06; \t\t\t# Length of diagram\n",
      "k = 147e06; \t\t\t# Spring consmath.tant in MPa/m\n",
      "w = 150.; \t\t\t# Speed of engine\n",
      "L = 1.2 ; \t\t\t# Stroke of piston\n",
      "d = 0.8; \t\t\t# Diameter of the cylinder in m\n",
      "\n",
      "# Calculation\n",
      "A = (math.pi/4)*(0.8**2); \t\t\t# Area of cylinder\n",
      "Pm = (ad/ld)*k; \t\t\t# Effective pressure\n",
      "W1 = Pm*L*A*w; \t\t\t# Work done in 1 minute\n",
      "W = (12*W1)/60; \t\t\t# The rate of work transfer gas to the piston in MJ/s\n",
      "\n",
      "# Results\n",
      "print \"The rate of work transfer gas to the piston is %.0f kw\"%(round(W/1000,-2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rate of work transfer gas to the piston is 24400 kw\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6 Page No : 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Tm = 1535.; \t\t\t# Melting point of iron on degree\n",
      "Ti = 15.; \t\t\t# Initial temperature\n",
      "Tf = 1650.; \t\t\t# Final temperature\n",
      "Lh = 270.e03; \t\t\t# Latent heat of iron in J/Kg\n",
      "ml = 29.93; \t\t\t# Atomic weight of iron in liquid state\n",
      "m = 56.; \t\t\t# Atomoc weight of iron\n",
      "sh = 0.502e03; \t\t\t# Specific heat of iron in J/Kg\n",
      "d = 6900.; \t\t\t# Density of molten metal in kg/m3\n",
      "\n",
      "# Calculation and Results\n",
      "H = (Tm-Ti)*sh + Lh + (ml/m)*(Tf-Tm)*1000; \t\t\t# Heat required\n",
      "Mr = 5e03;      \t    \t\t# Melting rate in Kg/h\n",
      "Hr = H*Mr ; \t    \t    \t# Rate of heat suppy\n",
      "HrA = Hr/(0.7*3600) \t\t\t# Actual rate of heat supply\n",
      "print \"Rating of furnace would be %.2e\"%HrA,\"W\"\n",
      "\n",
      "V = (3*Mr)/d;                   \t\t\t# Volume required in m3\n",
      "d = ((V/2.)*(4/math.pi))**(1./3); \t\t\t# Diameter of cylinder of furnace in m\n",
      "l = 2*d; \t\t\t                        # Length of cylinder of furnace in m\n",
      "print \" Length of cylinder of furnace is %.2f m\"%l\n",
      "\n",
      "# rounding off error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rating of furnace would be 2.17e+06 W\n",
        " Length of cylinder of furnace is 2.23 m\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7 Page No : 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "SH = 0.9;   \t\t\t# Specific heat of alluminium in solid state \n",
      "L = 390.; \t    \t\t# Latent heat\n",
      "aw = 27.; \t\t    \t# Atomic weight\n",
      "D = 2400.; \t\t\t    # Density in molten state\n",
      "Tf = 700.+273; \t\t\t# Final temperature\n",
      "Tm = 660.+273; \t\t\t# Melting point of aluminium\n",
      "Ti = 15.+273; \t\t\t# Intial temperature\n",
      "\n",
      "# Calculation\n",
      "HR = round(SH*(Tm-Ti)+L+(29.93/27)*(Tf-Tm),1); \t\t\t# Heat requires\n",
      "HS = round(HR/0.7,1) ; \t\t\t# Heat supplied\n",
      "RM = 217*1000*3600/HS ; \t\t\t# From the data of problem 3.7\n",
      "V = 2.18; \t\t\t# Volume\n",
      "M = V*D;\n",
      "\n",
      "# Results\n",
      "print \"Mass of alluminium that can be melted is %.2f\"%(M/1000),\"tonnes\"\n",
      "print \"Rate at which alluminium can be melted is %.2f\"%(RM/100000),\"tonnes/h\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of alluminium that can be melted is 5.23 tonnes\n",
        "Rate at which alluminium can be melted is 5.39 tonnes/h\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8 Page No : 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "dd = 60e-06;\n",
      "mw = 1.;\n",
      "st = 0.07;\n",
      "dw = 1000.;\n",
      "dp = 15e-03;\n",
      "\n",
      "# Calculation\n",
      "N = (mw*6)/(math.pi*dd**3*dw);\n",
      "Af = math.pi*dd**2*N;\n",
      "S_L = 4/(dp*dw);\n",
      "W = st*(100-S_L);\n",
      "\n",
      "# Results\n",
      "print \"Work done during automization is %.2f J\"%W\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done during automization is 6.98 J\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9 Page No : 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "dc = 40e-02;\n",
      "L = 30e-02;\n",
      "P = 1e05; \t\t\t# Pressure in Pascal\n",
      "I = 0.5;\n",
      "V = 24.;\n",
      "t = 15.*60; \t\t\t# in seconds\n",
      "\n",
      "# Calculation\n",
      "Wm = V*I*t;\n",
      "Ws = 0.9*Wm;\n",
      "W = P*(math.pi/4)*dc**2*L;\n",
      "\n",
      "# Results\n",
      "print \"Work input to the motor is %.1f kJ\"%(Wm/1000)\n",
      "print \"Work input to the stirrer is %.2f kJ\"%(Ws/1000)\n",
      "print \"Work done by the fluid on the atmosphere is %.2f kJ\"%(W/1000)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work input to the motor is 10.8 kJ\n",
        "Work input to the stirrer is 9.72 kJ\n",
        "Work done by the fluid on the atmosphere is 3.77 kJ\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10 Page No : 63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "P1 = 100.\n",
      "P2 = 37.9\n",
      "P3 = 14.4;\n",
      "V1 = 0.1\n",
      "V2 = 0.2\n",
      "V3 = 0.4;\n",
      "\n",
      "# Calculation\n",
      "n1 = (math.log(P1/P2))/(math.log(V2/V1));\n",
      "n2 = (math.log(P2/P3))/(math.log(V3/V2));\n",
      "# n1 = n2\n",
      "W = ((P1*V1)-(P3*V3))/(n1-1);\n",
      "\n",
      "# Results\n",
      "print \"Work done by the system is %.1f kJ\"%W\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done by the system is 10.6 kJ\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11 Page No : 63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "P1 = 20*1.01325e05;\n",
      "V1 = 0.04\n",
      "V2 = 2*V1;\n",
      "n = 1.45;\n",
      "\n",
      "# Calculation\n",
      "P2 = round((V1/V2)**n*P1,-2)\n",
      "W12 = ((P1*V1)-(P2*V2))/(n-1);\n",
      "W23 = P2*(V2-V1);\n",
      "Wc = W12-W23;\n",
      "\n",
      "# Results\n",
      "print \"Work done in the cycle is %.2f kJ\"%(Wc/1000)\n",
      "\n",
      "# rounding off error. please check using calculator."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done in the cycle is 18.61 kJ\n"
       ]
      }
     ],
     "prompt_number": 25
    }
   ],
   "metadata": {}
  }
 ]
}