{
 "metadata": {
  "name": "",
  "signature": "sha256:aa78c4fecb9e6170fff80d7d4acf98ab991ec2677f1baef191ee2d45ad66490b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 - Heat Transfer"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the interface temperature\n",
      "#Initialization of variables\n",
      "km1=0.62\n",
      "km2=0.16\n",
      "km3=0.4\n",
      "l1=8. #in\n",
      "l2=4. #in\n",
      "l3=4. #in\n",
      "Tf=1600. #F\n",
      "Tc=100. #F\n",
      "#calculations\n",
      "Rw=l1/12./km1 +l2/12./km2 +l3/12./km3\n",
      "Rb=l1/12./km1\n",
      "Ti=Tf-Rb/Rw *(Tf-Tc)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Interface temperature =\",Ti,\"F\")\n",
      "print '%s' %(\"The answers might differ a bit from textbook due to rounding off error.\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Interface temperature = 1196.0 F\n",
        "The answers might differ a bit from textbook due to rounding off error.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the heat flow and the interface temperature\n",
      "#Initialization of variables\n",
      "import math\n",
      "th=350. #F\n",
      "tc=150. #F\n",
      "od1=4.5\n",
      "id1=4.026\n",
      "od2=6.5\n",
      "id2=4.5\n",
      "k1=32.\n",
      "k2=0.042\n",
      "#calculations\n",
      "Q=2*math.pi*(th-tc)/(math.log(od1/id1) /k1 + math.log(od2/id2) /k2)\n",
      "r1=math.log(od1/id1) /k1\n",
      "rt=math.log(od1/id1) /k1 + math.log(od2/id2) /k2\n",
      "ti=th-r1/rt*(th-tc)\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Heat flow =\",Q,\"Btu/hr\")\n",
      "print '%s %.2f %s' %(\"\\n Interface temperature =\",ti,\" F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat flow = 143.5 Btu/hr\n",
        "\n",
        " Interface temperature = 349.92  F\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 239"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the net energy exchange in the process\n",
      "#Initialization of variables\n",
      "import math\n",
      "Fa=0.045\n",
      "l=4. #m\n",
      "b=4. #m\n",
      "Fe=1.\n",
      "Ta=540.+460 #R\n",
      "Tb=1540.+460 #R\n",
      "#calculations\n",
      "A=l*b\n",
      "Q=0.173*A*Fa*Fe*(math.pow((Tb/100.),4) -math.pow((Ta/100.),4))\n",
      "Q2=416000.\n",
      "#results\n",
      "print '%s %d %s' %(\"In case 1, Net energy exchange =\",Q,\"Btu/hr\")\n",
      "print '%s %d %s' %(\"\\n In case 2, Net energy exchange =\",Q2,\"Btu/hr\")\n",
      "print '%s' %('The answers are a bit different due to rounding off error in textbook')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In case 1, Net energy exchange = 18684 Btu/hr\n",
        "\n",
        " In case 2, Net energy exchange = 416000 Btu/hr\n",
        "The answers are a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 239"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the net energy exchange\n",
      "#Initialization of variables\n",
      "import math\n",
      "ea=0.8\n",
      "eb=0.7\n",
      "Fa=0.045\n",
      "l=4. #m\n",
      "b=4. #m\n",
      "Fe=1.\n",
      "Ta=540.+460 #R\n",
      "Tb=1540.+460 #R\n",
      "#calculations\n",
      "A=l*b\n",
      "ef=ea*eb\n",
      "Q=0.173*A*Fa*Fe*ef*(math.pow((Tb/100),4) -math.pow((Ta/100),4))\n",
      "#results\n",
      "print '%s %d %s' %(\"Net energy exchange =\",\tQ,\"Btu/hr\")\n",
      "print '%s' %('The answers are a bit different due to rounding off error in textbook')\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Net energy exchange = 10463 Btu/hr\n",
        "The answers are a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 246"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the inside film coefficient\n",
      "#Initialization of variables\n",
      "import math\n",
      "den=61.995 #lb/cu ft\n",
      "vel=6 #ft/s\n",
      "t1=100. #F\n",
      "t2=160. #F\n",
      "de=2.067 #in\n",
      "mu=1.238\n",
      "pr=3.3\n",
      "#calculations\n",
      "G=den*vel*3600.\n",
      "tm=(t1+t2)/2\n",
      "hc=0.023*0.377/(de/12.) *math.pow(de/12 *G/mu,0.8) *math.pow(pr,0.4)\n",
      "#results\n",
      "print '%s %d %s' %(\"Inside film coefficient =\",hc,\"Btu/sq ft hr F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inside film coefficient = 1335 Btu/sq ft hr F\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 247"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the inside film coefficient\n",
      "#Initialization of variables\n",
      "import math\n",
      "d=0.5 #in\n",
      "tm=1000. #F\n",
      "v=5#ft/s\n",
      "k=38.2\n",
      "den=51.2\n",
      "mu=0.3\n",
      "#calculations\n",
      "Nu=7+ 0.025*math.pow((d/12 *v*den*mu/k*3600),0.8)\n",
      "h=Nu*k/(d/12.)\n",
      "#results\n",
      "print '%s %d %s' %(\"Inside film coefficient =\",h,\"Btu/sq ft hr F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inside film coefficient = 8624 Btu/sq ft hr F\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - Pg 249"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the convective film coefficient\n",
      "#Initialization of variables\n",
      "import math\n",
      "do=2 #in\n",
      "tf=120. #F\n",
      "ti=80. #F\n",
      "rho=0.0709\n",
      "g=32.17\n",
      "bet=1/560.\n",
      "cp=0.24\n",
      "mu=0.0461\n",
      "k=0.0157\n",
      "d=2. #in\n",
      "Cd=0.45\n",
      "#calculations\n",
      "GrPr=math.pow(d/12.,3) *rho*rho *g*3600*3600. *bet*(tf-ti)*cp/(mu*k)\n",
      "hc=Cd*k/math.pow(d/12.,(1./4.)) *math.pow(GrPr,(1./4.))\n",
      "#results\n",
      "print '%s %.3f %s' %(\"Convective film coefficient =\",hc,\"Btu/sq ft hr F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Convective film coefficient = 0.242 Btu/sq ft hr F\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - Pg 251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the outer film coefficient\n",
      "#Initialization of variables\n",
      "import math\n",
      "tf=220. #F\n",
      "ti=200. #F\n",
      "d=2. #in\n",
      "C=103.7\n",
      "k=0.394\n",
      "rho=59.37\n",
      "hfg=965.2\n",
      "mu=0.70\n",
      "#calculations\n",
      "h=C*math.pow(k*k*k *rho*rho *hfg/((d/12.) *mu*(tf-ti)),(1./4.))\n",
      "#results\n",
      "print '%s %d %s' %(\"Outer film coefficient =\",h,\"Btu/sq ft hr F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Outer film coefficient = 1792 Btu/sq ft hr F\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9 - Pg 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the boiling film coefficient\n",
      "#Initialization of variables\n",
      "tf=225. #F\n",
      "a=190.\n",
      "b=0.043\n",
      "ti=212. #F\n",
      "#calculations\n",
      "hc=a/(1-b*(tf-ti))\n",
      "hcti=hc*1.25\n",
      "#results\n",
      "print '%s %.1f %s' %(\"For a flat copper plate, boiling film coefficient =\",hc,\" Btu/sq ft hr F\")\n",
      "print '%s %d %s' %(\"\\n For an inclined copper plate, boiling film coefficient =\",hcti,\"Btu/sq ft hr F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For a flat copper plate, boiling film coefficient = 430.8  Btu/sq ft hr F\n",
        "\n",
        " For an inclined copper plate, boiling film coefficient = 538 Btu/sq ft hr F\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10 - Pg 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the heat transferred per foot length of pipe\n",
      "#Initialization of variables\n",
      "import math\n",
      "Do=2.375 #in\n",
      "hi=1200.\n",
      "Di=2.067 #in\n",
      "km=29.2\n",
      "h0=1500.\n",
      "L=2.375 #in\n",
      "t1=220. #F\n",
      "t4=140. #F\n",
      "#calculations\n",
      "U0= 1/(Do/(Di*hi) + (Do/12. *math.log(Do/Di) /(2*km)) + 1./h0)\n",
      "Q=U0*L*math.pi*(t1-t4)/12.\n",
      "#results\n",
      "print '%s %d %s' %(\"Heat transferred per foot length of pipe =\",Q,\"btu/hr\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transferred per foot length of pipe = 23744 btu/hr\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11 - Pg 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the temperature of inner and outer surfaces of pipe\n",
      "#Initialization of variables\n",
      "import math\n",
      "Do=2.375 #in\n",
      "hi=1200.\n",
      "Di=2.067 #in\n",
      "km=29.2\n",
      "h0=1500.\n",
      "L=2.375 #in\n",
      "t1=220. #F\n",
      "t4=140. #F\n",
      "#calculations\n",
      "Re=Do/(Di*hi)\n",
      "R0=Do/(Di*hi) + (Do/12. *math.log(Do/Di) /(2*km)) + 1./h0\n",
      "td=Re/R0 *(t1-t4)\n",
      "ti=t4+td\n",
      "Req=1./h0\n",
      "td2=Req/R0 *(t1-t4)\n",
      "to=t1-td2\n",
      "#results\n",
      "print '%s %.1f %s' %(\"The temperature of the inner surface of pipe =\",ti,\" F\")\n",
      "print '%s %.1f %s' %(\"\\n The temperature of the outer surface of pipe =\",to,\" F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The temperature of the inner surface of pipe = 176.6  F\n",
        "\n",
        " The temperature of the outer surface of pipe = 194.5  F\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12 - Pg 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Logarithmic Mean temperature difference \n",
      "#Initialization of variables\n",
      "import math\n",
      "th1=800. #F\n",
      "th2=300. #F\n",
      "tc1=100. #F\n",
      "tc2=400. #F\n",
      "#calculations\n",
      "lmtd= ((th1-tc2) - (th2-tc1) )/(math.log((th1-tc2)/(th2-tc1)))\n",
      "#results\n",
      "print '%s %d %s' %(\"Logarithmic Mean temperature difference =\",lmtd,\"F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Logarithmic Mean temperature difference = 288 F\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13 - Pg 262"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the True Mean temperature difference\n",
      "#Initialization of variables\n",
      "import math\n",
      "th1=200. #F\n",
      "th2=100. #F\n",
      "tc1=80. #F\n",
      "tc2=110. #F\n",
      "#calculations\n",
      "print '%s' %(\"From the lmtd graph,\")\n",
      "R=(tc1-tc2)/(th2-th1)\n",
      "P=(th2-th1)/(tc1-th1)\n",
      "F=0.62\n",
      "lmtd= F* ((th1-tc2) - (th2-tc1) )/(math.log((th1-tc2)/(th2-tc1)))\n",
      "#results\n",
      "print '%s %.1f %s' %(\"True Mean temperature difference =\",lmtd,\" F\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From the lmtd graph,\n",
        "True Mean temperature difference = 28.9  F\n"
       ]
      }
     ],
     "prompt_number": 13
    }
   ],
   "metadata": {}
  }
 ]
}