{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 5 : free convection"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.1 Page No : 153"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The rate of heat loss is 267 W\n"
     ]
    }
   ],
   "source": [
    "# Variables\n",
    "T1 = 65.                    \t\t\t#C, furnace temp.\n",
    "T2 = 25.                    \t\t\t#C, ambient temp.\n",
    "h = 1.5                     \t\t\t#m, height of door\n",
    "w = 1.                      \t\t\t#m, width of door\n",
    "Tf = (T1+T2)/2               \t\t\t#c, average air film temp.\n",
    "\n",
    "# Calculations\n",
    "Pr = 0.695                 \t\t\t#Prandtl no.\n",
    "mu = 1.85*10**-5            \t\t\t#m**2/s, vismath.cosity\n",
    "beeta = 1/(Tf+273)         \t\t\t#K**-1. coefficient of volumetric expension\n",
    "k = 0.028                  \t\t\t#W/m C, thermal conductivity\n",
    "g = 9.8                    \t\t\t#m/s**2, gravitational consmath.tant\n",
    "Grl = g*beeta*(T1-T2)*h**3/(mu**2)        \t\t\t#Grashof no.\n",
    "Ral = Grl*Pr                            \t\t\t#Rayleigh no.\n",
    "#Nusslet no.\n",
    "Nul = (0.825+(0.387*(Ral)**(1./6))/(1+(0.492/Pr)**(9./16))**(8./27))**2 \n",
    "hav = Nul*k/h              \t\t\t#average heat transfer coefficient\n",
    "Ad = h*w                   \t\t\t#m**2, door area\n",
    "dt = T1-T2                 \t\t\t#temp. driving force\n",
    "q = hav*Ad*dt              \t\t\t#W,rate of heat loss\n",
    "\n",
    "# Results\n",
    "print \"The rate of heat loss is %.0f W\"%(q)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.2 Page No : 154"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the steady state temp. of the plate is 61.6 C\n"
     ]
    }
   ],
   "source": [
    "# Variables\n",
    "T1 = 60.                    \t\t\t#C, plate temp.\n",
    "T2 = 25.                    \t\t\t#C, ambient temp.\n",
    "h = 1.\n",
    "w = 1.                      \t\t\t#m, width of door\n",
    "q = 170.                    \t\t\t#W, rate of heat transfer\n",
    "Tf = (T1+T2)/2             \t\t\t#c, average air film temp.\n",
    "#Properties of air at Tf\n",
    "Pr = 0.7                 \t\t\t#Prandtl no.\n",
    "mu = 1.85*10**-5            \t\t\t#m**2/s, vismath.cosity\n",
    "beeta = 1./(Tf+273)         \t\t\t#K**-1. coefficient of volumetric expension\n",
    "k = 0.028                  \t\t\t#W/m C, thermal conductivity\n",
    "g = 9.8                    \t\t\t#m/s**2, gravitational consmath.tant\n",
    "\n",
    "#Calculation\n",
    "A = h*w                    \t\t\t#m**2, plate area\n",
    "P = 2*(h+w)                \t\t\t#m,perimeter of plate \n",
    "L = A/P                    \t\t\t#m characteristic length\n",
    "Grl = g*beeta*(T1-T2)*L**3/(mu**2)      \t\t\t#Grashof no.\n",
    "Ral = Grl*Pr                          \t\t\t#Rayleigh no.\n",
    "#Nusslet no.\n",
    "Nul = 0.54*(Ral)**(1./4)                \t\t\t#Nusslet no.\n",
    "hav = Nul*k/L                        \t\t\t#average heat transfer coefficient\n",
    "Ts = q/(hav*A)+T2\n",
    "\n",
    "# Results\n",
    "print \"the steady state temp. of the plate is %.1f C\"%(Ts)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.3 Page No : 156"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The required time for cooling is 2.30 hr\n"
     ]
    }
   ],
   "source": [
    "import math \n",
    "from scipy.integrate import quad \n",
    "# Variables\n",
    "d = 0.0254                  \t\t\t#m, diameter of steel rod\n",
    "l = 0.4                     \t\t\t#m, length of rod\n",
    "T1 = 80.                     \t\t\t#C, initial temp.\n",
    "T2 = 30.                     \t\t\t#C, ambient temp.\n",
    "T3 = 35.                     \t\t\t#c, temp. after cooling\n",
    "rho = 7800.                  \t\t\t#kg/m**3 ,density of steel rod\n",
    "cp = 0.473                  \t\t\t#kj/kg C. specific heat\n",
    "\n",
    "#Calculation\n",
    "m = math.pi/4*d**2*l*rho         \t\t\t#kg. mass of cylinder\n",
    "A = math.pi*d*l                 \t\t\t#m**2, area of cylinder\n",
    "dt = T1-T2                  \t\t\t#c, insmath.tanmath.taneous temp. difference\n",
    "h = 1.32*(dt/d)**0.25        \t\t\t#W/m**2 C, heat transfer coefficient\n",
    "\n",
    "def f0(T): \n",
    "    return 1./(T**(5./4))\n",
    "\n",
    "i =  quad(f0,5,50)[0]\n",
    "\n",
    "t = i/(3.306*A/(m*cp*10**3))\n",
    "\n",
    "# Results\n",
    "print \"The required time for cooling is %.2f hr\"%(t/3600.)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.4 Page No : 157"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the rate of heat loss by free convection per meter length of pipe. is 107 W\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Variables\n",
    "id_ = 78.*10**-3                    \t\t\t#m, internal diameter\n",
    "od = 89.*10**-3                    \t\t\t#m, outer diameter\n",
    "Pg = 15.                          \t\t\t#kg/cm**2, gauge pressure\n",
    "t = 2.*10**-2                      \t\t\t#m, thickness of preformed mineral fibre\n",
    "k = 0.05                         \t\t\t#W/m C. thermal conductivity\n",
    "Ta = 25.                          \t\t\t#C, ambient air temp.\n",
    "Pr = 0.705                       \t\t\t#Prandtl no.\n",
    "#assume\n",
    "Ts = 50.                          \t\t\t#C, skin temp.\n",
    "l = 1.                            \t\t\t#m, length\n",
    "Ti = 200.5                        \t\t\t#C, initial temp.\n",
    "rs = od/2+t                      \t\t\t#m, outer radius of insulation\n",
    "ri = od/2                        \t\t\t#m, inner radius of insulation\n",
    "\n",
    "# Calculations\n",
    "Q = 2*math.pi*l*k*(Ti-Ts)/(math.log(rs/ri))           \t\t\t#W\n",
    "#properties of air at taken at the mean film temp.\n",
    "Tf = (Ta+Ts)/2                  \t\t\t#C\n",
    "mu = 1.76*10**-5                 \t\t\t#m**2/s. vismath.cosity\n",
    "beeta = (1/(Tf+273))            \t\t\t#K**-1, coefficient of volumetric expansion\n",
    "k1 = 0.027                      \t\t\t#W/m C, thermal conductivity\n",
    "ds = 2*rs                       \t\t\t#m, outer dia. of insulated pipe\n",
    "g = 9.8                         \t\t\t#m/s**2, gravitational consmath.tant\n",
    "Grd = g*beeta*(Ts-Ta)*ds**3/(mu**2)        \t\t\t#Grashof no.\n",
    "Rad = Grd*Pr                             \t\t\t#Rayleigh no.\n",
    "#from eq. 5.9\n",
    "#Nusslet no. \n",
    "Nu = (0.60+(0.387*(Rad)**(1./6))/(1+(0.559/Pr)**(9./16))**(8./27))**2 \n",
    "hav = Nu*k1/ds                 \t\t\t#W/ m**2 C, average heat transfer coefficient\n",
    "Ts = (Q/(math.pi*ds*l*hav))+Ta     \t\t\t#C, skin temp.\n",
    "#revised calculation by assuming\n",
    "Ts1 = 70.                      \t\t\t#C, skin temp.\n",
    "#Rate of heat transfer through insulation\n",
    "Q1 = 2*math.pi*l*k*(Ti-Ts1)/(math.log(rs/ri))\n",
    "Tf1 = (Ta+Ts1)/2                \t\t\t#C, average aie mean film temp.\n",
    "mu1 = 1.8*10**-5                  \t\t\t#m**2/s. vismath.cosity\n",
    "beeta1 = (1/(Tf1+273))            \t\t\t#K**-1, coefficient of volumetric expansion\n",
    "k1 = 0.0275                     \t\t\t#W/m C, thermal conductivity\n",
    "Pr1 = 0.703                     \t\t\t#Prandtl no.\n",
    "Grd1 = g*beeta1*(Ts1-Ta)*ds**3/(mu1**2)        \t\t\t#Grashof no.\n",
    "Rad = Grd1*Pr1                               \t\t\t#Rayleigh no.\n",
    "#from eq. 5.9\n",
    "# average heat transfer coefficient, in \t\t\t#W/ m**2 C,\n",
    "hav1 = (0.60+(0.387*(Rad)**(1./6))/(1+(0.559/Pr)**(9./16))**(8./27))**2*(k1/ds)\n",
    "Ts2 = (Q1/(math.pi*ds*l*hav1))+Ta\n",
    "#again assume skin temp. = 74\n",
    "Ts2 = 74                      \t\t\t#C, assumed skin temp.\n",
    "Q3 = 2*math.pi*l*k*(Ti-Ts2)/(math.log(rs/ri))\n",
    "\n",
    "# Results\n",
    "print \"the rate of heat loss by free convection per meter length of pipe. is %.0f W\"%(Q3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.5 Page No : 159"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The required insulation thickness is 0.188 m\n"
     ]
    }
   ],
   "source": [
    "from scipy.optimize import fsolve \n",
    "import math \n",
    "\n",
    "# Variables\n",
    "Ts = 65.                       \t\t\t#C, skin temp.\n",
    "To = 30.                       \t\t\t#C, ambient temp.\n",
    "Tw = 460.                      \t\t\t#C, wall temp.\n",
    "Tf = (Ts+To)/2                  \t\t\t#C,mean air film temp.\n",
    "beeta = (1./(Tf+273))                \t\t\t#K**-1, coefficient of volumetric expansion\n",
    "g = 9.8                         \t\t\t#m/s**2, gravitational consmath.tant\n",
    "mu = 1.84*10**-5               \t\t\t#m**2/s, vismath.cosity\n",
    "L = 10.5                      \t\t\t#m, height of converter\n",
    "di = 4.                        \t\t\t#m,diameter of converter\n",
    "Pr = 0.705                    \t\t\t#Prandtl no.\n",
    "k = 0.0241                    \t\t\t#kcal/h m C, thermal conductivity\n",
    "\n",
    "#Calculation\n",
    "Grl = g*beeta*(Ts-To)*L**3/(mu**2)        \t\t\t#Grashof no.\n",
    "x = di/L                      \t\t\t#assume di/l = x\n",
    "y = 35/(Grl)**(1./4)            \t\t\t#assume 35/(Grl)**(3/4) =  y\n",
    "#for a verticla flat plate,  from eq. 5.3\n",
    "Ral = Grl*Pr                  \t\t\t#Rayleigh no.\n",
    "#nusslet no.\n",
    "Nu = (0.825+(0.387*(Ral)**(1./6))/(1+(0.496/Pr)**(9./16))**(8./27))**2\n",
    "hav = Nu*k/L                 \t\t\t#kcal/h m**2 C, average heat transfer coefficient\n",
    "#w = poly(0,\"w\")\n",
    "#Dav = (4+(4+2*w))/2                 \t\t\t#average diameter\n",
    "#Aav = math.pi*Dav*L                     \t\t\t#average heat transfer area\n",
    "#Qi = math.pi*Dav*L*0.0602*(Tw-Ts)/w     \t\t\t#Rate of heat transfer through insulation\n",
    "#rate of heat transfer from the outer surface of the insulation by free convection\n",
    "#Qc = hav*math.pi*Dav*L*(Ts-To)          \n",
    "#Qi = Qc\n",
    "def f(w): \n",
    "    return math.pi*(4+w)*L*0.0602*(Tw-Ts)/w-hav*math.pi*(4+2*w)*L*(Ts-To)\n",
    "w = fsolve(f,0.1)\n",
    "\n",
    "# Results\n",
    "print \"The required insulation thickness is %.3f m\"%(w)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.6 Page No : 162"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the rate of heat  transfer is 13.4 W\n"
     ]
    }
   ],
   "source": [
    "# Variables\n",
    "L = 1.6                  \t\t\t#m,height of enclosure\n",
    "w = 0.04                 \t\t\t#m, width of enclosure\n",
    "b = 0.8                  \t\t\t#m, breath\n",
    "T1 = 22.                  \t\t\t#C,surface temp.\n",
    "T2 = 30.                  \t\t\t#C, wall temp.\n",
    "Tm = (T1+T2)/2           \t\t\t#C, Mean air temp.\n",
    "Pr = 0.7                 \t\t\t#Prandtl no.\n",
    "\n",
    "# Calculations\n",
    "#fpr air at 26 C\n",
    "beeta = 1./(Tm+273)       \t\t\t#K**-1. coefficient of volumetric expension\n",
    "mu = 1.684*10**-5         \t\t\t#m**2/s,  vismath.cosity\n",
    "k = 0.026                \t\t\t#W/m C, thermal conductivity\n",
    "alpha = 2.21*10**-5       \t\t\t#m**2/s, thermal diffusity\n",
    "g = 9.8                  \t\t\t#m/s**2, gravitational consmath.tant\n",
    "Raw = g*beeta*(T2-T1)*w**3/(mu*alpha)        \t\t\t#Rayleigh no.\n",
    "Nuw = 0.42*(Raw)**0.25*Pr**0.012*(L/w)**-0.3   \t\t\t#Nusslet no.\n",
    "h = Nuw*k/w                                 \t\t\t#kcal/h m**2 C, heat transfer coefficient\n",
    "q = h*(T2-T1)*(L*b)                         \t\t\t#W,the rate of heat transfer\n",
    "\n",
    "# Results\n",
    "print \"the rate of heat  transfer is %.1f W\"%(q)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.7 Page No : 163"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the rate of heat loss per meter length is 39.7 kcal/h\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Variables\n",
    "Ts = 60.              \t\t\t#C, surface temp\n",
    "To = 30.              \t\t\t#C, bulk temp.\n",
    "d = 0.06             \t\t\t#m, diameter  of pipe\n",
    "l = 1.                \t\t\t#m, length\n",
    "Tm = (Ts+To)/2\n",
    "#for air at Tm\n",
    "rho = 1.105                     \t\t\t#kg/m**3, density\n",
    "cp = 0.24                       \t\t\t#kcal/kg C. specific heat\n",
    "mu = 1.95*10**-5                 \t\t\t#kg/m s. vismath.cosity\n",
    "P = 0.7                         \t\t\t#Prandtl no. \n",
    "kv = 1.85*10**-5                     \t\t\t#m**2/s, kinetic vismath.cosity\n",
    "k = 0.0241                      \t\t\t#kcal/f m C, thermal conductivity\n",
    "beeta = (1./(Tm+273))                  \t\t\t#K**-1. coefficient of volumetric expension\n",
    "V = 0.3                         \t\t\t#m/s, velocity\n",
    "g = 9.8                         \t\t\t#m/s**2, gravitational consmath.tant\n",
    "\n",
    "#Calculation\n",
    "Rad = g*beeta*(Ts-To)*d**3*P/(kv**2)      \t\t\t#Rayleigh no.\n",
    "#from eq. 5.9\n",
    "Nufree = (0.60+(0.387*Rad**(1./6))/(1+(0.559/P)**(9./16))**(8./27))**2\n",
    "#calculation of forced convection nusslet no.\n",
    "#from eq. 4.19\n",
    "Re = d*V/(kv)\n",
    "Nuforced = 0.3+(0.62*Re**(1./2)*P**(1./3)/(1+(0.4/P)**(2./3))**(1./4))*(1.+(Re/(2.82*10**5))**(5./8))**(4./5)\n",
    "Nu = (Nuforced**3+Nufree**3)**(1./3)       \t\t\t#nusslet no. for mixed convection\n",
    "#Nu = h*d/k\n",
    "h = Nu*k/d                     \t\t\t#kcal/h m**2 C, heat transfer corfficient\n",
    "q = h*math.pi*d*l*(Ts-To)\n",
    "\n",
    "# Results\n",
    "print \"the rate of heat loss per meter length is %.1f kcal/h\"%(q)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}