{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 17: HEAT TRANSFER BY CONVECTION</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.01, page: 408</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "from scipy import integrate\n",
      "\n",
      "# Initialization  of  Variable\n",
      "\n",
      "#calculations:\n",
      "x2 = lambda x: x**-0.1\n",
      "ratio = integrate.quad(x2,0,1)\n",
      "\n",
      "#Results\n",
      "print  \"The ratio of the average heat transfer coefficient is\", round(ratio[0],2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ratio of the average heat transfer coefficient is 1.11\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.02, page: 415</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "Tinf = 300 #degC\n",
      "uinf = 10 #m/s\n",
      "L = 0.5 #m\n",
      "Ts = 27 #degC\n",
      "\n",
      "#calculations:\n",
      "#from Table HT-3\n",
      "Tf = 437 #K\n",
      "P = 1 #atm\n",
      "v = 30.84E-6 #m2/s\n",
      "k = 36.4E-3 #W/m.K\n",
      "Pr = 0.687\n",
      "#Reynolds number\n",
      "ReL = uinf*L/v\n",
      "#Correlation\n",
      "NuL = 0.664*ReL**0.5*Pr**(1/3)\n",
      "#average convection coefficient\n",
      "hbar = NuL*k/L\n",
      "#cooling rate per unit width of plate\n",
      "q1 = hbar*L*(Tinf - Ts)\n",
      "\n",
      "#Result\n",
      "print \"cooling rate per unit width of plate is\", round(q1,0),\"W/m\"\n",
      "#answer wrong in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cooling rate per unit width of plate is 2344.0 W/m\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.03, page: 416</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "Tinf = 25 #degC\n",
      "uinf = 60 #m/s\n",
      "Ts = 230 #degC\n",
      "d = 50 #mm\n",
      "L4 = 200 #mm\n",
      "L5 = 250 #mm\n",
      "\n",
      "#calculations:\n",
      "#from Table HT-3\n",
      "Tf = 400 #K\n",
      "P = 1 #atm\n",
      "v = 26.41E-6 #m2/s\n",
      "k = 0.0338 #W/m\n",
      "Pr = 0.690\n",
      "#reynolds num\n",
      "Re4 = uinf*L4*1E-3/v\n",
      "Re5 = uinf*L5*1E-3/v\n",
      "#\n",
      "h14bar = 0.664*Re4**0.5*Pr**(1/3)*k/(L4*1E-3)\n",
      "h15bar = k*(0.037*Re5**0.8 - 871)*Pr**(1/3)/(L5*1E-3)\n",
      "#the electrical power required\n",
      "qconv5 = (h15bar*L5*1E-3 - h14bar*L4*1E-3)*1*(Ts - Tinf)\n",
      "\n",
      "#Results\n",
      "print \"Electrical power required for the fifth heater is\", round(qconv5,0),\"W\"\n",
      "#answer wrong in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electrical power required for the fifth heater is 1018.0 W\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.04, page: 419</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Initialization  of  Variable\n",
      "Tinf = 26.2 #degC\n",
      "uinf = 10 #m/s\n",
      "Ts = 128.4 #degC\n",
      "Pe = 46.0 #W\n",
      "qconv = 0.85*Pe\n",
      "D = 12.7 #mm\n",
      "L = 94 #mm\n",
      "\n",
      "#calculations:\n",
      "#From Table HT-3\n",
      "Tf = 350 #K\n",
      "v = 20.92E-6 #m2/s\n",
      "k = 30E-3 #W/m.K\n",
      "Pr = 0.7\n",
      "#Area\n",
      "A = math.pi*D*L*1E-6\n",
      "#convection heat transfer coefficient\n",
      "hbar1 = qconv/(A*(Ts - Tinf))\n",
      "#reynolds num\n",
      "ReD = uinf*D*1E-3/v\n",
      "#Churchill-Bernstein correlation\n",
      "NuDbar = 0.3 + 0.62*ReD**0.5*Pr**(1/3)/(1 + (0.4/Pr)**(2/3))**0.25*(1 + (ReD/282000)**(5/8))**0.8\n",
      "#the convection coefficient\n",
      "hbar2 = NuDbar*k/(D*1E-3)\n",
      "\n",
      "#Results\n",
      "print  \"Convection coefficient associated with the operating condition is\",round(hbar1,0),\"W/m2.K\"\n",
      "print  \"Convection coefficient from an appropriate correlation is\", round(hbar2,0),\"W/m2.K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Convection coefficient associated with the operating condition is 102.0 W/m2.K\n",
        "Convection coefficient from an appropriate correlation is 96.0 W/m2.K\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.05, page: 421</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "Pinf = 1 #atm\n",
      "uinf = 10 #m/s\n",
      "Tinf = 23 #degC\n",
      "D = 10 #mm\n",
      "Ti = 75 #degC\n",
      "Tt = 35 #degC\n",
      "\n",
      "#calculations:\n",
      "#from Table HT-1\n",
      "pcu = 8933 #kg/m3\n",
      "ccu = 387 #J/kg.K\n",
      "kcu = 399 #W/m.K\n",
      "#from Table HT-3\n",
      "muTinf = 181.6E-7 #Ns/m2\n",
      "v = 15.36E-6 #m2/s\n",
      "k = 0.0258 #W/m.K\n",
      "Pr = 0.709\n",
      "muTs = 197.8E-7 #N.s/m2\n",
      "#reynolds Num\n",
      "ReD = uinf*D*1E-3/v\n",
      "#the average convection coefficient\n",
      "NuDbar = 2 + (0.4*ReD**0.5 + 0.06*ReD**(2/3))*Pr**0.4*(muTinf/muTs)**0.25\n",
      "hbar = NuDbar*k/D/1E-3\n",
      "#time\n",
      "t = pcu*ccu*D*1E-3/6/hbar*math.log((Ti - Tinf)/(Tt - Tinf))\n",
      "\n",
      "#Results\n",
      "print  \"cooling  time  required is\", round(t,1),\"s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cooling  time  required is 69.1 s\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.06, page: 429</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "mdot = 0.1 #kg/s\n",
      "D0 = 0.040 #m\n",
      "Di = 0.020 #m\n",
      "Tmi = 20 #degC\n",
      "qdot = 1E6 #W/m3\n",
      "Ts0 = 70 #degC\n",
      "Tm0 = 60 #degC\n",
      "\n",
      "#calculations:\n",
      "#from Table HT-5\n",
      "Cp = 4179 #J/kg.K\n",
      "mu = 6.57E-4 #N.s/m2\n",
      "#required tube length\n",
      "L = 4*mdot*Cp*(Tm0 - Tmi)/(math.pi*(D0**2 - Di**2)*qdot)\n",
      "#Reynolds num\n",
      "ReD = 4*mdot/math.pi/Di/mu\n",
      "#local coefficient at the outlet\n",
      "qs2 = qdot*(D0**2 - Di**2)/4/Di\n",
      "h0 = qs2/(Ts0 - Tm0)\n",
      "\n",
      "#Results\n",
      "print  \"tube  length is\", round(L,1),\"m\"\n",
      "print  \"reynolds  number is\", round(ReD,0),\",the flow is fully turbulant\"\n",
      "print  \"local  convection  coefficient at outlet is\", round(h0,0),\"W/m2.K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "tube  length is 17.7 m\n",
        "reynolds  number is 9690.0 ,the flow is fully turbulant\n",
        "local  convection  coefficient at outlet is 1500.0 W/m2.K\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.07, page: 432</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "mdot = 0.25 #kg/s\n",
      "Tmi = 15 #degC\n",
      "D = 0.05 #m\n",
      "Ts = 100 #degC\n",
      "Tm0 = 57 #degC\n",
      "L = 6 #m\n",
      "\n",
      "#calculations:\n",
      "#from Table HT-5\n",
      "Cp = 4178 #J/kg.K\n",
      "#log mean temp diff\n",
      "dTlm = ((Ts - Tm0) - (Ts - Tmi))/math.log((Ts-Tm0)/(Ts-Tmi))\n",
      "#avg Convection Coeff\n",
      "hbar = mdot*Cp*(Tm0 - Tmi)/math.pi/D/L/dTlm\n",
      "\n",
      "#Results\n",
      "print  \"Average convection heat transfer coefficient is\",round(hbar,0),\"W/m2.K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Average convection heat transfer coefficient is 755.0 W/m2.K\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.08, page: 433</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "Tinf = 37 #degC\n",
      "h0bar = 2 #W/m2.K\n",
      "Tmi = 7 #degC\n",
      "D = 0.3 #m\n",
      "L = 15 #m\n",
      "mdot = 0.05 #kg/s\n",
      "hibar = 3 #W/m2.K\n",
      "\n",
      "#calculations:\n",
      "Cp = 1007 #J/kg.K\n",
      "#overall heat transfer\n",
      "Ubar = (1/hibar + 1/h0bar)**-1\n",
      "#Area\n",
      "As = math.pi*D*L\n",
      "#Temp\n",
      "Tm0 = Tinf - (Tinf - Tmi)*math.e**(-1*Ubar*As/(mdot*Cp))\n",
      "#heat transfer rate\n",
      "q = mdot*Cp*(Tm0 - Tmi)\n",
      "\n",
      "#Results\n",
      "print  \"Chilled air exit temperature and the heat transfer rate are\", round(Tm0,1),\"degC and\",round(q,0),\"W respectively\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Chilled air exit temperature and the heat transfer rate are 15.6 degC and 432.0 W respectively\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.09, page: 434</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "D = 0.06 #m\n",
      "mdot = 0.01 #kg/s\n",
      "Tmi = 20 #degC\n",
      "Tmo = 80 #degC\n",
      "qs2 = 2000 #W/m2\n",
      "\n",
      "#calculations:\n",
      "Cp = 4181 #J/kg.K\n",
      "k = 0.670 #W/m.K\n",
      "mu = 352E-6 #Ns/m2\n",
      "Pr = 2.2\n",
      "#Length\n",
      "L = mdot*Cp*(Tmo - Tmi)/qs2/math.pi/D\n",
      "#Reynolds num\n",
      "ReD = 4*mdot/math.pi/D/mu\n",
      "#local coeff\n",
      "h = 4.36*k/D\n",
      "#surface temp at outlet\n",
      "Tso = qs2/h + Tmo\n",
      "\n",
      "#Results\n",
      "print  \"a)tube  length\", round(L,2),\"m\"\n",
      "print  \"b)surface  temperature at outlet section is\", round(Tso,0),\"degC\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a)tube  length 6.65 m\n",
        "b)surface  temperature at outlet section is 121.0 degC\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.10, page: 436</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "mdot = 2 #kg/s\n",
      "Tmi = 25 #degC\n",
      "Ts = 95 #degC\n",
      "L = 4 #m\n",
      "D = 0.04 #m\n",
      "\n",
      "#calculations:\n",
      "Cp = 4178 #J/kg.K\n",
      "mu = 695E-6 #Ns/m2\n",
      "k = 0.628 #W/m.K\n",
      "Pr = 4.62\n",
      "mus = 296E-6 #Ns/m2\n",
      "#Reynolds NUm\n",
      "ReD = 4*mdot/math.pi/D/mu\n",
      "#avg coeff\n",
      "hbar = (0.023*ReD**0.8*Pr*0.4)*k/D\n",
      "#Temp\n",
      "Tmo = Ts - (Ts - Tmi)*math.e**(-1*math.pi*D*L*hbar/mdot/Cp)\n",
      "#heat rate\n",
      "q = mdot*Cp*(Tmo - Tmi)\n",
      "\n",
      "#Results\n",
      "print  \"outlet water temperature is\", round(Tmo,1),\"degC\"\n",
      "print  \"rate  of  heat  transfer to the water is\", round(q/1000,0),\"kW\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "outlet water temperature is 46.9 degC\n",
        "rate  of  heat  transfer to the water is 183.0 kW\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.11, page: 441</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "L = 0.71 #m\n",
      "w = 1.02 #m\n",
      "Ts = 232 #degC\n",
      "Tinf = 23 #degC\n",
      "g = 9.8 #m/s2\n",
      "\n",
      "#calculations:\n",
      "k = 33.8E-3 #W/m.K\n",
      "v = 26.4E-6 #m2/s\n",
      "a = 38.3E-6 #m2/s\n",
      "Pr = 0.69\n",
      "b = 0.0025 #1/K\n",
      "#Rayleigh num\n",
      "RaL = g*b*(Ts - Tinf)*L**3/a/v\n",
      "#Churchill-Chu correlation\n",
      "NuLbar = (0.825 + 0.387*RaL**(1/6)/(1 + (0.492/Pr)**(9/16))**(8/27))**2\n",
      "#average convection coefficient\n",
      "hbar = NuLbar*k/L\n",
      "#the heat transfer by free convection between the firescreen and room air is\n",
      "q = hbar*L*w*(Ts - Tinf)\n",
      "\n",
      "#Results\n",
      "print  \"the heat transfer by free convection between the firescreen and room air is\", round(q,0),\"W\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the heat transfer by free convection between the firescreen and room air is 1060.0 W\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.12, page: 443</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "Tinf = 300 #K\n",
      "Tsur = 300 #K\n",
      "Ts = 350 #K\n",
      "e = 0.25\n",
      "s1 = 1.2 #m\n",
      "s2 = 1.2 #m\n",
      "Tf = 325 #K\n",
      "g = 9.8 #m/s2\n",
      "sigma = 5.67E-8 #W/m2.K4\n",
      "\n",
      "#calculations:\n",
      "v = 18.4E-6 #m2/s\n",
      "k = 0.028 #W/m.K\n",
      "a = 26.2E-6 #m2/s\n",
      "# Area\n",
      "As = s1*s2\n",
      "#perimeter\n",
      "P = 4*s1\n",
      "#characteristic length\n",
      "L = As/P\n",
      "#Rayleigh num\n",
      "b = 1/Tf\n",
      "RaL = g*b*(Ts - Tinf)*L**3/v/a\n",
      "#avg conv coeff\n",
      "hbar = (0.15*RaL**(1/3))*k/L\n",
      "#allowable electrical power\n",
      "Pe = hbar*As*(Ts - Tinf) + e*As*sigma*(Ts**4 - Tsur**4)\n",
      "\n",
      "#Results\n",
      "print  \"Maximum allowable electrical power dissipation is\", round(Pe,0),\"W\"\n",
      "#answer wrong in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum allowable electrical power dissipation is 583.0 W\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.13, page: 445</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#  Initialization  of  Variable\n",
      "D = 0.1 #m\n",
      "Tinf = 23 #degC\n",
      "Tsur = 23 #degC\n",
      "Ts = 165 #degC\n",
      "e = 0.85\n",
      "g = 9.8 #m/s2\n",
      "sigma = 5.67E-8 #W/m2.K4\n",
      "\n",
      "#calculations:\n",
      "k = 0.0313 #W/m.K\n",
      "v = 22.8E-6 #m2/s\n",
      "a = 32.8E-6 #m2/s\n",
      "Pr = 0.697\n",
      "b = 2.725E-3 #1/K\n",
      "#Rayleigh number\n",
      "RaD = g*b*(Ts - Tinf)*D**3/v/a\n",
      "#average convection coefficient\n",
      "hbar = (0.6 + 0.387*RaD**(1/6)/(1 + (0.559/Pr)**(9/16))**(8/27))**2*k/D\n",
      "#total heat transfer rate from the pipe is\n",
      "q1 = hbar*math.pi*D*(Ts - Tinf) + e*math.pi*D*sigma*((Ts + 273)**4 - (Tsur+273)**4)\n",
      "\n",
      "#Results\n",
      "print  \"Heat transfer from the pipe per unit length is\", round(q1,0),\"W/m\"\n",
      "#anwer wrong in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transfer from the pipe per unit length is 763.0 W/m\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.14, page: 452</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "ho = 40 #W/m2.K\n",
      "Do = 0.045 #m\n",
      "Di = 0.025 #m\n",
      "Thi = 100 #degC\n",
      "mhdot = 0.1 #kg/s\n",
      "Tho = 60 #degC\n",
      "mcdot = 0.2 #kg/s\n",
      "Tci = 30 #degC\n",
      "\n",
      "#calculations:\n",
      "Cpc = 4178 #J/kg.K\n",
      "mu = 725E-6 #Ns/m2\n",
      "k = 0.625 #W/m.K\n",
      "Pr = 4.85\n",
      "Cph = 2131 #J/kg.K\n",
      "#heat transfer rate\n",
      "q = mhdot*Cph*(Thi - Tho)\n",
      "#water outlet temperature\n",
      "Tco = q/mcdot/Cpc + Tci\n",
      "#log mean temperature difference\n",
      "dTlm = ((Thi - Tco) - (Tho - Tci))/math.log((Thi-Tco)/(Tho-Tci))\n",
      "#reynolds num\n",
      "ReD = 4*mcdot/math.pi/Di/mu\n",
      "#conv coeff\n",
      "hi = (0.023*ReD**0.8*Pr**0.4)*k/Di\n",
      "#overall heat transfer coefficien\n",
      "U = 1/(1/hi + 1/ho)\n",
      "#the required length of the exchanger\n",
      "L = q/U/math.pi/Di/dTlm\n",
      "\n",
      "#Results\n",
      "print  \"Tube length to achieve a desired hot fluid outlet temperature is\", round(L,1),\"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Tube length to achieve a desired hot fluid outlet temperature is 63.9 m\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h2>Example 17.15, page: 454</h2>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "# Initialization  of  Variable\n",
      "ho = 400 #W/m2.K\n",
      "n = 10\n",
      "D = 0.025 #m\n",
      "Thi = 160 #degC\n",
      "Tho = 100 #degC\n",
      "Tco = 85 #degC\n",
      "Tci = 15 #degC\n",
      "mcdot = 2.5 #kg/s\n",
      "\n",
      "#calculations:\n",
      "Cph = 2350 #J/kg.K\n",
      "Cpc = 4181 #J/kg.K\n",
      "mu = 548E-6 #Ns/m2\n",
      "k = 0.643 #W/m.K\n",
      "Pr = 3.56\n",
      "#heat transfer rate\n",
      "q = mcdot*Cpc*(Tco - Tci)\n",
      "#required flow rate\n",
      "mhdot = q/Cph/(Thi - Tho)\n",
      "#m1dot\n",
      "m1dot = mcdot/n\n",
      "#reynolds num\n",
      "ReD = 4*m1dot/math.pi/D/mu\n",
      "#conv coeff\n",
      "hi = (0.023*ReD**0.8*Pr**0.4)*k/D\n",
      "#overall Coeff\n",
      "U = 1/(1/ho + 1/hi)\n",
      "#\n",
      "R = (Thi - Tho)/(Tco - Tci)\n",
      "P = (Tco - Tci)/(Thi - Tci)\n",
      "F = 0.87\n",
      "#log mean temperature difference\n",
      "dTlm = ((Thi - Tco) - (Tho - Tci))/math.log((Thi-Tco)/(Tho-Tci))\n",
      "#the required tube length\n",
      "L = q/U/n/math.pi/D/F/dTlm\n",
      "\n",
      "#Results\n",
      "print  \"Oil flow rate required is\", round(mhdot,2),\"kg/s\"\n",
      "print  \"Tube length required is\", round(L,1),\"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Oil flow rate required is 5.19 kg/s\n",
        "Tube length required is 37.9 m\n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}