{
 "metadata": {
  "name": "",
  "signature": "sha256:b0605e72f5da8476b3859cf3dc90196dcbe80cabc58b8c8d37cf5b28482c7ee1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15 : Circulation Systems"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1, Page 369\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "thalf=1;   #Half life of catalyst in s\n",
      "F=960;     #Feed rate of oil in tons/day\n",
      "W=50;      #Weight of the bed in tons\n",
      "a=0.5;     #Activity after time equal to half life\n",
      "abar=0.01; #Average activity of the catalyst\n",
      "\n",
      "#CALCULATION\n",
      "Ka=-math.log(a)/thalf;#Rate constant is s**-1, assuming I order kinetics from Eqn.(12)\n",
      "Fs=Ka*W*abar/(1-abar);#Circulation rate of solids from Eqn.(16)\n",
      "x=(Fs*60*60*24.0)/F;  #Circulation rate per feed of oil\n",
      "\n",
      "#OUTPUT\n",
      "print '\\nSolid recirculation per feed of oil =%ftons of solid circulated/ton feed oil'%x\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Solid recirculation per feed of oil =31.506690tons of solid circulated/ton feed oil\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 2, Page 370\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "deltaHr1=1260.;                               #Enthalpy change during endothermic reaction in kJ/kg\n",
      "deltaHr2=-33900.;                             #Enthal[y change during exothermic reaction in kJ/kg\n",
      "H1=703.;                                      #Enthalpy of feed oil in kJ/kg\n",
      "T1=260.;                                      #Temperature of feed oil in degree celcius\n",
      "H3=1419.;                                     #Enthalpy of cracked product in kJ/kg\n",
      "T3=500.;                                      #Temperature of cracked product in degree celcius\n",
      "Ta=20.;                                       #Temperature of entering air in degree celcius\n",
      "Cpa=1.09;                                     #Specific heat of entering air in kJ/kg K\n",
      "Cpf=1.05;                                     #Specific heat of flue gases in kJ/kg K\n",
      "Cps=1.01;                                     #Specific heat of solids in kJ/kg K\n",
      "Cpv=3.01;                                     #Specific heat of vaporized feed in kJ/kg K\n",
      "T4=[520.,540.,560.,580.,600.,620.,640.,660.]; #Temperature of flue gas in degree celcius\n",
      "V=22.4;                                       #Volume of 1 mole of Carbon dioxide gas in N-m**3\n",
      "M=12.;                                        #Molecular weight of carbon in kg\n",
      "rho=1.293;                                    #Density of carbon dioxide gas in kg/N-m**3\n",
      "xa=0.21;                                      #Mass fraction of oxygen in air\n",
      "betac=0.07;                                   #Mass fraction of carbon\n",
      "\n",
      "#CALCULATION\n",
      "n=len(T4);\n",
      "i=0;\n",
      "x1 = [0,0,0,0,0,0,0,0]\n",
      "x2 = [0,0,0,0,0,0,0,0]\n",
      "excess_air = [0,0,0,0,0,0,0,0]\n",
      "\n",
      "x2min=betac*(V*rho/(M*xa));#Minimum amount of air required for complete combustion\n",
      "while i<n:\n",
      "    x1[i]=(deltaHr1+0.93*H3-H1)/(Cps*(T4[i]-T3));#Fs/F1 by simplifying the overall energy balance\n",
      "    x2[i]=((0.07*(-deltaHr2)-(deltaHr1+0.93*H3-H1))/(Cpf*(T4[i]-Ta)))-0.07;#F2/F1 by simplifying the energy balance for regenerator\n",
      "    if x2[i]>x2min:\n",
      "        excess_air[i]=(x2[i]-x2min)/x2min; #Excess air used\n",
      "    else:\n",
      "        excess_air[i]=0;\n",
      "    i=i+1;\n",
      "\n",
      "#OUTPUT    \n",
      "print 'T4(degree celcius)',\n",
      "print '\\tFs/F1',\n",
      "print '\\t\\tF2/F1',\n",
      "print '\\t\\tExcess air(percentage)'\n",
      "i=0;\n",
      "while i<n:\n",
      "    print '%f'%T4[i],\n",
      "    print '\\t\\t%f'%x1[i],\n",
      "    print '\\t%f'%x2[i],\n",
      "    print '\\t%f'%(excess_air[i]*100);\n",
      "    i=i+1;\n",
      "\n",
      "#Disclaimer: The values of F2/F1 obtained by manual calculation has close correspondance to the ones obtained as the output, whereas it deviates largely from the values given in textbook.\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "T4(degree celcius) \tFs/F1 \t\tF2/F1 \t\tExcess air(percentage)\n",
        "520.000000 \t\t92.904455 \t0.875390 \t8.807235\n",
        "540.000000 \t\t46.452228 \t0.839029 \t4.287699\n",
        "560.000000 \t\t30.968152 \t0.805362 \t0.102944\n",
        "580.000000 \t\t23.226114 \t0.774099 \t0.000000\n",
        "600.000000 \t\t18.580891 \t0.744992 \t0.000000\n",
        "620.000000 \t\t15.484076 \t0.717825 \t0.000000\n",
        "640.000000 \t\t13.272065 \t0.692412 \t0.000000\n",
        "660.000000 \t\t11.613057 \t0.668586 \t0.000000\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3, Page 379\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Fs=100.;        #Solid flowrate in kg/s\n",
      "ephsilon1=0.55;\n",
      "ephsilon2=0.5;\n",
      "p1=120.;         #Pressure at upper level in kPa\n",
      "rhos=1000.;      #Density of solid in kg/m**3\n",
      "rhog=1.;         #Density of gas in kg/m**3\n",
      "gc=1.;           #Conversion factor\n",
      "g=9.81;          #Acceleration due to gravity in m/s**2\n",
      "di=0.34;         #Diameter of downcomer in m\n",
      "pi=3.14;\n",
      "\n",
      "#CALCULATION\n",
      "x=(ephsilon1/ephsilon2)*((1-ephsilon2)/(1-ephsilon1));#To find pressure at lower level using Eqn.(30)\n",
      "p2=x*p1;#Pressure at lower level using Eqn.(30)\n",
      "deltap=p2-p1;\n",
      "ephsilonbar=0.5*(ephsilon1+ephsilon2);\n",
      "deltah=(deltap*10**3*gc)/(rhos*(1-ephsilonbar)*g);#Static head height from Eqn.(28)\n",
      "At=0.25*pi*di**2;#Area of downcomer\n",
      "Gs=Fs/At;#Flux of solids in downcomer\n",
      "Gg=Gs*(ephsilon1/(1-ephsilon1))*(rhog/rhos)*(x-1);#Required gas aeration rate from Eqn.(31)\n",
      "Fg=Gg*At;#Flow rate of gas required\n",
      "\n",
      "#OUTPUT\n",
      "print '\\nThe required flow rate of gas required for location of %fm below downcomer is %.4fkg/s'%(deltah,Fg)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The required flow rate of gas required for location of 5.722768m below downcomer is 0.0272kg/s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 4, Page 380\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Fs=600;#Solid circulation rate in kg/s\n",
      "dpbar=60;#Mean size of solids in micrometer\n",
      "pA=120;#Pressure in vessel A in kPa\n",
      "pB=180;#Pressure in vessel B in kPa\n",
      "LfA=8;#Bed height in vessel A in m\n",
      "LfB=8;#Bed height in vessel B i m\n",
      "#Bulk densities in kg/m**3\n",
      "rho12=100;\n",
      "rho34=400;\n",
      "rho45=550;\n",
      "rho67=200;\n",
      "rho78=200;\n",
      "rho910=400;\n",
      "rho1011=400;\n",
      "rho1112=550;\n",
      "rho13=100;\n",
      "deltapdA=7;#Pressure drop across the distributor in regenerator in kPa\n",
      "deltapdB=8;#Pressure drop across the distributor in reactor in kPa\n",
      "deltap12=(9+4);#Friction loss and pressure difference required to accelerate the solids in transfer lines in kPa\n",
      "deltap78=(15+3);#Friction loss and pressure difference required to accelerate the solids in transfer lines in kPa\n",
      "deltap45=20;#Friction loss across the reactor's stripper downcomer in kPa\n",
      "deltap1112=4;#Friction loss across the regenerator's downcomer in kPa\n",
      "deltapvA=5;#Pressure drop assigned for the control valve in regenerator in kPa\n",
      "deltapvB=15;#Pressure drop assigned for the control valve in reactor in kPa\n",
      "deltah12=15;#Height of the riser in m\n",
      "deltah86=30;#Height of the riser in m\n",
      "deltah1011=7;#Height difference h10-h11 in m\n",
      "g=9.81;#Acceleration due to gravity in m/s**2\n",
      "gc=1;#Conversion factor\n",
      "pi=3.14;\n",
      "\n",
      "#CALCULATION\n",
      "Gs=900;#From Fig.(8), to find dt\n",
      "dt=math.sqrt((4/math.pi)*Fs/Gs);#Diameter of the downcomer\n",
      "#Height of downcomer A from Eqn.(7)\n",
      "deltahA=(1/(rho1112*g))*((pB-pA)*gc*(10**3)+(deltap12+deltapdB+deltap1112+deltapvA)*gc*10**3-rho12*g*(-deltah12)-rho34*g*(-LfB)-rho1011*g*deltah1011);\n",
      "#Height of downcomer B from Eqn.(8)\n",
      "deltahB=(1/(rho45*g))*(-(pB-pA)*gc*10**3+(deltap45+deltapvB+deltap78+deltapdA)*gc*10**3+rho78*g*deltah86+rho910*g*LfA)\n",
      "\n",
      "#OUTPUT\n",
      "print 'Height of downcomer for:'\n",
      "print '\\tRegenerator:%d m'%deltahA\n",
      "print '\\tReactor:%.1f m'%deltahB\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Height of downcomer for:\n",
        "\tRegenerator:20 m\n",
        "\tReactor:16.7 m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}