{
 "metadata": {
  "name": "",
  "signature": "sha256:3eba5bf9f8e98dcb46f4a3b03f9f7fa4b342f8fb2d0d8b697e9a50303c32aa8f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 18 : The Design of Noncatalytic Gas Solid Reactors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, Page 456\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "xA=0.08;      #Fraction of oxygen in stream\n",
      "dp=[2,0.1];   #Particle diameter in mm\n",
      "rhos=4130;    #Density of catalyst in kg/m**3\n",
      "Ds=8E-6;      #Diffusion coefficient of solid in m**2/s\n",
      "kc=0.02;      #Reaction rate constant in m/s\n",
      "P=10**5;      #Pressure in bar\\\n",
      "R=8.314;      #Universal gas constant\n",
      "T=900;        #Temperature in degree C\n",
      "mB=0.09745;   #Molecular weight of ZnS in kg/mol\n",
      "\n",
      "#CALCULATION\n",
      "b=2.0/3;#Stoichiometric coefficient of ZnS in the reaction equation\n",
      "CA=xA*P/(R*(T+273));#Concentration of Oxygen\n",
      "rhob=rhos/mB;       #Molar density of pure solid\n",
      "n=len(dp);\n",
      "i=0;\n",
      "kbar = [0,0]\n",
      "tou = [0,0]\n",
      "while i<n:\n",
      "    kbar[i]=(kc**-1+(dp[i]*10**-3/(12.0*Ds)))**-1;#Average reaction rate constant from Eqn.(11)\n",
      "    tou[i]=rhob*dp[i]*10**-3/(2*b*kbar[i]*CA);#Time for complete reaction in seconds from Eqn.(9)\n",
      "    i=i+1;\n",
      "\n",
      "#OUTPUT\n",
      "print 'Particle Size(mm)\\tAverage rate constant(m/s)\\tTime for complete reaction(min)'\n",
      "i=0;\n",
      "while i<n:\n",
      "    print '%f\\t\\t%f\\t\\t\\t%.2f'%(dp[i],kbar[i],tou[i]/60.0);\n",
      "    i=i+1;\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Particle Size(mm)\tAverage rate constant(m/s)\tTime for complete reaction(min)\n",
        "2.000000\t\t0.014118\t\t\t91.49\n",
        "0.100000\t\t0.019592\t\t\t3.30\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, Page 457\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "xA=0.08;   #Fraction of oxygen in stream\n",
      "dp=1;      #Particle diameter in mm\n",
      "rhos=2200; #Density of catalyst in kg/m**3\n",
      "kc=0.2;    #Reaction rate constant in m/s\n",
      "mC=0.012;  #Molecular weight of carbon in kg/mol\n",
      "P=10**5;   #Pressure in bar\\\n",
      "R=8.314;   #Universal gas constant\n",
      "T=900;     #Temperature in degree C\n",
      "\n",
      "#CALCULATION\n",
      "b=1;#Stoichiometric coefficient of C in the reaction equation\n",
      "CA=xA*P/(R*(T+273));#Concentration of Oxygen\n",
      "rhob=rhos/mC;#Molar density of pure solid reactant\n",
      "tou=rhob*10**-3/(2*b*kc*CA);#Time required for complete reaction in seconds\n",
      "\n",
      "#OUTPUT\n",
      "print 'The time required for complete combustion:%.1fmins'%(tou/60);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The time required for complete combustion:9.3mins\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3, Page 462\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "from numpy import zeros\n",
      "\n",
      "\n",
      "#INPUT\n",
      "dp = 110.;#Particle size in micrometer\n",
      "T = 900.;#Temperature of roaster in degree C\n",
      "tbar1 = [3.,10.,30.,50.];#Reported average time in min\n",
      "XBbarr = [0.840,0.940,0.985,0.990];#Reported value of average conversion\n",
      "tbar = 3.;\n",
      "XBbar = 0.840;#Average conversion for tbar  =  3 mins\n",
      "\n",
      "#CALCULATION\n",
      "#Uniform-Reaction Model\n",
      "x = (1./tbar)*(1./(1-XBbar)-1);#Term KrCA of Eqn.(20)\n",
      "n = len(tbar1);\n",
      "i = 0;\n",
      "XBbar1 = zeros(n)\n",
      "while i<  n:\n",
      "    XBbar1[i] = 1-1./(1+x*tbar1[i]);#Average conversion umath.sing calculated value of KrCA from Eqn.(20)\n",
      "    i = i+1;\n",
      "\n",
      "#Shrinking-Core, Rection Control\n",
      "touguess = 2;#Guess value of tou\n",
      "def solver_func(tou):#Function defined for solving the system\n",
      "    return (1-XBbar)-(0.25*tou/tbar)+(0.05*(tou/tbar)**2)-((1./120)*(tou/tbar)**3);\n",
      "\n",
      "tou = fsolve(solver_func,touguess)\n",
      "i = 0;\n",
      "XBbar2 = zeros(n)\n",
      "while i<n:\n",
      "    XBbar2[i] = 1-(0.25*tou/tbar1[i])+(0.05*(tou/tbar1[i])**2)-((1./120)*(tou/tbar1[i])**3);#Average conversion umath.sing calculated value of tou from Eqn.(23)\n",
      "    i = i+1;\n",
      "\n",
      "#Shrinking-Core, Diffusion Control\n",
      "touguess1 = 2;#Guess value of tou\n",
      "def solver_func1(tou):      #Function defined for solving the system\n",
      "    fn = (1-XBbar)-(1./5*tou/tbar)+(19./420*(tou/tbar)**2)-(41./4620*(tou/tbar)**3)+(0.00149*(tou/tbar)**4);\n",
      "\n",
      "tou1 = fsolve(solver_func1,touguess1)\n",
      "i = 0;\n",
      "XBbar3 = zeros(n)\n",
      "while i< n:\n",
      "    #Average conversion umath.sing calculated value of tou from Eqn.(23)\n",
      "    XBbar3[i] = 1-(1./5*tou1/tbar1[i])+(19./420*(tou1/tbar1[i])**2)-(41./4620*(tou1/tbar1[i])**3)+(0.00149*(tou1/tbar)**4);\n",
      "    i = i+1;\n",
      "\n",
      "#OUTPUT\n",
      "print '\\t\\t\\t\\tXBbar calculated for Models';\n",
      "print 'Reported Data';\n",
      "print 'tbarmin)\\tXBbar\\tUniform Reaction\\tShrinking-Core%( Rection Control\\t\\tShrinking-Core, Diffusion Control'\n",
      "i = 0\n",
      "while i< n:\n",
      "    print '%f\\t%f\\t%f\\t\\t%f\\t\\t\\t\\t%f'%(tbar1[i],XBbarr[i],XBbar1[i],XBbar2[i],XBbar3[i]);\n",
      "    i = i+1;\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\t\t\t\tXBbar calculated for Models\n",
        "Reported Data\n",
        "tbarmin)\tXBbar\tUniform Reaction\tShrinking-Core%( Rection Control\t\tShrinking-Core, Diffusion Control\n",
        "3.000000\t0.840000\t0.840000\t\t0.840000\t\t\t\t0.884437\n",
        "10.000000\t0.940000\t0.945946\t\t0.947234\t\t\t\t0.962033\n",
        "30.000000\t0.985000\t0.981308\t\t0.981898\t\t\t\t0.987159\n",
        "50.000000\t0.990000\t0.988701\t\t0.989075\t\t\t\t0.992366\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stderr",
       "text": [
        "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n",
        "  improvement from the last ten iterations.\n",
        "  warnings.warn(msg, RuntimeWarning)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4, Page 462\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "from numpy import zeros\n",
      "\n",
      "\n",
      "#INPUT\n",
      "W = 1;          #Bed weight in kg\n",
      "F1 = 0.01;      #Solid feed rate in kg/min\n",
      "dp = [200.,600.];           #Particle size in micrometer\n",
      "XBbar = [0.85,0.64];        #Average conversion for corresponding particle sizes\n",
      "rhos = 2500.;               #Density of solid in kg/m**3\n",
      "ephsilonm = 0.4;            #Void fracton of fixed bed\n",
      "F11 = 4.;                   #Feed rate of solids in tons/hr\n",
      "XBbar1 = 0.98;\n",
      "dp1 = 600.;\n",
      "pi = 3.14;\n",
      "\n",
      "#CALCULATION\n",
      "#Shrinking-Core, Rection Control\n",
      "n = len(dp);\n",
      "i = 0;\n",
      "touguess = 2;#Guess value of tou\n",
      "tou = zeros(n)\n",
      "while i< n:\n",
      "    def solver_func2(t):  #Function defined for solving the system\n",
      "        return  (1-XBbar[i])-(0.25*t/107)+(0.05*(t/107.)**2)-((1./120)*(t/107.)**3)\n",
      "    tou[i] = fsolve(solver_func2,touguess)\n",
      "    i = i+1;\n",
      "\n",
      "tou1 = tou[1];\n",
      "#For a math.single stage fluidized roaster\n",
      "tbar1 = 0.25*(tou1/(1-XBbar1))/60.;          #Mean residence time of solids in reactor in hr from Eqn.(24)\n",
      "W1 = F11*tbar1;\n",
      "dtguess = 2.;                    #Guess value of tou\n",
      "def solver_func3(dt):           #Function defined for solving the system\n",
      "    return  W1*10**3-(pi/4.)*dt**2*0.5*dt*rhos*(1-ephsilonm);#Since Lm = 0.5dt\n",
      "\n",
      "dt = fsolve(solver_func3,dtguess)\n",
      "Lm = dt/2.;#Length of bed required\n",
      "\n",
      "#For a two-stage fluidized roaster\n",
      "tbar2 = tou1*math.sqrt(1./(20*(1-XBbar1)))/60;      #Mean residence time of solids in reactor in hr from Eqn.(30)\n",
      "W2 = F11*tbar2;\n",
      "dtguess1 = 2;                   #Guess value of tou\n",
      "def solver_func4(dt):           #Function defined for solving the system\n",
      "    return W2*10**3-(pi/4.)*dt**2*0.5*dt*rhos*(1-ephsilonm);       #Since Lm = 0.5dt\n",
      "\n",
      "dt1 = fsolve(solver_func4,dtguess)\n",
      "Lm1 = dt1/2.;           #Length of bed required\n",
      "\n",
      "#OUTPUT\n",
      "print 'Single stage fluidized roaster';\n",
      "print '\\tWeight of bed needed:%ftons'%(W1);\n",
      "print '\\tDiameter of reactor:%fm'%(dt);\n",
      "print '\\tLength of bed:%fm'%(Lm);\n",
      "print 'Two-stage fluidized roaster';\n",
      "print '\\tWeight of bed needed:%ftons'%(W2);\n",
      "print '\\tDiameter of reactor:%fm'%(dt1);\n",
      "print '\\tLength of bed:%fm'%(Lm1);\n",
      "print 'These results show that this operation can be accomplished in a math.single bed of %ftons or in two beds of %f tons each.'%(W1,W2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Single stage fluidized roaster\n",
        "\tWeight of bed needed:174.370805tons\n",
        "\tDiameter of reactor:6.665728m\n",
        "\tLength of bed:3.332864m\n",
        "Two-stage fluidized roaster\n",
        "\tWeight of bed needed:22.056356tons\n",
        "\tDiameter of reactor:3.346064m\n",
        "\tLength of bed:1.673032m\n",
        "These results show that this operation can be accomplished in a math.single bed of 174.370805tons or in two beds of 22.056356 tons each.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 5, Page 468\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "from numpy import zeros\n",
      "\n",
      "#INPUT\n",
      "T = 900;                #Temperature in roaster in degree C\n",
      "P = 101325;             #Pressure in Pa\n",
      "R = 8.314;              #Universal gas consmath.tant\n",
      "dpbar = 150;            #Average particle size in micrometer\n",
      "rhosbar = 4130;         #Average particle density in kg/m**3\n",
      "kc = 0.015              #Rate consmath.tant in m/s for reaction which follows shrinking core model\n",
      "Ds = 8E-6;              #Diffusion coefficient of solid in m**2/s\n",
      "uo = 0.6;               #Superficial gas velocity in m/s\n",
      "D = 2.3E-4;             #Diffusion coefficient of gas in m**2/s\n",
      "Lm = 1;                 #Length of fixed bed in m\n",
      "dte = 0.4;              #Equivalent diameter of bed\n",
      "umf = 0.025;            #Velocity at minimum fluidization condition in m/s\n",
      "ephsilonm = 0.45;       #Void fraction of fixed bed\n",
      "ephsilonmf = 0.50;      #Void fraction at minimum fluidized condition\n",
      "db = 0.2;               #Estimated bubble size in m\n",
      "gammab = 0.005;         #Ratio of volume of print ersed solids to that of bubble phase\n",
      "Fo = 2;                 #Feed rate of solids in kg/s\n",
      "XA = 0.6677;            #Conversion of Oxygen\n",
      "xA = 0.21;              #Mole fraction of oxygen in feed\n",
      "mB = 0.09744;           #Molecular weight of ZnS\n",
      "F = 0.85;               #Fraction of open area\n",
      "g = 9.81;               #Acceleration due to gravity in square m/s**2\n",
      "pi = 3.14;\n",
      "\n",
      "#CALCULATION\n",
      "#(a)Extreme Calculation\n",
      "a = 3./2;#Stoichiometric coefficient of Oxygen in the reaction equation\n",
      "At = (Fo/mB)*(a)/(uo*(273./(T+273))*(XA*xA)/0.0224);\n",
      "dt = math.sqrt(At/F*4/pi);\n",
      "\n",
      "#(b)The Three-Step Procedure\n",
      "#Step 1. Conversion of gas\n",
      "ubr = 0.711*(g*db)**0.5;                                #Rise velocity of bubble from Eqn.(6.7)\n",
      "ub = 1.6*((uo-umf)+1.13*db**0.5)*dte**1.35+ubr;         #Bubble rise velocity for Geldart B particle\n",
      "\n",
      "delta = uo/ub;#Fraction of bed in bubbles from Eqn.(6.29)\n",
      "ephsilonf = 1-(1-delta)*(1-ephsilonmf);                 #Void fraction of fixed bed from Eqn.(6.20)\n",
      "\n",
      "fw = 0.15;#Wake volume to bubble volume from Fig.(5.8)\n",
      "gammac = (1-ephsilonmf)*((3/(ubr*ephsilonmf/umf-1))+fw);        #Volume of solids in cloud to that of the bubble from Eqn.(6.36)\n",
      "gammae = ((1-ephsilonmf)*((1-delta)/delta))-gammab-gammac;      #Volume of solids in emulsion to that of the bubble from Eqn.(6.35)\n",
      "Kbc = 4.5*(umf/db)+5.85*((D**0.5*g**0.25)/db**(5./4));           #Gas interchange coefficient between bubble and cloud from Eqn.(10.27)\n",
      "Kce = 6.77*((D*ephsilonmf*0.711*(g*db)**0.5)/db**3)**0.5;       #Gas interchange coefficient between emulsion and cloud from Eqn.(10.34)\n",
      "x = delta*Lm*(1-ephsilonm)/((1-ephsilonf)*uo);                  #Term Lf/ub of Eqn.(12.16) from Eqn.(6.19)\n",
      "CAi = xA*P/(R*(T+273));                                         #Initial concentration of oxygen\n",
      "\n",
      "#Step 2.Conversion of solids\n",
      "rhob = rhosbar/mB;                                              #Density of ZnS\n",
      "kbar = (kc**-1+(dpbar*10**-6/(12*Ds))**-1)**-1;                 #Modified rate consmath.tant from Eqn.(11)\n",
      "tbar = At*Lm*(1-ephsilonm)*rhosbar/Fo;                          #Mean residence time of solids\n",
      "Krguess = 2;                                                    #Guess value of Kr\n",
      "def solver_func(Kr):                #Function defined for solving the system\n",
      "    Kf = gammab*Kr+1/((1./Kbc)+(1./(gammac*Kr+1/((1./Kce)+(1./(gammae*Kr))))));            #Reaction rate for fluidized bed from Eqn.(14)\n",
      "    XA = 1-math.exp(-x*Kf);                                                         #Conversion of oxygen from Eqn.(42)\n",
      "    CAbar = (CAi*XA*uo)/(Kr*Lm*(1-ephsilonm));                                      #Average concentration of oxygen from Eqn.(43)\n",
      "    tou = rhob*dpbar*10**-6*a/(2*kbar*CAbar);                                       #Time for complete reaction from Eqn.(9)\n",
      "    y = tbar/tou;#Term tbar/tou\n",
      "    XBbar = 3*y-6*y**2+6*y**3*(1-math.exp(-1/y));                                   #Average conversion of ZnS from Eqn.(22)\n",
      "    #Step 3. Material balance of both streams\n",
      "    return (Fo/mB)*XBbar-(At*uo*CAi*XA/a);                                          #From Eqn.(44b)\n",
      "\n",
      "Kr = fsolve(solver_func,Krguess)\n",
      "Kf = gammab*Kr+1/((1/Kbc)+(1/(gammac*Kr+1/((1/Kce)+(1/(gammae*Kr))))));             #Reaction rate for fluidized bed from Eqn.(14)\n",
      "XA = 1-math.exp(-x*Kf);                                                             #Conversion of oxygen from Eqn.(42)\n",
      "CAbar = (CAi*XA*uo)/(Kr*Lm*(1-ephsilonmf));                                         #Average concentration of oxygen from Eqn.(43)\n",
      "tou = rhob*dpbar*10**-6*a/(2*kbar*CAbar);                                           #Time for complete reaction from Eqn.(9)\n",
      "y = tbar/tou;                                                                       #Term tbar/tou\n",
      "XBbar = 3*y-6*y**2+6*y**3*(1-math.exp(-1/y));                                       #Average conversion of ZnS from Eqn.(22)\n",
      "\n",
      "\n",
      "#(c) For other feed rates of solids\n",
      "F1 = [2,2.5,3,3.5];#Various feed rates of solids in kg/s\n",
      "n = len(F1)\n",
      "i = 0;\n",
      "tbar1 = zeros(n)\n",
      "Kr1 = zeros(n)\n",
      "XA1 = zeros(n)\n",
      "y1 = zeros(n)\n",
      "tou1 = zeros(n)\n",
      "XBbar1 = zeros(n)\n",
      "Kf1 = zeros(n)\n",
      "CAbar1 = zeros(n)\n",
      "Krguess1 = 2;           #Guess value of Kr\n",
      "while i<  n:\n",
      "    tbar1[i] = At*Lm*(1-ephsilonm)*rhosbar/F1[i];#Mean residence time of solids\n",
      "    def solver_func1(Kr):               #Function defined for solving the system\n",
      "        Kf1 = gammab*Kr+1/((1/Kbc)+(1/(gammac*Kr+1/((1/Kce)+(1/(gammae*Kr))))));#Reaction rate for fluidized bed from Eqn.(14)\n",
      "        XA1 = 1-math.exp(-x*Kf1);#Conversion of oxygen from Eqn.(42)\n",
      "        CAbar1 = (CAi*XA1*uo)/(Kr*Lm*(1-ephsilonm));#Average concentration of oxygen from Eqn.(43)\n",
      "        tou1 = rhob*dpbar*10**-6*a/(2*kbar*CAbar1);#Time for complete reaction from Eqn.(9)\n",
      "        y1[i] = tbar1[i]/tou1;#Term tbar/tou\n",
      "        XBbar1[i] = 3*y1[i]-6*y1[i]**2+6*y1[i]**3*(1-math.exp(-1/y1[i]));#Average conversion of ZnS from Eqn.(22)\n",
      "        #Step 3. Material balance of both streams\n",
      "        return (F1[i]/mB)*XBbar1[i]-(At*uo*CAi*XA1/a);#From Eqn.(44b)\n",
      "\n",
      "    Kr1[i] = fsolve(solver_func1,Krguess1)\n",
      "    Kf1[i] = gammab*Kr1[i]+1/((1/Kbc)+(1/(gammac*Kr1[i]+1/((1/Kce)+(1/(gammae*Kr1[i]))))));#Reaction rate for fluidized bed from Eqn.(14)\n",
      "    XA1[i] = 1-math.exp(-x*Kf1[i]);#Conversion of oxygen from Eqn.(42)\n",
      "    CAbar1[i] = (CAi*XA1[i]*uo)/(Kr1[i]*Lm*(1-ephsilonmf));#Average concentration of oxygen from Eqn.(43)\n",
      "    tou1[i] = rhob*dpbar*10**-6*a/(2*kbar*CAbar1[i]);#Time for complete reaction from Eqn.(9)\n",
      "    y1[i] = tbar1[i]/tou1[i];#Term tbar/tou\n",
      "    XBbar1[i] = 3*y1[i]-6*y1[i]**2+6*y1[i]**3*(1-math.exp(-1/y1[i]));#Average conversion of ZnS from Eqn.(22)\n",
      "    i = i+1;\n",
      "\n",
      "#OUTPUT\n",
      "print 'Extreme Calculation';\n",
      "print '\\tDiameter of tube with all its internals:%fm'%(dt);\n",
      "print 'Three step procedure';\n",
      "print '\\tConversion of ZnS:%f'%(XBbar);\n",
      "print 'For other feed rates of solids';\n",
      "print '\\tFeedkg/s\\ttbars\\t\\tXBbar/XA\\tKrbars**-1\\tCAbar/CAi\\ttous\\t\\tXA\\t\\tXB';\n",
      "i = 0;\n",
      "while i<  n:\n",
      "    print '\\t%f\\t%f\\t%f\\t%f\\t%f\\t%f\\t%f\\t%f'%(F1[i],tbar1[i],XBbar1[i]/XA1[i],Kr1[i],CAbar1[i]/CAi,tou1[i],XA1[i],XBbar1[i]);\n",
      "    i = i+1;\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Extreme Calculation\n",
        "\tDiameter of tube with all its internals:7.265465m\n",
        "Three step procedure\n",
        "\tConversion of ZnS:0.992491\n",
        "For other feed rates of solids\n",
        "\tFeedkg/s\ttbars\t\tXBbar/XA\tKrbars**-1\tCAbar/CAi\ttous\t\tXA\t\tXB\n",
        "\t2.000000\t40003.518104\t1.498777\t6.529973\t0.121691\t1208.748626\t0.662201\t0.992491\n",
        "\t2.500000\t32002.814483\t1.201348\t23.149964\t0.041993\t3502.838402\t0.810111\t0.973225\n",
        "\t3.000000\t26669.012069\t1.007581\t76.183481\t0.014228\t10338.227251\t0.903294\t0.910141\n",
        "\t3.500000\t22859.153202\t0.871565\t146.263086\t0.007742\t18998.458994\t0.943693\t0.822490\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 6, Page 471\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "\n",
      "#INPUT\n",
      "T = 900;                #Temperature in roaster in degree C\n",
      "P = 101325;             #Pressure in Pa\n",
      "R = 8.314;              #Universal gas consmath.tant\n",
      "dp = 750;               #Particle size in micrometer5\n",
      "Fo = 2.5;               #Feed rate of solids in kg/s\n",
      "uo = 0.6;               #Superficial gas velocity in m/s\n",
      "W = 80140;              #Weight of bed in kg\n",
      "ephsilonmf = 0.50;      #Void fraction at minimum fluidized condition\n",
      "umf = 0.5;              #Velocity at minimum fluidization condition in m/s\n",
      "db = 0.2;               #Estimated bubble size in m\n",
      "g = 9.81;               #Acceleration due to gravity in square m/s**2\n",
      "Lm = 1;                 #Length of fixed bed in m\n",
      "ephsilonm = 0.45;       #Void fraction of fixed bed\n",
      "xA = 0.21;              #Mole fraction of oxygen in feed\n",
      "kc = 0.015              #Rate consmath.tant in m/s for reaction which follows shrinking core model\n",
      "Ds = 8E-6;              #Diffusion coefficient of solid in m**2/s\n",
      "rhosbar = 4130;         #Average particle density in kg/m**3\n",
      "mB = 0.09744;           #Molecular weight of ZnS\n",
      "a = 3./2;               #Stoichiometric coefficient of Oxygen in the reaction equation\n",
      "\n",
      "#CALCULATION\n",
      "#Selection of models to represent reactor\n",
      "ubr = 0.711*(g*db)**0.5;        #Rise velocity of bubble from Eqn.(6.7)\n",
      "f = ubr/(umf/ephsilonmf);\n",
      "\n",
      "#Step 1.\n",
      "ub = uo-umf+ubr;            #Rise velocity of bubbles from Eqn.(6.8)\n",
      "delta = (uo-umf)/(ub+2*umf);        #Fraction of the bed in bubbles from Eqn.(6.26)\n",
      "Krguess = 2;                        #Guess value of Kr\n",
      "x = Lm*(1-ephsilonm)*umf*(1-delta)/uo**2;\n",
      "CAi = xA*P/(R*(T+273));             #Initial concentration of oxygen\n",
      "\n",
      "#Step 2.\n",
      "kbar = (kc**-1+(dp*10**-6/(12*Ds))**-1)**-1;            #Modified rate consmath.tant from Eqn.(11)\n",
      "tbar = W/Fo;                    #Mean residence time of solids from Eqn.(14.2)\n",
      "rhob = rhosbar/mB;              #Density of ZnS\n",
      "def solver_func1(Kr):           #Function defined for solving the system\n",
      "    XA = 1-math.exp(-x*Kr);     #Conversion from Eqn.(42)\n",
      "    CAbar = (CAi*XA*uo**2)/(Kr*Lm*(1-ephsilonm)*umf*(1-delta));         #Average concentration of oxygen from Eqn.(43)\n",
      "    tou = rhob*dp*10**-6*a/(2*kbar*CAbar);          #Time for complete reaction from Eqn.(9)\n",
      "    y = tbar/tou;               #Term tbar/tou\n",
      "    XBbar = 3*y-6*y**2+6*y**3*(1-math.exp(-1./y));          #Average conversion of ZnS from Eqn.(22)\n",
      "    return XBbar-1.2*XA;        #From Table E5, for Fo = 2.5kg/s\n",
      "\n",
      "Kr = fsolve(solver_func1,Krguess)\n",
      "XA = 1-math.exp(-x*Kr);         #Conversion from Eqn.(42)\n",
      "CAbar = (CAi*XA*uo**2)/(Kr*Lm*(1-ephsilonm)*umf*(1-delta))      #Average concentration of oxygen from Eqn.(43)\n",
      "tou = rhob*dp*10**-6*a/(2*kbar*CAbar);          #Time for complete reaction from Eqn.(9)\n",
      "y = tbar/tou;                   #Term tbar/tou\n",
      "XBbar = 3*y-6*y**2+6*y**3*(1-math.exp(-1./y));  #Average conversion of ZnS from Eqn.(22)\n",
      "\n",
      "#OUTPUT\n",
      "print 'Selection of models to represent reactor';\n",
      "print '\\tSince ratio ubr/umf/ephsilonmf) =  %f <1 the reactor is operating in slow bubble regime'%(f);\n",
      "print '\\tSince particle size  = %f micrometer they react according to shrinking-core model'%(dp);\n",
      "print '\\tConversion obtained for %f micrometer particle:%f'%(dp,XBbar);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Selection of models to represent reactor\n",
        "\tSince ratio ubr/umf/ephsilonmf) =  0.995908 <1 the reactor is operating in slow bubble regime\n",
        "\tSince particle size  = 750.000000 micrometer they react according to shrinking-core model\n",
        "\tConversion obtained for 750.000000 micrometer particle:0.988127\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}