{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 01 - Introduction To Heat Transfer"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.1 - Page : 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# given data\n",
      "t1=38   # in degree C\n",
      "t2=21   # in degree C\n",
      "k=0.19   # unit less\n",
      "x=4   #in cm\n",
      "x=x*10**-2   # in meter\n",
      "# Formula q=k*A*(t1-t2)/x\n",
      "q_by_A=k*(t1-t2)/x  \n",
      "print \"The rate of heat transfer is :\",round(q_by_A,3),\"W/m**2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rate of heat transfer is : 80.75 W/m**2\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.2 - Page : 8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "t_i=120   # in degree C\n",
      "t_o=40   # in degree C\n",
      "K=0.04   # unit less\n",
      "x=0.06   #in m\n",
      "Q=50   # in W\n",
      "print \"Assuming steady state heat transfer in the wall\"\n",
      "# Rate of heat transfer across the wall = Rate of electrical energy dissipation in the furnance\n",
      "# Formula Q= K*A*(t_i-t_o)/x \n",
      "A=Q*x/(K*(t_i-t_o)) \n",
      "print \"Area of wall = %0.4f square meter\" %A"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Assuming steady state heat transfer in the wall\n",
        "Area of wall = 0.9375 square meter\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.3 - Page : 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# given data\n",
      "t_f=30   # in degree C\n",
      "t_s=400   # in degree C\n",
      "d=0.04   #in m\n",
      "h=20   # in W/m**2K\n",
      "l=1   #in meter\n",
      "A=pi*d*l#\n",
      "q=h*A*(t_s-t_f)   # in W\n",
      "print \"Rate of heat loss = %0.3f watt\" %q"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of heat loss = 929.911 watt\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.4 - Page : 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# given data\n",
      "t_s=100   # in degree C\n",
      "t_w=80   # in degree C\n",
      "d=2*10**-3   #in m\n",
      "h=3000   # in W/m**2 degree C\n",
      "L=100   #in mm\n",
      "L=L*10**-3   # in meter\n",
      "A=pi*d*L#\n",
      "# Heat loss by convection = Electric power supplied\n",
      "# Formula h*A*(t_s-t_w) = Q\n",
      "Q= h*A*(t_s-t_w)#\n",
      "print \"Electric power supplied = %0.1f watt\" %Q"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electric power supplied = 37.7 watt\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.5 - Page : 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "A=0.6*0.9   # in square meter\n",
      "x=.025   # in meter\n",
      "t_s=310   # in degree C\n",
      "t_f=15   # in degree C\n",
      "h=22   # in W/m**2 degree C\n",
      "K=45   # in W/m degree C\n",
      "Q_rad=250   # in W\n",
      "# Heat transfer through the plate = Convection heat loss + radiation heat loss\n",
      "# Formula Q_cond = Q_conv + Q_rad\n",
      "# -K*A*dt/dx = h*A*(t_s-t_f)+ Fg12*sigmaA(Ts**4-Ta64)\n",
      "t_i=x*(h*A*(t_s-t_f)+Q_rad)/(K*A)+t_s \n",
      "print \"The inside plate temperature = %0.2f degree C\" %t_i"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The inside plate temperature = 313.86 degree C\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.6 - Page : 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# given data\n",
      "T1=50   # in degree C\n",
      "T1=T1+273   # in K\n",
      "T2=20   # in degree C\n",
      "T2=T2+273   # in K\n",
      "d=5*10**-2   #in m\n",
      "h=6.5   # in W/m**2K\n",
      "l=1   #in meter\n",
      "epsilon=0.8#\n",
      "sigma=5.67*10**-8#\n",
      "A=pi*d*l   # in Square meter\n",
      "q_conv = h*A*(T1-T2)   # in W/m\n",
      "print \"The heat loss by convection = %0.1f W/m\" %q_conv\n",
      "# formula q= sigma*A*F_g12*(T1**4-T2**4) = sigma*A*epsilon*(T1**4-T2**4)    (since A1<<A2, so F_g12=epsilon)\n",
      "q_rad = sigma*A*epsilon*(T1**4-T2**4)   # in W/m\n",
      "print \"Heat loss by radiation = %0.0f W/m\" %q_rad\n",
      "q_total= q_conv+q_rad#\n",
      "print \"Total heat loss = %0.3f W/m\" %q_total"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat loss by convection = 30.6 W/m\n",
        "Heat loss by radiation = 25 W/m\n",
        "Total heat loss = 55.672 W/m\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.7 - Page : 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.integrate import quad\n",
      "# given data\n",
      "T1=1350   # in degree C\n",
      "T2=50   # in degree C\n",
      "L=25*10**-2   #in meter\n",
      "# Formula q= -k*A*dT/dx\n",
      "# or q/A= -k*dT/dx\n",
      "# let q/A = q_by_A\n",
      "def integrand(T):\n",
      "    return -0.838*(1+0.0007*T)\n",
      "ans, err = quad(integrand, T1, T2)\n",
      "def integrand(x):\n",
      "    return 1\n",
      "ans2, err2 = quad(integrand, 0, L)\n",
      "q_by_A=ans/ans2#\n",
      "print \"Heat transfer rate per square meter through  the cylinder = %0.0f watt\" %q_by_A\n",
      "\n",
      "# Note : Answer in the book is incorrect"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transfer rate per square meter through  the cylinder = 6493 watt\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.9 - Page : 21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "K_A=0.5   # in W/m degree C\n",
      "K_B=0.8   # in W/m degree C\n",
      "Ti_A=600   # inside temp. of slab A in degree C\n",
      "To_B=100   # outside temp. of slab B in degree C\n",
      "t_A=4*10**-2   # thickness of slab A\n",
      "t_B=6*10**-2   # thickness of slab B\n",
      "# Heat transfer rate per square meter through the slab A\n",
      "# q/A = +K_A * ( Ti_A - T) / t_A         (1)\n",
      "# Heat transfer rate through slab B\n",
      "# q/A = +K_B * ( T - To_B) / t_B        (2)\n",
      "# Equating Eqns (1) and (2)\n",
      "# K_A*(Ti_A - T)/t_A  =  K_B*(T - To_B)/t_B\n",
      "T=t_A*t_B/(K_A*t_B+K_B*t_A)*(K_A*Ti_A/t_A + K_B*To_B/t_B)\n",
      "print \"T, intermediate temperature of slab A and B is :\",round(T,3),\"degree C\"\n",
      "#Putting the value of T in Eq(1), we get\n",
      "q_by_A= K_A*( Ti_A - T) / t_A#\n",
      "print \"Steady state heat transfer rate per square meter is :\",round(q_by_A,3),\"W/m**2\"\n",
      "#Note : Answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T, intermediate temperature of slab A and B is : 341.935 degree C\n",
        "Steady state heat transfer rate per square meter is : 3225.806 W/m**2\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.10 - Page : 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "La=3*10**-2   # in meter\n",
      "Aa=1   # in m**2\n",
      "ka=150   # in W/m-K\n",
      "\n",
      "Lb=8*10**-2   # in meter\n",
      "Ab=0.5   # in m**2\n",
      "kb=30   # in W/m-K\n",
      "\n",
      "Lc=8*10**-2   # in meter\n",
      "Ac=0.5   # in m**2\n",
      "kc=65   # in W/m-K\n",
      "\n",
      "Ld=5*10**-2   # in meter\n",
      "Ad=1   # in m**2\n",
      "kd=50   # in W/m-K\n",
      "\n",
      "T1=400   # in degree C\n",
      "T2=60   # in degree C\n",
      "\n",
      "Ra=La/(ka*Aa)#\n",
      "Rb=Lb/(kb*Ab)#\n",
      "Rc=Lc/(kc*Ac)#\n",
      "Rd=Ld/(kd*Ad)#\n",
      "#The equivalent resistance for Rb and Rc\n",
      "Re=Rb*Rc/(Rb+Rc)#\n",
      "#Total Resistance\n",
      "sigmaR=Ra+Re+Rd#\n",
      "# heat transfer rate per square meter\n",
      "q=(T1-T2)/sigmaR#\n",
      "print \"Heat transfer rate per square meter = %0.2e Watt\" %q"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transfer rate per square meter = 1.18e+05 Watt\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.11 - Page : 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "k_Al=202   # in W/mK\n",
      "x_Al=0.005   # in m\n",
      "del_T=80   # in degree C\n",
      "R_contact=0.88*10**-4   # in m**2K/W\n",
      "sigmaR=x_Al/k_Al+R_contact+x_Al/k_Al   # in m**2K/W\n",
      "q=del_T/sigmaR   # in W/m**2\n",
      "#Temperature drop across the rough surface\n",
      "del_T=q*R_contact   #in degree C\n",
      "print \"Temperature drop across the rough surface = %0.3f degree C\" %del_T"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature drop across the rough surface = 51.198 degree C\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.12 - Page : 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "T1=100   # in degree C\n",
      "T2=10   # in degree C\n",
      "A=3*5   #in square meter\n",
      "x=40*10**-2   # thickness in m**2\n",
      "k=1.6   # in W/mk\n",
      "h=10   # in W/m**2k\n",
      "# Total resistance in heat flow path\n",
      "sigmaR=x/(k*A)+1/(h*A)#\n",
      "# so heat transfer rate\n",
      "q=(T1-T2)/sigmaR   # in Watt\n",
      "q=q*10**-3   #in kW\n",
      "print \"Heat transfer rate = %0.3f kW\" %q\n",
      "\n",
      "# Note: Answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transfer rate = 3.857 kW\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.13 - Page : 25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.integrate import quad\n",
      "# given data\n",
      "k='2.0+0.0005*T'   # in W/m-k\n",
      "A=3*5   #in square meter\n",
      "T1=150   # in degree C\n",
      "T2=50   # in degree C\n",
      "L=20*10**-2   # thickness in m**2\n",
      "# Formula q= -k*A*dt/dx\n",
      "def integrand(T):\n",
      "    return 2.0+0.0005*T\n",
      "ans, err = quad(integrand, T1, T2)\n",
      "def integrand(x):\n",
      "    return 1\n",
      "ans2, err2 = quad(integrand, 0, L)\n",
      "\n",
      "q=-A*ans/ans2   # in Watt\n",
      "q=q*10**-3   #in kW\n",
      "print \"Rate of heat transfer = %0.3f kW\" %q"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of heat transfer = 15.375 kW\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.14 - Page : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "T1=300   #in degree C\n",
      "T2=50   #in degree C\n",
      "x2=2*10**-2   # thickness of boiler wall in m\n",
      "tc2=58   # thermal conductivity of wall in W/mk\n",
      "x3=0.5*10**-2   # thickness of outer surface of the  wall in m\n",
      "tc3=116*10**-3   # thermal conductivity of outer surface of the wall in W/mk\n",
      "R1=2.3*10**-3   # in k/W\n",
      "R2=x2/tc2#\n",
      "R3=x3/tc3#\n",
      "sigmaR=R1+R2+R3   # Total Resistance\n",
      "q=(T1-T2)/sigmaR#\n",
      "print \"Heat transfer rate per unit area = %0.3f W/m**2\" %q\n",
      "# Note: Answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transfer rate per unit area = 5464.687 W/m**2\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.15 - Page : 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# given data\n",
      "Tf=80   # in degree C\n",
      "I=200   # in amp\n",
      "h=4000   # in W/m**2degree C\n",
      "rho=70*10**-6#\n",
      "L=100   # in cm\n",
      "R=0.1   # in ohm\n",
      "d=3   # in mm\n",
      "d=d*10**-3#\n",
      "As= pi*d#\n",
      "#Formula I**2*R= h*As*(Tw-Tf)\n",
      "Tw= I**2*R/(h*As)+Tf#\n",
      "print \"Central temperature of the wire = %0.f \u00b0C\" %Tw"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Central temperature of the wire = 186 \u00b0C\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  1.16 - Page : 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# given data\n",
      "E=500   #Absorb solar energy in W/m**2\n",
      "epsilon= 0.9#\n",
      "T_s= 280   # in K\n",
      "T_infinite=300   # in K\n",
      "h_c=20   # in W/m**2degree C\n",
      "T_sky=280   # in K\n",
      "sigma=5.67*10**-8#\n",
      "# Formula E= h_c*(T_p-T_infinite)+epsilon*sigma*(T_P**4-T_s**4)\n",
      "# On simplication T_P= 340.6-0.255*T-p**4\n",
      "T_p= 315.5   # in K\n",
      "print \"Equilibrium Temperature of the plate = %0.1f K\" %T_p"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Equilibrium Temperature of the plate = 315.5 K\n"
       ]
      }
     ],
     "prompt_number": 29
    }
   ],
   "metadata": {}
  }
 ]
}