{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 10 - Vapour liquid equillibrium" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.1 Page: 390" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.1 - Page: 390\n", "\n", "\n", " Mathematics is involved in proving but just that no numerical computations are involved.\n", "\n", "\n", " For prove refer to this example 10.1 on page 390 of the book.\n" ] } ], "source": [ "print \"Example: 10.1 - Page: 390\\n\\n\"\n", "\n", "# Mathematics is involved in proving but just that no numerical computations are involved.\n", "# For prove refer to this example 10.1 on page number 390 of the book.\n", "\n", "print \" Mathematics is involved in proving but just that no numerical computations are involved.\\n\\n\"\n", "print \" For prove refer to this example 10.1 on page 390 of the book.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.2 Page: 399" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.2 - Page: 399\n", "\n", "\n", " Mathematics is involved in proving but just that no numerical computations are involved.\n", "\n", "\n", " For prove refer to this example 10.2 on page 399 of the book.\n" ] } ], "source": [ "print \"Example: 10.2 - Page: 399\\n\\n\"\n", "\n", "# Mathematics is involved in proving but just that no numerical computations are involved.\n", "# For prove refer to this example 10.2 on page number 399 of the book.\n", "\n", "print \" Mathematics is involved in proving but just that no numerical computations are involved.\\n\\n\"\n", "print \" For prove refer to this example 10.2 on page 399 of the book.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.3 Page: 400" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.3 - Page: 400\n", "\n", "\n", "The total pressure is 13.04 atm\n", "\n", "Mole fraction of ethylene in vapour phase is 0.7\n", "\n", "Mole fraction of propylene in the vapour phase is 0.3\n", "\n" ] } ], "source": [ "from __future__ import division\n", "print \"Example: 10.3 - Page: 400\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "x1 = 0.6## [mole fraction of ethylene]\n", "x2 = 0.4## [mole fraction of propylene]\n", "T = 423## [K]\n", "P1_sat = 15.2## [vapour pressure of ethylene, atm]\n", "P2_sat = 9.8## [vapour pressure of propylene, atm]\n", "#**************#\n", "\n", "P = x1*P1_sat + x2*P2_sat## [atm]\n", "print \"The total pressure is %.2f atm\\n\"%(P)#\n", "# In vapour phase:\n", "y1 = x1*P1_sat/P## [mole fraction of ethylene]\n", "y2 = x2*P2_sat/P## [mole fraction of propylene]\n", "print \"Mole fraction of ethylene in vapour phase is %.1f\\n\"%(y1)#\n", "print \"Mole fraction of propylene in the vapour phase is %.1f\\n\"%(y2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.4 Page: 400" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.4 - Page: 400\n", "\n", "\n", "In Liquid phase\n", "\n", "The mole fraction of X is 0.701\n", "\n", "The mole fraction of Y is 0.299\n", "\n", "In Vapour phase\n", "\n", "The mole fraction of X is 0.796\n", "\n", "The mole fraction of Y is 0.204\n", "\n" ] } ], "source": [ "from math import exp\n", "print \"Example: 10.4 - Page: 400\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "Temp = 77## [OC]\n", "P = 75## [kPa]\n", "#deff('[P1] = f1(T)','P1 = exp(14.35 - 2942/(T + 220))')#\n", "#deff('[P2] = f2(T)','P2 = exp(14.25 - 2960/(T + 210))')#\n", "def f1(T):\n", " P1 = exp(14.35 - 2942/(T + 220))\n", " return P1\n", "\n", "def f2(T):\n", " P2 = exp(14.25 - 2960/(T + 210))\n", " return P2\n", "\n", "\n", "#*************#\n", "\n", "P1sat = f1(Temp)## [kPa]\n", "P2sat = f2(Temp)## [kPa]\n", "#deff('[y] = f3(x1)','y = P - (x1*P1sat) - (1 - x1)*P2sat')#\n", "def f3(x1):\n", " y = P - (x1*P1sat) - (1 - x1)*P2sat\n", " return y\n", "from scipy.optimize import fsolve\n", "x1 = fsolve(f3,7)#\n", "x2 = 1 - x1#\n", "print \"In Liquid phase\\n\"\n", "print \"The mole fraction of X is %.3f\\n\"%(x1)#\n", "print \"The mole fraction of Y is %.3f\\n\"%(x2)#\n", "\n", "y1 = x1*P1sat/P#\n", "y2 = 1 - y1#\n", "print \"In Vapour phase\\n\"\n", "print \"The mole fraction of X is %.3f\\n\"%(y1)#\n", "print \"The mole fraction of Y is %.3f\\n\"%(y2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.5 Page: 401" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.5 - Page: 401\n", "\n", "\n", "Solution (i)\n", "\n", "The mole fraction of acetone is 0.549\n", "\n", "The mole fraction of acetonitrile is 0.327\n", "\n", "The mole fraction of nitromethane is 0.124\n", "\n", "Solution (ii)\n", "\n", "The mole fraction of acetone is 0.216\n", "\n", "The mole fraction of acetonitrile is 0.371\n", "\n", "The mole fraction of nitromethane is 0.413\n", "\n" ] } ], "source": [ "print \"Example: 10.5 - Page: 401\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "#deff('[P1] = f1(T)','P1 = exp(14.3916 - 2795/(T + 230))')#\n", "def f1(T):\n", " P1 = exp(14.3916 - 2795/(T + 230))\n", " return P1\n", "\n", "#deff('[P2] = f2(T)','P2 = exp(14.2724 - 2945.47/(T + 224))')#\n", "def f2(T):\n", " P2 = exp(14.2724 - 2945.47/(T + 224))\n", " return P2\n", "#deff('[P3] = f3(T)','P3 = exp(14.2043 - 2972.64/(T + 209))')#\n", "def f3(T):\n", " P3 = exp(14.2043 - 2972.64/(T + 209))\n", " return P3\n", "\n", "#*************#\n", "\n", "# Solution (i)\n", "\n", "#*****Data******#\n", "Temp = 75## [OC]\n", "P = 75## [kPa]\n", "x1 = 0.30#\n", "x2 = 0.40#\n", "#*************#\n", "\n", "x3 = 1 - (x1 + x2)#\n", "P1sat = f1(Temp)## [kPa]\n", "P2sat = f2(Temp)## [kPa]\n", "P3sat = f3(Temp)## [kPa]\n", "P = x1*P1sat + x2*P2sat + x3*P3sat## [kPa]\n", "y1 = x1*P1sat/P#\n", "y2 = x2*P2sat/P#\n", "y3 = x3*P3sat/P#\n", "print \"Solution (i)\\n\"\n", "print \"The mole fraction of acetone is %.3f\\n\"%(y1)#\n", "print \"The mole fraction of acetonitrile is %.3f\\n\"%(y2)#\n", "print \"The mole fraction of nitromethane is %.3f\\n\"%(y3)#\n", "\n", "# Solution (ii)\n", "\n", "#*****Data*****#\n", "Temp = 80## [OC]\n", "y1 = 0.45#\n", "y2 = 0.35#\n", "#**************#\n", "\n", "y3 = 1 - (y1 + y2)#\n", "P1sat = f1(Temp)## [kPa]\n", "P2sat = f2(Temp)## [kPa]\n", "P3sat = f3(Temp)## [kPa]\n", "P = 1/((y1/P1sat) + (y2/P2sat) + (y3/P3sat))## [kPa]\n", "x1 = y1*P/P1sat#\n", "x2 = y2*P/P2sat#\n", "x3 = y3*P/P3sat#\n", "print \"Solution (ii)\\n\"\n", "print \"The mole fraction of acetone is %.3f\\n\"%(x1)#\n", "print \"The mole fraction of acetonitrile is %.3f\\n\"%(x2)#\n", "print \"The mole fraction of nitromethane is %.3f\\n\"%(x3)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.6 Page: 403" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.6 - Page: 403\n", "\n", "\n", "In Vapour phase\n", "\n", "The mole fraction of methanol is 0.282\n", "\n", "The mole fraction of methyl acetate is 0.718\n", "\n" ] } ], "source": [ "print \"Example: 10.6 - Page: 403\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "#deff('[P1] = f1(T)','P1 = exp(16.5915 - 3643.31/(T - 33.424))')#\n", "def f1(T):\n", " P1 = exp(16.5915 - 3643.31/(T - 33.424))\n", " return P1\n", "#deff('[P2] = f2(T)','P2 = exp(14.2532 - 2665.54/(T - 53.424))')#\n", "def f2(T):\n", " P2 = exp(14.2532 - 2665.54/(T - 53.424))\n", " return P2\n", "#deff('[A] = f3(T)','A = 2.771 - 0.00523*T')#\n", "def f3(T):\n", " A = 2.771 - 0.00523*T\n", " return A\n", "\n", "Temp = 318.15## [K]\n", "x1 = 0.25#\n", "#**************#\n", "\n", "P1sat = f1(Temp)## [kPa]\n", "P2sat = f2(Temp)## [kPa]\n", "A = f3(Temp)#\n", "x2 = 1 - x1#\n", "gama1 = exp(A*x2**2)#\n", "gama2 = exp(A*x1**2)#\n", "P = x1*gama1*P1sat + x2*gama2*P2sat#\n", "y1 = x1*gama1*P1sat/P#\n", "y2 = x2*gama2*P2sat/P#\n", "print \"In Vapour phase\\n\"\n", "print \"The mole fraction of methanol is %.3f\\n\"%(y1)#\n", "print \"The mole fraction of methyl acetate is %.3f\\n\"%(y2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.7 Page: 408" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.7 - Page: 408\n", "\n", "\n", "Azeotropic Composition\n", "\n", "The mole fraction of component 1 is 0.260\n", "\n", "The mole fraction of component 2 is 0.740\n", "\n" ] } ], "source": [ "from math import log\n", "print \"Example: 10.7 - Page: 408\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "Temp = 30## [OC]\n", "A = 0.625#\n", "#**************#\n", "\n", "P1sat = exp(13.71 - 3800/Temp)## [kPa]\n", "P2sat = exp(14.01 - 3800/Temp)## [kPa]\n", "# At azeotropic point:\n", "# P = gama1*P1sat + gama2*P2sat\n", "# gama1/gama2 = P2sat/P1sat\n", "# log(gama1) - log(gama2) = log(P2sat) - log(P1sat)\n", "# Val = log(gama1) - gama2\n", "Val = log(P2sat) - log(P1sat)#\n", "# log(gama1) = (A*x2**2)\n", "# log(gama2) = (A*x1**2)\n", "# A(x2**2 - x1**2) = 0.625*(x2**2 - x1**2)..................... (1)\n", "# x1 + x2 = 1............................................. (2)\n", "# On simplifying, we get:\n", "# A*(1 - (2*x1)) = Val\n", "x1 = (1/2)*(1 - Val/A)#\n", "x2 = 1 - x1#\n", "print \"Azeotropic Composition\\n\"\n", "print \"The mole fraction of component 1 is %.3f\\n\"%(x1)#\n", "print \"The mole fraction of component 2 is %.3f\\n\"%(x2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.8 Page: 410" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.8 - Page: 410\n", "\n", "\n", " This problem involves proving a relation in which no mathematics and no calculations are involved.\n", "\n", "\n", " For prove refer to this example 10.8 on page 410 of the book.\n" ] } ], "source": [ "print \"Example: 10.8 - Page: 410\\n\\n\"\n", "\n", "# This problem involves proving a relation in which no mathematics and no calculations are involved.\n", "# For prove refer to this example 10.8 on page number 410 of the book.\n", "\n", "print \" This problem involves proving a relation in which no mathematics and no calculations are involved.\\n\\n\"\n", "print \" For prove refer to this example 10.8 on page 410 of the book.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.9 Page: 412" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.9 - Page: 412\n", "\n", "\n", "Van Laar Constants\n", "\n", "A = -5.008\n", "\n", "B = 0.275\n", "\n" ] } ], "source": [ "print \"Example: 10.9 - Page: 412\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "x1 = 0.42#\n", "x2 = 0.58#\n", "P = 760## [mm of Hg]\n", "P1sat = 786## [mm of Hg]\n", "P2sat = 551## [mm of Hg]\n", "#***************#\n", "\n", "gama1 = P/P1sat#\n", "gama2 = P/P2sat#\n", "A = log(gama1)*(1 + (x2*log(gama2))/(x1*log(gama1)))**2#\n", "B = log(gama2)*(1 + (x1*log(gama1))/(x2*log(gama2)))**2#\n", "print \"Van Laar Constants\\n\"\n", "print \"A = %.3f\\n\"%(A)#\n", "print \"B = %.3f\\n\"%(B)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.10 Page: 412" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.10 - Page: 412\n", "\n", "\n", "Activity Coeffecient\n", "\n", "gama1 = 1.086\n", "\n", "gama2 = 1.002\n", "\n" ] } ], "source": [ "print \"Example: 10.10 - Page: 412\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "P = 101.3## [kPa]\n", "P1sat = 100.59## [kPa]\n", "P2sat = 99.27## [kPa]\n", "x1 = 0.532#\n", "#****************#\n", "\n", "x2 = 1 - x1#\n", "gama1 = P/P1sat#\n", "gama2 = P/P2sat#\n", "A = log(gama1)*(1 + (x2*log(gama2))/(x1*log(gama1)))**2#\n", "B = log(gama2)*(1 + (x1*log(gama1))/(x2*log(gama2)))**2#\n", "\n", "# For solution containing 10 mol percent benzene:\n", "x1 = 0.10#\n", "x2 = 1 - x1#\n", "gama1 = exp(A/(1 + (A*x1/(B*x2))**2))#\n", "gama2 = exp(B/(1 + (B*x2/(A*x1))**2))#\n", "print \"Activity Coeffecient\\n\"\n", "print \"gama1 = %.3f\\n\"%(gama1)#\n", "print \"gama2 = %.3f\\n\"%(gama2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.11 Page: 413" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.11 - Page: 413\n", "\n", "\n", "Equilibrium Composition\n", "\n", "Acetone Composition = 4.98 %\n", "\n", "Chloform composition = 95.02 %\n", "\n" ] } ], "source": [ "print \"Example: 10.11 - Page: 413\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "P = 760## [mm of Hg]\n", "P1sat = 995## [mm of Hg]\n", "P2sat = 885## [mm of Hg]\n", "x1 = 0.335#\n", "T = 64.6## [OC]\n", "#****************#\n", "\n", "x2 = 1 - x1#\n", "gama1 = P/P1sat#\n", "gama2 = P/P2sat#\n", "A = log(gama1)*(1 + (x2*log(gama2))/(x1*log(gama1)))**2#\n", "B = log(gama2)*(1 + (x1*log(gama1))/(x2*log(gama2)))**2#\n", "\n", "# For solution containing 11.1 mol percent acetone:\n", "x1 = 0.111#\n", "x2 = 1 - x1#\n", "gama1 = exp((A*x2**2)/(x2 + (A*x1/(B))**2))#\n", "gama2 = exp((B*x1**2)/(x1 + (B*x2/(A))**2))#\n", "y1 = 1/(1 + (gama2*x2*P2sat/(gama1*x1*P1sat)))#\n", "y2 = 1 - y1#\n", "print \"Equilibrium Composition\\n\"\n", "print \"Acetone Composition = %.2f %%\\n\"%(y1*100)#\n", "print \"Chloform composition = %.2f %%\\n\"%(y2*100)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.12 Page: 414" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.12 - Page: 414\n", "\n", "\n", " Mathematics is involved in proving but just that no numerical computations are involved.\n", "\n", "\n", " For prove refer to this example 10.12 on page 414 of the book.\n" ] } ], "source": [ "print \"Example: 10.12 - Page: 414\\n\\n\"\n", "\n", "# Mathematics is involved in proving but just that no numerical computations are involved.\n", "# For prove refer to this example 10.12 on page number 414 of the book.\n", "\n", "print \" Mathematics is involved in proving but just that no numerical computations are involved.\\n\\n\"\n", "print \" For prove refer to this example 10.12 on page 414 of the book.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.13 Page: 418" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.13 - Page: 418\n", "\n", "\n", "Wilson equation\n", "\n", "Activity Coeffecient of iso - butanol is 2.270\n", "\n", "Activity Coeffecient of iso - propanol is 1.265\n", "\n", "\n", "\n", "NTRL equation\n", "\n", "Activity Coeffecient of iso - butanol is 2.160\n", "\n", "Activity Coeffecient of iso - propanol is 1.269\n", "\n" ] } ], "source": [ "print \"Example: 10.13 - Page: 418\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# 1: iso - butanol\n", "# 2: iso - propanol\n", "T = 50 + 273## [K]\n", "x1 = 0.3#\n", "V1 = 65.2## [cubic cm/mol]\n", "V2 = 15.34## [cubic cm/mol]\n", "# For Wilson equation:\n", "a12 = 300.55## [cal/mol]\n", "a21 = 1520.32## [cal/mol]\n", "# For NTRL equation:\n", "b12 = 685.21## [cal/mol]\n", "b21 = 1210.21## [cal/mol]\n", "alpha = 0.552#\n", "R = 2## [cal/mol K]\n", "#******************#\n", "\n", "x2 = 1 - x1#\n", "# A: Estimation of activity coeffecient using Wilson equation:\n", "# From Eqn. 10.65:\n", "A12 = (V2/V1)*exp(-a12/(R*T))#\n", "# From Eqn. 10.66:\n", "A21 = (V1/V2)*exp(-a21/(R*T))#\n", "# From Eqn. 10.67:\n", "gama1 = exp(-log(x1 + A12*x2) + x2*((A12/(x1 + A12*x2)) - (A21/(A21*x1 + x2))))#\n", "# From Eqn. 10.68:\n", "gama2 = exp(-log(x2 + A21*x1) - x1*((A12/(x1 + A12*x2)) - (A21/(A21*x1 + x2))))#\n", "print \"Wilson equation\\n\"\n", "print \"Activity Coeffecient of iso - butanol is %.3f\\n\"%(gama1)#\n", "print \"Activity Coeffecient of iso - propanol is %.3f\\n\"%(gama2)#\n", "print \"\\n\"\n", "\n", "# A: Estimation of activity coeffecient using NTRL equation:\n", "t12 = b12/(R*T)#\n", "t21 = b21/(R*T)#\n", "G12 = exp(-alpha*t12)#\n", "G21 = exp(-alpha*t21)#\n", "# From Eqn. 10.70:\n", "gama1 = exp((x2**2)*(t21*(G21/(x1 + x2*G21))**2 + (t12*G12/(x2 + x1*G12)**2)))#\n", "# From Eqn. 10.71:\n", "gama2 = exp((x1**2)*(t12*(G12/(x2 + x1*G12))**2 + (t21*G21/(x1 + x2*G21)**2)))#\n", "print \"NTRL equation\\n\"\n", "print \"Activity Coeffecient of iso - butanol is %.3f\\n\"%(gama1)#\n", "print \"Activity Coeffecient of iso - propanol is %.3f\\n\"%(gama2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.14 Page: 426" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.14 - Page: 426\n", "\n", "\n", "Bubble Temperature is 9 OC\n", "\n", "Composition of the vapour bubble:\n", " y1 = 0.70\n", " y2 = 0.30\n" ] } ], "source": [ "print \"Example: 10.14 - Page: 426\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "x1 = 0.4## [mole fraction of ethane in vapour phase]\n", "x2 = 0.6## [mole fraction of propane in vapour phase]\n", "P = 1.5## [MPa]\n", "#***************#\n", "\n", "# Assume T = 10 OC\n", "T = 10## [OC]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 1.8#\n", "K2 = 0.5#\n", "# From Eqn. 10.83:\n", "y1 = K1*x1#\n", "y2 = K2*x2#\n", "# Since y1 + y2 > 1, so we assume another value of T = 9 OC.\n", "T = 9## [OC]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 1.75#\n", "K2 = 0.5#\n", "# From Eqn. 10.83:\n", "y1 = K1*x1#\n", "y2 = K2*x2#\n", "# Since y1 + y2 = 1. Therefore:\n", "print \"Bubble Temperature is %d OC\\n\"%(T)#\n", "print \"Composition of the vapour bubble:\\n y1 = %.2f\\n y2 = %.2f\"%(y1,y2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.15 Page: 428" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.15 - Page: 428\n", "\n", "\n", "Dew Pressure is 2.15 MPa\n", "\n", "Composition of the liquid drop:\n", " x1 = 0.0247\n", " x2 = 0.1648\n", " x3 = 0.8065\n" ] } ], "source": [ "print \"Example: 10.15 - Page: 428\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "y1 = 0.20## [mole fraction of methane in vapour phase]\n", "y2 = 0.30## [mole fraction of ethane in vapour phase]\n", "y3 = 0.50## [mole fraction of propane in vapour phase]\n", "T = 30## [OC]\n", "#*************#\n", "\n", "# Assume P = 2.0 MPa\n", "P = 2.0## [MPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 8.5#\n", "K2 = 2.0#\n", "K3 = 0.68#\n", "# From Eqn. 10.83:\n", "x1 = y1/K1#\n", "x2 = y2/K2#\n", "x3 = y3/K3#\n", "# Since x1 + x2 +x3 < 1, so we assume another value of P = 2.15 MPa at 30 OC.\n", "P = 2.15## [MPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 8.1#\n", "K2 = 1.82#\n", "K3 = 0.62#\n", "# From Eqn. 10.83:\n", "x1 = y1/K1#\n", "x2 = y2/K2#\n", "x3 = y3/K3#\n", "# Since x1 + x2 +x3 = 1. Therefore:\n", "print \"Dew Pressure is %.2f MPa\\n\"%(P)#\n", "print \"Composition of the liquid drop:\\n x1 = %.4f\\n x2 = %.4f\\n x3 = %.4f\"%(x1,x2,x3)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.16 Page: 429" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.16 - Page: 429\n", "\n", "\n", "Dew Pressure is 870 kPa\n", "\n", "Composition of the liquid drop:\n", " x1 = 0.0063\n", " x2 = 0.0755\n", " x3 = 0.9186\n", "\n", "\n", "\n", "Bubble Pressure is 2656 kPa\n", "\n", "Composition of the vapour bubble:\n", " y1 = 0.5490\n", " y2 = 0.2200\n", " y3 = 0.2310\n" ] } ], "source": [ "print \"Example: 10.16 - Page: 429\\n\\n\"\n", "\n", "# Solution\n", "\n", "# Dew point Pressure\n", "#*****Data******#\n", "y1 = 0.10## [mole fraction of methane in vapour phase]\n", "y2 = 0.20## [mole fraction of ethane in vapour phase]\n", "y3 = 0.70## [mole fraction of propane in vapour phase]\n", "T = 10## [OC]\n", "#*************#\n", "\n", "# Assume P = 690 kPa\n", "P = 690## [kPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 20.0#\n", "K2 = 3.25#\n", "K3 = 0.92#\n", "# From Eqn. 10.83:\n", "x1 = y1/K1#\n", "x2 = y2/K2#\n", "x3 = y3/K3#\n", "# Since x1 + x2 +x3 < 1, so we assume another value of P = 10135 kPa at 10 OC.\n", "P = 10135## [kPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 13.20#\n", "K2 = 2.25#\n", "K3 = 0.65#\n", "# From Eqn. 10.83:\n", "x1 = y1/K1#\n", "x2 = y2/K2#\n", "x3 = y3/K3#\n", "# Since x1 + x2 +x3 > 1, so we assume another value of P = 870 kPa at 10 OC.\n", "P = 870## [kPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 16.0#\n", "K2 = 2.65#\n", "K3 = 0.762#\n", "# From Eqn. 10.83:\n", "x1 = y1/K1#\n", "x2 = y2/K2#\n", "x3 = y3/K3#\n", "# Since x1 + x2 +x3 = 1. Therefore:\n", "print \"Dew Pressure is %d kPa\\n\"%(P)#\n", "print \"Composition of the liquid drop:\\n x1 = %.4f\\n x2 = %.4f\\n x3 = %.4f\\n\"%(x1,x2,x3)#\n", "print \"\\n\"\n", "\n", "# Bubble point Pressure\n", "#*****Data******#\n", "x1 = 0.10## [mole fraction of methane in vapour phase]\n", "x2 = 0.20## [mole fraction of ethane in vapour phase]\n", "x3 = 0.70## [mole fraction of propane in vapour phase]\n", "T = 10## [OC]\n", "#*************#\n", "\n", "# Assume P = 2622 kPa\n", "P = 2622## [kPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 5.60#\n", "K2 = 1.11#\n", "K3 = 0.335#\n", "# From Eqn. 10.83:\n", "y1 = K1*x1#\n", "y2 = K2*x2#\n", "y3 = K3*x3#\n", "# Since x1 + x2 +x3 > 1, so we assume another value of P = 2760 kPa at 10 OC.\n", "P = 2760## [kPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 5.25#\n", "K2 = 1.07#\n", "K3 = 0.32#\n", "# From Eqn. 10.83:\n", "y1 = K1*x1#\n", "y2 = K2*x2#\n", "y3 = K3*x3#\n", "# Since x1 + x2 +x3 < 1, so we assume another value of P = 2656 kPa at 10 OC.\n", "P = 2656## [kPa]\n", "# From Fig. 10.14 (Pg 426):\n", "K1 = 5.49#\n", "K2 = 1.10#\n", "K3 = 0.33#\n", "# From Eqn. 10.83:\n", "y1 = K1*x1#\n", "y2 = K2*x2#\n", "y3 = K3*x3#\n", "# Since x1 + x2 +x3 = 1. Therefore:\n", "print \"Bubble Pressure is %d kPa\\n\"%(P)#\n", "print \"Composition of the vapour bubble:\\n y1 = %.4f\\n y2 = %.4f\\n y3 = %.4f\"%(y1,y2,y3)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.17 Page: 432" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.17 - Page: 432\n", "\n", "\n", " L = 3.154304e-08 mol\n", "\n", " V = 1.000000e+00 mol\n", "\n", " y1 = 0.4500\n", " y2 = 0.3500\n", " y3 = 0.2000\n", "\n", " x1 = 0.2334\n", " x2 = 0.3631\n", " x3 = 0.4035\n", "\n" ] } ], "source": [ "print \"Example: 10.17 - Page: 432\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# 1: acetone 2: acetonitrile 3: nitromethane\n", "z1 = 0.45#\n", "z2 = 0.35#\n", "z3 = 0.20#\n", "P1sat = 195.75## [kPa]\n", "P2sat = 97.84## [kPa]\n", "P3sat = 50.32## [kPa]\n", "#***************#\n", "\n", "# Bubble Point Calculation:\n", "Pbubble = z1*+P1sat + z2*P2sat +z3*P3sat## [kPa]\n", "\n", "# Dew Point Calculation:\n", "Pdew = 1/((z1/P1sat) + (z2/P2sat) + (z3/P3sat))## [kPa]\n", "K1 = P1sat/Pdew#\n", "K2 = P2sat/Pdew#\n", "K3 = P3sat/Pdew#\n", "# Overall Material balance:\n", "# For 1 mol of the feed.\n", "# L + V = 1......................................... (1)\n", "# F*zi = L*xi + V*yi ............................... (2)\n", "# zi = (1 - V)*xi + V*yi ........................... (3)\n", "# Substituting xi = yi/K in eqn. (3)\n", "# yi = zi*Ki/(1 + V*(Ki - 1))\n", "# Since, Sum(yi) = 1.\n", "#deff('[y] = f(V)','y = (z1*K1/(1 + V*(K1 - 1))) + (z2*K2/(1 + V*(K2 - 1))) + (z3*K3/(1 + V*(K3 - 1))) - 1')#\n", "def f(V):\n", " y = (z1*K1/(1 + V*(K1 - 1))) + (z2*K2/(1 + V*(K2 - 1))) + (z3*K3/(1 + V*(K3 - 1))) - 1\n", " return y\n", "\n", "V = fsolve(f,0.8)#\n", "L = 1 - V#\n", "y1 = z1*K1/(1 + V*(K1 - 1))#\n", "y2 = z2*K2/(1 + V*(K2 - 1))#\n", "y3 = z3*K3/(1 + V*(K3 - 1))#\n", "# From Eqn. 10.83:\n", "x1 = y1/K1#\n", "x2 = y2/K2#\n", "x3 = y3/K3#\n", "print \" L = %e mol\\n\"%(L)#\n", "print \" V = %e mol\\n\"%(V)#\n", "print \" y1 = %.4f\\n y2 = %.4f\\n y3 = %.4f\\n\"%(y1,y2,y3)#\n", "print \" x1 = %.4f\\n x2 = %.4f\\n x3 = %.4f\\n\"%(x1,x2,x3)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.18 Page: 433" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.18 - Page: 433\n", "\n", "\n", " L = 0.1615 mol\n", "\n", " V = 0.8385 mol\n", "\n", " y1 = 0.8205\n", " y2 = 0.1795\n", "\n", " x1 = 0.7555\n", " x2 = 0.2445\n", "\n" ] } ], "source": [ "print \"Example: 10.18 - Page: 433\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# 1: Benzene 2: Toulene\n", "z1 = 0.81#\n", "Temp = 60## [OC]\n", "P = 70## [kPa]\n", "# Antonine Constants:\n", "A1 = 14.2321#\n", "B1 = 2773.61#\n", "C1 = 220.13#\n", "A2 = 15.0198#\n", "B2 = 3102.64#\n", "C2 = 220.02#\n", "#******************#\n", "\n", "#deff('[P1] = f1(T)','P1 = exp(A1 - B1/(T + C1))')#\n", "def f1(T):\n", " P1 = exp(A1 - B1/(T + C1))\n", " return P1\n", "\n", "P1sat = f1(Temp)## [kPa]\n", "#deff('[P2] = f2(T)','P2 = exp(A2 - B2/(T + C2))')#\n", "def f2(T):\n", " P2 = exp(A2 - B2/(T + C2))\n", " return P2\n", "\n", "P2sat = f2(Temp)## [kPa]\n", "# P = x1*P1sat + x2*P2sat#\n", "# x2 = 1 - x1#\n", "#deff('[y] = f3(x1)','[y] = P - (x1*P1sat + (1 - x1)*P2sat)')#\n", "def f3(x1):\n", " y= P - (x1*P1sat + (1 - x1)*P2sat)\n", " return y\n", "\n", "x1 = fsolve(f3,7)#\n", "y1 = x1*P1sat/P#\n", "x2 = 1 - x1#\n", "y2 = 1 - y1#\n", "\n", "# Basis: 1 mol of feed stream.\n", "F = 1## [mol]\n", "# F*zi = L*xi + V*yi = L*xi + (1 - L)*yi\n", "#deff('[y] = f4(L)','[y] = F*z1 - (L*x1 + (1 - L)*y1)')#\n", "def f4(L):\n", " y = F*z1 - (L*x1 + (1 - L)*y1)\n", " return y\n", "\n", "L = fsolve(f4,7)## [mol]\n", "V = 1 - L## [mol]\n", "print \" L = %.4f mol\\n\"%(L)#\n", "print \" V = %.4f mol\\n\"%(V)#\n", "print \" y1 = %.4f\\n y2 = %.4f\\n\"%(y1,y2)#\n", "print \" x1 = %.4f\\n x2 = %.4f\\n\"%(x1,x2)#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example: 10.19 Page: 413" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Example: 10.19 - Page: 436\n", "\n", "\n", "The data is not consistent thermodynamically\n", "\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEPCAYAAABGP2P1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcFNXV//HPAQQF0VERTdA4SUTcHUQFHzCMDwQRF4Jx\nQ6OZoIgLWY2oSVRwQXHfFVHBJYpbEjUiKtFRxA3UQRBQ0JgHNPEXFXdjWM7vj9tQM+Mw0zM91VXd\n/X2/XvMK1V3TfTxp+lD31L3X3B0REZE12iQdgIiIpIsKg4iI1KHCICIidagwiIhIHSoMIiJShwqD\niIjUEWthMLNbzex9M5vXyDmVZvaqmc03s+o44xERkaZZnPMYzGwf4HPgdnffpYHny4BZwH7uvszM\nurj7B7EFJCIiTYr1isHdZwLLGznlKOABd1+WOV9FQUQkYUn3GLoDm5rZU2Y2x8yOSTgeEZGS1y7h\n918P2B0YAHQEnjezF9x9cbJhiYiUrqQLw1LgA3f/CvjKzJ4BdgPqFAYz04JOIiIt4O7W3N9Jeijp\nQaCfmbU1s45Ab2BBQye6u37cOeeccxKPIS0/yoVyoVw0/tNSsV4xmNndQH+gi5ktBc4hDB/h7hPd\nfZGZTQdeA1YDk9y9wcIgwTvvvJN0CKmhXESUi4h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ErkJggg==\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from math import exp, log\n", "print \"Example: 10.19 - Page: 436\\n\\n\"\n", "\n", "# Solution\n", "\n", "#*****Data******#\n", "# (1): acetone (2): carbon tetrachloride\n", "T = 45## [OC]\n", "# Data = [P (torr), x1, y1]\n", "from numpy import mat\n", "Data = mat([[315.32, 0.0556, 0.2165],[339.70, 0.0903, 0.2910],[397.77, 0.2152, 0.4495],[422.46, 0.2929, 0.5137],[448.88, 0.3970, 0.5832],[463.92, 0.4769, 0.6309],[472.84, 0.5300, 0.6621],[485.16, 0.6047, 0.7081],[498.07, 0.7128, 0.7718],[513.20, 0.9636, 0.9636]])\n", "#*************#\n", "\n", "# From the standard data (Pg 531):\n", "# For Acetone:\n", "A1 = 14.2342#\n", "B1 = 2691.46#\n", "C1 = 230.00#\n", "# For carbon tetrachloride:\n", "A2 = 13.6816#\n", "B2 = 2355.82#\n", "C2 = 220.58#\n", "P1sat = exp(A1 - B1/(T + C1))## [kPa]\n", "P2sat = exp(A2 - B2/(T + C2))## [kPa]\n", "P1sat = P1sat*760/101.325## [torr]\n", "P2sat = P2sat*760/101.325## [torr]\n", "P = Data[:,0]#\n", "x1 = Data[:,1]#\n", "y1 = Data[:,2]#\n", "x2 = 1 - x1#\n", "y2 = 1 - y1#\n", "from numpy import nditer, shape, zeros\n", "gama1 = zeros(x1.shape)\n", "i=0\n", "for a,b,c in nditer([y1,P,x1]):\n", " gama1[i]=(a*b/c)\n", " i+=1\n", "\n", " \n", "gama2 = zeros(x2.shape)\n", "i=0\n", "for a,b,c in nditer([y2,P,x2]):\n", " gama2[i]=(a*b/c)\n", " i+=1\n", "\n", "Value = zeros(gama1.shape)\n", "i=0 \n", "for x,y in nditer([gama1, gama2]):\n", " Value[i]=(log(x/y))\n", " i+=1\n", " \n", "%matplotlib inline\n", "from matplotlib.pyplot import plot, xlabel, ylabel, show, grid\n", "plot(x1,Value)\n", "grid()#\n", "xlabel(\"x1\")\n", "ylabel(\"ln(y1/y2)\")\n", "# Since the whole area is above X - axis:\n", "print \"The data is not consistent thermodynamically\\n\"\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }