{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 12: Convection Heat Transfer1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 12.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transfer rate from both sides of the plate (Btu/hr) =  40.50\n",
      "press enter key to exit\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#An electrically heated vertical plate, 5 in square has a temperature of \n",
    "#150 F and is being cooled by natural convection in 50 F air. What is the \n",
    "#heat transfer rate from both sides of the plate?\n",
    "import math\n",
    "#initialisation of variables\n",
    "d= 5. \t\t\t\t\t\t\t\t#ft\n",
    "Tw= 150. \t\t\t\t\t\t\t#F\n",
    "T= 50 \t\t\t\t\t\t\t\t#F\n",
    "Pr= 0.72\n",
    "k= 0.015 \t\t\t\t\t\t\t#Btu/hr ft F\n",
    "r= 1.76*1000000. \t\t\t\t\t#(F ft^3)^-1\n",
    "#CALCULATIONS\n",
    "D= d*(0.42/5.) \t\t\t\t\t\t#Diameter\n",
    "dt= Tw-T \t\t\t\t\t\t\t#change in temp\n",
    "Gr= r*D*D*D*dt \t\t\t\t\t\t#Grashof number\n",
    "z= Gr*Pr \t\t\t\t\n",
    "h= 0.59*(math.pow(z,(0.25))) *(k/D) #Heat transfer coefficient\n",
    "q= (2*h*dt*d*d)/144. \t\t\t\t#Heat transfer rate\n",
    "#RESULTS\n",
    "print '%s %.2f' % ('Heat transfer rate from both sides of the plate (Btu/hr) = ',q)\n",
    "raw_input('press enter key to exit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 12.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transfer coefficient when the flow is fully devoloped (Btu/hr ft^2 F) =  1311.13\n",
      "press enter key to exit\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Cooling water at an average temperature of 70 F flows through a tube of \n",
    "#0.9 in ID, with an average velocity of 7 ft/s. What is the heat transfer\n",
    "#coefficient when the flow is fully developed?\n",
    "#initialisation of variables\n",
    "import math\n",
    "T= 70. \t\t\t\t\t\t\t\t\t\t#F\n",
    "l= 0.9 \t\t\t\t\t\t\t\t\t\t#in\n",
    "v= 7. \t\t\t\t\t\t\t\t\t\t#ft/s\n",
    "d= 62.3 \t\t\t\t\t\t\t\t\t#lbm/ft^3\n",
    "m= 6.58*math.pow(10,-4) \t\t\t\t\t#lbm/ft s\n",
    "Pr= 6.82 \n",
    "k= 0.347 \t\t\t\t\t\t\t\t\t#Bt/hr ft F\n",
    "#CALCULATIONS\n",
    "l1= l*0.075/l\n",
    "Re= (d*v*l1)/m \t\t\t\t\t\t\t\t#Reynold's number\n",
    "Nu= 0.023*math.pow(Re,0.8)*math.pow(Pr,0.4) #Nusselt number\n",
    "h= Nu*k/l1 \t\t\t\t\t\t\t\t\t#Transfer coefficient\n",
    "#RESULTS\n",
    "print '%s %.2f' % ('Heat transfer coefficient when the flow is fully devoloped (Btu/hr ft^2 F) = ',h)\n",
    "raw_input('press enter key to exit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 12.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transfer rate per unit lenght (W/m) =  23.21\n",
      "press enter key to exit\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Air at 1 atm pressure and a mixing cup temperature of 450k flows through \n",
    "#a 3 cm diameter tube with a velocity of 6 m/s. determine the heat transfer\n",
    "#rate per unit length if tube if a constant heat flux condition is maintained\n",
    "#at the tube wall and the wall temperature is 10 C above the air temperature\n",
    "import math\n",
    "#initialisation of variables\n",
    "P= 1 \t\t\t\t\t\t\t\t\t\t#atm\n",
    "d= 0.783 \t\t\t\t\t\t\t\t\t#Kg/m^3\n",
    "K= 0.0371 \t\t\t\t\t\t\t\t\t#W/m C\n",
    "m= 2.48*math.pow(10,-5) \t\t\t\t\t#Ns/m^2\n",
    "Pr= 0.683\n",
    "D= 0.03 \t\t\t\t\t\t\t\t\t#m\n",
    "v= 6 \t\t\t\t\t\t\t\t\t\t#m/s\n",
    "T= 10 \t\t\t\t\t\t\t\t\t\t#C\n",
    "#CALCULATIONS\n",
    "Re= d*v*D/m \t\t\t\t\t\t\t\t#Reynolds number\n",
    "Nu= 0.023*math.pow(Re,0.8)*math.pow(Pr,0.4) #Nusselt number\n",
    "h= Nu*K/D \t\t\t\t\t\t\t\t\t#Heat transfer coefficient\n",
    "ql= h*math.pi*D*T \t\t\t\t\t\t\t#Heat transfer rate\n",
    "#RESULTS\n",
    "print '%s %.2f' % ('Heat transfer rate per unit lenght (W/m) = ',ql)\n",
    "raw_input('press enter key to exit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 12.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transfer rate per unit lenght of cylinder (W/m) =  3023.70\n",
      "press enter key to exit\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Air at 1 atm pressure and 25 C flows past a horizontal 5 cm diameter with\n",
    "#a velocity of 46 m/s. If the surface of the cylinder is kept at 135 C, determine\n",
    "#the rate of heat flow from the cylinder\n",
    "import math\n",
    "#initialisation of variables\n",
    "T= 25 \t\t\t\t\t\t#C\n",
    "P= 1 \t\t\t\t\t\t#atm\n",
    "v= 46 \t\t\t\t\t\t#m/s\n",
    "d= 5 \t\t\t\t\t\t#cm\n",
    "T1= 135 \t\t\t\t\t#C\n",
    "d1= 0.998 \t\t\t\t\t#kg/m^3\n",
    "k= 0.03 \t\t\t\t\t#W/m C\n",
    "m= 2.08*math.pow(10,-5) \t#Kg/s m\n",
    "c= 0.024\n",
    "n= 0.81\n",
    "#CALCULATIONS\n",
    "Tf= (T+T1)/2. \t\t\t\t#Final temp.\n",
    "D= d/100.\n",
    "Re= d1*v*D/m \t\t\t\t#Reynolds number\n",
    "h= c*math.pow(Re,0.81)*k/D \t#Heat transfer coefficient\n",
    "dt= T1-T \t\t\t\t\t#temp diff.\n",
    "ql= h*math.pi*D*dt \t\t\t#Heat transfer rate\n",
    "#RESULTS\n",
    "print '%s %.2f' % ('Heat transfer rate per unit lenght of cylinder (W/m) = ',ql)\n",
    "raw_input('press enter key to exit')"
   ]
  }
 ],
 "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
}
