{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter4: Radiation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.1,Page no:4.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat loss by radiation is 704.0 W/m^2\n"
     ]
    }
   ],
   "source": [
    "#Heat loss by radiaiton\n",
    "\n",
    "#Variable declaration\n",
    "e=0.9   #[Emissivity]\n",
    "sigma=5.67*10**-8    #[W/m**2.K**4]\n",
    "T1=377  #[K]\n",
    "T2=283  #[K]\n",
    "\n",
    "#Calculation\n",
    "Qr_by_a=e*sigma*(T1**4-T2**4) #[W/sq m]\n",
    "\n",
    "#Result\n",
    "print\"Heat loss by radiation is\",round(Qr_by_a),\"W/m^2\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.2,Page no:4.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rate of heat transfer by radiation is 841.2 W/sq m\n"
     ]
    }
   ],
   "source": [
    "#Radiation from unlagged steam pipe\n",
    "\n",
    "#Variable declaration\n",
    "e=0.9   #Emissivity\n",
    "T1=393  #[K]\n",
    "T2=293  #[K]\n",
    "sigma=5.67*10**-8    #[W/sq m.K]\n",
    "#Calculation\n",
    "Qr_by_a=e*sigma*(T1**4-T2**4) #W/sq m\n",
    "#Result\n",
    "print\"Rate of heat transfer by radiation is\",round(Qr_by_a,1),\"W/sq m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.3,Page no:4.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Net radiaiton rate per 1 metre length of pipe is 204.0 W/m(approx)\n"
     ]
    }
   ],
   "source": [
    "#Interchange of radiation energy\n",
    "import math\n",
    "\n",
    "#Variable declaration\n",
    "L=1  #[m]\n",
    "e=0.8    #Emissivity\n",
    "sigma=5.67*10**-8     #[m**2.K**4]\n",
    "T1=423.0   #[K]\n",
    "T2=300.0   #[K]\n",
    "Do=60.0    #[mm]\n",
    "Do=Do/1000   #[m]\n",
    "\n",
    "#Calculation\n",
    "A=round(math.pi*Do*L,3)  #[sq m]\n",
    "Qr=e*sigma*A*(T1**4-T2**4)    #[W/m]\n",
    "\n",
    "#Result\n",
    "print\"Net radiaiton rate per 1 metre length of pipe is\",round(Qr),\"W/m(approx)\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.4,Page no:4.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total heat loss by convection is 344.9 W/m\n"
     ]
    }
   ],
   "source": [
    "#Heat loss in unlagged steam pipe\n",
    "import math\n",
    "#Variable declaration\n",
    "e=0.9   #Emissivity\n",
    "L=1.0 #[m]\n",
    "Do=50.0   #[mm]\n",
    "Do=Do/1000  #[m]\n",
    "sigma=5.67*10**-8    #[W/(m**2.K**4)]\n",
    "T1=415.0  #[K]\n",
    "T2=290.0  #[K]\n",
    "dT=T1-T2    #[K]\n",
    "#Calculation\n",
    "hc=1.18*(dT/Do)**(0.25)  #[W/sq m.K]\n",
    "A=math.pi*Do*L  #Area in [sq m]\n",
    "Qc=hc*A*dT #Heat loss by convection W/m\n",
    "Qr=e*sigma*A*(T1**4-T2**4)    #Heat loss by radiation per length W/m\n",
    "Qt=Qc+Qr    #Total heat loss in [W/m]\n",
    "#Result\n",
    "print\"Total heat loss by convection is\",round(Qt,1),\"W/m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.5,Page no:4.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total heat loss is 2712.0 W\n"
     ]
    }
   ],
   "source": [
    "#Loss from horizontal pipe\n",
    "import math\n",
    "#Variable declaration\n",
    "e=0.85\n",
    "sigma=5.67*10**-8    #[W/sq m.K]\n",
    "T1=443.0  #[K]\n",
    "T2=290.0  #[K]\n",
    "dT=T1-T2    #[K]\n",
    "hc=1.64*dT**0.25     #W/sq m.K\n",
    "Do=60.0   #[mm]\n",
    "Do=Do/1000  #[m]\n",
    "L=6 #Length [m]\n",
    "#Calculation\n",
    "A=math.pi*Do*L  #Surface area of pipe in [sq m]\n",
    "Qr=e*sigma*A*(T1**4-T2**4)    # Rate of heat loss by radiaiton W\n",
    "Qc=hc*A*(T1-T2) # Rate of heat loss by convection [W]\n",
    "Qt=Qr+Qc    #Total heat loss  [W]\n",
    "#Result\n",
    "print\"Total heat loss is\",round(Qt),\"W\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.6,Page no:4.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat lost by radiation is 1588.5 W\n"
     ]
    }
   ],
   "source": [
    "#Heat loss by radiation in tube\n",
    "import math\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/m**2.K**4]\n",
    "e1=0.79 \n",
    "e2=0.93 \n",
    "T1=500   #[K]\n",
    "T2=300   #[K]\n",
    "D=70    #[mm]\n",
    "D=D/1000    #[m]\n",
    "L=3 #[m]\n",
    "W=0.3   #Side of conduit [m]\n",
    "#Calculation\n",
    "A1=math.pi*D*L  #[sq m]\n",
    "A1=0.659        #Approximate calculation in book in [m**2]\n",
    "A2=4*(L*W)  #[sq m]\n",
    "Q=sigma*A1*(T1**4-T2**4)/(1/e1+((A1/A2)*(1/e2-1)))    #[W]\n",
    "#Result\n",
    "print\"Heat lost by radiation is\",round(Q,1),\"W\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.7,Page no:4.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Net radiant interchange per square metre is 6571.0 W/sq m\n"
     ]
    }
   ],
   "source": [
    "#Net radiant interchange\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/sq m.K**4]\n",
    "T1=703  #[K]\n",
    "T2=513  #[K]\n",
    "e1=0.85 \n",
    "e2=0.75\n",
    "#Calculation\n",
    "Q_by_Ar=sigma*(T1**4-T2**4)/(1/e1+1/e2-1) #[W/sq m]\n",
    "#Result\n",
    "print\"Net radiant interchange per square metre is\",round(Q_by_Ar),\"W/sq m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.8,Page no:4.12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Net radiant interchange is 2900.0 W\n"
     ]
    }
   ],
   "source": [
    "#Radiant interchange between plates\n",
    "#Variable declaration\n",
    "L=3  #[m]\n",
    "A=L**2   #Area in [sq m]\n",
    "sigma=5.67*10**-8     #[W/sq m.K**4]\n",
    "T1=373   #[K]\n",
    "T2=313   #[K]\n",
    "e1=0.736 \n",
    "e2=e1 \n",
    "#Calculation\n",
    "F12=1.0/((1.0/e1)+(1.0/e2)-1)\n",
    "Q=sigma*A*F12*(T1**4-T2**4)   #[W]\n",
    "#Result\n",
    "print\"Net radiant interchange is\",round(Q),\"W\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.9,Page no:4.12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rate of heat loss when of silvered surface is 15.95 W/sq m\n",
      "\n",
      " When both surfaces are black,Rate of heat loss  is 622.0 W/sq m\n"
     ]
    }
   ],
   "source": [
    "#Heat loss from thermofask  \n",
    "#Variable declaration  \n",
    "sigma=5.67*10**-8    #[W/sq m.K**4]\n",
    "e1=0.05 \n",
    "e2=0.05\n",
    "#A1=A2=1 (let)\n",
    "A1=1 \n",
    "A2=A1 \n",
    "\n",
    "#Calculation\n",
    "F12=1.0/(1.0/e1+(A1/A2)*(1.0/e2-1))   \n",
    "T1=368  #[K]\n",
    "T2=293  #[K]\n",
    "Q_by_A=sigma*F12*(T1**4-T2**4)    #Heat loss per unit Area  [W/sq m]\n",
    "print\"Rate of heat loss when of silvered surface is\",round(Q_by_A,2),\"W/sq m\"\n",
    "#When both the surfaces are black\n",
    "e1=1 \n",
    "e2=1 \n",
    "F12=1/(1/e1+(A1/A2)*(1/e2-1))   \n",
    "Q_by_A=sigma*F12*(T1**4-T2**4)    #[W/sq m]\n",
    "\n",
    "#Result\n",
    "print\"\\n When both surfaces are black,Rate of heat loss  is\",round(Q_by_A),\"W/sq m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.10,Page no:4.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The liquid oxygen will evaporate at 0.59 kg/h\n"
     ]
    }
   ],
   "source": [
    "#Diwar flask\n",
    "import math\n",
    "\n",
    "#Variable declaration\n",
    "e1=0.05\n",
    "e2=e1\n",
    "A1=0.6944 \n",
    "A2=1 \n",
    "T1=293  #[K]\n",
    "T2=90   #[K]\n",
    "sigma=5.67*10**-8    #[W/m**2.K**4]\n",
    "D=0.3   #Diameter in [m]\n",
    "\n",
    "#Calculation\n",
    "F12=1.0/(1.0/e1+(A1/A2)*(1.0/e2-1))\n",
    "Q_by_A=sigma*F12*(T1**4-T2**4)    #[W/sq m]\n",
    "Q=Q_by_A*math.pi*(D**2)  #[kJ/h]\n",
    "Q=Q*3600/1000   #[kJ/h]\n",
    "lamda=21.44    #Latent heat in [kJ/kg]\n",
    "m_dot=Q/lamda    #kg/h\n",
    "\n",
    "#Result\n",
    "print\"The liquid oxygen will evaporate at\",round(m_dot,2),\"kg/h\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.11,Page no:4.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rate of heat flow due to radiation is 36.62 W\n",
      "Reduction in heat flow will be 79.97 %\n"
     ]
    }
   ],
   "source": [
    "#Heat flow due to radiation\n",
    "import math\n",
    "\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #W/(m**2.K**4)\n",
    "e1=0.3 \n",
    "e2=e1 \n",
    "D1=0.3  #[m]\n",
    "D2=0.5  #[m]\n",
    "T1=90   #[K]\n",
    "T2=313  #[K]\n",
    "\n",
    "#Calculation\n",
    "A1=math.pi*D1**2 #Area in [sq m]\n",
    "A2=math.pi*D2**2#Area in [sq m]\n",
    "Q1=sigma*A1*(T1**4-T2**4)/(1/e1+(A1/A2)*(1/e2-1))  #[W]\n",
    "Q1=abs(Q1)  #Absolute value in [W]\n",
    "print\"Rate of heat flow due to radiation is\",round(Q1,2),\"W\"\n",
    "#When Aluminium is used\n",
    "e1=0.05\n",
    "e2=0.5\n",
    "Q2=sigma*A1*(T1**4-T2**4)/(1/e1+(A1/A2)*(1/0.3-1))  #[W]\n",
    "Q2=abs(Q2) #Absolute value in [W]\n",
    "Red=(Q1-Q2)*100/Q1  #Percent reduction\n",
    "\n",
    "#Result\n",
    "print\"Reduction in heat flow will be\",round(Red,2),\"%\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.12,Page no:4.14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Nitrogen evaporates at 0.047 kg/h\n"
     ]
    }
   ],
   "source": [
    "#Heat exchange between concentric shell\n",
    "import math\n",
    "\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/sq m.K**4]\n",
    "T1=77.0   #[K]\n",
    "T2=303.0  #[K]\n",
    "D1=32.0   #cm\n",
    "D1=D1/100   #[m]\n",
    "D2=36.0   #[cm]\n",
    "D2=D2/100   #[m]\n",
    "\n",
    "#Calculation\n",
    "A1=math.pi*D1**2 #[sq m]\n",
    "A2=math.pi*D2**2 #[sq m]\n",
    "e1=0.03 \n",
    "e2=e1 \n",
    "Q=sigma*A1*(T1**4-T2**4)/(1.0/e1+(A1/A2)*(1.0/e2-1))  #[W]\n",
    "Q=Q*3600.0/1000   #[kJ/h]\n",
    "Q=abs(Q)    #[kJ/h]\n",
    "lamda=201.0  #kJ/kg\n",
    "m_dot=Q/lamda  #Evaporation rate in [kg/h]\n",
    "#Result\n",
    "print\"Nitrogen evaporates at\",round(m_dot,3),\"kg/h\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.13,Page no:4.15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-2.4112304452\n",
      "Rate of evaporation is 0.0441 kg/h\n"
     ]
    }
   ],
   "source": [
    "#Evaporation in concenric vessels\n",
    "import math\n",
    "#Variable declaration\n",
    "D1=250.0  #Inner sphere idameter[mm]\n",
    "D1=D1/1000  #Outer diameter [m]\n",
    "D2=350.0  #[mm]\n",
    "D2=D2/1000  #[m]\n",
    "sigma=5.67*10**-8    #W/(sq m.K**4)\n",
    "#Calculation\n",
    "A1=math.pi*D1**2 #[sq m]\n",
    "A2=math.pi*D2**2 #[sq m]\n",
    "T1=76.0   #[K]\n",
    "T2=300.0  #[K]\n",
    "e1=0.04 \n",
    "e2=e1 \n",
    "Q=sigma*A1*(T1**4-T2**4)/((1.0/e1)+(A1/A2)*((1.0/e2)-1))   #[W]\n",
    "Q=-2.45     #Approximate\n",
    "Q=abs(Q)    #[W]\n",
    "Q=Q*3600.0/1000   #[kJ/h]\n",
    "lamda=200.0  #kJ/kg\n",
    "Rate=Q/lamda   #[kg/h]\n",
    "#Result\n",
    "print\"Rate of evaporation is\",Rate,\"kg/h\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.15,Page no:4.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transfer rate per unit area(WITHOUT SHIELD) due to radiation is 363.1 W/sq m\n",
      "\n",
      "Heat transfer rate per unit area(WITH SHIELD) due to radiation is 248.44 W/sq m\n",
      "\n",
      "Reduction in heat loss is 31.58 %\n"
     ]
    }
   ],
   "source": [
    "#infinitely long plates\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/(m**2.K**4)]\n",
    "e1=0.4\n",
    "e3=0.2\n",
    "T1=473  #[K]\n",
    "T3=303  #[K]\n",
    "#Calculation\n",
    "Q_by_a=sigma*(T1**4-T3**4)/((1.0/e1)+(1.0/e3)-1)  #[W/sq m]\n",
    "#Q1_by_a=sigma*(T1**4-T2**4)/((1/e1)+(1/e2)-1)=sigma*A*(T2**4-T3**4)/((1/e2)+(1/e3)-1) #[W/sq m]\n",
    "e2=0.5\n",
    "#Solving we get\n",
    "T2=((6.0/9.5)*((3.5/6)*T3**4+T1**4))**(1.0/4.0)  #[K]\n",
    "Q1_by_a=sigma*(T1**4-T2**4)/((1.0/e1)+(1.0/e2)-1) #[W/sq m]\n",
    "red=(Q_by_a-Q1_by_a)*100/Q_by_a\n",
    "#Result\n",
    "print\"Heat transfer rate per unit area(WITHOUT SHIELD) due to radiation is\",round(Q_by_a,1),\"W/sq m\"\n",
    "print\"\\nHeat transfer rate per unit area(WITH SHIELD) due to radiation is\",round(Q1_by_a,2),\"W/sq m\"\n",
    "print\"\\nReduction in heat loss is\",round(red,2),\"%\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.16,Page no:4.20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Steady state temperatures,Tc= 560.94 K,and Td= 461.73  K\n",
      "Rate of heat exchange per unit area= 770.95 W/m**2\n"
     ]
    }
   ],
   "source": [
    "#Heat exchange between parallel plates\n",
    "from scipy.optimize import fsolve\n",
    "import math\n",
    "#In steady state,we can write:\n",
    "#Qcd=Qdb\n",
    "#sigma(Tc**4-Td**4)*/(1/ec+1/ed-1)=sigma(Td**4-Tb**4)/(1/ed+1/eb-1)\n",
    "# i.e Td**4=0.5*(Tc**4-Tb**4)\n",
    "#Variable declaration\n",
    "Ta=600  #[K]\n",
    "eA=0.8 \n",
    "eC=0.5 \n",
    "eD=0.4 \n",
    "sigma=5.67*10**-8        #For air\n",
    "\n",
    "#Calculation\n",
    "\n",
    "#(600**4-Tc**4)/2.25=(Tc**4-Td**4)/3.5\n",
    "#1.56*(600**4-Tc**4)=Tc**4-Td**4\n",
    "#Putting value of Td in terms of Tc\n",
    "#1.56*(600**4-Tc**4)=Tc**4-0.5*(Tc**4-300**4)\n",
    "def f(Tc):\n",
    "    y=1.56*(600**4-Tc**4)-Tc**4+0.5*(Tc**4-300**4)\n",
    "    return(y)\n",
    "Tc=fsolve(f,500)            #[K]\n",
    "#or\n",
    "Tc=560.94       #[K] Approximate after solving\n",
    "Td=math.sqrt(math.sqrt(0.5*(Tc**4-300**4)))         #[K]\n",
    "Q_by_a=sigma*(Ta**4-Tc**4)/(1/eA+1/eC-1)      #[W/sq m]\n",
    "\n",
    "#Result\n",
    "\n",
    "print\"Steady state temperatures,Tc=\",Tc,\"K,and Td=\",round(Td,2),\" K\"\n",
    "print\"Rate of heat exchange per unit area=\",round(Q_by_a,2),\"W/m**2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.17,Page no:4.21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Due to thermal radiaiton,Loss of heat to surrounding is 5600.0 W/m\n",
      "When pipe is enclosed in 1 400 mm diameter brick conduit,Loss of heat is 5390.0 W/m\n",
      " Reduction in heat loss is 210.0 W/m\n"
     ]
    }
   ],
   "source": [
    "#Thermal radiation in pipe\n",
    "\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/(sq m.K**4)]\n",
    "e=0.8\n",
    "T1=673   #[K]\n",
    "T2=303   #[K]\n",
    "Do=200   #[mm]\n",
    "Do=Do/1000  #[m]\n",
    "L=1      #Let [m]\n",
    "\n",
    "#Calculation\n",
    "import math\n",
    "A1=math.pi*Do*L #[m**2/m]\n",
    "#CAse 1: Pipe to surrundings\n",
    "\n",
    "Q1=e*A1*sigma*(T1**4-T2**4)   #[W/m]\n",
    "Q1=5600     #Approximated\n",
    "#Q1=5600         #[W/m] approximated in book for calculation purpose\n",
    "#Concentric cylinders\n",
    "e1=0.8 \n",
    "e2=0.91 \n",
    "D1=0.2  #[m]\n",
    "D2=0.4  #[m]\n",
    "Q2=sigma*0.628*(T1**4-T2**4)/((1/e1)+(D1/D2)*((1/e2)-1))   #[W/m] length\n",
    "Red=Q1-Q2   #Reduction in heat loss\n",
    "\n",
    "#Result\n",
    "print\"Due to thermal radiaiton,Loss of heat to surrounding is\",round(Q1),\"W/m\"\n",
    "print\"When pipe is enclosed in 1 400 mm diameter brick conduit,Loss of heat is\",round(Q2),\"W/m\" \n",
    "print\" Reduction in heat loss is\",round(Red),\"W/m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.18,Page no:4.22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat transfer by radiaiton is 6229.0 W/sq m\n"
     ]
    }
   ],
   "source": [
    "#Heat transfer in concentric tube\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8     #[W/(sq m.K**4)]\n",
    "T1=813.0   #[K]\n",
    "T2=473.0   #[K]\n",
    "e1=0.87 \n",
    "e2=0.26 \n",
    "D1=0.25  #[m]\n",
    "D2=0.3  #[m]\n",
    "#Calculation\n",
    "Q_by_a1=sigma*(T1**4-T2**4)/(1.0/e1+(D1/D2)*(1.0/e2-1.0))   #[W/ sqm]\n",
    "#Result\n",
    "print\"Heat transfer by radiaiton is\",round(Q_by_a1),\"W/sq m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.19,Page no:4.24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Net radiant heat exchange between plates is 18334.0 W\n"
     ]
    }
   ],
   "source": [
    "#Heat exchange between black plates\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/sq m.K**4]\n",
    "A1=0.5*1    #[sq m]\n",
    "F12=0.285\n",
    "T1=1273 #/[K]\n",
    "T2=773  #[K]\n",
    "#Calculation\n",
    "Q=sigma*A1*F12*(T1**4-T2**4)    #[W]\n",
    "#Result\n",
    "print\"Net radiant heat exchange between plates is\",round(Q),\"W\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.20,Page no:4.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Reduction in heat transfer rate as a result of radiaiotn shield is 94.35 percent\n"
     ]
    }
   ],
   "source": [
    "#Radiation shield\n",
    "import math\n",
    "\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/sq m.K**4]\n",
    "T1=750  #[K]\n",
    "T2=500  #[K]\n",
    "e1=0.75 \n",
    "e2=0.5 \n",
    "\n",
    "#Calculation\n",
    "#Heat transfer without shield :\n",
    "Q_by_a=sigma*(T1**4-T2**4)/((1/e1)+(1/e2)-1)  #[W/sq m]\n",
    "\n",
    "#Heat transfer with shield:\n",
    "R1=(1-e1)/e1    #Resistance 1\n",
    "F13=1 \n",
    "R2=1/F13        #Resistance 2\n",
    "e3=0.05\n",
    "R3=(1-e3)/e3    #Resistance 3\n",
    "R4=(1-e3)/e3    #Resistance 4\n",
    "F32=1 \n",
    "R5=1/F32        #Resistance 5\n",
    "R6=(1-e2)/e2       #Resistance 6\n",
    "Total_R=R1+R2+R3+R4+R5+R6   #Total resistance\n",
    "Q_by_as=sigma*(T1**4-T2**4)/Total_R   #[W/sq m]\n",
    "Red=(Q_by_a-Q_by_as)*100/Q_by_a     #Reduciton in heat tranfer due to shield \n",
    "\n",
    "#Result\n",
    "print\"Reduction in heat transfer rate as a result of radiaiotn shield is\",round(Red,2),\"percent\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.21,Page no:4.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The heat transfer is reduced by 93.2 % due to shield\n"
     ]
    }
   ],
   "source": [
    "#Heat transfer with radiaiton shield\n",
    "\n",
    "#Variable declaration\n",
    "e1=0.3\n",
    "e2=0.8\n",
    "\n",
    "#Calculation\n",
    "#Let sigma*(T1**4-T2**4)=z=1(const)\n",
    "z=1     #Let\n",
    "Q_by_A=z/(1/e1+1/e2-1)  #W/sq m\n",
    "\n",
    "#Heat transfer with radiation shield \n",
    "e3=0.04\n",
    "F13=1 \n",
    "F32=1 \n",
    "#The resistances are:\n",
    "R1=(1-e1)/e1\n",
    "R2=1.0/F13\n",
    "R3=(1-e3)/e3\n",
    "R4=R3\n",
    "R5=1.0/F32\n",
    "R6=(1-e2)/e2\n",
    "R=R1+R2+R3+R4+R5+R6     #Total resistance\n",
    "Q_by_As=z/R #where z=sigma*(T1**4-T2**4) #W/sq m\n",
    "red=(Q_by_A-Q_by_As)*100/Q_by_A    #Percent reduction in heat transfer\n",
    "\n",
    "#Result\n",
    "print\"The heat transfer is reduced by\",round(red,1),\"% due to shield\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.22,Page no:4.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total heat lost by plate 1 is 14423.0 W/sq m\n",
      "Total heat lost by plate 2 is 2598.0 W/sq m\n",
      "The net energy lost by both plates must be absorbed by the room 17032.9 = 17021.0\n"
     ]
    }
   ],
   "source": [
    "#Radiaition shape factor\n",
    "\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8 \n",
    "T1=1273 #[K]\n",
    "T2=773  #[K]\n",
    "T3=300  #[K]\n",
    "A1=0.5  #[sq m]\n",
    "A2=A1   #[sq m]\n",
    "F12=0.285 \n",
    "F21=F12 \n",
    "F13=1-F12 \n",
    "F23=1-F21 \n",
    "e1=0.2 \n",
    "e2=0.5\n",
    "\n",
    "#Calculation\n",
    "#Resistance in the network are calculated as:\n",
    "R1=1-e1/(e1*A1)\n",
    "R2=1-e2/(e2*A2)\n",
    "R3=1.0/(A1*F12)\n",
    "R4=1.0/(A1*F13)\n",
    "R5=1.0/(A2*F23)\n",
    "R6=0    #Given (1-e3)/e3*A3=0\n",
    "#Also\n",
    "Eb1=sigma*T1**4  #W/sq m\n",
    "Eb2=sigma*T2**4   #[W/sq m]\n",
    "Eb3=sigma*T3**4 #[W/sq m]\n",
    "\n",
    "#Equations are:\n",
    "#(Eb1-J1)/2+(J2-J1)/7.018+(Eb3-J1)/2.797=0\n",
    "#(J1-J2)/7.018+(Eb3-J2)/2.797+(Eb2-J2)/2=0\n",
    "\n",
    "#On solving we get:\n",
    "J1=33515    #[W/sq m]\n",
    "J2=15048    #[W/sqm]\n",
    "J3=Eb3  #[W/sq m]\n",
    "Q1=(Eb1-J1)/((1.0-e1)/(e1*A1))        #[W/sq m]\n",
    "Q2=(Eb2-J2)/((1.0-e2)/(e2*A2))        #[W/sq m]\n",
    "Q3=(J1-J3)/(1.0/(A1*F13))+(J2-J3)/(1.0/(A2*F23))    #[W/sq m]\n",
    "\n",
    "#Result\n",
    "print\"Total heat lost by plate 1 is\",round(Q1),\"W/sq m\"\n",
    "print\"Total heat lost by plate 2 is\",round(Q2),\"W/sq m\" \n",
    "print\"The net energy lost by both plates must be absorbed by the room\",round(Q3,1),\"=\",round(Q1+Q2)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.23,Page no:4.37"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      " New Radiaiton loss is 4513.9 W/sq m\n"
     ]
    }
   ],
   "source": [
    "#Radiation loss in plates\n",
    "\n",
    "#Variable declaration\n",
    "sigma=5.67*10**-8    #[W/sq m.K**4]\n",
    "e1=0.7 \n",
    "e2=0.7 \n",
    "T1=866.5    #[K]\n",
    "T2=588.8    #[K]\n",
    "\n",
    "#Calculation\n",
    "Q_by_A=sigma*(T1**4-T2**4)/((1/e1)+(1/e2)-1)  #[W/sq m]\n",
    "e1=0.7 \n",
    "e2=e1 \n",
    "e3=e1 \n",
    "e4=e1 \n",
    "e=e1 \n",
    "#Q with n shells =1/(n+1)\n",
    "n=2\n",
    "Q_shield=1/(n+1) \n",
    "es1=e1 \n",
    "es2=e1 \n",
    "Q_by_A=sigma*(T1**4-T2**4)/((1/e1)+(1/e2)+2*(1/es1+1/es2)-(n+1))  #[W/sq m]\n",
    "\n",
    "#Result\n",
    "print\"\\n New Radiaiton loss is\",round(Q_by_A,1),\"W/sq m\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example no:4.24,Page no:4.38"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Without shield,Q= -4.182 W/m\n",
      "With cylindrical radiaiton shield Heat gained by fluid per 1 m lengh of tube is -1.446 W/m\n",
      "Percent reduction in heat gain is 65.41 %\n",
      "With radiaiton network approach -1.45 W/sqm \n"
     ]
    }
   ],
   "source": [
    "#Radiation in Concentric tube\n",
    "import math\n",
    "\n",
    "#Variable declaration\n",
    "#1.WITHOUT SHIELD\n",
    "sigma=5.67*10**-8        \n",
    "e1=0.12 \n",
    "e2=0.15 \n",
    "T1=100  #[K]\n",
    "T2=300  #[K]\n",
    "r1=0.015    #[m]\n",
    "r2=0.045    #[m]\n",
    "L=1         #[m]\n",
    "\n",
    "#Calculation\n",
    "A1=2*math.pi*r1*L   #[sq m]\n",
    "Q_by_L=2*math.pi*r1*sigma*(T1**4-T2**4)/(1/e1+(r1/r2)*(1/e2-1))   #[W/m]\n",
    "#-ve saign indicates that the net heat flow is in the radial inward direction\n",
    "print \"Without shield,Q=\",round(Q_by_L,3),\"W/m\"\n",
    "#2.WITH CYLINDRICAL RADIATION SHIELD\n",
    "e3=0.10 \n",
    "e4=0.05 \n",
    "r3=0.0225   #[m]\n",
    "Qs_by_L=2*math.pi*r1*sigma*(T1**4-T2**4)/(1/e1+r1/r2*(1/e2-1)+(r1/r3)*(1/e3+1/e4-1))  #[W/sq m]\n",
    "red=(abs(Q_by_L)-abs(Qs_by_L))*100/abs(Q_by_L)  #percent reduction in heat gain\n",
    "\n",
    "#Radiation network approach\n",
    "A3=2*math.pi*r3     #[sq m]\n",
    "A2=2*math.pi*r2     #[sq m]\n",
    "F13=1 \n",
    "F32=1 \n",
    "R1=(1-e1)/(e1*A1)\n",
    "R2=1.0/(A1*F13)\n",
    "R3=(1-e3)/(e3*A3)\n",
    "R4=(1-e4)/(e4*A3)\n",
    "R5=1.0/(A3*F32)\n",
    "R6=(1-e2)/(e2*A2)\n",
    "\n",
    "Qs=sigma*(T1**4-T2**4)/((1.0-e1)/(e1*A1)+1/(A1*F13)+(1.0-e3)/(e3*A3)+(1.0-e4)/(e4*A3)+1/(A3*F32)+(1.0-e2)/(e2*A2))        \n",
    "\n",
    "#Result\n",
    "print\"With cylindrical radiaiton shield Heat gained by fluid per 1 m lengh of tube is\",round(Qs_by_L,3),\"W/m\" \n",
    "print\"Percent reduction in heat gain is\",round(red,2),\"%\"\n",
    "print\"With radiaiton network approach\",round(Qs,2),\"W/sqm \"\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
}