{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Conduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.1,Page no:2.18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Thickness of insulation\n",
      "\n",
      "#Variable declaration\n",
      "A=1  #Area of heat transfer[sq metre]\n",
      "Q=450  #Rate of heat loss/unit area[W/ sq mtre]\n",
      "dT=400  #Temperature difference across insulation layer[K]\n",
      "k=0.11 #k for asbestos[W/(m.K)]\n",
      "\n",
      "#Calculation\n",
      "#Q=(k* A*dT)/x\n",
      "x1=(k*A*dT)/Q\n",
      "X1=x1*1000 \n",
      "#for fire clay insulation\n",
      "k=0.84  #For fire clay insulation[W/(m.K)]\n",
      "x=(k*A*dT)/Q \n",
      "X=x*1000 \n",
      "\n",
      "#Result\n",
      "print\"Ans.(A).Thickness of asbestos is:\",round(X1),\"mm\"\n",
      "print\"Ans.(B)Thickness of fire clay insulation is:\",round(X),\"mm\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ans.(A).Thickness of asbestos is: 98.0 mm\n",
        "Ans.(B)Thickness of fire clay insulation is: 747.0 mm\n"
       ]
      }
     ],
     "prompt_number": 125
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.2,Page no:2.18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss per metre\n",
      "\n",
      "#Variable declaration\n",
      "L=1.0 # Length of pipe[m]\n",
      "r1=(50.0/2.0) # in mm\n",
      "r1=r1/1000.0 # in m\n",
      "r2=(25.0+3.0)/1000.0 # m\n",
      "\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "rm1=(r2-r1)/math.log(r2/r1) \n",
      "k1=45.0 #W/(m.K)\n",
      "R1=(r2-r1)/(k1*(2*math.pi*rm1*L)) # Thermal resistance of wall pipe[K/W]\n",
      "\n",
      "#For inner lagging:\n",
      "k2=0.08 #W/(m.K)\n",
      "ri1=0.028 #m\n",
      "ri2=(ri1+r1) # m\n",
      "rmi1=(ri2-ri1)/math.log(ri2/ri1)\n",
      "R2=(ri2-ri1)/(k2*2*math.pi*rmi1*L) #Thermal resistance of inner lagging [K/W]\n",
      "\n",
      "#For  outer lagging:\n",
      "k3=0.04 #W/(m.K)\n",
      "ro1=0.053 #m\n",
      "ro2=(ro1+0.04) # m\n",
      "rmo1=(ro2-ro1)/math.log(ro2/ro1)\n",
      "R3=(ro2-ro1)/(k3*2*math.pi*rmo1*L)  #Thermal resistance of outer lagging\n",
      "\n",
      "R=R1+R2+R3\n",
      "Ti=550.0 #K #inside\n",
      "To=330.0 #K  # outside\n",
      "dT=Ti-To  #Temperature difference\n",
      "Q=dT/R\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"Rate of heat loss per metre of pipe,Q=\",round(Q,1),\"W/m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of heat loss per metre of pipe,Q= 62.7 W/m\n"
       ]
      }
     ],
     "prompt_number": 126
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.3,Page no:2.19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Loss in pipe\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "r1=44.0 #i [mm]\n",
      "r1=r1/1000.0  #i[m]\n",
      "r2=0.094   #i [m]\n",
      "r3=0.124  #i [m]\n",
      "T1=623.0  #iTemperature at outer surface of wall in[K]\n",
      "T3=313.0  #iTemperature at outer surface of outer insulation  [K]\n",
      "k1=0.087  #iThermal conductivity of insulation layer 1..in [W/m.K]\n",
      "k2=0.064  #iThermal conductivity of insulation layer 2  [W/m.K]\n",
      "l=1    #i Length of pipe   [m]\n",
      "\n",
      "#Calculation\n",
      "rm1=(r2-r1)/math.log(r2/r1)  #imath.log mean radius of insulation layer 1 [m]\n",
      "rm2=(r3-r2)/math.log(r3/r2)  #imath.log mean radius of insulation layer 2[m]\n",
      "#iPutting values in following eqn:\n",
      "Q= (T1-T3)/((r2-r1)/(k1*2*math.pi*rm1*l)+(r3-r2)/(k2*2*math.pi*rm2*l)) \n",
      "\n",
      "#Result\n",
      "print\"Heat loss per meter pipe is\",round(Q,1),\"W/m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss per meter pipe is 149.2 W/m\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.4,Page no:2.21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss in interface\n",
      "\n",
      "#Variable declaration\n",
      "A=1 #Heat transfer area  [sq m]\n",
      "x1=0.229  # thickness of fire brick in [m]\n",
      "x2=0.115  # thickness of insulating brick in [m]\n",
      "x3=0.229  # thickness of building brick in [m]\n",
      "k1=6.05  #thermal conductivity of fir brick  [W/(m.K)]\n",
      "k2=0.581  #thermal conductivity of insulating brick   [W/m.K]\n",
      "k3=2.33  #thermal conductivity of building brick   [W/m.K]\n",
      "T1=1223  # inside temperature [K]\n",
      "T2=323 # Outside temperature[K]\n",
      "\n",
      "#Calculation\n",
      "dT=T1-T2  #Overall temp drop [K]\n",
      "R1=(x1/k1*A) #thermal resistance 1\n",
      "R2=(x2/k2*A) # Thermal resistance 2\n",
      "R3=(x3/k3*A) #Thermal resistance 3\n",
      "Q=dT/(R1+R2+R3) #w/SQ m\n",
      "Ta=-((Q*R1)-T1)  #from  Q1=Q=(T1-Ta)/(x1/k1*A)\n",
      "#Similarly\n",
      "Tb=(Q*R3)+T2 \n",
      "\n",
      "#Result\n",
      "print\"Interface temperature:\\ni-Between  FB-IB=\",round(Ta),\" K  \\nii-Between IB-PB=\",round(Tb,1),\"K\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Interface temperature:\n",
        "i-Between  FB-IB= 1121.0  K  \n",
        "ii-Between IB-PB= 587.8 K\n"
       ]
      }
     ],
     "prompt_number": 130
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.5,Page no:2.23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss per unit area\n",
      "\n",
      "#Variable declaration\n",
      "A=1   #let [sq m]\n",
      "x1=0.23    #thickness of fir brick layer[m]\n",
      "x2=0.115    # [m]\n",
      "x3=0.23    #[m]\n",
      "T1=1213.0   #Temperature of furnace [K]\n",
      "T2=318.0    #Temperature of furnace  [K]\n",
      "dT=T1-T2   #[K]\n",
      "k1=6.047    #W/(m.K) (fire brick)\n",
      "k2=0.581    #W/(m.K) (insulating brick)\n",
      "k3=2.33    #W/(m.K) (building brick)\n",
      "\n",
      "#Calculation\n",
      "Q_by_A=dT/((x1/k1)+(x2/k2)+(x3/k3))  #Heat lost per unit Area in Watt\n",
      "Q_by_A=round(Q_by_A,1)\n",
      "R1=(x1/k1)  #Thermal resistance\n",
      "R2=(x2/k2)\n",
      "R3=(x3/k3)\n",
      "R1=round(R1,2)\n",
      "R2=round(R2,1)\n",
      "R3=round(R3,1)\n",
      "Ta=T1-((dT*R1)/(R1+R2+R3))\n",
      "Ta=round(Ta)\n",
      "Tb=((dT*R3)/(R1+R2+R3))+T2\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"Heat loss per unit area is\",Q_by_A,\"W=\",Q_by_A,\"J/s\\n\"\n",
      "print\"Ta=\",Ta,\"K(APPROX) =Temperature at the interface between fire brick and insulating brick\"\n",
      "print\"Tb=\",round(Tb),\"K Temperature at the interface between insulating and building brick\"\n",
      "print\"\\nNOTE:Tb is wrongly calculated in the book as 565 K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss per unit area is 2674.2 W= 2674.2 J/s\n",
        "\n",
        "Ta= 1108.0 K(APPROX) =Temperature at the interface between fire brick and insulating brick\n",
        "Tb= 581.0 K Temperature at the interface between insulating and building brick\n",
        "\n",
        "NOTE:Tb is wrongly calculated in the book as 565 K\n"
       ]
      }
     ],
     "prompt_number": 159
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.7,Page no:2.26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss in wall\n",
      "#Part-(a)\n",
      "\n",
      "#Variable declaration\n",
      "A=1.0  # sq metre\n",
      "x1=114.0 # mm\n",
      "x1=x1/1000.0 # metre\n",
      "k1=0.138 # W/(m.K)\n",
      "R1= x1/(k1*A)\n",
      "x2=229.0 #mm\n",
      "x2= x2/1000.0  # metre\n",
      "k2=1.38  # W/m.K\n",
      "R2=x2/(k2*A)\n",
      "dT=1033.0-349.0\n",
      "\n",
      "#Calculation\n",
      "#Heat loss\n",
      "Q1=dT/(R1+R2)\n",
      "#Part(b)\n",
      "#contact resistance=cr\n",
      "cr=0.09 #K/W\n",
      "R=R1+R2+cr\n",
      "Q=dT/R\n",
      "\n",
      "#Result\n",
      "print\"Heat loss  from 1 sq metre wall=\",round(Q1,1),\"W\"\n",
      "print\"Heat loss from 1 sq metre when resistance present=\",round(Q,1),\"W\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss  from 1 sq metre wall= 689.5 W\n",
        "Heat loss from 1 sq metre when resistance present= 632.1 W\n"
       ]
      }
     ],
     "prompt_number": 161
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.8,Page no:2.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Loss per area\n",
      "\n",
      "#Variable declaration\n",
      "x1=0.02  #[m]\n",
      "x2=0.01  #[m]\n",
      "x3=0.02  #[m]\n",
      "k1=0.105  #W/(m.k)\n",
      "k3=k1  #W/(m.K)\n",
      "k2=0.041  #W/(m.K)\n",
      "T1=303\n",
      "T2=263\n",
      "\n",
      "#Calculation\n",
      "dT=T1-T2   #[K]\n",
      "Q_by_A=dT/((x1/k1)+(x2/k2)+(x3/k3))\n",
      "R=0.625  #K/W\n",
      "Tx=293   #K\n",
      "Rx=0.9524   #K/W\n",
      "x=R*(T1-Tx)/(dT*Rx)\n",
      "x=x*100  #mm\n",
      "\n",
      "#Result\n",
      "print\"The temperature of 293 K will be reached at point\",round(x,1),\"mm from the outermost wall surface of the ice-box\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The temperature of 293 K will be reached at point 16.4 mm from the outermost wall surface of the ice-box\n"
       ]
      }
     ],
     "prompt_number": 163
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.9,Page no:2.28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss\n",
      "\n",
      "#Variable declaration\n",
      "import math\n",
      "ID=50.0 #Internal diameter[mm]\n",
      "dT=(573.0-303.0) \n",
      "r1=ID/2.0 #mm\n",
      "r1=r1/1000.0 # metres\n",
      "OD=150.0 #Outer diameter[mm]\n",
      "r2=OD/2.0 # mm\n",
      "r2=75.0/1000.0 # m\n",
      "#Thermal conductivity\n",
      "k=17.45 # W/(m.K) \n",
      "\n",
      "#Calculation\n",
      "#Q/A=dT/(r2-r1)/k\n",
      "A1=4*math.pi*(r1**2) \n",
      "A2=4*math.pi*(r2**2) \n",
      "A=math.sqrt(A1*A2)\n",
      "Q=(A*k*dT)/(r2-r1)\n",
      "\n",
      "#Result\n",
      "print\"Heat loss=Q=\",round(Q),\"W\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss=Q= 2220.0 W\n"
       ]
      }
     ],
     "prompt_number": 164
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.10,Page no:2.29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Passed\n",
      "\n",
      "#Variable declaration\n",
      "A= 1.0 #sq m\n",
      "x1=0.15\n",
      "x2=0.01\n",
      "x4=0.15\n",
      "T1=973.0  #[K]\n",
      "T2=288.0  #[K]\n",
      "dT=T1-T2  #[K]\n",
      "#Thermal conductivities\n",
      "k1=1.75  \n",
      "k2=16.86\n",
      "k3=0.033\n",
      "k4=5.2\n",
      "\n",
      "#Calculation\n",
      "#in absence of air gap,sum of thermal resistances \n",
      "sR=(x1/k1*A)+(x2/k2*A)+(x4/k4*A)\n",
      "round(sR,3)\n",
      "sR=0.1153  #approximate\n",
      "Q= dT/sR\n",
      "\n",
      "#When heat loss,Q=1163,then new resistance =sR1\n",
      "Q1=1163.0  #[W/sq m]\n",
      "sR1=dT/Q1\n",
      "#width of air gap be w then\n",
      "w=(sR1-sR)*k3*A  # [m]\n",
      "w=w*1000  #in [mm]\n",
      "\n",
      "#Result\n",
      "print\"Heat lost per sq meter is\",round(Q),\"W/sq m\"\n",
      "print\"Width of air gap is\",round(w,1),\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat lost per sq meter is 5941.0 W/sq m\n",
        "Width of air gap is 15.6 mm\n"
       ]
      }
     ],
     "prompt_number": 184
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.11,Page no:2.30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Heat loss in Insulated pipe\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "d1=300.0  #[mm]\n",
      "r1=d1/2.0  # [mm]\n",
      "r1=r1/1000.0  #[m]\n",
      "r2=r1+0.05  #[m]\n",
      "r3=r2+0.04  #[m]\n",
      "x1=0.05  #[m]\n",
      "x2=0.04  #[m]\n",
      "k1=0.105  #W/(m.K)\n",
      "k2=0.07   #W/(m.K)\n",
      "\n",
      "#Calculation\n",
      "rm1=  (r2-r1)/math.log(r2/r1)   # [m]\n",
      "rm2=(r3-r2)/math.log(r3/r2)      #[m]\n",
      "L=1  #let\n",
      "A1=math.pi*rm1*L   #let L=1\n",
      "R1=x1/(k1*A1) \n",
      "A2=math.pi*rm2*L\n",
      "R2=x2/(k2*A2)\n",
      "T1=623.0  #[K]\n",
      "T2=323.0  #[K]\n",
      "dT=T1-T2  #[K]\n",
      "\n",
      "#Part a\n",
      "Q_by_L= dT/(R1+R2)   #Heat loss\n",
      "\n",
      "#Part b:\n",
      "P=2*math.pi*(r1+x1+x2)  #[m]\n",
      "Q_by_L_peri=Q_by_L/P  # [W/sq m]\n",
      "R1=x1/(k1*A1) \n",
      "sR=0.871+0.827\n",
      "dT1=dT*R1/sR\n",
      "\n",
      "\n",
      "#Result\n",
      "#Part a\n",
      "print\"Heat loss is:\",round(Q_by_L,1),\"W/m\" \n",
      "#Part b:\n",
      "print\"Heat lost per sq meter of outer insulation is\",round(Q_by_L_peri),\"W/sq m\"\n",
      "print\"Temperature between two layers of insulation=\",round((T1-dT1)),\"K\"\n",
      "\n",
      "  \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss is: 176.3 W/m\n",
        "Heat lost per sq meter of outer insulation is 117.0 W/sq m\n",
        "Temperature between two layers of insulation= 469.0 K\n"
       ]
      }
     ],
     "prompt_number": 187
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.12,Page no:2.31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss in Composite brick\n",
      "\n",
      "#Variable declaration\n",
      "x1=0.01  #[m]\n",
      "x2=0.15  #[m]\n",
      "x3=0.15  #[m]\n",
      "T1=973.0  #[K]\n",
      "T2=423.0  #[K]\n",
      "dT=T1-T2 \n",
      "#Thermal conductivities\n",
      "k1=16.86  #[W/m.K]\n",
      "k2=1.75  #[W/m.K]\n",
      "k3=5.23  #[W/m.K]\n",
      "k_air=0.0337  # [W/m.K]\n",
      "A=1  #[sq m]\n",
      "\n",
      "#Calculation\n",
      "sigma_R=(x1/(k1*A)+x2/(k2*A)+x3/(k3*A))\n",
      "Q=dT/sigma_R  #Heat flow in  [W\n",
      "Tm= Q*x3/k3  #Temperature drop in magnesite brick\n",
      "#Interface temperature=iT\n",
      "iT=T2+Tm  #[K]\n",
      "sigma_xbyk= A*dT/1163   #with air gap for reducing heat loss to 1163 per sq m\n",
      "x_by_k=sigma_xbyk-sigma_R   #x/k for air\n",
      "t=x_by_k*k_air\n",
      "t=t*1000 \n",
      "\n",
      "#Calculation\n",
      "print\"Width of the air gap is\",round(t,2),\"mm\"\n",
      "\n",
      " \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Width of the air gap is 12.06 mm\n"
       ]
      }
     ],
     "prompt_number": 189
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.13,Page no:2.32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat flow in a pipe\n",
      "import math\n",
      "#Variable declaration\n",
      "L=1   #assume  [m]\n",
      "k1=43.03   #[W/(m.K)\n",
      "k2=0.07    #(W/m.K)\n",
      "T1=423    #inside temperature [K]\n",
      "T2=305     # [K]\n",
      "r1=0.0525    #[mm]\n",
      "r2=0.0575    #[m]\n",
      "r3=0.1075 #[m]\n",
      "\n",
      "#Calculation\n",
      "#r3=r3/1000   #[m]\n",
      "Q=(2*math.pi*L*(T1-T2))/(((math.log(r2/r1))/k1)+((math.log(r3/r2))/k2))      #Heat loss per metre \n",
      "#Part 2\n",
      "#T=Temperature of outer surface\n",
      "T=T1-(Q*math.log(r2/r1))/(k1*2*math.pi*L) \n",
      "#Part iii\n",
      "id=0.105    #inside diametre in [m]\n",
      "A=math.pi*id*1  #inside area in [sq m]\n",
      "C=Q/(A*(T1-T2))    #conductance per length\n",
      "\n",
      "#Result\n",
      "print\"Heat flow per metre of pipe is\",round(Q,2),\"W/m\"\n",
      "#Part 2\n",
      "print\"Temperature at outer surface of steel pipe:\",round(T,2),\"K\" \n",
      "#Part iii\n",
      "print\"Conductance per m length based on inside area is\",round(C,1),\"W/K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat flow per metre of pipe is 82.93 W/m\n",
        "Temperature at outer surface of steel pipe: 422.97 K\n",
        "Conductance per m length based on inside area is 2.1 W/K\n"
       ]
      }
     ],
     "prompt_number": 192
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.15,Page no:2.35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Thickness of insulation \n",
      "  \n",
      "#Variable declaration\n",
      "A=1  # [sq m]\n",
      "x1=0.1    #m\n",
      "x2=0.04\n",
      "k1=0.7\n",
      "k2=0.48\n",
      "\n",
      "#Calculation\n",
      "sigma=x1/(k1*A)+x2/(k2*A)   #K/W\n",
      "#Q=4.42*dT\n",
      "#Q=dT/sigma\n",
      "#with rockwool insulation added,Q_dash=0.75*Q\n",
      "k3=0.065     # W/(m.K)\n",
      "#Q_dash=dT/sigma+x3/k3*A\n",
      "#On solving Q and Q_dash we get\n",
      "x3=((1/(0.75*4.42))-sigma)*k3    #[m]\n",
      "x3=x3*1000     # [mm]\n",
      "\n",
      "#Result\n",
      "print\"Thickness of rockwool insulation required=\",round(x3,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of rockwool insulation required= 4.91 mm\n"
       ]
      }
     ],
     "prompt_number": 193
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.16,Page no:2.36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Reduction in heat loss in insulated pipe\n",
      "d1=40.0    # Diameter of pipe[mm]\n",
      "r1=(d1/2.0)/1000.0  #Outside radius in [m]\n",
      "t1=20.0     #Insulation 1 thickness in [mm]\n",
      "t1=t1/1000    #[m]\n",
      "t2=t1          #Insulation 2 thickness in[m]\n",
      "r2=r1+t1      #radius after 1st insulation  in [m]\n",
      "r3=r2+t2      #Radius after second insulation in [m]\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "#Since python does not handles symbolic constants,we will assume some values:\n",
      "#(1)\n",
      "#Let the layer M-1 be nearer to the surface\n",
      "L=1.0          #[m]\n",
      "T1=10.0        #Temperature of inner surface of pipe [K]\n",
      "T2=5.0         #Temperature of outer surface of insulation [K]\n",
      "k=1.0          #Thermal conductivity\n",
      "k1=k         #For M-1 material\n",
      "k2=3*k       #For material M-2\n",
      "Q1=(T1-T2)/(math.log(r2/r1)/(2*math.pi*L*k1)+math.log(r3/r2)/(2*math.pi*L*k2))\n",
      "#(2)\n",
      "#Let the layer of material M-2 be nearer to the surface\n",
      "Q2=(T1-T2)/(math.log(r2/r1)/(2*math.pi*L*k2)+math.log(r3/r2)/(2*math.pi*L*k1))\n",
      "#For dummy variables unity...\n",
      "#For any value of k,T1 and T2,Q1 is always less than Q2\n",
      "\n",
      "#Result\n",
      "print\"M-1 near the surface is advisable(i.e Arrangement one will result in less heat loss)\"\n",
      "per_red=(Q2-Q1)*100/Q2\n",
      "print\"Percent reduction in heat loss is\",round(per_red,1),\"percent\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "M-1 near the surface is advisable(i.e Arrangement one will result in less heat loss)\n",
        "Percent reduction in heat loss is 23.2 percent\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.17,Page no:2.37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss in a pipe\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T1=523   #[K]\n",
      "T2=323   #[K]\n",
      "r1=0.05   #[m]\n",
      "r2=0.055   #[m]\n",
      "r3=0.105   #[m]\n",
      "r4=0.155   #[m]\n",
      "k1=50      #[W/(m.K)]\n",
      "k2=0.06    #[W/(m.K)]\n",
      "k3=0.12    #W/(m.K)\n",
      "\n",
      "#Calculation\n",
      "#CASE 1\n",
      "Q_by_L1=2*math.pi*(T1-T2)/((math.log(r2/r1))/k1+(math.log(r3/r2))/k2+(math.log(r4/r3))/k3)   #[W/m]\n",
      "#Case 2\n",
      "Q_by_L2=2*math.pi*(T1-T2)/((math.log(r2/r1))/k1+(math.log(r3/r2))/k3+(math.log(r4/r3))/k2)\n",
      "perct=(Q_by_L2-Q_by_L1)*100/Q_by_L1\n",
      "\n",
      "#Result\n",
      "#CASE 1\n",
      "print\"Heat loss=\",round(Q_by_L1,1),\"W/m\"\n",
      "#Case 2\n",
      "print\"If order is changed then heat loss=\",round(Q_by_L2,2),\"W/m\" \n",
      "print\"Loss of heat is increased by\",round(perct,2),\" percent by putting material with higher thermal conductivity near the pipe surface\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss= 89.6 W/m\n",
        "If order is changed then heat loss= 105.76 W/m\n",
        "Loss of heat is increased by 18.04  percent by putting material with higher thermal conductivity near the pipe surface\n"
       ]
      }
     ],
     "prompt_number": 198
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.18,Page no:2.38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Arrangements for heat loss\n",
      "\n",
      "#Variable declaration\n",
      "#Assume:\n",
      "L=1.0    #[m]\n",
      "r1=0.10    #[m]    Outside radius od pipe\n",
      "ia=0.025    #inner insulaiton [m]\n",
      "import math \n",
      "r2=r1+ia    #Outer radius of inner insulation\n",
      "r3=r2+ia    #Outer radius of outer insulation\n",
      "\n",
      "#Calculation\n",
      "#CASE 1:'a' near the pipe surface\n",
      "#let k1=1\n",
      "k1=1.0     #Thermal conductivity of A[W/m.K]\n",
      "#and k2=3k1=3\n",
      "k2=3.0     #Thermal conductivity of B[W/m.K]\n",
      "#Let dT=1\n",
      "dT=1.0\n",
      "Q1=dT/(math.log(r2/r1)/(2*math.pi*k1*L)+math.log(r3/r2)/(2*math.pi*k2*L))\n",
      "#CASE 2:'b' near the pipe surface \n",
      "Q2=dT/(math.log(r2/r1)/(2*math.pi*k2*L)+math.log(r3/r2)/(2*math.pi*k1*L))\n",
      "\n",
      "#Result\n",
      "print\"ANSWER-(i)\\nQ1=\",round(Q1,2),\"W \\nQ2=\",round(Q2,2),\" W \"\n",
      "print\"Q1 is less than Q2.i.e arrangement A near the pipe surface and B as outer layer gives less heat loss\\n\"\n",
      "percent=(Q2-Q1)*100/Q1     #percent reduction in heat loss\n",
      "print\"ANSWER-(ii) \\nPercent reduction in heat loss (with near the pipe surface)=\",round(percent,1),\"%(approx)\" \n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "ANSWER-(i)\n",
        "Q1= 22.13 W \n",
        "Q2= 24.48  W \n",
        "Q1 is less than Q2.i.e arrangement A near the pipe surface and B as outer layer gives less heat loss\n",
        "\n",
        "ANSWER-(ii) \n",
        "Percent reduction in heat loss (with near the pipe surface)= 10.6 %(approx)\n"
       ]
      }
     ],
     "prompt_number": 206
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.19,Page no:2.39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Insulation thickness\n",
      "\n",
      "#Variable declaration\n",
      "x1=0.224 # m\n",
      "k1=1.3 # W/(m.K)\n",
      "k2=0.346 # W/(m.K)\n",
      "T1=1588.0 # K\n",
      "T2= 299.0 # K\n",
      "QA=1830.0 # W/ sq metre #heat loss\n",
      "\n",
      "#Calculation\n",
      "#Q/A=(T1-T2)/x1/k1+x2/k2\n",
      "x2=k2*((T1-T2)*1/(QA)-(x1/k1))\n",
      "x2=x2*1000 \n",
      "\n",
      "#Result\n",
      "print\"Thickness of insulation=\",round(x2),\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of insulation= 184.0 mm\n"
       ]
      }
     ],
     "prompt_number": 209
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.20,Page no:2.39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss in furnace\n",
      "\n",
      "#Variable declaration\n",
      "\n",
      "#for clay\n",
      "k1=0.533    #[W/(m.K)]\n",
      "#for red brick\n",
      "k2=0.7      #[W/m.K]\n",
      "\n",
      "\n",
      "#Calculation\n",
      "\n",
      "#Case 1\n",
      "A=1     #Area\n",
      "x1=0.125    #[m]\n",
      "x2=0.5      #[m]\n",
      "#Resistances\n",
      "r1=x1/(k1*A) #Res of fire clay [K/W]\n",
      "r2=x2/(k2*A)  #Res of red brick[K/W]\n",
      "r=r1+r2\n",
      "#Temperatures\n",
      "T1=1373    #[K]\n",
      "T2=323     #[K]\n",
      "Q=(T1-T2)/r #[W/sq m]\n",
      "Tdash=T1-Q*r1  #[K]\n",
      "\n",
      "#Case2\n",
      "# Heat loss must remain  unchanged,Thickness of red brick also reduces to its half\n",
      "x3=x2/2   #[m]\n",
      "r3=x3/(k2*A)  #[K/W]\n",
      "Tdd= T2+(Q*r3)    #[K]\n",
      "#Thickness of diatomite be x2,km be mean conductivity\n",
      "Tm=(Tdash+Tdd)/2   #[K]\n",
      "km=0.113+(0.00016*Tm)  #[W/(m.K]\n",
      "x2=km*A*(Tdash-Tdd)/Q  #[m]\n",
      "x2=x2*1000      #[mm]\n",
      "\n",
      "#Result\n",
      "print\"Thickness of diatomite layer=\",round(x2),\"mm\"\n",
      "  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of diatomite layer= 93.0 mm\n"
       ]
      }
     ],
     "prompt_number": 210
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.21,Page no:2.41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Rate of heat loss in pipe\n",
      "\n",
      "#Variable declaration\n",
      "k1=0.7   #common brick   W/((m.K)\n",
      "k2=0.48  #gypsum layer [W/(m.K)\n",
      "k3=0.065 #Rockwool    [W/m.K]\n",
      "#Heat loss with insulatiob will be 20% of without insulation\n",
      "A=1      #sq m\n",
      "x1=0.1   #[m]\n",
      "x2=0.04 #[m]\n",
      "\n",
      "#Calculation\n",
      "R1=x1/(k1*A)   #K/W\n",
      "R2=x2/(k2*A)   #K/W\n",
      "R=R1+R2        #K/W\n",
      "#R3=x3/(k3*A)\n",
      "QbyQd=0.2\n",
      "sigRbyRd=QbyQd\n",
      "x3=(R/QbyQd-R)/15.4 #m\n",
      "x3=x3*1000          #[mm]\n",
      "\n",
      "#Result\n",
      "print\"Thickness of rockwool insulation\",round(x3),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of rockwool insulation 59.0 mm\n"
       ]
      }
     ],
     "prompt_number": 211
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.22,Page no:2.44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss from insulated steel pipe\n",
      "\n",
      "#Variable declaration\n",
      "Ts=451.0       #Steam temperature in [K]\n",
      "Ta=294.0       #Air temperature in [K]\n",
      "Di=25.0    #Internal diameter of pipe  [mm]\n",
      "Di=Di/1000               #[m]\n",
      "od=33.0    #Outer diameter of pipe   [mm] \n",
      "od=od/1000               #[m]\n",
      "hi=5678.0  #Inside heat transfer coefficient [W/(m**2.K)]\n",
      "ho=11.36  #Outsideheat transfer coefficient  [W/(sq m.K)]\n",
      "\n",
      "#Calculation\n",
      "xw=(od-Di)/2     #Thickness of steel pipe  [m]\n",
      "k2=44.97         #k for steel in W/(m.K)\n",
      "k3=0.175         #k for rockwool in W/(m.K)\n",
      "ti=38.0/1000            #thickness of insulation in [m]\n",
      "r1=Di/2          #[m]\n",
      "r2=od/2          #[m]\n",
      "rm1=(r2-r1)/math.log(r2/r1)       #[m]\n",
      "r3=r2+ti             #[m]\n",
      "rm2=(r3-r2)/math.log(r3/r2)   #[m]\n",
      "Dm1=2*rm1                #[m]\n",
      "Dm2=2*rm2                #[m]\n",
      "import math\n",
      "#Rate of heat loss = dT/(sigma_R)\n",
      "L=1              #[m]\n",
      "R1=1/(hi*math.pi*Di*L)   #[K/W]\n",
      "R1=round(R1,4)\n",
      "R2=xw/(k2*math.pi*Dm1*L)\n",
      "R2=round(R2,6)\n",
      "R3=(r3-r2)/(k3*math.pi*Dm2*L)\n",
      "R3=round(R3,3)\n",
      "R3=1.086\n",
      "Do=(od+2*ti)            #[mm]\n",
      "R4=1/(ho*math.pi*Do*L)               #[m]\n",
      "R4=round(R4,3)\n",
      "sigma_R=R1+R2+R3+R4 \n",
      "#Heat loss\n",
      "dT=Ts-Ta                 #[K]\n",
      "Q=dT/sigma_R             #Heat loss [W/m]\n",
      "\n",
      "#Result\n",
      "print\"Rate of heat loss is\",round(Q,2),\"W/m\"\n",
      "print\"\\nNOTE:Slight variation in final answer due to mistake in calculation of sigma_R in textbook.\\nIn book is is taken as 1.366\\n \"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of heat loss is 116.63 W/m\n",
        "\n",
        "NOTE:Slight variation in final answer due to mistake in calculation of sigma_R in textbook.\n",
        "In book is is taken as 1.366\n",
        " \n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.23,Page no:2.46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat loss from furnace\n",
      "\n",
      "#Variable declaration\n",
      "T1=913.0     #[K]\n",
      "T=513.0     #[K]\n",
      "T2=313.0      #[K]\n",
      "\n",
      "#Calculation\n",
      "\n",
      "#Q=(T1-T)/(x/(k*A))\n",
      "#Q=(T-T2)/(1/(h*A))\n",
      "#x=2k/h\n",
      "#Q=(T1-T2)/(x/(kA)+1/(h*A))\n",
      "#Therefore,Q=hA/3*(T1-T2)\n",
      "#With increase in thickness(100%)\n",
      "#x1=4*k/h\n",
      "#Q2=(T1-T2)/(x1/k*A+1/(h*A))\n",
      "#Q2=(h*A)/5)*(T1-T2)\n",
      "#Now\n",
      "h=1.0     #Assume\n",
      "A=1.0     #Assume for calculation\n",
      "Q1=(h*A/3)*(T1-T2)\n",
      "Q2=((h*A)/5)*(T1-T2)\n",
      "percent=(Q1-Q2)*100/Q1      #Percent reduction in heat loss\n",
      "\n",
      "#Result\n",
      "print\"Percentage reduction in heat loss is\",percent,\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage reduction in heat loss is 40.0 %\n"
       ]
      }
     ],
     "prompt_number": 100
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.24,Page no:2.47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Rate of heat loss\n",
      "\n",
      "#Variable declaration\n",
      "L=1.0#m\n",
      "thp=2.0#Thickness of pipe  in mm\n",
      "thi=10.0#Thickness of insulation  in mm\n",
      "T1=373.0#K\n",
      "T2=298.0#K\n",
      "id=30.0#mm\n",
      "r1=id/2#mm\n",
      "\n",
      "#Calculation\n",
      "r2=r1+thp#mm\n",
      "r3=r2+thi#mm\n",
      "#In S.I units\n",
      "r1=r1/1000 #m\n",
      "r2=r2/1000#m\n",
      "r3=r3/1000#m\n",
      "k1=17.44#W/(m.K)\n",
      "k2=0.58#W/(m.K)\n",
      "hi=11.63#W/(sq m.K)\n",
      "ho=11.63#W/(sq m.K)\n",
      "import math\n",
      "Q=(2*math.pi*L*(T1-T2))/(1/(r1*hi)+(math.log(r2/r1))/k1+((math.log(r3/r2))/k2)+(1/(0.02*ho)))\n",
      "\n",
      "#Result\n",
      "print\"Rate of heat loss,Q=\",round(Q,1),\"W\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rate of heat loss,Q= 43.5 W\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.25,Page no:2.48"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Thickness of insulation .\n",
      "from scipy.optimize import fsolve\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h=8.5        #[W/sq m.K]\n",
      "dT=175       #[K]\n",
      "r2=0.0167            #[m]\n",
      "\n",
      "#Calculation\n",
      "Q_by_l=h*2*math.pi*r2*dT        #[W/m]\n",
      "k=0.07           #For insulating material in  [W/m.K]\n",
      "#for insulated pipe--50% reduction in heat loss\n",
      "Q_by_l1=0.5*Q_by_l      #[w/m]\n",
      "def f(r3):\n",
      "    x=Q_by_l1-dT/((math.log(r3/r2))/(2*math.pi*k)+1/(2*math.pi*r3*h))\n",
      "    return(x)\n",
      "#by trial and error method we get:\n",
      "r3=fsolve(f,0.05)\n",
      "t=r3-r2         #thickness of insulation in [m]\n",
      "\n",
      "#Result\n",
      "print\"Required thickness of insulation is\",round(t[0],4),\"m=\",round(t[0]*1000,1),\" mm or\",round(t[0]*1000),\"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required thickness of insulation is 0.0188 m= 18.8  mm or 19.0 m\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.26,Page no:2.49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate heat loss per metre length\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "id=0.1    #internal diameter in[m]\n",
      "od=0.12    #outer diameter in [m]\n",
      "T1=358    #Temperature of fluid   [K]\n",
      "T2=298    #Temperature of surrounding   [K]\n",
      "t=0.03    #thickness of insulation     [m]\n",
      "k1=58    #[W/m.K]\n",
      "k2=0.2    #W/(m.K) insulating material\n",
      "h1=720    #inside heat transfer coeff [W/sq m .K]\n",
      "h2=9      #W/sq m.K\n",
      "r1=id/2    #[m]\n",
      "r2=od/2    #[m]\n",
      "r3=r2+t    #[m]\n",
      "\n",
      "#Calculation\n",
      "#Heat loss per meter=Q_by_L\n",
      "Q_by_L=(T1-T2)/(1/(2*math.pi*r1*h1)+math.log(r2/r1)/(2*math.pi*k1)+math.log(r3/r2)/(2*math.pi*k2)+1/(2*math.pi*r3*h2))  #W/m\n",
      "\n",
      "#Result\n",
      "print\"Heat loss per metre length of pipe=\",round(Q_by_L,2),\"W\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss per metre length of pipe= 114.49 W\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.27,Page no:2.50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Mineral wool insulation\n",
      "from scipy.optimize import fsolve\n",
      "\n",
      "#Variable declaration\n",
      "import math\n",
      "T1=573           #[K]\n",
      "T2=323          #[K]\n",
      "T3=298          #[K]\n",
      "h1=29            # Outside heat transfer coefficients [W/sq m.K]\n",
      "h2=12           #[W/sq m.K]\n",
      "r1=0.047             #Internal radius [m]\n",
      "r2=0.05              #Outer radius[m]\n",
      "k1=58                #[W/m.K]\n",
      "k2=0.052             #[W/m.K]\n",
      "\n",
      "#Calculation\n",
      "#Q=(T1-T2)/(1/(r1*h1)+math.log(r2/r1)/k1+math.log(r3/r2)/k2)=(T2-T3)/(1/(r3*h2))\n",
      "def f(r3):\n",
      "    x=(T1-T2)/(1/(r1*h1)+math.log(r2/r1)/k1+math.log(r3/r2)/k2)-(T2-T3)/(1/(r3*h2))\n",
      "    return(x)\n",
      "\t#by trial and error method :\n",
      "r3=fsolve(f,0.05)\n",
      "t=r3-r2             #Thickness of insulation in [m]\n",
      "#Q=h2*2*math.pi*r3*L*(T2-T3)\n",
      "Q_by_l=h2*2*math.pi*r3*(T2-T3)      #[W/m]\n",
      "\n",
      "#Result\n",
      "print\"Thickness of insulation is\",round(t*1000),\"mm\"\n",
      "print\"Rate of heat loss per unit length is\",round(Q_by_l[0],1),\"W/m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of insulation is 32.0 mm\n",
        "Rate of heat loss per unit length is 154.1 W/m\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.28,Page no:2.51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate heat loss per sq m and temperature of outside surface\n",
      "\n",
      "#Variable declaration\n",
      "A=1 #assume [sq m]\n",
      "x1=0.006    #[m]\n",
      "x2=0.075    #[m]\n",
      "x3=0.2    #[m]\n",
      "k1=39.0    #[W/m.K]\n",
      "k2=1.1    #[W/m.K]\n",
      "k3=0.66    #[W/m.K]\n",
      "h0=65.0    #W/sq m .K\n",
      "T1=900.0    #K\n",
      "T2=300.0   #K\n",
      "\n",
      "#Calculation\n",
      "sigma_R=(x1/(k1*A)+x2/(k2*A)+x3/(k3*A)+1/(h0*A)) \n",
      "\n",
      "#To calculate heat loss/sq m area\n",
      "Q=(T1-T2)/sigma_R    #[W/sq m]\n",
      "#Q/A=T-T2/(1/h0), where T=Temp of outside surface\n",
      "#So, T=T2+Q/(A*h0)\n",
      "T=Q/(A*h0)+T2    #[K]\n",
      "\n",
      "#Result\n",
      "print\"Heat loss per sq metre area is:\",round(Q,1),\"W/sq m\" \n",
      "print\"Temperature of outside surface of furnace is:\",round(T,1),\"K (\",round(T-273,1),\"degree C)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss per sq metre area is: 1551.4 W/sq m\n",
        "Temperature of outside surface of furnace is: 323.9 K ( 50.9 degree C)\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.29,Page no:2.52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine necessary thickness of insulation brick\n",
      "\n",
      "#Variable declaration\n",
      "A=1.0    #Assume [sq m]\n",
      "x1=0.003    #[m]\n",
      "x3=0.008    #[m]\n",
      "k1=30.0    #[W/m.K]\n",
      "k2=0.7    #[W/m.K]\n",
      "k3=40.0    #[W/m.K]\n",
      "T1=363.0    #[K]\n",
      "T=333.0    #[K]\n",
      "T2=300.0    #[K]\n",
      "h0=10.0    #W/sq m.K\n",
      "\n",
      "#Calculation\n",
      "#Q=(T1-T2)/(x1/(k1*A)+x2/(k2*A)+x3/(k3*A)+1/(h0*A))\n",
      "#Also,Q=(T-T2)/(1/(h0*A))\n",
      "#So, (T1-T2)/((x1/(k1*A)+x2/(k2*A)+x3/(k3*A)+1/(h0*A))=(T-T2)/(1/(h0*A))\n",
      "#or,x2=k2*A((T1-T2)/((T-T2)*h0*A)-1/(h0*A)-x1/(k1*A)-x3/(k3*A))\n",
      "x2=k2*A*((T1-T2)/((T-T2)*h0*A)-1/(h0*A)-x1/(k1*A)-x3/(k3*A))  #[m]\n",
      "\n",
      "#Result\n",
      "print\"Thickness of insulating brick required is\",round(x2*1000,1),\"mm\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of insulating brick required is 63.4 mm\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.30,Page no:2.53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat flow through furnace wall\n",
      "\n",
      "#Variable declaration\n",
      "hi=75.0        #[W/sq m.K)\n",
      "x1=0.2    #m\n",
      "x2=0.1    #[m]\n",
      "x3=0.1    #[m]\n",
      "T1=1943    #[K]\n",
      "k1=1.25    #W/m.K\n",
      "k2=0.074    #/W/m.K\n",
      "k3=0.555    #W/m.K\n",
      "T2=343.0    #K\n",
      "A=1.0    #assume [sq m]\n",
      "\n",
      "#Calculation\n",
      "sigma_R=1.0/(hi*A)+x1/(k1*A)+x2/(k2*A)+x3/(k3*A) \n",
      "#Heat loss per i sq m\n",
      "Q=(T1-T2)/sigma_R    #[W]\n",
      "#if T=temperature between chrome brick and koalin brick then \n",
      "#Q=(T1-T)/(1/(hi*A)+x1/(k1*A))\n",
      "#or T=T1-(Q*(1/(hi*A)+x1/(k1*A)))\n",
      "T=T1-(Q*(1.0/(hi*A)+x1/(k1*A)))     #[K]\n",
      "#if Tdash=temperature at the outer surface of middle layer,then\n",
      "#Q=(Tdash-T2)/(x3/(k1*A))\n",
      "#or Tdash=T2+(Q*x3/(k3*A))\n",
      "Tdash=T2+(Q*x3/(k3*A))    #[K]\n",
      "\n",
      "#Result\n",
      "print\"Heat loss per sq m is:\",round(Q,1),\"W\"\n",
      "print\"Temperature at inner surface of middle layer=\",round(T,1),\"K(\",round(T-273,1),\"degree C)\"\n",
      "print\"Temperature at outer surface of middle layer=\",round(Tdash,1),\"K (\",round(Tdash-273,1),\"degree C)\" \n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss per sq m is: 938.5 W\n",
        "Temperature at inner surface of middle layer= 1780.3 K( 1507.3 degree C)\n",
        "Temperature at outer surface of middle layer= 512.1 K ( 239.1 degree C)\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.31,Page no:2.54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate:(a) Heat loss per unit length  \n",
      "#(b)Reduction in heat loss\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "hi=10    #W/sq m.K\n",
      "h0=hi    #W/sq.m.K\n",
      "r1=0.09    #m\n",
      "r2=0.12    #m\n",
      "t=0.05    #thickness of insulation [m]\n",
      "k1=40    #W/m.K\n",
      "k2=0.05    #W/m.K\n",
      "T1=473    #K\n",
      "T2=373    #K\n",
      "\n",
      "#Calculation\n",
      "Q_by_L=2*math.pi*(T1-T2)/(1/(r1*hi)+math.log(r2/r1)/k1+1/(r2*h0))     #W/m\n",
      "#After addition of insulation:\n",
      "r3=r2+t     #radius of outer surface of insulaiton\n",
      "Q_by_L1=2*math.pi*(T1-T2)/(1/(r1*hi)+math.log(r2/r2)/k1+math.log(r3/r2)/k2+1/(r3*h0))     # W\n",
      "Red=Q_by_L-Q_by_L1    #Reduciton in heat loss in [W/m]\n",
      "percent_red=(Red/Q_by_L)*100    #% Reduction in heat loss\n",
      "\n",
      "#Result\n",
      "print\"Ans (a) Heat loss=\",round(Q_by_L,2),\"W/m \"\n",
      "print\"Ans (b) Percent reduction in heat loss is\",round(percent_red,1),\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ans (a) Heat loss= 321.94 W/m \n",
        "Ans (b) Percent reduction in heat loss is 77.5 %\n"
       ]
      }
     ],
     "prompt_number": 54
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.32,Page no:2.55"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine: i-Heat flux across the layers and\n",
      "#ii-Interfacial temperature between the layers\n",
      "\n",
      "#Variable declaration\n",
      "T1=798.0    #K\n",
      "T2=298.0    #K\n",
      "x1=0.02    #m\n",
      "x2=x1    #m\n",
      "k1=60.0    #W/m.K\n",
      "k2=0.1    #W/m.K\n",
      "hi=100.0    #W/sq m.K\n",
      "h0=25.0    #W/sq m.K\n",
      "\n",
      "#Calculation\n",
      "Q_by_A=(T1-T2)/(1.0/hi+x1/k1+x2/k2+1.0/h0)     #W/sq m\n",
      "#If Tis the interfacial temperature between steel plate and insulating material\n",
      "#Q_by_A=(T-T2)/(x2/k2+1/h0)\n",
      "T=Q_by_A*(x2/k2+1.0/h0)+T2\n",
      "\n",
      "#Result\n",
      "print\"Ans (i)- Heat flux across the layers is\",round(Q_by_A),\"W/sq m\" \n",
      "print\"Ans-(ii)-Interfacial temperature between layers is\",round(T,1),\"K(\",round(T-273,1),\"degree C)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ans (i)- Heat flux across the layers is 1997.0 W/sq m\n",
        "Ans-(ii)-Interfacial temperature between layers is 777.4 K( 504.4 degree C)\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.33,Page no:2.56"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine Temperature at the outer surface of wall and convective conductance on the outer wall\n",
      "    \n",
      "    \n",
      "#Variable declaration    \n",
      "T1=2273                 #Temperature of hot gas:[K]\n",
      "T4=318                  #Ambient aur temperature[K]\n",
      "Qr1_by_A=23260          #Heat flow by radiation from gases to inside surface of wall[W/sq m]\n",
      "hi=11.63                #Heat transfer coefficient on inside wall:[W/sq m.K]\n",
      "K=58                    #Thermal conductivity of wall[W.sq m/K]\n",
      "Qr4_by_A=9300           #Heat flow by radiation from external surface to ambient[W/sq m]\n",
      "T2=1273                 #Inside Wall temperature[K]\n",
      "Qr1=Qr1_by_A    #W  for\n",
      "A=1    #sq m\n",
      "\n",
      "\n",
      "#Calculation\n",
      "Qc1_by_A=hi*(T1-T2)    #W/sq m\n",
      "Qc1=Qc1_by_A    #for A=1 sq m\n",
      "    #Thermal resistance:\n",
      "R=1.0/K    #K/W per sq m\n",
      "#Now Q=(T2-T3)/R,i.e \n",
      "#External wall temp T3=T2-Q*R\n",
      "#Q entering wall=\n",
      "Q_enter=Qr1+Qc1    #W\n",
      "T3=T2-Q_enter*R    #K\n",
      "T3=673      #Approximate\n",
      "#Heat loss due to convection:\n",
      "Qc4_by_A=Q_enter-Qr4_by_A    #W/sq m\n",
      "#Qc4_by_A=h0*(T3-T4)\n",
      "#or  h0=Qc4_by_A/(T3-T4)\n",
      "h0=Qc4_by_A/(T3-T4)    #W/sq m.K\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"Convective conductance is:\",round(h0,1),\"W/m^2.K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Convective conductance is: 72.1 W/m^2.K\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.34,Page no:2.60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Critical radius of insulation\n",
      "\n",
      "#Variable declaration\n",
      "T1=473    #[K]\n",
      "T2=293    #[K]\n",
      "k=0.17    #W/(m.K)\n",
      "h=3    #W/(sq m.K)\n",
      "h0=h    #W/sq m.K\n",
      "rc=k/h    #m\n",
      "r1=0.025    #Inside radius of insulaiton [mm]    \n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "q_by_l1=2*math.pi*(T1-T2)/(math.log(rc/r1)/k+1/(rc*h0))    #Heat transfer with insulation in W/m\n",
      "#Without insulation:\n",
      "q_by_l2=h*2*math.pi*r1*(T1-T2)    #W/m\n",
      "inc=(q_by_l1-q_by_l2)*100/q_by_l2    #Increase of heat transfer\n",
      "k=0.04    #Fibre glass insulaiton W/(sq m.K)\n",
      "rc=k/h    #Critical radius of insulaiton\n",
      "\n",
      "#Result\n",
      "print\"When covered with insulation:\\nHeat loss=\",round(q_by_l1,1),\"W\"\n",
      "print\"When without insulation,\\nHeat loss=\",round(q_by_l2,1),\"W\"\n",
      "print\"\\nPercent increase =\",round(inc,2),\"percent\" \n",
      "print\"In this case the value of rc=\",round(rc,4),\"m is less than the outside radius of pipe (\",r1,\"m)\"\n",
      "print\"So additon of any fibre glass would cause a decrease in the heat transfer\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When covered with insulation:\n",
        "Heat loss= 105.7 W\n",
        "When without insulation,\n",
        "Heat loss= 84.8 W\n",
        "\n",
        "Percent increase = 24.66 percent\n",
        "In this case the value of rc= 0.0133 m is less than the outside radius of pipe ( 0.025 m)\n",
        "So additon of any fibre glass would cause a decrease in the heat transfer\n"
       ]
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.36,Page no:2.61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the heat loss per metre of pipe and outer surface temperature\n",
      "\n",
      "#Variable declaration\n",
      "import math\n",
      "k=1.0    #Thermal conductivity in [W/sq m.K]\n",
      "h=8.0    #Het transfer coeff in W/sq m.K\n",
      "rc=k/h  #Critical radius in m\n",
      "T1=473.0    #K\n",
      "T2=293.0    #K\n",
      "r1=0.055    #Outer radius =inner radius in [m]\n",
      "\n",
      "#Calculation\n",
      "Q_by_L=2*math.pi*(T1-T2)/(math.log(rc/r1)/k+1.0/(rc*h))\n",
      "#For outer surface\n",
      "#Q_by_L=2*math.pi*(T-T2)/(1/rc*h)\n",
      "# implies that, T=T2+Q_by_L/(rc*2*math.pi)\n",
      "T=T2+Q_by_L/(rc*2*math.pi*h)    #K\n",
      "\n",
      "#Result\n",
      "print\"Heat loss per meter of pipe is\",round(Q_by_L),\"W/m(approx)\"\n",
      "print\"Outer surface temperature is: \",round(T,1),\"K(\",round(T-273,1),\"degree C)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss per meter of pipe is 621.0 W/m(approx)\n",
        "Outer surface temperature is:  391.8 K( 118.8 degree C)\n"
       ]
      }
     ],
     "prompt_number": 68
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.37,Page no:2.78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the time required for a ball to attain a temperature of 423 K\n",
      "\n",
      "#Variable declaration\n",
      "k_steel=35.0    #W/m.K\n",
      "Cp_steel=0.46    #kJ/(kg*K)\n",
      "Cp_steel=Cp_steel*1000    #J/(kg*K)\n",
      "h=10    #W/sq m.K\n",
      "rho_steel=7800.0    #kg/cubic m\n",
      "dia=50.0    #mm\n",
      "dia=dia/1000    #m\n",
      "R=dia/2      #radius in m\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "A=4*math.pi*R**2  #Area  in sq m\n",
      "V=A*R/3      #Volume in cubic meter\n",
      "Nbi=h*(V/A)/k_steel\n",
      "#As Nbi<0.10,internal temp gradient is negligible\n",
      "T=423.0    #K\n",
      "T0=723.0    #K\n",
      "T_inf=373.0    #K\n",
      "#(T-T_inf)/(T0-T_inf)=e**(-h*At/rho*Cp*V)\n",
      "t=-rho_steel*Cp_steel*R*math.log((T-T_inf)/(T0-T_inf))/(3*h)     #s\n",
      "\n",
      "#Result\n",
      "print\"Time required for a ball to attain a temperature of 423 K is\",round(t),\"s=\",round(t/3600,2),\"h\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time required for a ball to attain a temperature of 423 K is 5818.0 s= 1.62 h\n"
       ]
      }
     ],
     "prompt_number": 70
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.38,Page no:2.78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Time take in Steel ball quenched\n",
      "\n",
      "#Variable declaration\n",
      "dia=50.0    #mm\n",
      "dia=dia/1000    #m\n",
      "r=dia/2    #radius in m\n",
      "h=115.0    #W/sq m.K\n",
      "rho=8000.0 #kg/cubic m\n",
      "Cp=0.42    #kJ/kg.K\n",
      "Cp=Cp*1000    #J/(kg*K)\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "A=4*math.pi*r**2    #Area in sq m\n",
      "V=A*r/3    #Volume in cubic m\n",
      "T=423.0    #K\n",
      "T_inf=363.0    #K\n",
      "T0=723    #K\n",
      "#(T-T_inf)/(T0-T_inf)=e**(-3ht/(rho*Cp*r))\n",
      "t=-rho*Cp*r*math.log((T-T_inf)/(T0-T_inf))/(3*h)     #Time in seconds\n",
      "\n",
      "#Result\n",
      "print\"Time taken by centre of ball to reach a temperature of 423 K is\",round(t,2),\"s or\",round(t/60,2),\"minutes\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken by centre of ball to reach a temperature of 423 K is 436.25 s or 7.27 minutes\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.39,Page no:2.79"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#HT in a Ball plunged in a medium\n",
      "\n",
      "#Variable declaration\n",
      "h=11.36    #W/sq m.K\n",
      "k=43.3    #w/(m.K)\n",
      "r=25.4    #radius in mm\n",
      "r=r/1000    # radius in m\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "A=4*math.pi*r**2    #Area of sphere [sq m]\n",
      "V=A*r/3    #Volume in [cubic m]\n",
      "rho=7849.0    #kg/cubic m\n",
      "Cp=0.4606*10**3    #J/kg.K\n",
      "t=1.0    #hour\n",
      "t=t*3600    #seconds\n",
      "T_inf=394.3    #[K]\n",
      "T0=700.0    #[K]\n",
      "# (T-T_inf)/(T0-T_inf)=e**(-3*h*t/rho*Cp*V)\n",
      "T=T_inf+(T0-T_inf)*(math.exp((-h*A*t)/(rho*Cp*V))) \n",
      "\n",
      "#Result\n",
      "print\"Temperature of ball after 1 h=\",round(T),\"K (\",round(T-273),\"degree C)(APPROXIMATE)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature of ball after 1 h= 475.0 K ( 202.0 degree C)(APPROXIMATE)\n"
       ]
      }
     ],
     "prompt_number": 74
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.40,Page no:2.80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Slab temperature suddenly lowered\n",
      "\n",
      "#Variable declaration\n",
      "import math\n",
      "rho=9000.0  #kg/cubic m\n",
      "Cp=0.38   #kJ/(kg.K)\n",
      "Cp=Cp*1000    #J/(kg.K)\n",
      "k=370.0     #W/m.K\n",
      "h=90.0      #W/sq m.K\n",
      "l=400.0     #mm\n",
      "l=l/1000     #length of copper slab\n",
      "t=5.0/1000     #thickness in [m]\n",
      "\n",
      "#Calculation\n",
      "A=2*l**2     #Area of slab\n",
      "V=t*l**2       #Volume in [cubic m]\n",
      "L_dash=V/A    #[m]\n",
      "#for slab of thickness 2x\n",
      "#L_dash=x\n",
      "L_dash=0.025     #[m]\n",
      "Nbi=h*L_dash/k    #< 0.10\n",
      "var=h*A/(rho*Cp*V)\n",
      "#As Nbi<0.10,we can apply lumped capacity analysis\n",
      "T=363.0    #[K]\n",
      "T_inf=303.0    #[K]\n",
      "T0=523.0    #[K]\n",
      "t=-(math.log((T-T_inf)/(T0-T_inf)))/var\n",
      "\n",
      "#Result\n",
      "print\"Time at which slab temperature becomes 363 K is\",round(t,1),\"s\"\n",
      "print\"CALCULATION MISTAKE IN BOOK IN LAST LINE\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time at which slab temperature becomes 363 K is 123.4 s\n",
        "CALCULATION MISTAKE IN BOOK IN LAST LINE\n"
       ]
      }
     ],
     "prompt_number": 75
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.41,Page no:2.80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Flow over a flat plate\n",
      "\n",
      "#Variable declaration\n",
      "rho=9000.0    #kg/cubic meter\n",
      "Cp=0.38    #kJ/(kg.K)\n",
      "Cp=Cp*1000    #J/kg.K\n",
      "k=370.0    #W/(m.K)\n",
      "T0=483.0    #K\n",
      "T_inf=373.0    #K\n",
      "delta_T=40.0    #K\n",
      "\n",
      "#Calculation\n",
      "T=T0-delta_T    #K\n",
      "t=5.0    #time in [minutes]\n",
      "t=t*60    #[seconds]\n",
      "#A=2A.....Two faces\n",
      "#V=A.2x\n",
      "#2x=thickness of slab=30    mm=0.03    m\n",
      "x=0.015    #[m]\n",
      "th=2*x    #thickness of slab\n",
      "h=-rho*Cp*x*math.log((T-T_inf)/(T0-T_inf))/t\n",
      "\n",
      "#Result\n",
      "print\"Heat transfer coefficient is:\",round(h,1),\"W/(m^2.K)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transfer coefficient is: 77.3 W/(m^2.K)\n"
       ]
      }
     ],
     "prompt_number": 77
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.42,Page no:2.81"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#TIme required in Stainless steel rod immersed in water\n",
      "\n",
      "#Variable declaration\n",
      "rho=7800.0    #[kg per cubic m]\n",
      "h=100.0    #W/(sq m.K)  Convective heat transfer coeff\n",
      "Cp=460.0    #J/(kg.K)\n",
      "k=40.0    #W/(m.K)\n",
      "L=1.0    #[m] length ofrod\n",
      "D=10.0    #mm    \n",
      "D=D/1000    #diameter in[m]\n",
      "R=D/2    #raidus in [m]\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "#For cylindrical rod:\n",
      "A=2*math.pi*R*L    #Area in [sq m]\n",
      "V=math.pi*R**2*L    #Volume in [cubic m]\n",
      "L_dash=V/A    #[m]\n",
      "Nbi=h*L_dash/k    #Biot number\n",
      "#N_bi<0.10,Hence lumped heat capavity is possible\n",
      "T=473.0    #[K]    \n",
      "T_inf=393.0    #[K]\n",
      "T0=593.0    #[K]\n",
      "t=-rho*Cp*V*math.log((T-T_inf)/(T0-T_inf))/(h*A)\n",
      "\n",
      "#Result\n",
      "print\"Time required to reach temperature\",T,\"K is\",round(t,1),\"s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time required to reach temperature 473.0 K is 82.2 s\n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.43,Page no:2.82"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Time constant of Chromel alumel thermocouple  \n",
      "\n",
      "#Variable declaration\n",
      "import math\n",
      "rho=8600.0    #[kg/cubic m]\n",
      "Cp=0.42    #kJ/(kg.K)\n",
      "Cp=Cp*1000    #J/(kg.K)\n",
      "dia=0.71    #[mm]\n",
      "dia=dia/1000    #[dia in m]\n",
      "R=dia/2    #radius [m]\n",
      "h=600.0    #convective coeff W/(sq m.K)\n",
      "\n",
      "#Calculation\n",
      "#Let length =L=1\n",
      "L=1.0         #[m]\n",
      "A=2*math.pi*R*L \n",
      "V=math.pi*(R**2)*L \n",
      "tao=(rho*Cp*V)/(h*A) \n",
      "#at1\n",
      "t=tao\n",
      "#From  (T-T_inf)/(T0-T_inf)=e**(-t/tao)\n",
      "ratio=math.exp(-t/tao)    #Ratio of thermocouple difference to initial temperature difference\n",
      "print\"Time constant of the thermocouple is\",round(tao,3),\"s\" \n",
      "print\"At the end of the time period t=tao=\",round(tao,3),\"s\"\n",
      "print\"Temperature difference b/n the thermocouple and the gas stream would be\",round(ratio,3),\"of the initial temperature difference\"\n",
      "print\"It should be reordered after\",round(4*tao),\"s\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time constant of the thermocouple is 1.069 s\n",
        "At the end of the time period t=tao= 1.069 s\n",
        "Temperature difference b/n the thermocouple and the gas stream would be 0.368 of the initial temperature difference\n",
        "It should be reordered after 4.0 s\n"
       ]
      }
     ],
     "prompt_number": 84
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.44,Page no:2.83"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Thermocouple junction\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "rho=8000.0    #kg/cubic m\n",
      "Cp=420.0    #J/(kg.K)\n",
      "h_hot=60.0    # for hot stream W/(sq m.K)    \n",
      "dia=4.0    #[mm]\n",
      "t=10.0 \n",
      "\n",
      "#Calculation\n",
      "r=dia/(2.0*1000)    #radius in [m]\n",
      "#For sphere\n",
      "V=(4.0/3.0)*math.pi*r**3    #Volume in [cubic m]\n",
      "A=4*math.pi*r**2        #Volume in [sq m]\n",
      "tao=rho*Cp*V/(h_hot*A)    # Time constant in [s]\n",
      "ratio=math.exp(-t/tao)    # %e**(-t/tao)=(T-T-inf)/(T0-T_inf)\n",
      "T_inf=573.0    #[K]\n",
      "T0=313.0    #[K]\n",
      "T=T_inf+ratio*(T0-T_inf)\n",
      "#IN STILL AIR:\n",
      "h_air=10.0    #W/(sq m .K)\n",
      "tao_air=rho*Cp*V/(h_air*A)    #[s]\n",
      "t_air=20.0    #[s]\n",
      "ratio_air=math.exp(-t_air/tao_air)\n",
      "T_inf_air=303.0    #[K]\n",
      "T0_air=T \n",
      "T_air=T_inf_air+ratio_air*(T0_air-T_inf_air)\n",
      "\n",
      "#Result\n",
      "#ANS-[i]\n",
      "print\"Time constant of thermocouple is\",round(tao,2),\"s\"\n",
      "#ANS-[ii]\n",
      "print\"Temperature attained by junction 20 s after removing from the hot air stream is:\",round(T_air),\"K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time constant of thermocouple is 37.33 s\n",
        "Temperature attained by junction 20 s after removing from the hot air stream is: 368.0 K\n"
       ]
      }
     ],
     "prompt_number": 85
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.45,Page no:2.84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Batch reactor time taken \n",
      "from scipy.optimize import fsolve\n",
      "from scipy import integrate\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T_inf=390.0                #[K]\n",
      "U=600.0                    #[W/sq m.K]\n",
      "Ac=1.0                      #[sq m]\n",
      "Av=10.0                       #Vessel area in [sq m]\n",
      "m=1000.0                   #[kg]\n",
      "Cp=3.8*10**3             #[J/kg.K]\n",
      "To=290.0                   #[K]\n",
      "T=360.0                    #[K]\n",
      "h=8.5                   #[W/sq m.K]\n",
      "\n",
      "#Calculation\n",
      "#Heat gained from the steam=Rate of increase of internal energy\n",
      "#U*A*(T_inf-T)=m*Cp*dT\n",
      "def f(t):\n",
      "    x=math.log((T_inf-To)/(T_inf-T))-U*Ac*t/(m*Cp) \n",
      "    return(x)\n",
      "t=fsolve(f,1)           #[in s]\n",
      "t=round(t)    #[in s]\n",
      "Ts=290 \n",
      "print\"Time taken to heat the reactants over the same temperature range is\",t,\"s\"\n",
      "def g(T):\n",
      "    t1=m*Cp/(U*Ac*(T_inf-T)-h*Av*(T-Ts))\n",
      "    return(t1)\n",
      "t1= integrate.quad(g,To,T)\n",
      "def fx(Tmax):\n",
      "    m=U*Ac*(T_inf-Tmax)-h*Av*(Tmax-Ts)\n",
      "    return(m)\n",
      "T_max=fsolve(fx,1)\n",
      "\n",
      "#Result\n",
      "print\"In CASE 1\\nTime  taken to heat the reactants =\",t,\"s .ie\",round(t/3600,2),\"h\" \n",
      "print\"In CASE 2 \\nTime  taken to heat the reactants =\",round(t1[0]),\"s\"\n",
      "print\"Maximum temperature at which temperature can be raised is\",round(T_max,1),\"K\" \n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken to heat the reactants over the same temperature range is 7625.0 s\n",
        "In CASE 1\n",
        "Time  taken to heat the reactants = 7625.0 s .ie 2.12 h\n",
        "In CASE 2 \n",
        "Time  taken to heat the reactants = 8905.0 s\n",
        "Maximum temperature at which temperature can be raised is 377.6 K\n"
       ]
      }
     ],
     "prompt_number": 92
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.46,Page no:2.95"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat dissipation by aluminium rod  \n",
      "import math \n",
      "\n",
      "#Variable declaration\n",
      "dia=3.0    #[mm]\n",
      "dia=dia/1000    #[m]\n",
      "r=dia/2    #radius in[m]\n",
      "k=150    #W/(m.K)\n",
      "h=300    #W/(sq m.K)\n",
      "T0=413    #[K]\n",
      "T_inf=288    #[K]\n",
      "\n",
      "#Calculation\n",
      "A=math.pi*(r**2)    #Area in [sq m]\n",
      "P=math.pi*dia      #[W/sq m.K]\n",
      "Q=(T0-T_inf)*math.sqrt(h*P*k*A)   #Heat dissipated in [W]\n",
      "\n",
      "#Result\n",
      "print\"Heat dissipated by the rod is\",round(Q,3),\"W\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat dissipated by the rod is 6.844 W\n"
       ]
      }
     ],
     "prompt_number": 94
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.47,Page no:2.96"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Aluminium fin efficiency\n",
      "#Variable declaration\n",
      "k=200.0    #W/(m.K)\n",
      "h=15.0    #W/(sq m.K)\n",
      "T0=523.0    #[K]\n",
      "T_inf=288.0    #[K]\n",
      "theta_0=T0-T_inf    \n",
      "dia=25.0    #diameter[mm]\n",
      "dia=dia/1000    #diameter[m]\n",
      "r=dia/2    #radius in [m]\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "P=math.pi*dia    #[m]\n",
      "A=math.pi*r**2    #[sq m]\n",
      "#For insulated fin:\n",
      "m=math.sqrt(h*P/(k*A))\n",
      "L=100.0    #length of rod in [mm]\n",
      "L=L/1000    #length of rod in [m]\n",
      "Q=theta_0*math.tanh(m*L)*math.sqrt(h*P*k*A)    #Heat loss \n",
      "nf=math.tanh(m*L)/(m*L)    #Fin efficiency for  insulated fin\n",
      "#At the end of the fin: theta/theta_0=(cosh[m(L-x)]/cosh(mL))\n",
      "#at x=L, theta/theta_0=1/(cosh(mL)\n",
      "T=T_inf+(T0-T_inf)*(1/math.cosh(m*L))    #[K]\n",
      "\n",
      "\n",
      "#Result\n",
      "#ANSWER-1\n",
      "print\"Heat loss by the insulated rod is\",round(Q,1),\"W\"\n",
      "#ANSWER-2\n",
      "print\"Fin efficiency is\",round(nf*100,1),\"percent\"\n",
      "#ANSWER-3\n",
      "print\"Temperature at the end of the fin is\",round(T,1),\"K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss by the insulated rod is 26.6 W\n",
        "Fin efficiency is 96.2 percent\n",
        "Temperature at the end of the fin is 509.6 K\n"
       ]
      }
     ],
     "prompt_number": 97
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.49,Page no:2.98"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Finding effective Pin fins\n",
      "\n",
      "#Variable declaration\n",
      "k=300.0    #W/(m.K)\n",
      "h=20.0    #W.(sq m.K)\n",
      "P=0.05    #[m]\n",
      "A=2.0    #[sq cm]\n",
      "A=A/10000    #[sq m]\n",
      "T0=503.0    #[K]\n",
      "T_inf=303.0    #[K]\n",
      "\n",
      "\n",
      "#Calculation\n",
      "theta_0=T0-T_inf    #[K]\n",
      "import math\n",
      "m=math.sqrt(h*P/(k*A))\n",
      "\n",
      "#CASE 1:  6 Fins of 100 mm length\n",
      "L1=0.1    #Length of fin in [m]\n",
      "Q=math.sqrt(h*P*k*A)*theta_0*math.tanh(m*L1)    #[W]\n",
      "#For 6 fins\n",
      "Q=Q*6    #for 6 fins [W]\n",
      "\n",
      "#CASE 2:  10 fins of 60 mm length\n",
      "L2=60.0    #[mm]\n",
      "L2=L2/1000    #[m]\n",
      "Q2=math.sqrt(h*P*k*A)*theta_0*math.tanh(m*L2)     #[W]\n",
      "Q2=Q2*10    #For 10 fins\n",
      "\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"As,Q for 10 fins of 60 mm length(\",round(Q2,2),\"W) is more than Q for 6 fins of 100 mm length (\",round(Q,2),\"W)\"\n",
      "print\"The agreement-->10 fins of 60 mm length is more effective\"  \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "As,Q for 10 fins of 60 mm length( 117.66 W) is more than Q for 6 fins of 100 mm length ( 113.75 W)\n",
        "The agreement-->10 fins of 60 mm length is more effective\n"
       ]
      }
     ],
     "prompt_number": 101
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.50,Page no:2.98"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Metallic wall surrounded by oil and water   \n",
      "#Variable declaration\n",
      "h_oil=180.0    #W/(sq m.K)\n",
      "h_air=15.0    #W/(sq m.K)\n",
      "T_oil=353.0    #[K]\n",
      "T_air=293.0    #[K]\n",
      "delta_T=T_oil-T_air     #[K]\n",
      "k=80.0    #Conductivity in  [W/(m.K)]\n",
      "for_section=11.0*10**-3    #[m]\n",
      "L=25.0    #[mm]\n",
      "L=L/1000    #[m]\n",
      "W=1.0    #[m] Width,..let\n",
      "t=1.0    #[mm] \n",
      "t=t/1000    #[m]\n",
      "A=W*t    #[m]\n",
      "P=2*t\n",
      "Af=2*L*W    #sq m\n",
      "N=1.0\n",
      "\n",
      "#Calculation\n",
      "\n",
      "import math\n",
      "Ab=for_section-A    #[sq m]\n",
      "#CASE 1: Fin on oil side only\n",
      "m=math.sqrt(h_oil*P/(k*A)) \n",
      "nf_oil=math.tanh(m*L)/(m*L)\n",
      "Ae_oil=Ab+nf_oil*Af*N    #[sq m]\n",
      "Q1=delta_T/(1/(h_oil*Ae_oil)+1/(h_air*for_section))    #[W]\n",
      "#CASE 2: Fin on  air side only\n",
      "m=math.sqrt(h_air*P/(k*A))\n",
      "nf_air=math.tanh(m*L)/(m*L)\n",
      "nf_air=0.928        #Approximation\n",
      "Ae_air=Ab+nf_air*Af*N    #[sq m]\n",
      "Q=delta_T/(1.0/(h_oil*for_section)+1.0/(h_air*Ae_air))    #[W]\n",
      "\n",
      "#Result\n",
      "print\"In oil side,Q=\",round(Q1,2),\"W\"\n",
      "print\"In air side,Q=\",round(Q,2),\"W\"\n",
      "print\"From above results we see that more heat transfer takes place if fins are provided on the air side\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In oil side,Q= 9.75 W\n",
        "In air side,Q= 35.56 W\n",
        "From above results we see that more heat transfer takes place if fins are provided on the air side\n"
       ]
      }
     ],
     "prompt_number": 103
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:2.51,Page no:2.100"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Brass wall having fins\n",
      "\n",
      "#Variable declaration\n",
      "k=75.0    #Thermal conductivity [W/(m.K)]\n",
      "T_water=363.0    #[K]\n",
      "T_air=303.0    #[K]    \n",
      "dT=T_water-T_air    #delta T\n",
      "h1=150.0    # for water[W/(sq m.K)]\n",
      "h2=15.0       #for air [W/(sq m.K)]\n",
      "W=0.5    #Width of wall[m]\n",
      "L=0.025    #[m]\n",
      "\n",
      "#Calculation\n",
      "Area=W**2    #Base Area [sq m]\n",
      "t=1.0    #[mm]\n",
      "t=t/1000    #[m]\n",
      "pitch=10.0    #[mm]\n",
      "pitch=pitch/1000    #[m]\n",
      "N=W/pitch    #[No of fins]\n",
      "\n",
      "\n",
      "#Calculations\n",
      "A=N*W*t    #Total cross-sectional area of fins   in [sq m]\n",
      "Ab=Area-A    #[sq m]\n",
      "Af=2*W*L    #Surface area of fins    [sq m]\n",
      "import math\n",
      "#CASE 1: HEAT TRANSFER WITHOUT FINS\n",
      "A1=Area    #[sq m]\n",
      "A2=A1    #[sq m]\n",
      "Q=dT/(1.0/(h1*A1)+1.0/(h2*A2))         #[W]\n",
      "print\"Without fins,Q=\",round(Q,2),\"W\"\n",
      "#CASE 2: Fins on the water side\n",
      "P=2*(t+W) \n",
      "A=0.5*10**-3 \n",
      "m=math.sqrt(h1*P/(k*A))\n",
      "nfw=math.tanh(m*L)/(m*L)   #Effeciency on water side\n",
      "Aew=Ab+nfw*Af*N    #Effective area on the water side    [sq m]\n",
      "Q=dT/(1.0/(h1*Aew)+1.0/(h2*A2))         #[W]\n",
      "print\"With fins on water side,Q=\",round(Q,2),\"W\"\n",
      "#CASE 3: FINS ON THE AIR SIDE\n",
      "m=math.sqrt(h2*P/(k*A))\n",
      "nf_air=tanh(m*L)/(m*L)    #Effeciency\n",
      "Aea=Ab+nf_air*Af*N    #Effective area on air side\n",
      "Q=dT/(1.0/(h1*A1)+1.0/(h2*Aea))         #[W]\n",
      "print\"With Fins on Air side,Q=\",round(Q,1),\"W\"\n",
      "#BOTH SIDE:\n",
      "Q=dT/(1.0/(h1*Aew)+1.0/(h2*Aea))         #[W]\n",
      "\n",
      "#Result\n",
      "print\"With Fins on both side,Q=\",round(Q,1),\"W\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Without fins,Q= 204.55 W\n",
        "With fins on water side,Q= 219.24 W\n",
        "With Fins on Air side,Q= 800.3 W\n",
        "With Fins on both side,Q= 1084.7 W\n"
       ]
      }
     ],
     "prompt_number": 107
    }
   ],
   "metadata": {}
  }
 ]
}