{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 - Transient (Unsteady State) Heat Conduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.1 - Page :  102"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# given data\n",
      "L=1   # in m\n",
      "rho=1600   # in kg/m**3\n",
      "k=40   # in w/mK\n",
      "Cp=4*10**3   # in J/kgK\n",
      "a=900   # in  degree C\n",
      "b=-300   # in  degree C/m\n",
      "c=-50   # in  degree C/m**2\n",
      "Qg=1*10**3   # in kW/m**2\n",
      "A=10   # area in m**2\n",
      "#t=a+b*x+c*x**2 at any instant, so\n",
      "# dtBYdx= b+2*c*x\n",
      "# d2tBYdx2 = 2*c, then\n",
      "\n",
      "# Part(a)\n",
      "#q1= -k*A*dtBYdx , at\n",
      "x=0#\n",
      "q1= -k*A*(b+2*c*x)   # in w\n",
      "#q2= -k*A*dtBYdx , at\n",
      "x=L#\n",
      "q2= -k*A*(b+2*c*x)   # in w\n",
      "E_stored= (q1-q2)+Qg*A*L   # in watt\n",
      "print \"The rate of change of energy storage = %0.1e watt\" %E_stored\n",
      "\n",
      "# Part(b)\n",
      "alpha= k/(rho*Cp)   # in m**2s\n",
      "d2tBYdx2 = 2*c#\n",
      "dtBYdtoh= alpha*(d2tBYdx2+Qg/k )   # in degree C/sec\n",
      "print \"Rate of change of temperature = %0.3e degree C/sec\" %dtBYdtoh\n",
      "print \"Since dt by dx is independent of x. Hence time rate of charge of temperature throughout wall will remain same.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rate of change of energy storage = -3.0e+04 watt\n",
        "Rate of change of temperature = -4.688e-04 degree C/sec\n",
        "Since dt by dx is independent of x. Hence time rate of charge of temperature throughout wall will remain same.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.2 - Page :  109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "from numpy import log, pi\n",
      "# given data\n",
      "k=40   # in W/mK\n",
      "rho=7800   # in kg/m**3\n",
      "C=450   # in J/kgK\n",
      "d=20*10**-3   # in m\n",
      "r=d/2#\n",
      "t_i=400   # in degree C\n",
      "t=85   # in degree C\n",
      "t_infinite=25   # in degree C\n",
      "h=80   # in W/m**2K\n",
      "#l_s=V/A = (4/3*pi*r**3)/(4*pi*r**2) = r/3\n",
      "l_s=r/3   # in m\n",
      "Bi= h*l_s/k#\n",
      "# since Biot number is less than 0.1, hence lumped heat capacity system analysis can be applied\n",
      "\n",
      "# Part(a)\n",
      "# Formula (t-t_infinite)/(t_i-t_infinite)= %e**(-h*A*toh/(rho*V*C)) = %e**(-h*toh/(rho*l_s*C))\n",
      "toh= -log((t-t_infinite)/(t_i-t_infinite))*(rho*l_s*C)/h   # in sec\n",
      "print \"The time require to cool the sphere = %0.3f sec\" %toh\n",
      "\n",
      "# Part(b)\n",
      "# dtBYdtoh = h*A*(t_i-t_infinite)/(rho*V*C) = h*(t_i-t_infinite)/(rho*l_s*C)\n",
      "dtBYdtoh = h*(t_i-t_infinite)/(rho*l_s*C)   # in degree C/sec\n",
      "print \"Initial rate of cooling = %0.3f degree C/sec\" %dtBYdtoh\n",
      "\n",
      "# Part(c)\n",
      "A=4*pi*r**2#\n",
      "toh=60#\n",
      "q_in= h*A*(t_i-t_infinite)*exp(-h*toh/(rho*l_s*C))   # in watt\n",
      "print \"Instantaneous heat transfer rate = %0.3f watt\" %q_in\n",
      "\n",
      "# Part(d) Total energy transferred during first one minute\n",
      "V=4/3*pi*r**3#\n",
      "TotalEnergy = rho*C*V*(t_i-t_infinite)*(1-exp(-h*toh/(rho*C*l_s)))#\n",
      "print \"Total energy transferred during first one minute = %0.3f watt\" %TotalEnergy\n",
      "\n",
      "# Note: Answer of first and last part in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The time require to cool the sphere = 268.015 sec\n",
        "Initial rate of cooling = 2.564 degree C/sec\n",
        "Instantaneous heat transfer rate = 25.013 watt\n",
        "Total energy transferred during first one minute = 1855.401 watt\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.3 - Page :  111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "# given data\n",
      "k=40   # in W/mK\n",
      "rho=8200   # in kg/m**3\n",
      "C=400   # in J/kgK\n",
      "D=6*10**-3   # in m\n",
      "R=D/2#\n",
      "t_i=30   # in degree C\n",
      "t_infinite1=400   # for 10 sec in degree C\n",
      "t_infinite2=20   # for 10 sec in degree C\n",
      "h=50   # in W/m**2K\n",
      "\n",
      "# Part(a)\n",
      "#l_s= V/A = R/3\n",
      "l_s= R/3   # in m\n",
      "#toh= rho*V*C/(h*A) = rho*C*l_s/h\n",
      "toh= rho*C*l_s/h   # in sec\n",
      "print \"Time constance = %0.1f sec\" %toh\n",
      "\n",
      "# Part (b)\n",
      "Bi= h*l_s/k#\n",
      "# since Bi < 0.1 , hence lumped heat capacity analysis is valid. Now , temperature attained by junction in 10 seconds when exposed to hot air at 400 degree C\n",
      "toh=10   # in sec\n",
      "# (t-t_infinite1)/(t_i-t_infinite1)= %e**(-h*A*toh/(rho*V*C)) = %e**(-h*toh/(rho*l_s*C))\n",
      "t= exp(-h*toh/(rho*l_s*C))*(t_i-t_infinite1)+t_infinite1   # in degree C\n",
      "\n",
      "print \"The junction is taken out from hot air stream and placed in stream of still air 20 degree C.\"\n",
      "print \"The initial temperature in this case = \",round(t,3)\n",
      "t_i=t#\n",
      "toh=20   # in sec\n",
      "t= exp(-h*toh/(rho*l_s*C))*(t_i-t_infinite2)+t_infinite2   # in degree C\n",
      "print \"The temperature attained by junction = %0.3f degree C\" %t\n",
      "\n",
      "# Note: In the last, calculation to find the value of t is wrong so Answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time constance = 65.6 sec\n",
        "The junction is taken out from hot air stream and placed in stream of still air 20 degree C.\n",
        "The initial temperature in this case =  82.314\n",
        "The temperature attained by junction = 65.939 degree C\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.4 - Page :  112"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "# given data\n",
      "k=8   # in W/mK\n",
      "alpha=4*10**-6   # in m**2/s\n",
      "h=50   # in W/m**2K\n",
      "D=6*10**-3   # in m\n",
      "R=D/2#\n",
      "T=0.5   # where T = (t-t_infinite)/(t_i-t_infinite)\n",
      "#l_s= V/A = R/3\n",
      "l_s= R/2   # in m\n",
      "Bi= h*l_s/k#\n",
      "# since Bi < 0.1 , hence lumped heat capacity analysis can be applied\n",
      "# toh= rho*V*C/(h*A) = rho*C*l_s/h = k*l_s/(h*alpha)\n",
      "toh=  k*l_s/(h*alpha)   # in seconds\n",
      "print \"Time constant = %0.f seconds\" %toh\n",
      "# It is given that (t-t_infinite)/(t_i-t_infinite) = 0.5 =  %e**(-h*A*c /(rho*V*C)) = %e**(-h*c/(rho*l_s*C)) = %e**(-h*alpha*c/(l_s))\n",
      "# or (t-t_infinite)/(t_i-t_infinite) = %e**(-h*alpha*c/(l_s)#\n",
      "c= -log(T)*l_s/(h*alpha)   # in sec\n",
      "print \"The time required to temperature change to reach half of its initial value = %0.1f seconds\" %c"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time constant = 60 seconds\n",
        "The time required to temperature change to reach half of its initial value = 5.2 seconds\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.5 - Page :  113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "#t=450-500*x+100*x**2+150*x**3 at any instant, so\n",
      "# dtBYdx= -500+200*x+450*x**2\n",
      "L=0.5   # thickness of the wall in meter\n",
      "k=10   # in W/mK\n",
      "# Rate of heating entering in the wall per unit area, at\n",
      "x=0#\n",
      "#q1= -k*dtBYdx\n",
      "q1= -k*(-500+200*x+450*x**2)   # in W/m**2\n",
      "# Rate of heat going out of the wall per unit area , at\n",
      "x=L#\n",
      "q2= -k*(-500+200*x+450*x**2)   # in W/m**2\n",
      "E=q1-q2   # in W/m**2\n",
      "print \"Heat energy stored per unit area = %0.0f W/m**2\" %E"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat energy stored per unit area = 2125 W/m**2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.6 - Page :  114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# given data\n",
      "k=385   # in W/mK\n",
      "h=100   # in W/m**2K\n",
      "delta =2*10**-3   # thickness of plate in meter\n",
      "A=25*25   # area of plate in square meter\n",
      "rho=8800   # kg/m**3\n",
      "C=400   # J/kg-K\n",
      "# l_s= V/A= L*B*delta/(2*L*B) = delta/2\n",
      "l_s= delta/2   # in meter\n",
      "Bi= h*l_s/k#\n",
      "# since Bi < 0.1 , hence lumped heat capacity analysis can be applied\n",
      "\n",
      "# Part(i)\n",
      "# toh= rho*V*C/(h*A) = rho*C*l_s/h\n",
      "toh= rho*C*l_s/h   # in second\n",
      "print \"Time constant = %0.1f seconds\" %toh\n",
      "\n",
      "# Part(ii)\n",
      "t_i=400   # in degree C\n",
      "t=40   # in degree C\n",
      "t_infinite=25   # in degree C\n",
      "# (t-t_infinite)/(t_i-t_infinite) =  %e**(-h*A*toh /(rho*V*C)) = %e**(-h*toh/(rho*l_s*C)) \n",
      "toh= -log((t-t_infinite)/(t_i-t_infinite))*rho*C*l_s/h   # in sec\n",
      "print \"The time required for the plate to reach the temperature of 40 degree C = %0.1f seconds\" %toh"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time constant = 35.2 seconds\n",
        "The time required for the plate to reach the temperature of 40 degree C = 113.3 seconds\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.7 - Page :  114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "# given data\n",
      "k=380   # in W/mK\n",
      "delta =6*10**-2   # thickness of plate in meter\n",
      "rho=8800   # kg/m**3\n",
      "C=400   # J/kg-K\n",
      "# l_s= V/A = delta/2\n",
      "l_s= delta/2   # in meter\n",
      "t=80   # in degree C\n",
      "t_i=200   # in degree C\n",
      "t_inf=30   # in degree C\n",
      "hw= 75   # in W/m**2K\n",
      "ha= 10   # in W/m**2K\n",
      "\n",
      "# Part(i)\n",
      "# ha*A*(t-t_inf_a)+ hw*A*(t-t_inf_w) = -rho*V*C*dtBYdtho, since t_ini_a = t_inf_w = t_inf = 30 degree C\n",
      "# (ha+hw)*A*(t-t_inf)= -rho*V*C*dtBYdtho\n",
      "# (ha+hw)/(rho*C*V)*A*dtoh = -dt/(t-t_inf)\n",
      "# integrate('(ha+hw)/(rho*V*C)*A','toh',0,toh) = integrate('1/(t-t_inf)','t',t_i,t)\n",
      "toh= -rho*l_s*C/(ha+hw)*log((t-t_inf)/(t_i-t_inf))#\n",
      "print \"Time required to cool plate to 80 degree C is :\",round(toh,1),\"seconds =\",round(toh/60,2),\"minutes\"\n",
      "\n",
      "# Part (ii)\n",
      "t= -rho*l_s*C/(2*ha)*log((t-t_inf)/(t_i-t_inf))#\n",
      "print \"Time required to cool plate in only air is :\",round(t,1),\"seconds =\",round(t/60,2),\"minutes\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time required to cool plate to 80 degree C is : 1520.4 seconds = 25.34 minutes\n",
        "Time required to cool plate in only air is : 6461.5 seconds = 107.69 minutes\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.8 - Page :  116"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# given data\n",
      "k=45   # in W/m degree C\n",
      "d =0.1   # in meter\n",
      "l =0.30   # in meter\n",
      "t=800   # in degree C\n",
      "t_i=100   # in degree C\n",
      "t_infinite=1200   # in degree C\n",
      "h= 120   # in W/m**2 degree C\n",
      "alpha=1.2*10**-5   # in meter\n",
      "rhoC= k/alpha#\n",
      "V=pi/4*d**2*l   # in m**3\n",
      "A= pi*d*l + 2*pi/4*d**2   # in m**2\n",
      "# l_s= V/A = (pi/4*d**2*l)/(pi*d*l + 2*pi/4*d**2) = d*l/(4*l+2*d**2)\n",
      "l_s = d*l/(4*l+2*d**2)#\n",
      "Bi= h*l_s/k#\n",
      "# since Bi < 0.1 , hence lumped heat capacity analysis can be applied\n",
      "# (t-t_infinite)/(t_i-t_infinite)  =  %e**(-h*A*toh /(rho*V*C)) = %e**(-h*toh/(rho*l_s*C)) = %e**(-h*toh/(rhoC*l_s))\n",
      "toh = -log((t-t_infinite)/(t_i-t_infinite))*rhoC*l_s/h   # in sec\n",
      "\n",
      "# So, the velocity of ingot passing through the furnace\n",
      "FurnaceLength = 8*100   # in cm\n",
      "time = toh#\n",
      "Velocity = FurnaceLength/time   # in cm/sec\n",
      "print \"Maximum speed = %0.4f cm/sec\" %Velocity"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum speed = 1.0291 cm/sec\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.9 - Page :  117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "# given data\n",
      "rho=8500   # in kg/m**3\n",
      "C=400   # J/kgK\n",
      "toh=1   # in sec\n",
      "h= 400   # in W/m**2 degree C\n",
      "t=198   # in degree C\n",
      "t_i=25   # in degree C\n",
      "t_infinite=200   # in degree C\n",
      "\n",
      "# Part (1)\n",
      "# toh =rho*V*C/(h*A) = rho*C*l_s/h\n",
      "l_s= toh*h/(rho*C)#\n",
      "# l_s = V/A = r/3 \n",
      "r=3*l_s   # in m\n",
      "r=r*10**3   # in mm\n",
      "d=2*r   # in m\n",
      "print \"Junction diameter needed for the thermocouple = %0.3f mili miter\" %d\n",
      "\n",
      "# Part(ii)\n",
      "# toh= -rho*V*C/(h*A)*log((t-t_infinite)/(t_i-t_infinite))  \n",
      "toh = -toh*log((t-t_infinite)/(t_i-t_infinite))#\n",
      "print \"Time required for the thermocouple junction to reach 198 degree C = %0.3f seconds\" %toh"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Junction diameter needed for the thermocouple = 0.706 mili miter\n",
        "Time required for the thermocouple junction to reach 198 degree C = 4.472 seconds\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.10 - Page :  118"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "L=40*10**-2   # in m\n",
      "k=1.5   # in W/mK\n",
      "A=4   # in square meter\n",
      "alpha=1.65*10**-3   # in m**2/h\n",
      "#T = 50-40*x+10*x**2+20*x**3-15*x**4 , so\n",
      "# dtBYdx= -40+20*x+60*x**2-60*x**3\n",
      "# d2tBYdx2 = 20+120*x-180*x**2\n",
      "\n",
      "# Part (a) Heat entering the slab\n",
      "#q1= -k*A*dtBYdx , at\n",
      "x=0#\n",
      "qi= -k*A*(-40+20*x+60*x**2-60*x**3)   # in w\n",
      "print \"Heat entering the slab = %0.0f watt\" %qi\n",
      "# Heat leaving the slab\n",
      "#ql= -k*A*dtBYdx , at\n",
      "x=L#\n",
      "ql= -k*A*(-40+20*x+60*x**2-60*x**3)   # in w\n",
      "print \"Heat leaving the slab = %0.2f watt\" %ql\n",
      "\n",
      "# Part (b) Rate of heat storage\n",
      "RateOfHeatStorage = qi-ql   # in watt\n",
      "print \"Rate of heat storage = %0.2f watt\" %RateOfHeatStorage\n",
      "\n",
      "# Part (c) Rate of temperature change\n",
      "# d2tBYdx2 = 1/alpha*dtBYdtoh\n",
      "# dtBYdtoh= alpha*d2tBYdx2, at\n",
      "x=0#\n",
      "dtBYdtoh = alpha*(20+120*x-180*x**2)   # in degree C/h\n",
      "print \"The rate of temperature change at entering the slab = %0.3f degree C/h\" %dtBYdtoh\n",
      "# dtBYdtoh= alpha*d2tBYdx2, at\n",
      "x=L\n",
      "dtBYdtoh = alpha*(20+120*x-180*x**2)   # in degree C/h\n",
      "print \"The rate of temperature change at leaving the slab = %0.3f degree C/h\" %dtBYdtoh\n",
      "\n",
      "# Part (d) for the rate of heating or cooling to be maximum\n",
      "# dBYdx of dtBYdtoh = 0\n",
      "# dBYdx of (alpha*d2tBYdx2) =0\n",
      "# d3tBYdx3 = 0\n",
      "x=120/360   # in meter\n",
      "print \"The point where rate of heating or cooling is maximum = %0.3f meter\" %x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat entering the slab = 240 watt\n",
        "Heat leaving the slab = 157.44 watt\n",
        "Rate of heat storage = 82.56 watt\n",
        "The rate of temperature change at entering the slab = 0.033 degree C/h\n",
        "The rate of temperature change at leaving the slab = 0.065 degree C/h\n",
        "The point where rate of heating or cooling is maximum = 0.333 meter\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.11 - Page :  119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "# given data\n",
      "k=40   # in W/m degree C\n",
      "d =12*10**-3   # in meter\n",
      "t=127   # in degree C\n",
      "t_i=877   # in degree C\n",
      "t_infinite=52   # in degree C\n",
      "h= 20   # in W/m**2 degree C\n",
      "rho=7800   # in W/m**2K\n",
      "C=600   # in J/kg K\n",
      "r=d/2   # in meter\n",
      "#l_s = V/A = r/3\n",
      "l_s =  r/3#\n",
      "Bi= h*l_s/k#\n",
      "# since Bi < 0.1 , hence lumped heat capacity analysis can be applied\n",
      "# (t-t_infinite)/(t_i-t_infinite)  =  %e**(-h*A*toh /(rho*V*C)) = %e**(-h*toh/(rho*l_s*C)) = %e**(-h*toh/(rho*C*l_s))\n",
      "toh = -log((t-t_infinite)/(t_i-t_infinite))*rho*C*l_s/h   # in sec\n",
      "print \"Time required for cooling process =\",round(toh,3),\"seconds =\",round(toh/60,2),\"minutes\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time required for cooling process = 1122.215 seconds = 18.7 minutes\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.12 - Page :  127"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "D=10*10**-2   # in m\n",
      "b=D/2#\n",
      "h= 100   # in W/m**2 degree C\n",
      "T_o=418   # in degree C\n",
      "T_i=30   # in degree C\n",
      "T_infinite=1000   # in degree C\n",
      "\n",
      "print \" (A) For copper cylinder \"\n",
      "k=350   # in W/mK\n",
      "alpha=114*10**-7   # in m**2/s\n",
      "Bi= h*b/k#\n",
      "theta_0_t = (T_o-T_infinite)/(T_i-T_infinite)#\n",
      "Fo=18.8#\n",
      "# Formula Fo= alpha*t/b**2\n",
      "t=Fo*b**2/alpha#\n",
      "print \"Time required to reach for the cylinder centreline temperature 418 degree C =\",round(t,3),\"seconds =\",round(t/3600,3),\"hours\"\n",
      "\n",
      "# (2) Temperature at the radius of 4 cm\n",
      "theta_0_t = 0.985#\n",
      "# Formula theta_0_t = (T-T_infinite)/(T_o-T_infinite)\n",
      "T= theta_0_t*(T_o-T_infinite)+T_infinite   # in degree C\n",
      "print \"Temperature at the radius of 4 cm = %0.2f degree C\" %T \n",
      "print \"It has very less temperature gradients over 4 cm radius\"\n",
      "\n",
      "print \" (B) For asbestos cylinder \"\n",
      "k=0.11   # in W/mK\n",
      "alpha=0.28*10**-7   # in m**2/s\n",
      "Bi= h*b/k#\n",
      "theta_0_t = (T_o-T_infinite)/(T_i-T_infinite)#\n",
      "Fo=0.21#\n",
      "# Formula Fo= alpha*t/b**2\n",
      "t=Fo*b**2/alpha#\n",
      "print \"Time required to reach for the cylinder centreline temperature 418 degree C =\",round(t,3),\"seconds =\",round(t/3600,1),\"hours\"\n",
      "\n",
      "# (2) Temperature at the radius of 4 cm\n",
      "theta_x_t = 0.286#\n",
      "# Formula theta_x_t = (T-T_infinite)/(T_o-T_infinite)\n",
      "T= theta_x_t*(T_o-T_infinite)+T_infinite   # in degree C\n",
      "print \"Temperature at the radius of 4 cm = %0.3f degree C\" %T \n",
      "print \"It has large temperature gradients\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " (A) For copper cylinder \n",
        "Time required to reach for the cylinder centreline temperature 418 degree C = 4122.807 seconds = 1.145 hours\n",
        "Temperature at the radius of 4 cm = 426.73 degree C\n",
        "It has very less temperature gradients over 4 cm radius\n",
        " (B) For asbestos cylinder \n",
        "Time required to reach for the cylinder centreline temperature 418 degree C = 18750.0 seconds = 5.2 hours\n",
        "Temperature at the radius of 4 cm = 833.548 degree C\n",
        "It has large temperature gradients\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  4.13 - Page :  133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# given data\n",
      "D=5*10**-2   # in m\n",
      "b=D/2#\n",
      "h= 500   # in W/m**2 degree C\n",
      "k=60   # in W/m**2K\n",
      "rho=7850   # in kg/m**3\n",
      "C=460   # in J/kg\n",
      "alpha=1.6*10**-5   # in m**2/s\n",
      "T_i=225   # in degree C\n",
      "T_infinite=25   # in degree C\n",
      "t=2   # in minute\n",
      "\n",
      "# Part(i)\n",
      "Bi= h*b/k#\n",
      "Fo= alpha*t/b**2#\n",
      "theta_0_t = 0.18#\n",
      "# Formula theta_0_t = (T_o-T_infinite)/(T_i-T_infinite)\n",
      "T_o= theta_0_t*(T_i-T_infinite)+T_infinite   # in degree C\n",
      "print \"Centreline Temperature of the sphere after 2 minutes of exposure = %0.f degree C \" %T_o\n",
      "\n",
      "# Part(2)\n",
      "depth= 10*10**-3   # in meter\n",
      "r=b-depth   # in meter\n",
      "rBYb=r/b#\n",
      "theta_x_t = 0.95#\n",
      "# Formula theta_x_t = (T-T_infinite)/(T_o-T_infinite)\n",
      "T= theta_x_t*(T_o-T_infinite)+T_infinite   # in degree C\n",
      "print \"The Temperature at the depth of 1 cm from the surface after 2 minutes = %0.1f degree C\" %T\n",
      "\n",
      "# Part (3)\n",
      "BiSquareFo= Bi**2*Fo#\n",
      "QbyQo= 0.8   # in kJ\n",
      "A=4/3*pi*b**3#\n",
      "Qo= rho*A*C*(T_i-T_infinite)   # in J\n",
      "Qo=Qo*10**-3   # in kJ\n",
      "# The heat transffered during 2 minute, \n",
      "Q= Qo*QbyQo   # in kJ\n",
      "print \"The heat transffered during 2 minutes = %0.3f kJ\" %Q"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Centreline Temperature of the sphere after 2 minutes of exposure = 61 degree C \n",
        "The Temperature at the depth of 1 cm from the surface after 2 minutes = 59.2 degree C\n",
        "The heat transffered during 2 minutes = 37.814 kJ\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}