{

 "metadata": {

  "name": "",

  "signature": "sha256:c24c5f13f06ad2e35494c2ba2e22ba1351ce2de7d258eb50313205ed297dec4a"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter 4: Diffusion In Solids"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.1: Page 89"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "\n",

      "# Illustration 4.1\n",

      "# Page: 89\n",

      "\n",

      "import math\n",

      "print'Illustration 4.1 - Page: 89\\n\\n'\n",

      " \n",

      "# solution\n",

      "\n",

      "#***Data****#\n",

      "P = 2;# [atm]\n",

      "a1 = 0.025;# [m]\n",

      "a2 = 0.050;# [m]\n",

      "solub = 0.053*P;# [cubic m H2 (STP)/(cubic m rubber)]\n",

      "Ca1 = solub/22.41;# inner surface of the pipe\n",

      "Ca2 = 0;# resistance to difusion of H2 away from the surface is negligible.\n",

      "Da = 1.8*10**(-10);# [square m/s]\n",

      "l = 1;# [m]\n",

      "#********#\n",

      "\n",

      "z = (a2-a1)/2;# [m]\n",

      "# Using Eqn. 4.4\n",

      "Sav = (2*(math.pi)*l*(a2-a1))/(2*math.log(a2/a1));# [square m]\n",

      "# Using Eqn. 4.3\n",

      "w = (Da*Sav*(Ca1-Ca2))/z;# [kmol H2/s for 1m length]\n",

      "w = w*2.02*10**3*3600;# [g H2/m.h]\n",

      "print'The rate of loss of H2 by diffusion per m of pipe length:',round(w,6),' g H2/m.h'"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Illustration 4.1 - Page: 89\n",

        "\n",

        "\n",

        "The rate of loss of H2 by diffusion per m of pipe length: 5.6e-05  g H2/m.h\n"

       ]

      }

     ],

     "prompt_number": 4

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.2: Page 92"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "\n",

      "# Illustration 4.2\n",

      "# Page: 92\n",

      "\n",

      "print'Illustration 4.2 - Page: 92\\n\\n'\n",

      "print'Illustration 4.2 (a)\\n\\n'\n",

      "\n",

      "# solution (a)\n",

      "\n",

      "# Given\n",

      "a = 3.0/2;# [cm]\n",

      "thetha = 68*3600;# [s]\n",

      "# Ca can e calculated in terms of g/100 cubic cm\n",

      "Cao = 5.0;# [g/100 cubic cm]\n",

      "Ca_thetha = 3.0;# [g/100 cubic cm]\n",

      "Ca_Inf = 0.0;# [g/100 cubic cm]\n",

      "#**********#\n",

      "\n",

      "E = (Ca_thetha-Ca_Inf)/(Cao-Ca_Inf);\n",

      "# E = 0.6;\n",

      "# From Fig. 4.2 (Pg 91): For diffusion from only one exposed surface D*thetha/(4*a^2) = 0.128\n",

      "D = 0.128*4*(a**2)/thetha;# [square cm/s]\n",

      "D = D*10**(-4);# [square m/s]\n",

      "print'Diffusivity of urea in gel from only one exposed durface:',round(D,12),'square m/s\\n\\n'\n",

      "\n",

      "print'Illustration 4.2 (b)\\n\\n'\n",

      "\n",

      "# Solution (b)\n",

      "\n",

      "#****Data****#\n",

      "# Ca can e calculated in terms of g/100 cubic cm\n",

      "Cao = 5.0;# [g/100 cubic cm]\n",

      "Ca_thetha = 1.0;# [g/100 cubic cm]\n",

      "Ca_Inf = 0.0;# [g/100 cubic cm]\n",

      "#*********#\n",

      "\n",

      "E = (Ca_thetha-Ca_Inf)/(Cao-Ca_Inf);\n",

      "# E = 0.2;\n",

      "# From Fig. 4.2 (Pg 91): For diffusion from only one exposed surface D*thetha/(4*a**2) = 0.568\n",

      "D = 4.70*10**(-6);# From Illusration 4.2(a) [square cm/s]\n",

      "thetha = 0.568*4*a**2/D;# [s]\n",

      "thetha = thetha/3600.0;# [h]\n",

      "print'The time taken for the avg. conc. to fall to 1g/100 cubic cm is:',round(thetha),' hours'\n",

      "\n",

      "print'Illustration 4.2 (c)\\n\\n'\n",

      "\n",

      "# solution (c)\n",

      "\n",

      "#****Data*****#\n",

      "Cao = 5.0;# [g/100 cubic cm]\n",

      "Ca_thetha = 1.0;# [g/100 cubic cm]\n",

      "Ca_Inf = 0.0;# [g/100 cubic cm]\n",

      "#*******#\n",

      "\n",

      "E = (Ca_thetha-Ca_Inf)/(Cao-Ca_Inf);\n",

      "# E = 0.2;\n",

      "# From Fig. 4.2: For diffusion from two opposite exposed surface D*thetha/(a**2) = 0.568\n",

      "D = 4.70*10**(-6);# From Illusration 4.2(a) [square cm/s]\n",

      "thetha = 0.568*(a**2)/D;# [s]\n",

      "thetha = thetha/3600.0;# [h]\n",

      "print'The time taken for the avg. conc. to fall to 1g/100 cubic cm when two faces opposed is:',int(thetha),' hours'\n",

      "# the solution in the textbook is wrong due to approximation\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Illustration 4.2 - Page: 92\n",

        "\n",

        "\n",

        "Illustration 4.2 (a)\n",

        "\n",

        "\n",

        "Diffusivity of urea in gel from only one exposed durface: 4.71e-10 square m/s\n",

        "\n",

        "\n",

        "Illustration 4.2 (b)\n",

        "\n",

        "\n",

        "The time taken for the avg. conc. to fall to 1g/100 cubic cm is: 302.0  hours\n",

        "Illustration 4.2 (c)\n",

        "\n",

        "\n",

        "The time taken for the avg. conc. to fall to 1g/100 cubic cm when two faces opposed is: 75  hours\n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.3: Page 94"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "\n",

      "# Illustration 4.3\n",

      "# Page: 94\n",

      "\n",

      "print'Illustration 4.3 - Page: 94\\n\\n'\n",

      "\n",

      "# solution \n",

      "\n",

      "#****Data****#\n",

      "z = 0.1;# [cm]\n",

      "pa1 = 1;# [cmHg]\n",

      "pa2 = 0;# [cmHg]\n",

      "Da = 1.1*10**(-10)*10**4;# [square cm/s]\n",

      "#***********#\n",

      "\n",

      "# Solubility coeffecient in terms of Hg\n",

      "Sa = 0.90/76;# [cubic cm gas (STP)/cubic cm.cmHg]\n",

      "# Using Eqn. 4.15\n",

      "Va = (Da*Sa*(pa1-pa2))/z;# [cubic cm(STP)/square cm.s]\n",

      "# Using Eqn. 4.16\n",

      "P = Da*Sa;# [cubic cm gas (STP)/square cm.s.(cmHg/cm)]\n",

      "print'The rate of diffusion of CO is:',round(Va,8),'cubic cm(STP)/square cm.s'\n",

      "print'The permeability of the membrane is',round(P,9),'cubic cm gas (STP)/square cm.s.(cmHg/cm)'"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Illustration 4.3 - Page: 94\n",

        "\n",

        "\n",

        "The rate of diffusion of CO is: 1.3e-07 cubic cm(STP)/square cm.s\n",

        "The permeability of the membrane is 1.3e-08 cubic cm gas (STP)/square cm.s.(cmHg/cm)\n"

       ]

      }

     ],

     "prompt_number": 23

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.4: Page 96"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "    \n",

      "\n",

      "# Illustration 4.4\n",

      "# Page: 96\n",

      "\n",

      "print'Illustration 4.4 - Page: 96\\n\\n'\n",

      "\n",

      "# solution\n",

      "\n",

      "#****Data****#\n",

      "a = 0.005;# [m]\n",

      "# For the KCl diffusion\n",

      "Dab1 = 1.84*10**(-9);# [square m/s]\n",

      "thetha = 4.75*3600;# [s]\n",

      "Ca_Inf = 0;\n",

      "# For K2CrO4 diffusion\n",

      "Cao = 0.28;# [g/cubic cm]\n",

      "Ca_Inf = 0.002;# [g/cubic cm]\n",

      "Dab2 = 1.14*10**(-9);# [square m/s]\n",

      "#*******#\n",

      "\n",

      "E = 0.1;# For 90% removal of KCl\n",

      "# From Fig. 4.2 (Pg 91): Deff*thetha/a^2 = 0.18\n",

      "Deff = 0.18*a**2/thetha;# [square m/s]\n",

      "Dab_by_Deff = Dab1/Deff;\n",

      "Ca_thetha = 0.1*0.28;# [g/cubic cm]\n",

      "Es = (Ca_thetha-Ca_Inf)/(Cao-Ca_Inf);\n",

      "# From Fig. 4.2 (Pg 91): Deff*thetha/a^2 = 0.30\n",

      "Deff = Dab2/Dab_by_Deff;# [square m/s]\n",

      "thetha = 0.3*a**2/Deff;# [s]\n",

      "thetha = thetha/3600;# [h]\n",

      "print'The time reqd. is:',round(thetha,3),'hours'"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Illustration 4.4 - Page: 96\n",

        "\n",

        "\n",

        "The time reqd. is: 12.778 hours\n"

       ]

      }

     ],

     "prompt_number": 27

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.5: Page 98"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "\n",

      "# Illustration 4.5\n",

      "# Page: 98\n",

      "import math \n",

      "\n",

      "print'Illustration 4.5 - Page: 98\\n\\n'\n",

      "print'Illustration 4.5 (a)\\n\\n'\n",

      "\n",

      "# solution (a)\n",

      "\n",

      "#****Data****#\n",

      "# a = H2 b = N2\n",

      "Dab_eff = 5.3*10**(-6);# [square m/s]\n",

      "Dkb_eff = 1.17*10**(-5);# [square m/s]\n",

      "Dab = 7.63*10**(-5);# [square m/s]\n",

      "#*******#\n",

      "\n",

      "R = 8314;#[Nm/kmol]\n",

      "Mb = 2.02;# [kg/kmol]\n",

      "T = 293;# [K]\n",

      "Dtrue_by_Deff = Dab/Dab_eff;\n",

      "# Since the ratio is strictly a matter of the geometry of the solid.\n",

      "Dkb = Dkb_eff*Dtrue_by_Deff;# [square m/s]\n",

      "# From Eqn. 4.20\n",

      "d = 3*Dkb*((math.pi*Mb)/(8*R*T))**0.5;# [m]\n",

      "print'The equivalent pore diameter is: ',round(d,9),' m\\n\\n'\n",

      "\n",

      "print'Illustration 4.5 (b)\\n\\n'\n",

      "\n",

      "# Solution (b)\n",

      "\n",

      "#****Data*****#\n",

      "# a = O2 b = N2 c = H2\n",

      "Ya1 = 0.8;\n",

      "Ya2 = 0.2;\n",

      "Pt = 10133;# [N/square m]\n",

      "z = 0.002;# [m]\n",

      "T = 293;# [K]\n",

      "#*******#\n",

      "\n",

      "# From Table 2.1 (Pg 31):\n",

      "Dab = 1.81*10**(-5);# [square m/s] at STP\n",

      "Dkc = 1.684*10**(-4);# [square m/s] From Illustration 4.5(a)\n",

      "Mc = 2.02;# [kg/kmol]\n",

      "Ma = 32;# [kg/kmol]\n",

      "Mb = 28.02;# [kg/kmol]\n",

      "Dab = Dab*(1/0.1)*((293/273)**1.5);# [square m/s] at 0.1 atm & 20 C\n",

      "DabEff = Dab/14.4;# [square m/s] From Illustration 4.5(a)\n",

      "Dka = Dkc*((Mc/Ma)**0.5);# [square m/s]\n",

      "DkaEff = Dka/14.4;# [square m/s]\n",

      "Nb_by_Na = -(Ma/Mb)**0.5;\n",

      "# Na/(Na+Nb) = 1.0/(1+(Nb/Na))\n",

      "Na_by_NaSumNb = 1.0/(1+(Nb_by_Na));\n",

      "DabEff_by_DkaEff = DabEff/DkaEff;\n",

      "# By Eqn. 4.23\n",

      "Na = (Na_by_NaSumNb)*(DabEff*Pt/(R*T*z))*log((((Na_by_NaSumNb)*(1+DabEff_by_DkaEff))-Ya2)/(((Na_by_NaSumNb)*(1+DabEff_by_DkaEff))-Ya1));# [kmol/square m.s]\n",

      "Nb = Na*(Nb_by_Na);# [kmol/square m.s]\n",

      "print\"Diffusion flux of O2 is \",round(Na,8),\" kmol/square m.s\\n\"\n",

      "print\"Diffusion flux of N2 is \",round(Nb,8),\" kmol/square m.s\\n\"\n",

      "#the answer in textbook is slightly different due to approximation while here calculation is precise"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Illustration 4.5 - Page: 98\n",

        "\n",

        "\n",

        "Illustration 4.5 (a)\n",

        "\n",

        "\n",

        "The equivalent pore diameter is:  2.88e-07  m\n",

        "\n",

        "\n",

        "Illustration 4.5 (b)\n",

        "\n",

        "\n",

        "Diffusion flux of O2 is  2.95e-06  kmol/square m.s\n",

        "\n",

        "Diffusion flux of N2 is  -3.16e-06  kmol/square m.s\n",

        "\n"

       ]

      }

     ],

     "prompt_number": 33

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.6: Page 100"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "\n",

      "# Illustration 4.6\n",

      "# Page: 100\n",

      "\n",

      "import math\n",

      "print'Illustration 4.6 - Page: 100\\n\\n'\n",

      "\n",

      "# solution\n",

      "\n",

      "#***Data***#\n",

      "# a = N2\n",

      "# For N2 at 300K\n",

      "viscosity1 = 1.8*10**(-5);# [kg/m.s]\n",

      "Pt1 = 10133.0;# [N/square m.sec]\n",

      "T = 300;# [K]\n",

      "z = 0.0254;# [m]\n",

      "T2 = 393.0;# [K]\n",

      "#***********#\n",

      "\n",

      "Ma = 28.02;# [kg/kmol]\n",

      "R = 8314.0;# [J/K.kgmol]\n",

      "#From Eqn 4.22\n",

      "Lambda = (3.2*viscosity1/Pt1)*(R*T/(2*(math.pi)*Ma))**0.5;\n",

      "d = 10**(-4);# [m]\n",

      "d_by_lambda = d/Lambda;\n",

      "# Kundsen flow will not occur\n",

      "# N2 flow corresponding to 9 cubic ft/square ft.min at 300K & 1 std atm = 0.0457 cubic m/square m.min\n",

      "Na1 = 0.0457*(273.0/T)*(1/22.41);# [kmol/square m.s]\n",

      "Pt1_diff_Pt2 = 2*3386/13.6;# [N/square m]\n",

      "Ptav = Pt1+(Pt1_diff_Pt2/2.0);# [N/square m]\n",

      "# From Eqn. 4.26\n",

      "k1 = Na1*R*T*z/(Ptav*(Pt1_diff_Pt2));# [m**4/N.s]\n",

      "\n",

      "#For N2 at 393K\n",

      "viscosity2 = 2.2*10**(-5);# [kg/m.s]\n",

      "k2 = (k1*viscosity1)/(viscosity2);# [m^4/N.s]\n",

      "# From Eqn 4.26\n",

      "Na = (k2*Ptav*Pt1_diff_Pt2)/(R*T2*z);# [kmol/square m.s]\n",

      "print\"Flow rate to be expected is\",round(Na,6),\" kmol/square m.s\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Illustration 4.6 - Page: 100\n",

        "\n",

        "\n",

        "Flow rate to be expected is 0.001159  kmol/square m.s\n"

       ]

      }

     ],

     "prompt_number": 44

    }

   ],

   "metadata": {}

  }

 ]

}