{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter No - 10 : Mass Transfer\n",
      "    "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  10.1 - Page No. : 318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "P1=4     # in bar\n",
      "P2=2     # in bar\n",
      "T=25     # in degree C\n",
      "Dhp=9*10**-8     # in m**2/s\n",
      "S=3*10**-3     # in kg mole/m**3 bar\n",
      "del_x=0.5*10**-3     # thickness in m\n",
      "#(a) The molar concentration of a gas in terms of solubility\n",
      "CH1=S*P1     # in kg mole/m**3\n",
      "CH2=S*P2     # in kg mole/m**3\n",
      "#(b) Molar diffusion flux of hydrogen through plastic memberence is given by Fick's law of diffision\n",
      "#N_H= N_h/A = Dhp*(CH1-CH2)/del_x#\n",
      "N_H= Dhp*(CH1-CH2)/del_x     # in kg mole/s-m**2\n",
      "print \"Molar diffusion flux of hydrogen through the membrane = %0.2e kg mole/s-m**2\" %N_H\n",
      "#Mass_d_Flux= N_H*Molecular_Weight \n",
      "Molecular_Weight=2#\n",
      "Mass_d_Flux= N_H*Molecular_Weight \n",
      "print \"Molar diffusion flux = %0.3e kg/s-m**2\" %Mass_d_Flux"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Molar diffusion flux of hydrogen through the membrane = 1.08e-06 kg mole/s-m**2\n",
        "Molar diffusion flux = 2.160e-06 kg/s-m**2\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  10.2 - Page No. : 322"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "T=25     # in degree C\n",
      "T=T+273     # in K\n",
      "P=1#\n",
      "V1=12     #Molecular volume of H2 in cm**3/gm mole\n",
      "V2=30     #Molecular volume of Air in cm**3/gm mole\n",
      "M1=2     # Molecular weight of H2\n",
      "M2=29     # Molecular weight of Air\n",
      "#The diffusion coefficient for gases in terms of molecular volumes may be express as\n",
      "D_AB= .0043*T**(3/2)/(P*(V1**(1/3)+V2**(1/3)))*(1/M1+1/M2)**(1/2)#\n",
      "print \"The diffusion coefficient for gases in terms of molecular volumes = %0.3f cm**2/sec\" %D_AB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusion coefficient for gases in terms of molecular volumes = 2.997 cm**2/sec\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  10.3 - Page No. : 322"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "T=300     # temp of gas mixture in K\n",
      "D_HN2=18*10**-6     # in m**2/s at 300 K, 1 bar\n",
      "T1=300     # in K\n",
      "D_HO2=16*10**-6     # in m**2/s at 273 K, 1 bar\n",
      "T2=273     # in K\n",
      "O_2=0.2#\n",
      "N_2=0.7#\n",
      "H_2=0.1#\n",
      "#The diffusivity at the mixture temperature and pressure are calculated as \n",
      "# D1/D2 = (T1/T2)**(3/2)*(P2/P1)\n",
      "D_HO2= (T/T2)**(3/2)*1/4*D_HO2#\n",
      "D_HN2= (T/T1)**(3/2)*1/4*D_HN2#\n",
      "#The composition of oxygen and nitrogen on a H2 free basis is \n",
      "x_O= O_2/(1-H_2)#\n",
      "x_N= N_2/(1-H_2)#\n",
      "\n",
      "# The effective diffusivity for the gas mixture at given temperature and pressure is\n",
      "D= 1/(x_O/D_HO2+x_N/D_HN2)     # in m**2/s\n",
      "print \"Effective diffusivity = %0.3e m**2/s\" %D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Effective diffusivity = 4.524e-06 m**2/s\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  10.4 - Page No. : 323"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# Given data\n",
      "d=3     # in mm\n",
      "d=d*10**-3     # in meter\n",
      "T=25     # in \u00b0C\n",
      "T=T+273     # in K\n",
      "D= 0.4*10**-4     # in m**2/s\n",
      "R= 8314#\n",
      "P_A1=1     # in atm\n",
      "P_A1=P_A1*10**5     # in w/m**2\n",
      "P_A2=0#\n",
      "C_A2=0#\n",
      "x2= 15     # in meter\n",
      "x1= 0#\n",
      "A= pi/4*d**2#\n",
      "M_A= D*A/(R*T)*(P_A1-P_A2)/(x2-x1)     # in kg mole/sec\n",
      "N_B= M_A#\n",
      "M_B= M_A*29     # in kg/sec\n",
      "print \"Value of N_B = %0.3e kg mole/sec\" %N_B\n",
      "print \"Value of M_B = %0.3e kg /sec\" %M_B"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of N_B = 7.608e-13 kg mole/sec\n",
        "Value of M_B = 2.206e-11 kg /sec\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  10.5 - Page No. : 325"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "# Given data\n",
      "P=3     # in atm\n",
      "P=P*10**5     # in N/m**2\n",
      "r1=10     # in mm\n",
      "r1=r1*10**-3     # in m\n",
      "r2=20     # in mm\n",
      "r2=r2*10**-3     # in m\n",
      "R=4160     # in J/kg-K\n",
      "T=303     # in K\n",
      "D=3*10**-8     # in m**2/s\n",
      "S=3*0.05# # Solubility of hydrogen at a pressure of 3 atm in m**3/m**3 of rubber tubing\n",
      "del_x=r2-r1     # in m\n",
      "L=1     # in m\n",
      "Am=2*pi*L*del_x/log(r2/r1)#\n",
      "#Formula P*V= m*R*T\n",
      "V=S#\n",
      "m=P*V/(R*T)     # in kg/m**3 of rubber tubing at the inner surface of the pipe\n",
      "C_A1=m#\n",
      "C_A2=0#\n",
      "#Diffusion flux through the cylinder is given\n",
      "M=D*(C_A1-C_A2)*Am/del_x#\n",
      "print \"Diffusion flux through the cylinder = %0.2e kg/sm\" %M"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diffusion flux through the cylinder = 9.71e-09 kg/sm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  10.6 - Page No. :  329"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# Given data\n",
      "R=4160     # in J/kg-K\n",
      "M=2#\n",
      "D_AB=1.944*10**-8     # in m**2/s\n",
      "R_H2=R/M#\n",
      "S=2*0.0532# # Solubility of hydrogen at a pressure of 2 atm in cm**3/cm**3 of pipe\n",
      "P=2     # in atm\n",
      "P=P*1.03*10**5     # N/m**2\n",
      "T=25     # in degree C\n",
      "T=T+273     # in K\n",
      "r1=2.5     # in mm\n",
      "r1=r1*10**-3     # in m\n",
      "r2=5     # in mm\n",
      "r2=r2*10**-3     # in m\n",
      "del_x=r2-r1     # in m\n",
      "L=1     # in m\n",
      "#Formula P*V= m*R*T\n",
      "V=S#\n",
      "m=P*V/(R*T)     # in kg/m**3 of pipe\n",
      "# So, Concentration of H2 at inner surface of the pipe\n",
      "C_A1=0.0176     # in kg/m**3\n",
      "# The resistance of diffusion of H2 away from the outer surface is negligible i.e.\n",
      "C_A2=0#\n",
      "Am=2*pi*L*del_x/log(r2/r1)#\n",
      "# Loss of H2 by diffusion \n",
      "M_A= D_AB*(C_A1-C_A2)*Am/del_x#\n",
      "print \"Loss of H2 by diffusion = %0.2ef kg/s\" %M_A"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Loss of H2 by diffusion = 3.10e-09f kg/s\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No :  10.7 - Page No. : 330"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "from math import log\n",
      "# Given data\n",
      "Px1= 0.14     # in bar\n",
      "Px2= 0#\n",
      "P=1.013     # in bar\n",
      "Py1=P-Px1# # in bar\n",
      "Py2=P-Px2# # in bar\n",
      "D=8.5*10**-6     # in m**2/s\n",
      "d=5     # diameter in meter\n",
      "L=1     # in mm\n",
      "L=L*10**-3     #in meter\n",
      "M=78     # molecular weight\n",
      "Am_x= 1/4*pi*d**2*M#\n",
      "R=8314#\n",
      "del_x=3     # thickness in mm\n",
      "del_x=del_x*10**-3     # in m\n",
      "T=20     # in degree C\n",
      "T=T+273     # in K\n",
      "P=P*10**5     # in N/m**2\n",
      "m_x= D*Am_x*P*log(Py2/Py1)/(R*T*del_x)#\n",
      "# The mass of the benzene to be evaporated\n",
      "mass= 1/4*pi*d**2*L#\n",
      "density=880     # in kg/m**3\n",
      "m_b= mass*density#\n",
      "toh=m_b/m_x     # in sec\n",
      "print \"Time taken for the entire organic compound to evaporate = %0.0f seconds\" %toh\n",
      "\n",
      "\n",
      "# Note: Answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken for the entire organic compound to evaporate = 644 seconds\n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}