{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 24 : Fluid-Fluid Reactors: Design"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.1 pageno : 551"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "kag_a = 0.32;                  # mol/hr.m**3 Pa\n",
      "kal_a = 0.1                    # hr\n",
      "HA = 12.5                      # Pa.m**3/mol\n",
      "Fg = 10.**5                    # mol/hr.m**2\n",
      "Fl = 7.*10**5                  # mol/hr.m**2\n",
      "Ct = 56000.;                    #mol/m3\n",
      "P = 10.**5;                     #Pa\n",
      "\n",
      "# Calculations\n",
      "inv_Kag_a = 3.125+HA/(kal_a);\n",
      "Gfilm_res = (3.125)/inv_Kag_a;\n",
      "Lfilm_res = (HA/(kal_a))/inv_Kag_a;\n",
      "Kag_a = 1/inv_Kag_a;\n",
      "d = 20;\n",
      "def f9(dp): \n",
      "\t return 1./20\n",
      "\n",
      "h = (Fg/(P*Kag_a))* quad(f9,20,100)[0]\n",
      "\n",
      "# Results\n",
      "print \" The height of the tower required for countercurrent operartions is %.1f \"%(h),\n",
      "print \"m\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The height of the tower required for countercurrent operartions is 512.5  m\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.2 pageno : 554"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "Fg = 10.**5;             \n",
      "P = 10.**5;\n",
      "Fg_by_Acs = 10.**5              #(Fg/Acs)\n",
      "PA1 = 20;PA2 = 100.;\n",
      "kag_a = 0.32;\n",
      "\n",
      "# Calculations\n",
      "def f10(PA): \n",
      "\t return 1./(0.32*PA)\n",
      "\n",
      "h = (Fg_by_Acs/P)* quad(f10,PA1,PA2)[0]\n",
      "\n",
      "# Results\n",
      "print \" The height of the tower is %.2f \"%(h),\n",
      "print \"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The height of the tower is 5.03  m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.3 pageno : 555"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "\n",
      "# from example 24.2\n",
      "Fg = 10.**5;\n",
      "P = 10.**5;\n",
      "PA1 = 20.\n",
      "PA2 = 100.;\n",
      "HA = 12.5;\n",
      "kaga = 0.32\n",
      "kla = 0.1;\n",
      "\n",
      "# Calculations\n",
      "rA = 420./((1./kaga)+(HA/kla));\n",
      "\n",
      "def f8(PA): \n",
      "\t return 1./rA\n",
      "\n",
      "h = (Fg/P)* quad(f8,PA1,PA2)[0]\n",
      "\n",
      "# Results\n",
      "print \"The height of the tower is %.1f\"%(h),\n",
      "print \"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The height of the tower is 24.4 m\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.4 page no : 557"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "\n",
      "# from example 24.2\n",
      "PA1 = 20.\n",
      "PA2 = 100.          #Pa\n",
      "Fg_by_Acs = 10.**5;\n",
      "P = 10.**5;\n",
      "HA = 12.5;\n",
      "kaga = 0.32\n",
      "kla = 0.1;\n",
      "PA = 39.5           #Pa\n",
      "\n",
      "# Calculations\n",
      "def f11(P): \n",
      "\t return 1./(kaga*P)\n",
      "\n",
      "def f22(P):\n",
      "    return (1/kaga+HA/kla)/1620\n",
      "\n",
      "h = (Fg_by_Acs/P)*( quad(f11,PA1,PA)[0] + quad(f22,PA,PA2)[0])\n",
      "\n",
      "# Results\n",
      "print \"The height of the tower is %.2f\"%(h),\n",
      "print \"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The height of the tower is 6.91 m\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.5 pageno : 558"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "\n",
      "# from 24.2\n",
      "Fg = 10.**5;\n",
      "P = 10.**5;\n",
      "Fg_by_Acs = 10.**5          #(Fg/Acs)\n",
      "PA1 = 20.\n",
      "PA2 = 100.\n",
      "kag_a = 0.32;\n",
      "\n",
      "# Calculations\n",
      "def f0(PA): \n",
      "\t return 1./(PA/3.125)\n",
      "\n",
      "h = (Fg_by_Acs/P)* quad(f0,PA1,PA2)[0]\n",
      "\n",
      "# Results\n",
      "print \" The height of the tower is %.2f \"%(h),\n",
      "print \"m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The height of the tower is 5.03  m\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.6 pageno : 560"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad \n",
      "\n",
      "# Variables\n",
      "kag_a = 0.72;              # mol/hr.m**3 Pa\n",
      "kal_a = 144.;              # hr**-1\n",
      "HA = 1000.;                # Pa m**3/mol\n",
      "Fg = 9000.                  #mol/hr\n",
      "fl = 0.9\n",
      "b = 1\n",
      "Vr = 1.62                   #m3\n",
      "DA = 3.6*10**-6             #m2/hr\n",
      "a = 100.                    #m2/m3\n",
      "k = 2.6*10**5;              #m3/mol.hr\n",
      "DB = DA\n",
      "P = 10**5\n",
      "PA = 1000.                  #Pa\n",
      "kal = kal_a/a;\n",
      "#At the start\n",
      "CBo = 555.6;\n",
      "\n",
      "# Calculations\n",
      "Mh = (math.sqrt(DB*k*CBo))/kal;\n",
      "#Min value of EAi\n",
      "Ei = 1+(CBo*HA/PA);\n",
      "if Ei>Mh:\n",
      "    E = Mh;\n",
      "\n",
      "rA1 = PA/((P*Vr/Fg)+(1/kag_a)+(HA/(kal_a*E))+(HA/(k*fl*CBo)));\n",
      "#At the end\n",
      "CBf = 55.6;\n",
      "Mh = (math.sqrt(DB*k*CBf))/kal;\n",
      "#Min value of EAi\n",
      "Ei = 1+(CBf*HA/PA);\n",
      "if Ei>Mh:\n",
      "    E = Mh;\n",
      "\n",
      "rA2 = PA/((P*Vr/Fg)+(1/kag_a)+(HA/(kal_a*E))+(HA/(k*fl*CBf)));\n",
      "#Average rate of reaction\n",
      "rA_avg = (rA1+rA2)/2;\n",
      "\n",
      "def f7(CB): \n",
      "\t return 1./rA_avg\n",
      "\n",
      "t = (fl/b)* quad(f7,CBf,CBo)[0]\n",
      "\n",
      "# Results\n",
      "print \" Part a\"\n",
      "print \" The run time needed is %.2f\"%t,\n",
      "print \"hr\"\n",
      "#The min time required is\n",
      "tmin = Vr*(CBo-CBf)/(Fg*(PA/(P-PA)));\n",
      "print \" The minimum time required is %.2f\"%(tmin),\n",
      "print \"hr\"\n",
      "#Fraction of reacmath.tant which passes through the math.tank unreacted is\n",
      "f = (t-tmin)/tmin;\n",
      "print \" Part b\"\n",
      "print \" Fraction of reacmath.tant which passes through the math.tank unreacted is %.3f\"%(f)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Part a\n",
        " The run time needed is 9.13 hr\n",
        " The minimum time required is 8.91 hr\n",
        " Part b\n",
        " Fraction of reacmath.tant which passes through the math.tank unreacted is 0.025\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}