summaryrefslogtreecommitdiff
path: root/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter06.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter06.ipynb')
-rwxr-xr-xTRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter06.ipynb715
1 files changed, 715 insertions, 0 deletions
diff --git a/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter06.ipynb b/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter06.ipynb
new file mode 100755
index 00000000..0ae50546
--- /dev/null
+++ b/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter06.ipynb
@@ -0,0 +1,715 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:4a12202353f3cb1cbe50fd7930d91773aa80f5f97a640a6132154b29fdca09cb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6: Principles of Mass Transfer"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.1-1, Page number 384"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Molecular Diffusion of Helium in Nitrogen\n",
+ "\n",
+ "#Variable declaration\n",
+ "z1 = 0.0 #Location of one end of pipe, m\n",
+ "z2 = 0.2 #Location of other end of pipe, m\n",
+ "T = 298 #Temeperature of gas, K\n",
+ "pA1 = 0.6 #Partial pressure of Helium at end 1, atm\n",
+ "pA2 = 0.2 #Partial pressure of Helium at end 2, atm\n",
+ "DAB = 0.687e-4 #Diffusivity of Helium in Nitrogen, m2/s\n",
+ "P = 1. #Total pressure, atm\n",
+ "R = 82.057e-3 #Gas Constant,m3.atm/(kmol.K)\n",
+ "\n",
+ "#Calculation SI Units\n",
+ "JAz = DAB*(pA1-pA2)/(R*T*(z2-z1))\n",
+ "\n",
+ "#Result\n",
+ "print 'Flux of Helium through the Nitrogen in SI units: %5.2e'%(JAz), \"kmol/(m2.s)\"\n",
+ "\n",
+ "#Variable declaration cgs Units\n",
+ "z1 = 0.0 #Location of one end of pipe, m\n",
+ "z2 = 20 #Location of other end of pipe, m\n",
+ "DAB = 0.687 #Diffusivity of Helium in Nitrogen, cm2/s\n",
+ "R = 82.057 #Gas Constant,cm3.atm/(gmol.K)\n",
+ "\n",
+ "#Calculation cgs Units\n",
+ "JAz = DAB*(pA1-pA2)/(R*T*(z2-z1))\n",
+ "\n",
+ "#Result\n",
+ "print 'Flux of Helium through the Nitrogen in cgs units: %5.2e'%(JAz), \"gmol/(cm2.s)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flux of Helium through the Nitrogen in SI units: 5.62e-06 kmol/(m2.s)\n",
+ "Flux of Helium through the Nitrogen in cgs units: 5.62e-07 gmol/(cm2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2-1, Page Number 386"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Equimolar Counterdiffusion\n",
+ "\n",
+ "#Variable declaration\n",
+ "z1 = 0.0 #Location of one end of pipe, m\n",
+ "z2 = 0.1 #Location of other end of pipe, m\n",
+ "T = 298 #Temeperature of gas, K\n",
+ "pA1 = 1.013e4 #Partial pressure of Ammonia at end 1, Pa\n",
+ "pA2 = 0.507e4 #Partial pressure of Ammonia at end 2, Pa\n",
+ "DAB = 0.23e-4 #Diffusivity of Ammonia in Nitrogen, m2/s\n",
+ "P = 1.0132e5 #Total pressure, Pa\n",
+ "R = 8314.3 #Gas Constant,m3.Pa/(kmol.K)\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "JAz = DAB*(pA1-pA2)/(R*T*(z2-z1))\n",
+ "pB1 = P - pA1\n",
+ "pB2 = P - pA2\n",
+ "JBz = DAB*(pB1-pB2)/(R*T*(z2-z1))\n",
+ "#Result\n",
+ "\n",
+ "print 'Flux of Ammonia through the Nitrogen:%10.2e '%(JAz), \"kmolA/(m2.s)\"\n",
+ "print 'Flux of Nitrogen through the Ammonia:%10.2e '%(JBz), \"kmolB/(m2.s)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flux of Ammonia through the Nitrogen: 4.70e-07 kmolA/(m2.s)\n",
+ "Flux of Nitrogen through the Ammonia: -4.70e-07 kmolB/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2-2, Page number 389"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Diffusion of Water Through Stagnant, Nondiffusing Air\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration English Units\n",
+ "z1 = 0.0 #Location of one end of pipe, ft\n",
+ "z2 = 0.5 #Location of other end of pipe, ft\n",
+ "T = 68 #Temeperature of gas, \u00b0F\n",
+ "DAB = 0.25e-4 #Diffusivity of Water in Air, m2/s\n",
+ "p0w = 17.54 #Vapor pressure of Water at 68 \u00b0F, mmHg\n",
+ "R = 0.73 #Gas Constant, ft3.atm/(lbmol.\u00b0R)\n",
+ "P = 1.\n",
+ "\n",
+ "#Calculation English units\n",
+ "DAB = DAB*3.875e4\n",
+ "p0w = p0w/760\n",
+ "pA1 = p0w\n",
+ "pA2 = 0.\n",
+ "T = T + 460.\n",
+ "\n",
+ "pB1 = P - pA1\n",
+ "pB2 = P - pA2\n",
+ "pBM = (pB2-pB1)/log(pB2/pB1)\n",
+ "NA = DAB*P*(pA1-pA2)/(R*T*(z2-z1)*pBM)\n",
+ "#Result\n",
+ "print 'Rate of evaporation of water at steady state:English Units %10.3e'%(NA), \"lbmol/(ft2.hr)\"\n",
+ "\n",
+ "#Variable declaration SI Units\n",
+ "z1 = 0.0 #Location of one end of pipe, m\n",
+ "z2 = 0.1524 #Location of other end of pipe, m\n",
+ "T = 293 #Temeperature of gas, K\n",
+ "p0w = 17.54 #Vapor pressure of Water at 293 K, mmHg\n",
+ "DAB = 0.25e-4 #Diffusivity of Water in Air, m2/s\n",
+ "P = 1.01325e5 #Total pressure, Pa\n",
+ "R = 8314.3 #Gas Constant,m3.Pa/(kmol.K)\n",
+ "\n",
+ "#Calculation SI units\n",
+ "\n",
+ "p0wSI = p0w*P/760\n",
+ "pA1 = p0wSI\n",
+ "pA2 = 0.\n",
+ "JAz = DAB*(pA1-pA2)/(R*T*(z2-z1))\n",
+ "\n",
+ "pB1 = P - pA1\n",
+ "pB2 = P - pA2\n",
+ "pBM = (pB2-pB1)/log(pB2/pB1)\n",
+ "NA = DAB*P*(pA1-pA2)/(R*T*(z2-z1)*pBM)\n",
+ "\n",
+ "#Result\n",
+ "print 'Rate of evaporation of water at steady state SI Units:%10.3e'%(NA), \"kmol/(m2.s)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of evaporation of water at steady state:English Units 1.174e-04 lbmol/(ft2.hr)\n",
+ "Rate of evaporation of water at steady state SI Units: 1.593e-07 kmol/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2-4, Page number 392"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Evaporation of Napthalene Sphere\n",
+ "\n",
+ "# Variable declaration\n",
+ "r = 2. #Radius of Napthalene ball, mm\n",
+ "Tair = 318. #Ambient temperature of air, K\n",
+ "Tball = 318. #Temperature of the Napthalene ball, K\n",
+ "p0N = 0.555 #Vapor pressure of Napthalene at 318K, mmHg\n",
+ "DAB = 6.92e-6 #Diffusion Coefficient, m2/s\n",
+ "P = 101325. #Atmospheric pressure, Pa \n",
+ "R = 8314. #Gas constant, m3.Pa/(kmol.K)\n",
+ "\n",
+ "# Calculation\n",
+ "pA1 = p0N*P/760\n",
+ "r = r/1000\n",
+ "pA2 = 0.\n",
+ "pB1 = P - pA1\n",
+ "pB2 = P- pA2\n",
+ "pBM = (pB1+pB2)/2.\n",
+ "NA = DAB*P*(pA1-pA2)/(R*Tair*r*pBM)\n",
+ " \n",
+ "#Result\n",
+ "print 'Rate of evaporation of Napthalene from surface is:%10.3e'%(NA),\"kmol A/(m2.s)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of evaporation of Napthalene from surface is: 9.687e-08 kmol A/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2-5, Page number 397"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Estimation of diffusivity of a Gas Mixture\n",
+ "from math import sqrt\n",
+ "\n",
+ "# Variable declaration\n",
+ "P = 1. #Pressure in atmosphere\n",
+ "MA = 74.1 #Molecular weight of Butanol\n",
+ "MB = 29. #Molecular weight of Air\n",
+ "T1 = 0. #Temperature, deg C\n",
+ "T2 = 25.9 #Temperature, deg C\n",
+ "T3 = 0. #Temperature, deg C\n",
+ "P3 = 2.\n",
+ "# Calculation\n",
+ "def BinaryDiffusivity(P,T):\n",
+ " dab = 1.0e-7*T**1.75*sqrt(1./MA+1./MB)/(P*(SvA**(1./3)+ SvB**(1./3))**2)\n",
+ " print \"The binary diffusivity Butanol in Air at\",round(P,2),\"&\",T,'K is %5.3e'%(dab),\"m2/s\" \n",
+ " return dab\n",
+ "\n",
+ "#Atomic Diffusion volumes using table 6.2-2 pp-396\n",
+ "SvA = 4*16.5+10*1.98+1*5.48\n",
+ "SvB = 20.1\n",
+ "T1 = 273 + T1\n",
+ "DAB1 = BinaryDiffusivity(P,T1)\n",
+ "T2 = 273 + T2\n",
+ "DAB2 = BinaryDiffusivity(P,T2)\n",
+ "DAB3 = DAB1*(1./2.)\n",
+ "print 'The binary diffusivity Butanol in Air at %3.1f & %4.1f K is %5.3e m2/s'%(P3,T1,DAB3)\n",
+ "#OR\n",
+ "#DAB3 = BinaryDiffusivity(P3,T1)\n",
+ "#Result\n",
+ "print 'The answers different than book because of book uses rounded numbers'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The binary diffusivity Butanol in Air at 1.0 & 273.0 K is 7.701e-06 m2/s\n",
+ "The binary diffusivity Butanol in Air at 1.0 & 298.9 K is 9.025e-06 m2/s\n",
+ "The binary diffusivity Butanol in Air at 2.0 & 273.0 K is 3.851e-06 m2/s\n",
+ "The answers different than book because of book uses rounded numbers\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.3-1, Page number 399"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Diffusion of Ethanol(A) through Water(B)\n",
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "T = 298 #Temperature of solution, K\n",
+ "rho1 = 972.8 #Density of solution at 16.8% wt, kg/m3\n",
+ "rho2 = 998.1 #Density of solution at 6.8% wt, kg/m3\n",
+ "DAB = 0.740e-9 #Diffusivity of Ethanol, m2/s\n",
+ "MA = 46.05 #Molecular wt of ethanol\n",
+ "MB = 18.02 #Molecular wt of Water\n",
+ "xw1 = 16.8 #weight % of Ethanol at 1\n",
+ "xw2 = 6.8 #weight % of Ethanol at 2\n",
+ "z1 = 0. #Location 1, m\n",
+ "z2 = 2.e-3 #Location 2, m\n",
+ "#Calculation\n",
+ "\n",
+ "xmA1 = xw1/MA/(xw1/MA+(100-xw1)/MB)\n",
+ "xmA2 = xw2/MA/(xw2/MA+(100-xw2)/MB)\n",
+ "xmB1 = 1. - xmA1\n",
+ "xmB2 = 1. - xmA2\n",
+ "MW1 = MA*xmA1 + MB*xmB1\n",
+ "MW2 = MA*xmA2 + MB*xmB2\n",
+ "Cav = (rho1/MW1+rho2/MW2)/2.\n",
+ "xBM = (xmB1+xmB2)/2.\n",
+ "NA = DAB*Cav*(xmA1-xmA2)/(xBM*(z2-z1))\n",
+ "\n",
+ "#Result\n",
+ "print 'Steady State flux of Ethanol: %4.3e'%(NA), \"kgmol/(m2.s)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Steady State flux of Ethanol: 8.998e-07 kmol/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.3-2, Page number 402"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Prediction of Liquid Diffusivity \n",
+ "from math import sqrt\n",
+ "#Variable declaration\n",
+ "T1 = 25 #Temperature of solution, degC\n",
+ "T2 = 50 #Temperature of solution, degC\n",
+ "mu25B = 0.8937e-3 #Viscosity of Water at 25 degC, Pa.s\n",
+ "mu50B = 0.5494e-3 #Viscosity of Water at 50 degC, Pa.s\n",
+ "MB = 18.02\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "mvA = 3*0.0148 + 6*0.0037 + 1*0.0074\n",
+ "si = 2.6\n",
+ "\n",
+ "def LiquidDiffusivity(muB,T):\n",
+ " dab = 1.173e-16*sqrt(si*MB)*T/(muB*mvA**0.6)\n",
+ " print 'Liquid diffusivity of Acetone in Water at %5.3f \u00b0C is %5.3e m2/s' %(T,dab)\n",
+ " return \n",
+ "\n",
+ "LiquidDiffusivity(mu25B,T1+273)\n",
+ "LiquidDiffusivity(mu50B,T2+273)\n",
+ "#Result\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Liquid diffusivity of Acetone in Water at 298.000 \u00b0C is 1.277e-09 m2/s\n",
+ "Liquid diffusivity of Acetone in Water at 323.000 \u00b0C is 2.251e-09 m2/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.4-1, Page number 405"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Prediction of Diffusivity of Albumin\n",
+ "\n",
+ "#Variable declaration\n",
+ "T = 298 #Temperature, K\n",
+ "MA = 67500 #Molecular Weight of Albumin\n",
+ "muw298 = 0.8937e-3 #Viscosity of water at 298 K, Pa.s\n",
+ "\n",
+ "#Calculations\n",
+ "DAB = 9.4e-15*T/(muw298*MA**(1./3))\n",
+ "\n",
+ "#Result\n",
+ "print 'Diffusivity of Albumin in Water at 298 K %3.2e m2/s'%(DAB)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Diffusivity of Albumin in Water at 298 K 7.70e-11 m2/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.4-2, Page number 407"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Diffusion of urea in Agar\n",
+ "\n",
+ "#Variable Declaration\n",
+ "CA1 = 0.2 #Concentration at one end of tube\n",
+ "CA2 = 0.0 #Concentration at other end of tube\n",
+ "z1 = 0.0\n",
+ "z2 = 0.04 #Location of other end of tube from end 1\n",
+ "DAB = 0.727e-9 #Diffusivity of urea \n",
+ "\n",
+ "#Calculation\n",
+ "NA = DAB*(CA1-CA2)/(z2-z1)\n",
+ "\n",
+ "#Result\n",
+ "print 'Steady State Flux of urea through agar solution:%4.3e kgmol/(m2.s)'%(NA)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Steady State Flux of urea through agar solution:3.635e-09 kmol/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5-1, Page number 409"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Diffusion of H2 through Neoprene Membrance\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "T = 17 #Temnperature of hydrogen, deg C\n",
+ "pH21 = 0.01 #Partial pressure of H2 on one end of membrane, atm\n",
+ "z = 0.5 #Membrane thickness, mm\n",
+ "pH22 = 0.0 #Partial pressure of H2 on other end of membrane, atm\n",
+ "S = 0.051 #Solubility of H2 in Neoprene, [m3 at STP/(m3solid.atm)]\n",
+ "DAB = 1.03e-10 #Diffusivity at 17 deg C, m2/s\n",
+ "\n",
+ "#Calculations\n",
+ "cA1 = S*pH21/22.414\n",
+ "cA2 = S*pH22/22.414\n",
+ "NA = DAB*(cA1-cA2)/(z/1000.)\n",
+ "\n",
+ "#Results\n",
+ "print 'concentrations at face 1 and face 2 are %3.2e and %3.2e kgmol H2/m3 solid respectively'%(cA1,cA2)\n",
+ "print 'Steady State Flux of Hydrogen through Neoprene membrane:%5.2e'%(NA),\"kgmol H2/(m2.s)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "concentrations at face 1 and face 2 are 2.28e-05 and 0.00e+00 kgmol H2/m3 solid respectively\n",
+ "Steady State Flux of Hydrogen through Neoprene membrane:4.69e-12 kgmol H2/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5-2, Page number 411"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Diffusion through a Packaging Film using Permeability\n",
+ "\n",
+ "#Variable Declaration\n",
+ "z = 0.00015 #Thickness of the pkg film, m\n",
+ "T = 30. #Temperature of the film, deg C\n",
+ "pO21 = 0.21 #Partial pressure of O2 outside the film, atm\n",
+ "pO22 = 0.01 #Partial pressure of O2 inside the film, atm\n",
+ "PM = 4.17e-12 #Permeability of the film m3 solute STP/(s.m2.atm/m)\n",
+ "\n",
+ "#Calcualtions\n",
+ "NA = PM*(pO21-pO22)/(22.414*z)\n",
+ "\n",
+ "#Result\n",
+ "print 'Diffusional flux of the Oxygen through the polyethylene film:%10.3e kgmol/(m2.s)'%(NA)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Diffusional flux of the Oxygen through the polyethylene film: 2.481e-10 kgmol/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5-3, Page number 412"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Diffusion of KCl in porous Silica\n",
+ "\n",
+ "#Variable Declaration\n",
+ "z = 0.002 #Thickness of Silica, m\n",
+ "DAB = 1.87e-9 #Diffusivity of KCl in water, m2/s\n",
+ "cA1 = 0.1 #Concentration of KCl, kmol/m3\n",
+ "cA2 = 0.0 #Concentration of KCl on other side of Silica\n",
+ "epps = 0.3 #Porosity of Silica\n",
+ "tau = 4.0 #Tortuosity\n",
+ "\n",
+ "#Calculation\n",
+ "NA = epps*DAB*(cA1-cA2)/(tau*z)\n",
+ "\n",
+ "#Results\n",
+ "print 'Diffusional flux of the KCl through the Porous Silica: %5.2e kmol/(m2.s)'%(NA)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Diffusional flux of the KCl through the Porous Silica: 7.01e-09 kmol/(m2.s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.6-1, Page number 416"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Numerical Method for Convection and Steady State Diffusion\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable Declaration\n",
+ "ci = 6.00e-3 #Inside concentration, kmol/m3\n",
+ "kc = 2.0e-7 #Outside convective coefficient, m/s\n",
+ "cinf = 2.00e-3 #Outside concentration, kmol/m3\n",
+ "DAB = 1.0e-9 #Diffusivity in solid, m2/s\n",
+ "dx = dy = 0.005 #Grid size in x and y directions, m\n",
+ "K = 1.0 #Distribution coefficient\n",
+ "\n",
+ "#Calculations\n",
+ "kdxbyD = kc*dx/DAB\n",
+ "\n",
+ "#Index used are one less as in book\n",
+ "c1 = np.zeros(5)\n",
+ "c2 = np.zeros(5)\n",
+ "c3 = np.zeros(5)\n",
+ "\n",
+ "\n",
+ "cinf = cinf*1e3\n",
+ "ci = ci*1e3\n",
+ "np.set_printoptions(precision=2)\n",
+ "\n",
+ "#Initializations\n",
+ "c1[2] = c1[3] = ci\n",
+ "c2[1] = 3.8\n",
+ "c1[1] = c2[2] = c2[4] = 4.2\n",
+ "c2[3] = 4.4\n",
+ "c3[0] = 2.5\n",
+ "c3[1] = c2[0] = 2.7\n",
+ "c3[2] = c3[4] = 3.0\n",
+ "c3[3] = 3.2\n",
+ "\n",
+ "for j in range(3):\n",
+ " N22 = c1[1]+c3[1]+c2[0]+c2[2]-4*c2[1]\n",
+ " c2[1] = (c1[1]+ c3[1]+c2[0]+c2[2])/4\n",
+ " N23 = c2[1]+c2[3]+c1[2]+c3[2]-4*c2[2]\n",
+ " c2[2] = c2[4] = c1[1] = (c2[1]+c2[3]+c1[2]+c3[2])/4\n",
+ " N24 = c2[2]+c2[4]+c1[3]+c3[3]-4*c2[3]\n",
+ " c2[3] = (c2[2]+c2[4]+c1[3]+c3[3])/4\n",
+ " N31 = kdxbyD*cinf + (c2[0]+c3[1])/2 - (kdxbyD+1)*c3[0] \n",
+ " c3[0] = (kdxbyD*cinf + (c2[0]+c3[1])/2)/(kdxbyD+1) \n",
+ " N32 = kdxbyD*cinf + (2*c2[1]+c3[0]+c3[2])/2 - (kdxbyD+2)*c3[1]\n",
+ " c3[1] = c2[0] =(kdxbyD*cinf + (2*c2[1]+c3[0]+c3[2])/2)/(kdxbyD+2)\n",
+ " N33 = kdxbyD*cinf + (2*c2[2]+c3[1]+c3[3])/2-(kdxbyD+2)*c3[2]\n",
+ " c3[2] = c3[4] = (kdxbyD*cinf + (2*c2[2]+c3[1]+c3[3])/2)/(kdxbyD+2)\n",
+ " N34 = kdxbyD*cinf + (2*c2[3]+c3[2]+c3[4])/2 -(kdxbyD+2)*c3[3]\n",
+ " c3[3] = (kdxbyD*cinf + (2*c2[3]+c3[2]+c3[4])/2)/(kdxbyD+2)\n",
+ " \n",
+ " \n",
+ "c1[0] = c3[2]\n",
+ "c1[4] = c1[2]\n",
+ "\n",
+ "No = kc*(dx*1.)*((c3[0]-cinf)/2+(c3[1]-cinf)+(c3[2]-cinf)+(c3[3]-cinf)/2)*1e-3\n",
+ "Ni = DAB*(dx*1.)*((c1[2]-c2[2])+(c1[3]-c2[3])/2)*1e-3/dy\n",
+ "#Results\n",
+ "print \"Concentration Values at nodes are as follows\"\n",
+ "print \"C 1 2 3 4 \"\n",
+ "print 1,c1[:4]\n",
+ "print 2,c2[:4]\n",
+ "print 3,c3[:4]\n",
+ "\n",
+ "print '\\nThe average flux is %6.3e kmol/s'%((Ni+No)*.5)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Concentration Values at nodes are as follows\n",
+ "C 1 2 3 4 \n",
+ "1 [ 3.06 4.23 6. 6. ]\n",
+ "2 [ 2.73 3.48 4.23 4.41]\n",
+ "3 [ 2.36 2.73 3.06 3.15]\n",
+ "\n",
+ "The average flux is 2.554e-12 kmol/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 47
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file