{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 03:Work and Heat Transfer"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex3.1:pg-54"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 3.1\n",
      "\n",
      " The amount of work done upon the atmosphere by the balloon is  50.6625  kJ\n"
     ]
    }
   ],
   "source": [
    "dV = 0.5 # Change in volume in m**3\n",
    "\n",
    "P = 101.325e03 # Atmospheric pressure in N/m**2\n",
    "\n",
    "Wd = P*dV # Work done in J\n",
    "\n",
    "print \"\\n Example 3.1\"\n",
    "\n",
    "print \"\\n The amount of work done upon the atmosphere by the balloon is \",Wd/1e3,\" kJ\",\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex3.2:pg-55"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 3.2\n",
      "\n",
      " The displacement work done by the air is  60.795  kJ\n"
     ]
    }
   ],
   "source": [
    "dV = 0.6 # Volumetric change in m**3\n",
    "\n",
    "P = 101.325e03 # Atmospheric pressure in N/m**2\n",
    "\n",
    "Wd = P*dV # Work done in J\n",
    "\n",
    "print \"\\n Example 3.2\"\n",
    "\n",
    "print \"\\n The displacement work done by the air is \",Wd/1e3 ,\" kJ\"\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex3.3:pg-55"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 3.3\n",
      "\n",
      " The net work transfer for the system is  -57.19  kJ\n"
     ]
    }
   ],
   "source": [
    "# Given that\n",
    "\n",
    "T = 1.275 # Torque acting against the fluid in mN\n",
    "\n",
    "N = 10000 # Number of revolutions\n",
    "\n",
    "W1 = 2*math.pi*T*1e-3*N # Work done by stirring device upon the system\n",
    "\n",
    "P = 101.325e03 # Atmospheric pressure in kN/m**2\n",
    "\n",
    "d = 0.6 # Piston diameter in m\n",
    "\n",
    "A = (math.pi/4)*(d)**2 # Piston area in m\n",
    "\n",
    "L = 0.80 # Displacement of diameter in m\n",
    "\n",
    "W2 = (P*A*L)/1000 # Work done by the system on the surroundings i KJ\n",
    "\n",
    "W = -W1+W2 # net work transfer for the system\n",
    "print \"\\n Example 3.3\"\n",
    "print \"\\n The net work transfer for the system is \",round(W,2) ,\" kJ\"\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex3.4:pg-56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 3.4\n",
      "\n",
      " The rate of work transfer from gas to the piston is  24383.7855401  kW\n"
     ]
    }
   ],
   "source": [
    "# Given that\n",
    "\n",
    "ad = 5.5e-04 # Area of indicator diagram in m**2\n",
    "\n",
    "ld = 0.06 # Length of diagram in m\n",
    "\n",
    "k = 147 # Spring value in MPa/m\n",
    "\n",
    "w = 150 # Speed of engine in revolution per minute\n",
    "\n",
    "L = 1.2 # Stroke of piston in m\n",
    "\n",
    "d = 0.8 # Diameter of the cylinder in m\n",
    "\n",
    "A = (math.pi/4)*(0.8**2) # Area of cylinder\n",
    "\n",
    "Pm = (ad/ld)*k # Effective pressure in MPa\n",
    "\n",
    "W1 = Pm*L*A*w # Work done in 1 minute MJ\n",
    "\n",
    "W = (12*W1)/60 # The rate of work transfer gas to the piston in MJ/s\n",
    "\n",
    "\n",
    "\n",
    "print \"\\n Example 3.4\"\n",
    "\n",
    "print \"\\n The rate of work transfer from gas to the piston is \",W*1e3 ,\" kW\"\n",
    "\n",
    "#The answers vary due to round off error\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex3.5:pg-57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 3.5\n",
      "\n",
      " Rating of furnace would be  2.17163371599  *1e3 kW\n",
      "\n",
      " Diameter of furnace is  1.0  m\n",
      "\n",
      " Length of furnace is  2.0  m\n"
     ]
    }
   ],
   "source": [
    "#Given that\n",
    "\n",
    "m = 5 # mass flow rate in tones/h\n",
    "\n",
    "Ti = 15 # Initial temperature in degree Celsius\n",
    "\n",
    "tp = 1535 # Phase change temperature in degree Celsius\n",
    "\n",
    "Tf = 1650 # Final temperature in degree Celsius\n",
    "\n",
    "Lh = 270 # Latent heat of iron in kJ/Kg\n",
    "\n",
    "ml = 29.93 # Specific heat of iron in liquid phase in kJ/Kg\n",
    "\n",
    "ma = 56 # Atomic weight of iron\n",
    "\n",
    "sh = 0.502 # Specific heat of iron in solid phase in kJ/Kg\n",
    "\n",
    "d = 6900 # Density of molten metal in kg/m**3\n",
    "\n",
    "n=0.7 # furnace efficiency\n",
    "\n",
    "l_d_ratio = 2 # length to diameter ratio\n",
    "\n",
    "print \"\\n Example 3.5\"\n",
    "\n",
    "h1 = sh*(tp-Ti) # Heat required to raise temperature\n",
    "\n",
    "h2 = Lh # Heat consumed in phase change\n",
    "\n",
    "h3 = ml*(Tf-tp)/ma # Heat consumed in raising temperature of molten mass\n",
    "\n",
    "h = h1+h2+h3 # Heat required per unit mass\n",
    "\n",
    "Hi = h*m*1e3 # Ideal heat requirement\n",
    "\n",
    "H = Hi/(n*3600) # Actual heat requirement\n",
    "\n",
    "V = (3*m)/d # Volume required in m**3\n",
    "\n",
    "d = (4*V/(math.pi*l_d_ratio))**(1/3) # Diameter of furnace \n",
    "\n",
    "l = d*l_d_ratio # Length of furnace\n",
    "\n",
    "print \"\\n Rating of furnace would be \",H/1e3 ,\" *1e3 kW\"\n",
    "\n",
    "print \"\\n Diameter of furnace is \",d ,\" m\"\n",
    "\n",
    "print \"\\n Length of furnace is \",l ,\" m\"\n",
    "\n",
    "#The answer provided in the textbook is wrong\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex3.6:pg-57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " Example 3.6\n",
      "\n",
      " Rate at which aluminium can be melted is  5.39  tonnes/h\n",
      "\n",
      " Mass of aluminium that can be held in furnace is  5.232 tonnes\n"
     ]
    }
   ],
   "source": [
    "# Given that\n",
    "\n",
    "SH = 0.9 # Specific heat of aluminium in solid state in kJ/kgK \n",
    "\n",
    "L = 390 # Latent heat in kJ/kg\n",
    "\n",
    "aw = 27 # Atomic weight\n",
    "\n",
    "D = 2400 # Density in molten state in kg/m**3\n",
    "\n",
    "Tf = 700 # Final temperature in degree Celsius\n",
    "\n",
    "Tm = 660 # Melting point of aluminium in degree Celsius\n",
    "\n",
    "Ti = 15 # Initial temperature in degree Celsius\n",
    "\n",
    "HR = SH*(Tm-Ti)+L+(29.93/27)*(Tf-Tm) # Heat requirement\n",
    "\n",
    "HS = HR/0.7  # Heat supplied\n",
    "\n",
    "RM = 2.17e3*3600/HS  # From the data of problem 3.7\n",
    "\n",
    "V = 2.18 # Volume in m**3\n",
    "\n",
    "M = V*D\n",
    "\n",
    "print \"\\n Example 3.6\"\n",
    "\n",
    "print \"\\n Rate at which aluminium can be melted is \",round(RM/1e3,2) ,\" tonnes/h\"\n",
    "\n",
    "print \"\\n Mass of aluminium that can be held in furnace is \",M/1e3 ,\"tonnes\"\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}