{
 "metadata": {
  "name": "",
  "signature": "sha256:d0883c349e6026c1b16a5b0a707e34ddc2310403ffaeb85c40a328facdc14025"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Two dimensional, Steady State Conduction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1  Page 211 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "d = .005;        \t\t\t\t\t\t\t\t\t\t#[m] Diameter of wire\n",
      "k = .35;         \t\t\t\t\t\t\t\t\t\t#[W/m.K] Thermal Conductivity\n",
      "h = 15;          \t\t\t\t\t\t\t\t\t\t#[W/m^2.K] Total coeff with Convection n Radiation\n",
      "#calculations\n",
      "\n",
      "rcr = k/h;        \t\t\t\t\t\t\t\t\t\t# [m] critical insulation radius\n",
      "tcr = rcr - d/2.;  \t\t\t\t\t\t\t\t\t\t# [m] critical insulation Thickness\n",
      "\n",
      "Rtcond = 2.302*math.log10(rcr/(d/2.))/(2*math.pi*k);    #[K/W] Thermal resistance \n",
      "\n",
      "#Using Table 4.1 Case 7\n",
      "z = .5*tcr;\n",
      "D=2*rcr;\n",
      "Rtcond2D = (math.acosh((D*D + d*d - 4*z*z)/(2*D*d)))/(2*math.pi*k);\n",
      "#results\n",
      "\n",
      "print '%s %.2f %s' %(\"\\n\\n The reduction in thermal resistance of the insulation is\", Rtcond-Rtcond2D,\" K/W \");\n",
      "#END"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        " The reduction in thermal resistance of the insulation is 0.10  K/W \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3 Page 224"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "import numpy\n",
      "from numpy import linalg\n",
      "Ts = 500.;        \t#[K] Temp of surface\n",
      "Tsurr = 300.;     \t#[K] Temp of surrounding Air\n",
      "h = 10.;          \t#[W/m^2.K] Heat Convection soefficient\n",
      "#Support Column\n",
      "delx = .25;      \t#[m]\n",
      "dely = .25;      \t#[m]\n",
      "k = 1.;         \t#[W/m.K] From Table A.3, Fireclay Brick at T = 478K\n",
      "#calculations\n",
      "\n",
      "#Applying Eqn 4.42 and 4.48\n",
      "A = numpy.array([[-4, 1, 1, 0, 0, 0, 0, 0],\n",
      "\t\t[2, -4, 0, 1, 0, 0, 0, 0],\n",
      "\t\t[1, 0, -4, 1, 1, 0, 0, 0],\n",
      "\t\t[0, 1, 2, -4, 0, 1, 0, 0],\n",
      "\t\t[0,0, 1, 0, -4, 1, 1, 0],\n",
      "\t\t[0, 0, 0, 1, 2, -4, 0, 1],\n",
      "\t\t[0, 0, 0, 0, 2, 0, -9, 1],\n",
      "\t\t[0, 0, 0, 0, 0, 2, 2, -9]]);\n",
      "     \n",
      "C = numpy.array([[-1000], [-500], [-500], [0], [-500], [0], [-2000], [-1500]]);\n",
      "\n",
      "T = numpy.linalg.solve (A,C);\n",
      "#results\n",
      "\n",
      "print '%s' %(\"\\n Temp Distribution in K = \");\n",
      "print (T);\n",
      "\n",
      "q = 2*h*((delx/2.)*(Ts-Tsurr)+delx*(T[6]-Tsurr)+delx*(T[7]-Tsurr)/2.);\n",
      "print '%s %.2f %s' %(\"\\n\\n Heat rate from column to the airstream\",q,\" W/m \");\n",
      "#END"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Temp Distribution in K = \n",
        "[[ 489.30472333]\n",
        " [ 485.15381783]\n",
        " [ 472.06507549]\n",
        " [ 462.00582466]\n",
        " [ 436.94975396]\n",
        " [ 418.73932983]\n",
        " [ 356.99461052]\n",
        " [ 339.05198674]]"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "\n",
        " Heat rate from column to the airstream 882.60  W/m \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4  Page 230"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "import numpy\n",
      "from numpy import linalg\n",
      "#Operating Conditions\n",
      "\n",
      "ho = 1000;               #[W/m^2.K] Heat Convection coefficient\n",
      "hi = 200;                #[W/m^2.K] Heat Convection coefficient\n",
      "Ti = 400;                #[K] Temp of Air\n",
      "Tg = 1700;               #[K] Temp of Gas\n",
      "h = 10 ;                 #[W/m^2.K] Heat Convection coefficient\n",
      "\n",
      "A = 2*6*math.pow(10,-6) ;#[m^2] Cross section of each Channel\n",
      "x = .004 ;               #[m] Spacing between joints\n",
      "t = .006;                #[m] Thickness\n",
      "k = 25;                  #[W/m.K] Thermal Conductivity of Blade\n",
      "delx = .001 ;            #[m]\n",
      "dely = .001 ;            #[m]\n",
      "#calculations and results\n",
      "\n",
      "#Applying Eqn 4.42 and 4.48\n",
      "A = numpy.array([[-(2+ho*delx/k), 1, 0,0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n",
      "     [1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0],\n",
      "     [0,1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0],\n",
      "     [0,0,1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0],\n",
      "     [0,0,0,1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0],\n",
      "     [0,0,0,0,1,-(2+ho*delx/k),0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],\n",
      "     [1,0,0,0,0,0,-4,2,0,0,0,0,1,0,0,0,0,0,0,0,0],\n",
      "     [0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0,0,0,0],\n",
      "     [0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0,0,0],\n",
      "     [0,0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0,0],\n",
      "     [0,0,0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0],\n",
      "     [0,0,0,0,0,1,0,0,0,0,2,-4,0,0,0,0,0,1,0,0,0],\n",
      "     [0,0,0,0,0,0,1,0,0,0,0,0,-4,2,0,0,0,0,1,0,0],\n",
      "     [0,0,0,0,0,0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0],\n",
      "     [0,0,0,0,0,0,0,0,2,0,0,0,0,2,-2*(3+hi*delx/k),1,0,0,0,0,1],\n",
      "     [0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,-2*(2+hi*delx/k),1,0,0,0,0],\n",
      "     [0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,-2*(2+hi*delx/k),1,0,0,0],\n",
      "     [0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,-(2+hi*delx/k),0,0,0],\n",
      "     [0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,-2,1,0],\n",
      "     [0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,-4,1],\n",
      "     [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,-(2+hi*delx/k)]]);\n",
      "     \n",
      "C = numpy.array([[-ho*delx*Tg/k], \n",
      "     [-2*ho*delx*Tg/k],\n",
      "     [-2*ho*delx*Tg/k],\n",
      "     [-2*ho*delx*Tg/k],\n",
      "     [-2*ho*delx*Tg/k],\n",
      "     [-ho*delx*Tg/k],\n",
      "     [0],\n",
      "     [0],\n",
      "     [0],\n",
      "     [0],\n",
      "     [0],\n",
      "     [0],\n",
      "     [0],\n",
      "     [0],\n",
      "     [-2*hi*delx*Ti/k],\n",
      "     [-2*hi*delx*Ti/k],\n",
      "     [-2*hi*delx*Ti/k],\n",
      "     [-hi*delx*Ti/k],\n",
      "     [0],\n",
      "     [0],\n",
      "     [-hi*delx*Ti/k]]);\n",
      "\n",
      "T = numpy.linalg.solve (A,C);\n",
      "print '%s' %(\"\\n Temp Distribution in K = \");\n",
      "print (T);\n",
      "q = 4*ho*((delx/2.)*(Tg-T[0])+delx*(Tg-T[1])+delx*(Tg-T[2])+ delx*(Tg-T[3])+delx*(Tg-T[4])+delx*(Tg-T[5])/2.);\n",
      "print '%s %.1f %s' %(\"\\n\\n Heat rate Transfer = \" ,q,\"W/m \");\n",
      "#END"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Temp Distribution in K = \n",
        "[[ 1525.95413813]\n",
        " [ 1525.27944565]\n",
        " [ 1523.59609075]\n",
        " [ 1521.93574674]\n",
        " [ 1520.83066847]\n",
        " [ 1520.45069026]\n",
        " [ 1519.66699612]\n",
        " [ 1518.7949547 ]\n",
        " [ 1516.52842892]\n",
        " [ 1514.53554374]\n",
        " [ 1513.30134519]\n",
        " [ 1512.88873965]\n",
        " [ 1515.12393697]\n",
        " [ 1513.70494809]\n",
        " [ 1509.18712651]\n",
        " [ 1506.37665411]\n",
        " [ 1504.9504289 ]\n",
        " [ 1504.50157796]\n",
        " [ 1513.41885557]\n",
        " [ 1511.71377418]\n",
        " [ 1506.02634497]]\n",
        "\n",
        "\n",
        " Heat rate Transfer =  3540.6 W/m \n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}