{
 "metadata": {
  "name": "",
  "signature": "sha256:96c4eafa14e71d2a7ad08a3f1ed53ae85acbccb4e9c40ff9d082a4b129e50e09"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : Conduction of heat in the steady state"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1 page no : 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "deltax = 9./12;                 # thickness of wall in ft\n",
      "k = 0.18;                     # thermal conductivity of wall in B/hr-ft-degF\n",
      "t1 = 1500;                     # inside temperature of oven wall in degF\n",
      "t2 = 400;                      # outside temperature of oven wall in degF\n",
      "\n",
      "# Calculations \n",
      "q = k*(t1-t2)/deltax;          # heat loss in Btu/hr\n",
      "\n",
      "# Results\n",
      "print \" The heat loss for each square foot of wall surface is %d Btu/hr-ft**2\"%(q);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The heat loss for each square foot of wall surface is 264 Btu/hr-ft**2\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2 page : 29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "x1 = 9./12;             # thickness of firebrick in ft\n",
      "k1 = 0.72;             # thermal conductivity of firebrick in Btu/hr-ft-degF\n",
      "x2 = 5./12;             # thickness of insulating brick in ft\n",
      "k2 = 0.08;             # thermal conductivity of insulating brick in Btu/hr-ft-degF\n",
      "x3 = 7.5/12;           # thickness of redbrick in ft\n",
      "k3 = 0.5;              # thermal conductivity of firebrick in Btu/hr-ft-degF\n",
      "t1 = 1500.;             # inner temperature of wall in degF\n",
      "t2 = 150.;              # outer temperature of wall in degF\n",
      "\n",
      "# Calculations and Results\n",
      "# resistances of mortar joints are neglected\n",
      "q = (t1-t2)/(x1/k1+x2/k2+x3/k3);   # heat flow per square ft in Btu/hr\n",
      "t2 = t1-(q*x1/k1);                 # first contact temperature in degF\n",
      "print \" The temperature at the contact of firebrick and insulating brick is %d degF\"%(t2);\n",
      "\n",
      "t3 = t2-(q*x2/k2);                 # second contact temperature in degF\n",
      "print \" The temperature at the contact of insulating brick and red brick is %d degF\"%(t3);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The temperature at the contact of firebrick and insulating brick is 1312 degF\n",
        " The temperature at the contact of insulating brick and red brick is 375 degF\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3 page : 31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "d1 = 2.375/12;                   # internal diameter of pipe in ft\n",
      "t = 1./12;                        # thickness of insulating material in ft\n",
      "d2 = d1+2*t;                     # external (insulation)diameter of pipe in ft\n",
      "k = 0.0375;                      # thermal conductivity of insulating material in Btu/hr-ft-F\n",
      "l = 30.;                          # length of pipe in ft\n",
      "t1 = 380.;                        # inner surface temperature of insulation\n",
      "t2 = 80.;                         # outer surface temperature of insulation\n",
      "\n",
      "# Calculations and Results\n",
      "q = 2*math.pi*k*(t1-t2)/math.log(d2/d1);  # heat loss per unit length\n",
      "print \" Heat loss per linear foot is %.f Btu/hr\"%(q)\n",
      "\n",
      "qtot = round(q)*l;               # heat loss for 30 ft pipe\n",
      "print \" Total heat loss through 30 ft of pipe is %d Btu/hr\"%(qtot)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Heat loss per linear foot is 116 Btu/hr\n",
        " Total heat loss through 30 ft of pipe is 3480 Btu/hr\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4 page :33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "d1 = 10.75/12;            # outer diameter of pipe in ft\n",
      "x1 = 1.5/12;              # thickness of insulation 1 in ft\n",
      "x2 = 2./12;                # thickness of insulation 2 in ft\n",
      "d2 =  d1+2*x1;            # diameter of insulation 1 in ft\n",
      "d3 = d2+2*x2;             # diameter of insulation 1 in ft\n",
      "t1 = 700.;                 # inner surface temperature of composite insulation in degF\n",
      "t2 = 110.;                 # outer surface temperature of composite insulation in degF\n",
      "k1 = 0.05;                #thermal conductivity of material 1 in Btu/hr-ft-degF\n",
      "k2 = 0.039;               # thermal conductivity of material 2 in Btu/hr-ft-degF\n",
      "\n",
      "# Calculations \n",
      "q = 2*math.pi*(t1-t2)/(math.log(d2/d1)/k1+math.log(d3/d2)/k2);                                     # heat loss per linear foot in Btu/hr\n",
      "\n",
      "# Results\n",
      "print \" The heat loss is found to be %d Btu/hr-ft\"%( q);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The heat loss is found to be 323 Btu/hr-ft\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5 page : 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "km = 0.0377;               # Mean thermal conductivity at 220degF\n",
      "t1 = 260.;                  # Inner surface temperature of slab in degF \n",
      "t2 = 180.;                  # Outer surface temperature of slab in degF\n",
      "A = 1.;                     # Area of slab in ft\n",
      "x = 2./12;                  # Thickness of insulation in ft\n",
      "\n",
      "# Calculations \n",
      "q = km*A*(t1-t2)/x;        # Heat loss through slab in Btu/hr\n",
      "\n",
      "# Results\n",
      "print \" Heat loss through flat slab is %.1f Btu/hr\"%(q);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Heat loss through flat slab is 18.1 Btu/hr\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6 page : 37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "k = 0.8                     # Avg. thermal conductivity in Btu/hr-ft-degF\n",
      "T1 = 400.                    # Inner surface temperature of furnace in degF \n",
      "T2 = 100.                    # Outer surface temperature of furnace in degF\n",
      "a = 3.                       # Length of furnace in ft\n",
      "b = 4.                       # Breadth of furnace in ft\n",
      "c = 2.5                     # Height of furnace in ft\n",
      "Aa = 2*a*b                  # Area of surface A in ft**2\n",
      "Ab = 2*b*c                  # Area of surface A in ft**2\n",
      "Ac = 2*a*c                  # Area of surface A in ft**2\n",
      "x = 4.5/12                  # Thickness of insulation in ft\n",
      "t = 24.                      # Time elapsed in hr\n",
      "M = 4.                       # Number of edges\n",
      "N = 8.                       # Number of corners\n",
      "\n",
      "# Calculations \n",
      "S = Aa/x+Ab/x+Ac/x+0.54*(a+b+c)*M+0.15*x*N       # Shape factor\n",
      "qo = round(S*k*(T1-T2),-2)                                 # Heat flow per hour\n",
      "q = qo*t                                         # Heat loss in 24 hr\n",
      "\n",
      "# Results\n",
      "print \"The heat loss in 24 hr is %d Btu\"%(q)\n",
      "\n",
      "# note : book answer is wrong. Kindly check."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat loss in 24 hr is 1027200 Btu\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7 page : 40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "M = 8*9;                  # number of flow channels for the entire section\n",
      "N = 8.37;                 # number of equal channel intervals\n",
      "# the fractional part arises due to the fractional part of temperature close to border EG\n",
      "\n",
      "# Calculations \n",
      "k  =  M/N;               # Ratio of shape factor to wall length\n",
      "\n",
      "# Results\n",
      "print \" Shape factor for the special section where the ratio of radius of\\\n",
      " circle to half side length is 0.5,S is %.2fL\"%( k );\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Shape factor for the special section where the ratio of radius of circle to half side length is 0.5,S is 8.60L\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8 page  : 43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import zeros\n",
      "# Variables\n",
      "t1 = 800.;            # inner surface temperature of wall in degF\n",
      "t4 = 200.;           #  outer surface temperature of wall in degF\n",
      "\n",
      "#Grids are square in shape so delx  = dely where delx,y sre dimensions of square grid \n",
      "t2 = [700, 550 ,550, 587.5, 587.5, 596.9, 596.9, 599.3, 599.3, 599.8];             # Assumed temperature of grid point 1\n",
      "t3 = [300, 300 ,375 ,375, 393.8, 393.8, 398.5, 398.5, 399.6, 399.6];               # Assumed temperature of grid point 2\n",
      "\n",
      "th2 = zeros(9)\n",
      "th3 = zeros(9)\n",
      "\n",
      "# Calculations and Results\n",
      "for i in range(9):\n",
      "     th2[i] = t1+t3[i]-2*t2[i]; # th1 =  q/kz at grid pt1\n",
      "     th3[i] = t2[i]+t4-2*t3[i];# th2 =  q/kz at grid pt2\n",
      "     print \" Assuming t2 = %.1f  degF and t2 = %.1f degF  th1[%d] = %.1f degF and th2[%d] = %.1f degF \"%(t2[i],t3[i],i,th2[i],i,th3[i]);     \n",
      "     print \" Since th2[%d] is not equal to th3[%d], hence other values of t2 and t3 are to be assumed\"%(i,i);\n",
      "\n",
      "\n",
      "print \"Assuming t2 = 600 degF and t3 = 400 degF, th2 = th3.\"\n",
      "print \"Hence Steady state condition is satisfied at grid temperatures of 400 degF and 600 degF\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Assuming t2 = 700.0  degF and t2 = 300.0 degF  th1[0] = -300.0 degF and th2[0] = 300.0 degF \n",
        " Since th2[0] is not equal to th3[0], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 550.0  degF and t2 = 300.0 degF  th1[1] = 0.0 degF and th2[1] = 150.0 degF \n",
        " Since th2[1] is not equal to th3[1], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 550.0  degF and t2 = 375.0 degF  th1[2] = 75.0 degF and th2[2] = 0.0 degF \n",
        " Since th2[2] is not equal to th3[2], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 587.5  degF and t2 = 375.0 degF  th1[3] = 0.0 degF and th2[3] = 37.5 degF \n",
        " Since th2[3] is not equal to th3[3], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 587.5  degF and t2 = 393.8 degF  th1[4] = 18.8 degF and th2[4] = -0.1 degF \n",
        " Since th2[4] is not equal to th3[4], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 596.9  degF and t2 = 393.8 degF  th1[5] = 0.0 degF and th2[5] = 9.3 degF \n",
        " Since th2[5] is not equal to th3[5], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 596.9  degF and t2 = 398.5 degF  th1[6] = 4.7 degF and th2[6] = -0.1 degF \n",
        " Since th2[6] is not equal to th3[6], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 599.3  degF and t2 = 398.5 degF  th1[7] = -0.1 degF and th2[7] = 2.3 degF \n",
        " Since th2[7] is not equal to th3[7], hence other values of t2 and t3 are to be assumed\n",
        " Assuming t2 = 599.3  degF and t2 = 399.6 degF  th1[8] = 1.0 degF and th2[8] = 0.1 degF \n",
        " Since th2[8] is not equal to th3[8], hence other values of t2 and t3 are to be assumed\n",
        "Assuming t2 = 600 degF and t3 = 400 degF, th2 = th3.\n",
        "Hence Steady state condition is satisfied at grid temperatures of 400 degF and 600 degF\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10 page : 46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "k = 0.9;                        # thermal conductivity of section material in Btu/hr-ft-degF\n",
      "\n",
      "# Heat is considered to flow through fictitious rods and only half of the heat flows through symmetry axes    \n",
      "Ta = 300.;\n",
      "Tb = 441.;\n",
      "Tc = 600.;\n",
      "Td = 300.;\n",
      "Te = 432.;\n",
      "Tf = 600.;\n",
      "Tg = 600.;\n",
      "Th = 600.;\n",
      "Ti = 300.;\n",
      "Tj = 384.;\n",
      "Tk = 461.;\n",
      "Tl = 485.;\n",
      "Tm = 490.;\n",
      "Tn = 300.;\n",
      "To = 340.;\n",
      "Tp = 372.;\n",
      "Tq = 387.;\n",
      "Tr = 391.;\n",
      "Ts = 300.;\n",
      "Tt = 300.;\n",
      "Tu = 300.;\n",
      "Tv = 300.;\n",
      "Tw = 300.;\n",
      "\n",
      "# Calculations and Results\n",
      "# Above grid point temperatures are given in the question for the quarter section considered in degF(a,b,c...w are grid points)\n",
      "q1 = 4*k*((Tc-Tb)/2+(Tf-Te)+(Tf-Tk)+(Tg-Tl)+(Th-Tm)/2);                           # Amount of heat coming from inside in Btu/hr\n",
      "q2 = 4*k*((Tb-Ta)/2+(Te-Td)+(Tj-Ti)+(To-Tn)+(To-Tt)+(Tp-Tu)+(Tq-Tu)+(Tr-Tw)/2);   # Amount of heat going outside in Btu/hr\n",
      "q = (q1+q2)/2;                  # average of heat going in and heat coming out\n",
      "print \" Total heat flow per unit depth is %.1fBtu/hr\"%(q);\n",
      "\n",
      "S = q/(k*(Tc-Ta));              # shape factor in ft\n",
      "print \" Shape factor is %.2fft\"%(S)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Total heat flow per unit depth is 2029.5Btu/hr\n",
        " Shape factor is 7.52ft\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}