{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 : Transport with a net convective flux"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 5.9 - Page No :166\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "# given\n",
      "v = 1.;  \t\t\t #[cm/sec] - volume velocity or bulk velocity\n",
      "vol = 1.;  \t\t\t #[cm**3] - volume\n",
      "na = 2.;  \t\t\t # moles of a\n",
      "nb = 3.;  \t\t\t # moles of b\n",
      "nc = 4.;  \t\t\t # moles of c\n",
      "mma = 2.;  \t\t\t #molecular weight of a\n",
      "mmb = 3.;  \t\t\t #molecular weight of b\n",
      "mmc = 4.;  \t\t\t #molecular weight of c\n",
      "ma = na*mma;  \t\t\t #[g] weight of a\n",
      "mb = nb*mmb;  \t\t\t #[g] weight of b\n",
      "mc = nc*mmc;  \t\t\t #[g] weight of c\n",
      "NabyA = 2.+2;  \t\t\t #[mol/cm**2*s] - molar flux  =  diffusing flux +convected flux\n",
      "NbbyA = -1.+3;  \t\t\t #[mol/cm**2*s] - molar flux  =  diffusing flux +convected flux\n",
      "NcbyA = 0.+4;  \t\t\t #[mol/cm**2*s] - molar flux  =  diffusing flux +convected flux\n",
      "NtbyA = NabyA+NbbyA+NcbyA;  \t\t\t #[mol/cm**2*s] - total molar flux\n",
      "\n",
      "# Calculations\n",
      "# on a mass basis,these corresponds to\n",
      "nabyA = 4.+4;  \t\t\t #[g/cm**2*s]; - mass flux  =  diffusing flux +convected flux\n",
      "nbbyA = -3.+9;  \t\t\t #[g/cm**2*s]; - mass flux  =  diffusing flux +convected flux\n",
      "ncbyA = 0.+16;  \t\t\t #[g/cm**2*s]; - mass flux  =  diffusing flux +convected flux\n",
      "ntbyA = nabyA+nbbyA+ncbyA;  \t\t\t #[g/cm**2*s] - total mass flux\n",
      "\n",
      "# concentrations are expressed in molar basis\n",
      "CA = na/vol;  \t\t\t #[mol/cm**3]\n",
      "CB = nb/vol;  \t\t\t #[mol/cm**3]\n",
      "CC = nc/vol;  \t\t\t #[mol/cm**3]\n",
      "CT = CA+CB+CC;  \t\t\t #[mol/cm**3] - total concentration\n",
      "\n",
      "# densities are on a mass basis\n",
      "pa = ma/vol;  \t\t\t #[g/cm**3]\n",
      "pb = mb/vol;  \t\t\t #[g/cm**3]\n",
      "pc = mc/vol;  \t\t\t #[g/cm**3]\n",
      "pt = pa+pb+pc;  \t\t\t #[g/cm**3]\n",
      "Ua = NabyA/CA;  \t\t\t #[cm/sec];\n",
      "Ub = NbbyA/CB;  \t\t\t #[cm/sec];\n",
      "Uc = NcbyA/CC;  \t\t\t #[cm/sec];\n",
      "# the same result will be obtained from dividing mass flux by density\n",
      "Uz = (pa*Ua+pb*Ub+pc*Uc)/(pa+pb+pc);\n",
      "\n",
      "# Results\n",
      "print \" Uz = %.3f cm/sec\"%(Uz);\n",
      "Uzstar = (NtbyA/CT);\n",
      "print \" Uz* = %.2f cm/sec\"%(Uzstar);\n",
      "print \" For this Example  both Uz and Uz* are slightly greater than the volume \\\n",
      " velocity of 1cm/sec, because there is a net molar and \\n mass diffusion in the positive direction.\"\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Uz = 1.034 cm/sec\n",
        " Uz* = 1.11 cm/sec\n",
        " For this Example  both Uz and Uz* are slightly greater than the volume  velocity of 1cm/sec, because there is a net molar and \n",
        " mass diffusion in the positive direction.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 5.10 - Page No :171\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "# given (from Example  5.9)\n",
      "na = 2.;  \t\t\t # moles of a\n",
      "nb = 3.;  \t\t\t # moles of b\n",
      "nc = 4.;  \t\t\t # moles of c\n",
      "mma = 2.;  \t\t\t #molecular weight of a\n",
      "mmb = 3.;  \t\t\t #molecular weight of b\n",
      "mmc = 4.;  \t\t\t #molecular weight of c\n",
      "ma = na*mma;  \t\t\t #[g] weight of a\n",
      "mb = nb*mmb;  \t\t\t #[g] weight of b\n",
      "mc = nc*mmc;  \t\t\t #[g] weight of c\n",
      "NabyA = 2.+2;  \t\t\t #[mol/cm**2*s] - molar flux  =  diffumath.sing flux +convected flux\n",
      "NbbyA = -1.+3;  \t\t\t #[mol/cm**2*s] - molar flux  =  diffusing flux +convected flux\n",
      "NcbyA = 0.+4;  \t\t\t #[mol/cm**2*s] - molar flux  =  diffusing flux +convected flux\n",
      "NtbyA = NabyA+NbbyA+NcbyA;  \t\t\t #[mol/cm**2*s] - total molar flux\n",
      "vol= 1.\n",
      "# Calculations\n",
      "# on a mass basis,these corresponds to\n",
      "nabyA = 4+4;  \t\t\t #[g/cm**2*s]; - mass flux  =  diffusing flux +convected flux\n",
      "nbbyA = -3+9;  \t\t\t #[g/cm**2*s]; - mass flux  =  diffusing flux +convected flux\n",
      "ncbyA = 0+16;  \t\t\t #[g/cm**2*s]; - mass flux  =  diffusing flux +convected flux\n",
      "\n",
      "# concentrations are expressed in molar basis\n",
      "CA = na/vol;  \t\t\t #[mol/cm**3]\n",
      "CB = nb/vol;  \t\t\t #[mol/cm**3]\n",
      "CC = nc/vol;  \t\t\t #[mol/cm**3]\n",
      "CT = CA+CB+CC;  \t\t #[mol/cm**3] - total concentration\n",
      "\n",
      "# densities are on a mass basis\n",
      "pa = ma/vol;  \t\t\t #[g/cm**3]\n",
      "pb = mb/vol;  \t\t\t #[g/cm**3]\n",
      "pc = mc/vol;  \t\t\t #[g/cm**3]\n",
      "Ua = NabyA/CA;  \t\t\t #[cm/sec];\n",
      "Ub = NbbyA/CB;  \t\t\t #[cm/sec];\n",
      "Uc = NcbyA/CC;  \t\t\t #[cm/sec];\n",
      "U = (pa*Ua+pb*Ub+pc*Uc)/(pa+pb+pc);\n",
      "Ustar = (NtbyA/CT);\n",
      "\n",
      "# the fluxes relative to mass average velocities are found as follows\n",
      "JabyA = CA*(Ua-U);  \t\t\t #[mol/cm**2*sec]\n",
      "JbbyA = CB*(Ub-U);  \t\t\t #[mol/cm**2*sec]\n",
      "JcbyA = CC*(Uc-U);  \t\t\t #[mol/cm**2*sec]\n",
      "\n",
      "# Results\n",
      "print \" fluxes relative to mass average velocities are-\";\n",
      "print \" Ja/A = %.4f mol/cm**2*sec\"%(JabyA);\n",
      "print \" Jb/A = %.4f mol/cm**2*sec\"%(JbbyA);\n",
      "print \" Jc/A = %.4f mol/cm**2*sec\"%(JcbyA);\n",
      "jabyA = pa*(Ua-U);  \t\t\t #[g/cm**2*sec]\n",
      "jbbyA = pb*(Ub-U);  \t\t\t #[g/cm**2*sec]\n",
      "jcbyA = pc*(Uc-U);  \t\t\t #[g/cm**2*sec]\n",
      "print \" ja/A = %.4f g/cm**2*sec\"%(jabyA);\n",
      "print \" jb/A = %.4f g/cm**2*sec\"%(jbbyA);\n",
      "print \" jc/A = %.4f g/cm**2*sec\"%(jcbyA);\n",
      "\n",
      "# the fluxes relative to molar average velocity are found as follows\n",
      "JastarbyA = CA*(Ua-Ustar);  \t\t\t #[mol/cm**2*sec]\n",
      "JbstarbyA = CB*(Ub-Ustar);  \t\t\t #[mol/cm**2*sec]\n",
      "JcstarbyA = CC*(Uc-Ustar);  \t\t\t #[mol/cm**2*sec]\n",
      "print \" fluxes relative to molar average velocities are-\";\n",
      "print \" Ja*/A = %.4f mol/cm**2*sec\"%(JastarbyA);\n",
      "print \" Jb*/A = %.4f mol/cm**2*sec\"%(JbstarbyA);\n",
      "print \" Jc*/A = %.4f mol/cm**2*sec\"%(JcstarbyA);\n",
      "jastarbyA = pa*(Ua-Ustar);  \t\t\t #[g/cm**2*sec]\n",
      "jbstarbyA = pb*(Ub-Ustar);  \t\t\t #[g/cm**2*sec]\n",
      "jcstarbyA = pc*(Uc-Ustar);  \t\t\t #[g/cm**2*sec]\n",
      "print \" ja*/A = %.4f g/cm**2*sec\"%(jastarbyA);\n",
      "print \" jb*/A = %.4f g/cm**2*sec\"%(jbstarbyA);\n",
      "print \" jc*/A = %.4f g/cm**2*sec\"%(jcstarbyA);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " fluxes relative to mass average velocities are-\n",
        " Ja/A = 1.9310 mol/cm**2*sec\n",
        " Jb/A = -1.1034 mol/cm**2*sec\n",
        " Jc/A = -0.1379 mol/cm**2*sec\n",
        " ja/A = 3.8621 g/cm**2*sec\n",
        " jb/A = -3.3103 g/cm**2*sec\n",
        " jc/A = -0.5517 g/cm**2*sec\n",
        " fluxes relative to molar average velocities are-\n",
        " Ja*/A = 1.7778 mol/cm**2*sec\n",
        " Jb*/A = -1.3333 mol/cm**2*sec\n",
        " Jc*/A = -0.4444 mol/cm**2*sec\n",
        " ja*/A = 3.5556 g/cm**2*sec\n",
        " jb*/A = -4.0000 g/cm**2*sec\n",
        " jc*/A = -1.7778 g/cm**2*sec\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 5.11 - Page No :176\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math\n",
      "# Variables\n",
      "# given\n",
      "T = 0+273.15;  \t\t\t #[K] - temperature in Kelvins\n",
      "pa2 = 1.5;  \t\t\t #[atm] - partial presuure of a at point2\n",
      "pa1 = 0.5;  \t\t\t #[atm] - partial pressure of a at point 1\n",
      "z2 = 20.;  \t\t\t #[cm] - position of point 2 from reference point\n",
      "z1 = 0.;  \t\t\t #[cm] - position of point1 from reference point\n",
      "p = 2.;  \t\t\t #[atm] - total pressure\n",
      "d = 1.;  \t\t\t #[cm] - diameter\n",
      "D = 0.275;  \t\t #[cm**2/sec] - diffusion coefficient\n",
      "A = (math.pi*((d)**2))/4.;\n",
      "R = 0.082057;  \t\t\t #[atm*m**3*kmol**-1*K**-1] - gas constant\n",
      "\n",
      "# Calculations\n",
      "# (a) using the formula Na/A = -(D/(R*T))*((pa2-pa1)/(z2-z1))\n",
      "Na = (-(D/(R*T))*((pa2-pa1)/(z2-z1)))*(A)/(10.**6);\n",
      "print \" Na = %.2e kmol/sec \\n The negative sign indicates diffusion from point 2 to point 1\"%(Na);\n",
      "pb2 = p-pa2;\n",
      "pb1 = p-pa1;\n",
      "\n",
      "# (b) using the formula Na/A = ((D*p)/(R*T*(z2-z1)))*ln(pb2/pb1)\n",
      "Na = (((D*p)/(R*T*(z2-z1)))*math.log(pb2/pb1))*(A)/(10**6);\n",
      "\n",
      "# Results\n",
      "print \" Na = %.2e kmol/sec\"%(Na);\n",
      "print \" The induced velocity increases the net transport of A by the ratio of 10.6*10**-10 \\\n",
      "to 4.82*10**-10 or 2.2 times.This increse is equivalent to 120 percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Na = -4.82e-10 kmol/sec \n",
        " The negative sign indicates diffusion from point 2 to point 1\n",
        " Na = -1.06e-09 kmol/sec\n",
        " The induced velocity increases the net transport of A by the ratio of 10.6*10**-10 to 4.82*10**-10 or 2.2 times.This increse is equivalent to 120 percent\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 5.12 - Page No :178\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "# given\n",
      "T = 0+273.15;  \t\t\t #[K] - temperature in Kelvins\n",
      "pa2 = 1.5;  \t\t\t #[atm] - partial presuure of a at point2\n",
      "pa1 = 0.5;  \t\t\t #[atm] - partial pressure of a at point 1\n",
      "z2 = 20.;  \t\t\t #[cm] - position of point 2 from reference point\n",
      "z1 = 0.;  \t\t\t #[cm] - position of point1 from reference point\n",
      "p = 2.;  \t\t\t #[atm] - total pressure\n",
      "d = 1.;  \t\t\t #[cm] - diameter\n",
      "D = 0.275;  \t\t\t #[cm**2/sec] - diffusion coefficient\n",
      "\n",
      "# Calculations\n",
      "A = (math.pi*((d)**2.))/4;\n",
      "R = 0.082057;  \t\t\t #[atm*m**3*kmol**-1*K**-1] - gas consmath.tant\n",
      "k = 0.75;\n",
      "\n",
      "# umath.sing the formula (Na/A) = -(D/(R*T*(z2-z1)))*ln((1-(pa2/p)*(1-k))/(1-(pa1/p)*(1-k)))\n",
      "NabyA = -(D/(R*T*(z2-z1)))*(2*0.7854)*math.log((1-(pa2/p)*(1-k))/(1-(pa1/p)*(1-k)))/(10**6);\n",
      "\n",
      "# Results\n",
      "print \" Na/A = %.2e kmol/sec\"%(NabyA);\n",
      "print \" Note that this answer is larger than the rate for equimolar counter diffusion \\\n",
      "but smaller tahn the rate for diffusion through a stagnant film. \\nSometimes the\\\n",
      " rate for diffusin through a stagnant film can be considered as an upper bound\\\n",
      " if k ties between zero and one\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Na/A = 1.38e-10 kmol/sec\n",
        " Note that this answer is larger than the rate for equimolar counter diffusion but smaller tahn the rate for diffusion through a stagnant film. \n",
        "Sometimes the rate for diffusin through a stagnant film can be considered as an upper bound if k ties between zero and one\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 5.13 - Page No :184\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "# given\n",
      "l = 4.;  \t\t\t         #[m] - length of the tube\n",
      "id_ = 1.6*10**-3;  \t\t\t #[m] - insid_e diameter\n",
      "Nkn = 10.;  \t\t    \t # - knudsen no.\n",
      "Ma = 92.;  \t\t\t         # - molecular weight of gas\n",
      "mu = 6.5*10**-4;  \t\t\t #[kg/m*sec] - vismath.cosity\n",
      "T = 300.;  \t    \t\t        #[K] - temperature\n",
      "R = 8314.;    \t    \t\t    #[kPa*m**3*kmol**-1*K**-1] - gas consmath.tant\n",
      "lambdaA = Nkn*id_;  \t\t\t #[m] mean free path\n",
      "\n",
      "# Calculations\n",
      "# for calculating pressure umath.sing the formula lamdaA = 32*(mu/p)*((R*T)/(2*pi*Ma))**(1/2)\n",
      "p = 32*(mu/lambdaA)*((R*T)/(2*math.pi*Ma))**(1/2.);\n",
      "patm = p/(1.01325*10**5);\n",
      "\n",
      "# Results\n",
      "print \" p = %.2f kg/m*sec**2 = %.2f Pa = %.2e atm\"%(p,p,patm);\n",
      "print \" The value of 10 for the knudsen number is on the border \\\n",
      " between Knudsen diffusion and transition flow\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " p = 85.39 kg/m*sec**2 = 85.39 Pa = 8.43e-04 atm\n",
        " The value of 10 for the knudsen number is on the border  between Knudsen diffusion and transition flow\n"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}