{ "metadata": { "name": "", "signature": "sha256:1516bb23afc335a7092a1afab7991f3ed9c5be7c83937717220b23a740bce801" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 7 : Fugacity Ideal Solutions Activity Activity Coefficient" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ " Example 7.1 Page: 134" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "from scipy.integrate import quad \n", "\n", "\n", "T = 220+459.67 #[R] Temperature in Rankine\n", "P = 500. #[psia] Pressure\n", "R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n", "\n", "\n", "a = 4.256 #[ft**(3)/lbmol]\n", "\n", "def f6(p): \n", "\t return a*p**(0)\n", "\n", "I = quad(f6,0,P)[0]\n", "\n", "\n", "f = P*math.exp((-1/(R*T))*I) #[psia]\n", "\n", "print \"Fugacity of propane gas at the given condition is %.0f psia\"%(round(f,1))\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Fugacity of propane gas at the given condition is 374 psia\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ " Example 7.2 Page: 138\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "import math \n", "\n", "T = 100. + 460 #[R] Temperature of the system in Rankine\n", "P = 1. # [psia]\n", "R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n", "\n", "v = 0.016136*18 #[ft**(3)/lbmol]\n", "z = round((P*v)/(R*T),5)\n", "\n", "a = int(((R*T)/P))*(1-z) #[ft**(3)/lbmol]\n", "\n", "print \" Compresssibility factor the liquid water at the given condition is %.5f \"%(z)\n", "print \"Volume residual for the liquid water at the given condition is %0.1f cubic feet/lbmol\"%(a)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Compresssibility factor the liquid water at the given condition is 0.00005 \n", "Volume residual for the liquid water at the given condition is 6007.7 cubic feet/lbmol\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ " Example 7.3 Page: 138\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "from scipy.integrate import quad \n", "\n", "T = 100+460. #[R] Temperature\n", "P = 1000. #[psia] Pressure\n", "R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n", "\n", "f_b = 0.95 #[psia]\n", "f_c = f_b #[psia]\n", "v = 0.016136*18 #[ft**(3)/lbmol]\n", "\n", "P_d = 1000. #[psia]\n", "P_c = 1. #[psia]\n", "\n", "def f4(p): \n", "\t return p**(0)\n", "\n", "f_d = f_c*math.exp((v/(R*T))* (quad(f4,P_c,P_d))[0])\n", "\n", "print \"Fugacity of the pure liquid water at the given condition is %0.1f psia\"%(f_d)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Fugacity of the pure liquid water at the given condition is 1.0 psia\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ " Example 7.4 Page: 145\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\n", "T = 78.15 #[C]\n", "P = 1.0 #[atm]\n", "p_a_0 = 0.993 #[atm] Pure ethanol vapor pressure at 78.15C\n", "p_b_0 = 0.434 #[atm] Pure water vapor pressure at 78.15C\n", "\n", "x_a = 0.8943 # Amount of ethanol in the liquid phase \n", "x_b = 0.1057 # Amount of water in liquid phase \n", "\n", "y_a = x_a # Amount of ethanol in vapor phase \n", "y_b = x_b # Amount of water in the vapor phase \n", "\n", "\n", "\n", "Y_a_1 = 1.0\n", "Y_b_1 = 1.0\n", "\n", "Y_a_2 = ((y_a*P)/(x_a*p_a_0))\n", "Y_b_2 = ((y_b*P)/(x_b*p_b_0))\n", "\n", "f_a_1 = (y_a*Y_a_1*P) #[atm]\n", "f_b_1 = (y_b*Y_b_1*P) #[atm]\n", "f_a_2 = f_a_1 #[atm]\n", "f_b_2 = f_b_1 #[atm]\n", "\n", "f_a_1_0 = P #[atm]\n", "f_b_1_0 = P #[atm]\n", "\n", "f_a_2_0 = p_a_0 #[atm]\n", "f_b_2_0 = p_b_0 #[atm]\n", "\n", "print \" The results are summarized in the following table: \\n\\tPhase\\t\\t\\t\\t Etahnol(i=a)\\t\\t\\t\\t Water,i=b\"\n", "print \" \\tVAPOR PHASE 1\"\n", "print \" \\t f_i_1 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_1,f_b_1)\n", "print \" \\t f_i_1_0 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_1,f_b_1)\n", "print \" \\t Y_i_1 assumed \\t\\t %f \\t\\t\\t\\t %f\"%(Y_a_1,Y_b_1)\n", "print \" \\tLIQUID PHASE 2\"\n", "print \" \\t f_i_2 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_2,f_b_2)\n", "print \" \\t f_i_2_0 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_2,f_b_2)\n", "print \" \\t Y_i_2assumed \\t\\t %.4f \\t\\t\\t\\t %.4f\"%(Y_a_2,Y_b_2)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The results are summarized in the following table: \n", "\tPhase\t\t\t\t Etahnol(i=a)\t\t\t\t Water,i=b\n", " \tVAPOR PHASE 1\n", " \t f_i_1 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", " \t f_i_1_0 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", " \t Y_i_1 assumed \t\t 1.000000 \t\t\t\t 1.000000\n", " \tLIQUID PHASE 2\n", " \t f_i_2 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", " \t f_i_2_0 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", " \t Y_i_2assumed \t\t 1.0070 \t\t\t\t 2.3041\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ " Example 7.5 Page: 149\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math \n", "\n", "T = 220+460. #[R] Temperature in rankine\n", "P = 1000. #[psia] Pressure\n", "y_methane = 0.784 # Mol fraction of methane in the given mixture\n", "y_butane = (1-y_methane) # Mol fraction of n-bumath.tane in the given mixture\n", "R = 10.73 #[(psia*ft**(3)/(lbmol*R))] gas consmath.tant\n", "\n", "\n", "Im = 290. #[ft**(3)/lbmol]\n", "\n", "Jm = math.exp((-1/(R*T))*Im)\n", "\n", "f_methane = Jm*P*y_methane #[psia] fugacity of methane\n", "\n", "Ib = 5859. #[ft**(3)/lbmol]\n", "Jb = math.exp((-1/(R*T))*Ib)\n", "f_butane = Jb*P*y_butane #[psia] fugacity of bumath.tane\n", "\n", "print \" Fugacity of the methane in the gaseous mixture is %0.0f psia\"%(f_methane)\n", "print \" Fugacity of the butane in the gaseous mixture is %0.1f psia\"%(f_butane)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Fugacity of the methane in the gaseous mixture is 753 psia\n", " Fugacity of the butane in the gaseous mixture is 96.8 psia\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ " Example 7.6 Page: 153\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", "import math \n", "\n", "T = 220+460. #[R] Temperature in rankine\n", "P = 1000. #[psia] Pressure\n", "x_methane = 0.784 # Mol fraction of methane in the given mixture\n", "x_bumath_tane = (1-x_methane) # Mol fraction of n-bumath_tane in the given mixture\n", "\n", "v_i_into_Y_i = 0.961\n", "phi_cap_i = 0.961\n", "\n", "v_i = 0.954\n", "phi_i = v_i\n", "Y_i = phi_cap_i/v_i\n", "\n", "print \" The value of v_i is %f\"%(v_i)\n", "print \" The value of Y_i is %f\"%(Y_i)\n", "print \" The value of phi_cap_i is %f\"%(phi_cap_i)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The value of v_i is 0.954000\n", " The value of Y_i is 1.007338\n", " The value of phi_cap_i is 0.961000\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ " Example 7.7 Page: 154\n" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\n", "T_r = 0.889\n", "P_r = 1.815\n", "\n", "f_f = -0.48553\n", "\n", "v = math.exp((P_r/T_r)*f_f)\n", "phi = v\n", "\n", "print \" The value of v=phi for n-bumath.tane at given condition is %f\"%(v)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " The value of v=phi for n-bumath.tane at given condition is 0.371106\n" ] } ], "prompt_number": 14 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }