{
 "metadata": {
  "name": "",
  "signature": "sha256:986b48c61b98a83c6355e5fa469ece02cfaf500811fa7f186097ba3e31e4763e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13: Membrane Seperation Process"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2-1, Page number 756"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Membrane Diffusion and Liquid Film Resistances\n",
      "\n",
      "#Variable declaration\n",
      "C1 = 3.e-2                        #The concentration of solute A (mol.kg/m3)\n",
      "L = 3.e-5                         #Thickness of the membrane (m)\n",
      "K = 1.5                           #The distribution coefficient \n",
      "Dab = 7.e-11                      #The distribution coefficient \n",
      "C2 = 0.5e-2                       #Concentration on the other side (mol.kg/m3)\n",
      "kc2 = 2.02e-5                     #Mass transfer cofficient (m/s)\n",
      "\n",
      "#Calculation\n",
      "#Part (a) is therotical\n",
      "        #Calculation for part (b)\n",
      "#p_M = D_ab*K/L\n",
      "pM = Dab*K/L\n",
      "#N_a = (C_1 - C_2)/(1/p_M + 1/k_c2)\n",
      "Na = (C1 - C2)/(1/pM + 1/kc2)\n",
      "    #To calculate C_2i \n",
      "#N_a = k_c2*(C_2i - C_2)\n",
      "#C_2i = N_a/k_c2 + C_2\n",
      "C2i = Na/kc2 + C2\n",
      "#K = C_2is/C_2i\n",
      "#C_2is = K*C_2i\n",
      "C2is = K*C2i\n",
      "\n",
      "#Result\n",
      "print 'The flux at the interface membrane is %5.3e kg.mol/s.m2'%(Na)\n",
      "print 'The concentration at the interface membrane is %5.3e kg.mol/m3'%(C2is)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flux at the interface membrane is 7.458e-08 kg.mol/s.m2\n",
        "The concentration at the interface membrane is 1.304e-02 kg.mol/m3\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2-2, Page number 758"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Dialysis to Remove Urea from Blood\n",
      "\n",
      "#Variable declaration\n",
      "kc1 = 1.25e-5                     #Estimated blood side mass transfer cofficient (m/s)\n",
      "kc2 = 3.33e-5                     #Estimated aqueous side mass transfer cofficient (m/s)\n",
      "pM = 8.73e-6                      #Permeability of the membrane (m/s)\n",
      "c1 = 200.                         #Concentration of urea in blood (g/m3)\n",
      "c2 = 0.                           #Concentration of urea in dialyzing fluid (g/m3)\n",
      "t = 3600.                         #Time given for blood removal (sec)\n",
      "A = 2.                            #Area of membrane (m2)\n",
      "#Calculation\n",
      "Na = (c1 - c2)/(1/kc1 + 1/pM + 1/kc2)\n",
      "R = Na*t*A\n",
      "#Result\n",
      "print 'The flux of urea through membrane %5.2e g/(m2.s)'%(Na) \n",
      "print 'The rate of removal of urea from membrane is %5.3f g Urea/h'%(R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flux of urea through membrane 8.91e-04 g/(m2.s)\n",
        "The rate of removal of urea from membrane is 6.412 Urea g/h\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4-1, Page number 766"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Design of Membrane Unit for Complete Mixing\n",
      "\n",
      "#Variable declaration\n",
      "qf = 1.e4                  #Feed flow rate (STP/s)\n",
      "xf = 0.5                   #Mole fraction of A in feed\n",
      "x0 = 0.25                  #The desired composition of the reject\n",
      "t = 2.54e-3                #Thickness of membrane (cm)\n",
      "ph = 80.                   #Pressure on feed side (cm Hg)\n",
      "pl = 20.                   #Pressure on permeate side (cm Hg)\n",
      "PA = 50e-10                #Permeability of A (cm3(STP).cm/s.cm2.cmHg)\n",
      "PB = 5e-10                 #Permeability of B (cm3(STP).cm/s.cm2.cmHg)\n",
      "\n",
      "#Calculation\n",
      "alpha = PA/PB\n",
      "a = 1 - alpha\n",
      "b = (ph/pl)*(1 - x0) - 1 + alpha*(ph/pl)*x0 + alpha\n",
      "c = -alpha*x0*(ph/pl)\n",
      "\n",
      "yp = (-b + sqrt(b**2 - 4*a*c))/(2*a)\n",
      "    #x_0 = (x_f - theta*Y_p)/(1 - theta)\n",
      "theta = (x0 - xf)/(x0- yp)\n",
      "Am = theta*qf*yp/((PA/t)*(ph*x0-pl*yp))\n",
      "#Result\n",
      "print 'The membrane area calculated is %5.3e cm2 or %5.3e m2'%(Am, Am/1e4),\"\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The membrane area calculated is 2.734e+08 cm2 or 2.734e+04 m2 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4-2, Page number 767"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Membrane Design for Seperation of Air\n",
      "\n",
      "#Variable declaration\n",
      "qf = 1.e6                  #Feed flow rate (STP/s)\n",
      "t = 1.e-3                  #Thickness of membrane (cm)\n",
      "ph = 190.                  #Pressure on feed side (cm Hg)\n",
      "p1 = 19.                   #Pressure on permeate side (cm Hg)\n",
      "PA = 500e-10               #Permeability of A (cm3(STP).cm/s.cm2.cmHg)\n",
      "xf = 0.209                 #Mole fraction of A in feed\n",
      "alpha = 10.                #oxygen permeability divided by nitrogen permeability\n",
      "theta = 0.2                #Fraction cut\n",
      "t = 2.54e-3                #Thickness of membrane (cm)\n",
      "#Calculation\n",
      "a1 = theta + p1/ph - (p1/ph)*theta - alpha*theta - alpha*(p1/ph) + alpha*theta*(p1/ph)\n",
      "b1 = 1 - theta - xf - (p1/ph) + (p1/ph)*theta + alpha*theta + alpha*(p1/ph) - alpha*theta*(p1/ph) + alpha*xf\n",
      "c1 = -alpha*xf\n",
      "yp = (-b1 + sqrt(b1**2 - 4*a1*c1))/(2*a1)\n",
      "x0 = (xf - theta*yp)/(1 - theta)\n",
      "Am = theta*qf*yp/((PA/t)*(ph*x0 - p1*yp))\n",
      "\n",
      "#Result\n",
      "print \"The permeate composition is \",round(yp,4)\n",
      "print \"The reject composition is \",round(x0,4)\n",
      "print 'The area of membrane is %5.3e cm2'%(Am)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The permeate composition is  0.5068\n",
        "The reject composition is  0.1345\n",
        "The area of membrane is 3.231e+08 cm2\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4-3, Page number 769"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Effect of Feed Composition on Minimum Reject Concentration\n",
      "\n",
      "#Variable declaration\n",
      "qf = 1.e4                  #Feed flow rate (STP/s)\n",
      "xf = 0.5                   #Mole fraction of A in feed\n",
      "x0 = 0.25                  #The desired composition of the reject\n",
      "t = 2.54e-3                #Thickness of membrane (cm)\n",
      "ph = 80.                   #Pressure on feed side (cm Hg)\n",
      "pl = 20.                   #Pressure on permeate side (cm Hg)\n",
      "PA = 50e-10                #Permeability of A (cm3(STP).cm/s.cm2.cmHg)\n",
      "PB = 5e-10                 #Permeability of B (cm3(STP).cm/s.cm2.cmHg)\n",
      "\n",
      "#Calculations\n",
      "\n",
      "# for xf = 0.5\n",
      "alpha = PA/PB\n",
      "xoM =xf*(1+(alpha-1)*pl/ph*(1-xf))/(alpha*(1-xf)+xf)\n",
      "print \"Reject Concentration for xf = 0.50:\",round(xoM,4)\n",
      "\n",
      "# for xf = 0.65\n",
      "xf = 0.65\n",
      "alpha = PA/PB\n",
      "xoM =xf*(1+(alpha-1)*pl/ph*(1-xf))/(alpha*(1-xf)+xf)\n",
      "print \"Reject Concentration for xf = 0.65:\",round(xoM,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reject Concentration for xf = 0.50: 0.1932\n",
        "Reject Concentration for xf = 0.65: 0.28\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.5-1, Page number 771"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Design of Membrane Unit for Multicomponenet Mixture \n",
      "\n",
      "#Variable declaration\n",
      "qf = 1.e4                  #Feed flow rate (STP/s)\n",
      "xfA = 0.25                 #Mole fraction of A in feed\n",
      "xfB = 0.55                 #Mole fraction of B in feed\n",
      "xfC = 0.20                 #Mole fraction of A in feed\n",
      "x0 = 0.25                  #The desired composition of the reject\n",
      "t = 2.54e-3                #Thickness of membrane (cm)\n",
      "ph = 300.                  #Pressure on feed side (cm Hg)\n",
      "pl = 30.                   #Pressure on permeate side (cm Hg)\n",
      "PA = 200e-10               #Permeability of A (cm3(STP).cm/s.cm2.cmHg)\n",
      "PB = 50e-10                #Permeability of B (cm3(STP).cm/s.cm2.cmHg)\n",
      "PC = 25e-10                #Permeability of C (cm3(STP).cm/s.cm2.cmHg)\n",
      "theta = 0.25               #Fraction to be permeated\n",
      "\n",
      "#Calculations\n",
      "qp = theta*qf\n",
      "ypA = 0.501\n",
      "eR = 1.\n",
      "while abs(eR) >= 0.000001:\n",
      "    Am = qp*ypA*t/(PA*(ph/(1-theta)*(xfA-theta*ypA)-pl*ypA))\n",
      "    ypB = ph*xfB/((1-theta)*(qp*t/(PB*Am)+theta*ph/(1-theta)+pl))\n",
      "    ypC = ph*xfC/((1-theta)*(qp*t/(PC*Am)+theta*ph/(1-theta)+pl))\n",
      "    syp = ypA + ypB + ypC \n",
      "    eR = 1.- syp\n",
      "    ypA = ypA + eR/3.4\n",
      "ypA = ypA - eR/3.4\n",
      "xoA = xfA/(1-theta)-theta*ypA/(1-theta)\n",
      "xoB = xfB/(1-theta)-theta*ypB/(1-theta)\n",
      "xoC = xfC/(1-theta)-theta*ypC/(1-theta)\n",
      "sxo = xoA + xoB + xoC\n",
      "print \"Permeate compositions are yoA, yoB, yoC\"\n",
      "print round(ypA,4), round(ypB,4), round(ypC,4),\"respectively for A,B,C\"\n",
      "print \"Reject compositions are xoA, xoB, xoC\"\n",
      "print round(xoA,4), round(xoB,4), round(xoC,4),\"respectively for A,B,C\"\n",
      "print 'Membrane area %10.4e'%(Am),\"cm2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Permeate compositions are yoA, yoB, yoC\n",
        "0.4553 0.4503 0.0944 respectively for A,B,C\n",
        "Reject compositions are xoA, xoB, xoC\n",
        "0.1816 0.5832 0.2352 respectively for A,B,C\n",
        "Membrane area 3.5418e+06 cm2\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.6-1, Page number 775"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Design of Membrane Unit Using Cross Flow\n",
      "import numpy as np\n",
      "from scipy.interpolate import interp1d\n",
      "from scipy.integrate import quad, simps\n",
      "from scipy.optimize import root\n",
      "from math import sqrt\n",
      "\n",
      "#Variable declaration\n",
      "qf = 1.e6                  #Feed flow rate (STP/s)\n",
      "t = 1e-3                   #Thickness of membrane (cm)\n",
      "ph = 190.                  #Pressure on feed side (cm Hg)\n",
      "pl = 19.                   #Pressure on permeate side (cm Hg)\n",
      "PA = 500e-10               #Permeability of A (cm3(STP).cm/s.cm2.cmHg)\n",
      "xf = 0.209                 #Mole fraction of A in feed\n",
      "alpha = 10.                #oxygen permeability divided by nitrogen permeability\n",
      "theta = 0.2                #Fraction cut\n",
      "tk = 2.54e-3               #Thickness of membrane (cm)\n",
      "\n",
      "x0 = np.array([0.1190,0.1420,0.1642,0.1870,0.2090])\n",
      "\n",
      "#Calculation\n",
      "np.set_printoptions(precision=3)\n",
      "sorted(x0)\n",
      "thetas = np.zeros((len(x0)))\n",
      "u = np.zeros(len(x0))\n",
      "iI = np.zeros(len(x0))\n",
      "fi = np.zeros((len(x0)))\n",
      "Fi = np.zeros((len(x0)))\n",
      "yp = np.zeros((len(x0)))\n",
      "\n",
      "iF = xf/(1.-xf)\n",
      "D = 0.5*((1.-alpha)*pl/ph+alpha)\n",
      "F = -0.5*((1.-alpha)*pl/ph-1.)\n",
      "E = alpha/2.-D*F\n",
      "R = 1./(2*D-1.)\n",
      "S = (alpha*(D-1.)+F)/((2.*D-1.)*(alpha/2.-F))\n",
      "T = 1./(1-D-E/F)\n",
      "uf = -D*iF+sqrt(D**2*iF**2+2.*E*iF+F**2)\n",
      "print ' thetas[j]      x         yp        Fi       '\n",
      "\n",
      "for j in range(len(x0)):\n",
      "    i = iI[j] = x[j]/(1.-x[j])\n",
      "    u = -D*i+sqrt((D*i)**2 + 2*E*i + F**2)\n",
      "    k1 = ((uf-E/D)/(u-E/D))**R\n",
      "    k2 = ((uf-alpha+F)/(u-alpha+F))**S\n",
      "    k3 = ((uf-F)/(u-F))**T\n",
      "    k0 = (1-xf)/(1-x[j])\n",
      "    thetas[j] = 1.- k0*k1*k2*k3\n",
      "    fi[j] = (D*i-F) + sqrt(D**2*i**2 + 2*E*i+F**2)\n",
      "    Fi[j] =(1-thetas[j])*(1-x0[j])/((fi[j]-i)*(1./(1.+ i)-(pl/ph)*(1./(1.+fi[j]))))\n",
      "    if thetas[j]==0.0:\n",
      "        f = lambda y: y/(1-y) - alpha*(x0[j]-pl*y/ph)/((1-x0[j])-pl*(1-y)/ph)\n",
      "        sol = root(f,0.6)\n",
      "        yp[j] = sol.x[0]\n",
      "    else:\n",
      "        yp[j] = (xf-x0[j]*(1.0-thetas[j]))/thetas[j]\n",
      "    print '%8.5f   %8.5f   %8.5f   %8.5f   '%(thetas[j], x0[j], yp[j],Fi[j])\n",
      "\n",
      "Fun = interp1d(iI,Fi)\n",
      "I = quad(Fun,iI[0],iI[len(x0)-1])[0]\n",
      "Am = tk*qf/(ph*PA/alpha)*I\n",
      "\n",
      "#Result\n",
      "\n",
      "#Part A\n",
      "print \"PART A\"\n",
      "print 'Reject composition x0: %4.3f'%x0[0]\n",
      "print 'Permeate composition yp: %4.3f'%yp[0]\n",
      "print 'Total Membrane Area: %6.4e cm2'%(Am)\n",
      "\n",
      "#Part B\n",
      "print \"PART B\"\n",
      "print 'For PART B of Example 13.4-2 The permeate composition was 0.5068 as compared to %4.3f for cross flow' %yp[len(x0)-1] \n",
      "print 'For PART B of Example 13.4-2 The area of membrane was 3.2314e+08 cm2 as compared to %5.4e cm2 \\nfor cross flow'%(Am)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " thetas[j]      x0        yp        Fi       \n",
        " 0.20008    0.11900    0.56881    1.15197   \n",
        " 0.14813    0.14200    0.59429    0.96040   \n",
        " 0.09910    0.16420    0.61629    0.82535   \n",
        " 0.04892    0.18700    0.63675    0.71994   \n",
        " 0.00000    0.20900    0.65483    0.64034   \n",
        "Area under the curve is:0.1090"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "PART A\n",
        "Reject composition x0: 0.119\n",
        "Permeate composition yp: 0.569\n",
        "Total Membrane Area: 2.9135e+08 cm2\n",
        "PART B\n",
        "For PART B of Example 13.4-2 The permeate composition was 0.5068 as compared to 0.655 for cross flow\n",
        "For PART B of Example 13.4-2 The area of membrane was 3.2314e+08 cm2 as compared to 2.9135e+08 cm2 \n",
        "for cross flow\n"
       ]
      }
     ],
     "prompt_number": 97
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.9-1, Page number 784"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculation of Osmotic Pressure of Salt Solution\n",
      "\n",
      "#Variable declaration\n",
      "T = 298.5                        #Temperature of solution (k)\n",
      "Rho = 997.                       #Density of the solution (kg/m3)\n",
      "m = 0.1                          #Moles of NaCl present (g.mol)\n",
      "R = 82.057e-3                    #Gas constant \n",
      "#Calculations\n",
      "n = (2*m)*1.e-3\n",
      "Vm = 1/Rho\n",
      "Pi = n*R*T/(Vm)\n",
      "#Result \n",
      "print \"The calculated osmotic pressure is \",round(Pi,2),\"atm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The calculated osmotic pressure is  4.88 atm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.9-2, Page number 786"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Experimental Determination of Membrane Permeability\n",
      "\n",
      "#Variable declaration\n",
      "R = 82.057e-3        #Gas constant \n",
      "c1 = 10.0            #KgNaCl/m3 solution at inlet\n",
      "c2 = 0.39            #Concentration of salt in outlet, KgNaCl/m3 solution\n",
      "rho1 = 1004          #Density of inlet solution, Kg/m3\n",
      "rho2 = 997.0         #Density of outlet solution, Kg/m3\n",
      "delP = 54.42         #Pressure difference across membrane, atm\n",
      "A = 2.0e-3           #Area of membrane, m2\n",
      "V = 1.92e-8          #Flow rate of product, m3solution/s\n",
      "MW = 58.45           #Molecular Wt of NaCl\n",
      "#Calculations\n",
      "\n",
      "Nw = V*rho2/A\n",
      "Ns = Nw*c2/rho2\n",
      "C1 = c1*1000/((rho1-c1)*MW)    #molNaCL/kgwater in inlet water\n",
      "pi1 = 7.80                     #from table 13.9-1 obtained by interpolation,atm\n",
      "cw2 = rho2-c2 \n",
      "C2 = c2*1000/((cw2)*MW)        #molNaCL/kgwater in outgoing water \n",
      "pi2 = 0.32                     #from table 13.9-1 obtained by interpolation, atm\n",
      "delpi = pi1-pi2\n",
      "Aw = Nw/(delP-delpi)\n",
      "As = Ns/(c1-c2)\n",
      "R = (c1-c2)/c1\n",
      "B = Aw/(As*cw2)\n",
      "R = B*(delP-delpi)/(1+B*(delP-delpi))\n",
      "#Result \n",
      "print 'Solvent Permeability constant Aw =%6.4e kg solvent/(m2.s.atm)'%(Aw)\n",
      "print 'Solute Permeability constant As=%6.4e m/s'%(As)\n",
      "print \"Solute Rejection R=\", round(R,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Solvent Permeability constant 2.0390e-04 kg solvent/(m2.s.atm)\n",
        "Solute Permeability constant 3.8959e-07 m/s\n",
        "Solute Rejection 0.961\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.10-1, Page number 788"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Prediction of Performance in a Reverse-Osmosis Unit \n",
      "\n",
      "#Variable declaration\n",
      "c1 = 2.5                    #Concentration of NaCl (kg NaCl/m3)\n",
      "rho1 = 999.                 #Density of the solution (kg/m3)\n",
      "Aw = 4.81e-4                #Permeability constant for water (kg/s.m2)\n",
      "As = 4.42e-7                #Permeabilty constant for NaCl solute (kg/s.m2)\n",
      "delP = 27.2                 #Pressure drop across the membrane (atm)\n",
      "c2 = 0.1                    #Assumed Concentration of Product solution (kg NaCl/m3)\n",
      "rho2 = 997.                 #Density of the product solution (kg/m3)\n",
      "MW = 58.45                  #Molecular weight of NaCl\n",
      "\n",
      "#Calculations\n",
      "cw2 = rho2\n",
      "C1 = (c1*1000)/((rho1-c1)*MW)  #molNaCL/kgwater in inlet water\n",
      "pi1 = 1.97                     #from table 13.9-1 obtained by interpolation,atm\n",
      "C2 = c2*1000/((rho2-c2)*MW)    #molNaCL/kgwater in outgoing water \n",
      "pi2 = 0.08                    #from table 13.9-1 obtained by interpolation, atm\n",
      "delpi = pi1-pi2\n",
      "Nw = Aw*(delP - delpi)\n",
      "B = Aw/(As*cw2)\n",
      "R = B*(delP - delpi)/(1. + B*(delP - delpi))\n",
      "c2 =  c1 - R*c1 \n",
      "Ns = As*(c1-c2)\n",
      "\n",
      "#Result \n",
      "print 'Water flux through membrane Nw= %6.4e kg Water/(m2.s)'%(Nw)\n",
      "print 'Solute flux through membrane Ns=%6.4e kg NaCl/(m2.s)'%(Ns)\n",
      "print 'Solute Rejection rate is R=%4.3f' %(R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Water flux through membrane Nw= 1.2174e-02 kg Water/(m2.s)\n",
        "Solute flux through membrane Ns=1.0664e-06 kg NaCl/(m2.s)\n",
        "Solute Rejection rate is R=0.965\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " "
     ]
    }
   ],
   "metadata": {}
  }
 ]
}