{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Unsteady-state transport"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.1 - Page No :651\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "# given\n",
      "h = 12.;  \t\t\t #[W/m**2*K] - heat transfer coefficeint\n",
      "k = 400.;  \t\t\t #[W/m*K] - thermal conductivity\n",
      "\n",
      "# Calculation and Results\n",
      "# (a) for sphere\n",
      "r = 5.*10**-2;  \t\t\t #[m] - radius of copper sphere\n",
      "Lc = ((4*math.pi*((r)**3))/3)/(4*math.pi*((r)**2));\n",
      "Nbi = h*Lc*(1./k);\n",
      "print \" a) The biot no. is  Nbi  =  %.0e\"%(Nbi);\n",
      "\n",
      "# (b) for cyclinder\n",
      "r = 0.05;  \t\t\t #[m] - radius of cyclinder\n",
      "L = 0.3;  \t\t\t #[m] - height of cyclinder\n",
      "Lc = (math.pi*((r)**2)*L)/(2*math.pi*r*L);\n",
      "Nbi = h*Lc*(1./k);\n",
      "print \" b) The biot no. is  Nbi  =  %.1e\"%(Nbi);\n",
      "\n",
      "# (c) for a long square rod\n",
      "L = .4;  \t\t\t #[m] - length of copper rod\n",
      "r = 0.05;  \t\t\t #[m] - radius of a cyclinder havimg same cross sectional area as that of square\n",
      "x = ((math.pi*r**2)**(1./2));\n",
      "Lc = ((x**2)*L)/(4*x*L);\n",
      "Nbi = h*Lc*(1./k);\n",
      "print \" c) The biot no. is  Nbi  =  %.3e\"%(Nbi);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " a) The biot no. is  Nbi  =  5e-04\n",
        " b) The biot no. is  Nbi  =  7.5e-04\n",
        " c) The biot no. is  Nbi  =  6.647e-04\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.6 - Page No :684\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "# given\n",
      "d = 1*0.0254;  \t\t #[m]\n",
      "Lr = d/2;  \t\t\t #[m];\n",
      "Lz = (1.2/2)*(0.0254);\n",
      "x = Lz;\n",
      "r = Lr;\n",
      "k = 0.481;\n",
      "h = 20.;\n",
      "mr = k/(h*Lr);\n",
      "mz = k/(h*Lz);\n",
      "nr = r/Lr;\n",
      "nz = x/Lz;\n",
      "t = 1.2;  \t\t\t #[sec]\n",
      "\n",
      "# Calculations\n",
      "alpha = 1.454*10**-4;\n",
      "Xr = (alpha*t)/(Lr**2);\n",
      "Xz = (alpha*t)/(Lz**2);\n",
      "\n",
      "# using the above value of m,n,X the value for Ycz and Ycr from fig 13.14 is\n",
      "Ycr = 0.42;\n",
      "Ycz = 0.75;\n",
      "Yc = Ycr*Ycz;\n",
      "T_infinity = 400.;  \t\t\t #[K]\n",
      "To = 295.;\n",
      "Tc = T_infinity-(Yc*(T_infinity-To));\n",
      "\n",
      "# Results\n",
      "print \" The temperature t the centre is  Tc  =  %.0f K\"%(Tc);\n",
      "\n",
      "\n",
      "# Answer is vary because of rounding error."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The temperature t the centre is  Tc  =  367 K\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.7 - Page No :688\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "from numpy import *\n",
      "# Variables\n",
      "# given\n",
      "T_x0 = 300.;  \t\t\t #[K]\n",
      "Tw = 400.;  \t\t\t #[K]\n",
      "L = 0.013;  \t\t\t #[m]\n",
      "alpha = 2.476*(10**-5);  \t\t\t #[m**/sec]\n",
      "h = 600.;  \t\t\t #[W/m**2*K]\n",
      "pcp = 3.393*(10**6);  \t\t\t #[J/m**3*K]\n",
      "L = 0.013;  \t\t\t #[m]\n",
      "del_tax = L/10.;\n",
      "betaa = 0.5;\n",
      "del_tat = 0.03;\n",
      "\n",
      "# Calculations\n",
      "del_tat = betaa*((del_tax)**2)*(1./alpha);\n",
      "T_infinity = 400.;  \t\t\t #[K]\n",
      "\n",
      "# to be sure that the solution is stable, it is customary to truncate this number\n",
      "del_tat = 0.03;  \t\t\t #[sec]\n",
      "# betaa = alpha*del_tat*((1./del_tax)**2);\n",
      "Told = zeros(11)\n",
      "for i in range(11):\n",
      "    Told[i] = 300.;\n",
      "\n",
      "a = ((2*h*del_tat)/(pcp*del_tax));\n",
      "b = ((2*alpha*del_tat)/(pcp*((del_tax)**2)));\n",
      "\n",
      "Tnew = zeros(11)\n",
      "for j in range(11):\n",
      "    Tnew[0] = (T_infinity*0.08162)+(Told[0]*(1-0.08162-0.8791))+(Told[1]*0.8791)\n",
      "    for k in range(9):\n",
      "        Tnew[k+1] = (betaa*Told[k+2])+((1.-2*betaa)*(Told[k+1]))+(betaa*Told[k]);\n",
      "    Tnew[10] = ((2*betaa)*(Told[9]))\n",
      "    Told = Tnew;\n",
      "# Results\n",
      "print \"Told values : \" ,(Told);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Told values :  [ 325.54820838  319.78194857  315.05971328  311.28295197  308.32959437\n",
        "  306.07276601  304.39590474  303.20406441  302.43143939  302.04512688\n",
        "  302.04512688]\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example  13.9 - Page No :700\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "p = 2050.;  \t\t\t #[kg/m**3] - density of soil\n",
      "cp = 1840.;  \t\t\t #[J/kg*K] - heat cpapacity of soil\n",
      "k = 0.52;  \t\t\t #[W/m*K] - thermal conductivity of soil\n",
      "alpha = 0.138*10**-6;  \t\t\t #[m**2/sec]\n",
      "t = 4*30*24*3600;  \t\t\t #[sec] - no. of seconds in 4 months\n",
      "Tx = -5.;  \t\t\t #[degC]\n",
      "Tinf = -20.;  \t\t\t #[degC]\n",
      "T0 = 20.;  \t\t\t #[degC]\n",
      "\n",
      "# from the fig 13.24 the dimensionless dismath.tance Z is \n",
      "Z = 0.46;\n",
      "\n",
      "# Calculations\n",
      "# then the depth is\n",
      "x = 2*((alpha*t)**(1./2))*Z\n",
      "\n",
      "# Results\n",
      "print \" the depth is  x  =  %.1f m  =  %.1f ft\"%(x,x*3.6/1.10);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the depth is  x  =  1.1 m  =  3.6 ft\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 13.10 - Page No :701\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "d = 0.01;  \t\t\t #[m] - diameter of cyclindrical porous plug\n",
      "D = 2.*10**-9;  \t\t\t #[m**2/sec] - diffusion coefficient\n",
      "t = 60.*60;  \t\t\t #[sec]\n",
      "r = d/2.;\n",
      "m = 0.;\n",
      "Ca_inf = 0.;\n",
      "Ca_0 = 10.;\n",
      "X = (D*t)/((r)**2);\n",
      "# from fig 13.14 the ordinate is\n",
      "Y = 0.7;\n",
      "\n",
      "# Calculations\n",
      "Ca_c = Ca_inf-Y*(Ca_inf-Ca_0);\n",
      "\n",
      "# Results\n",
      "print \" the concentration of KCL at the centre after 60 min is  Ca  =  %.2f kg/m**3\"%(Ca_c);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the concentration of KCL at the centre after 60 min is  Ca  =  7.00 kg/m**3\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}