{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 11 : Properties of solutions" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.1 Page No : 378" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "%pylab inline\n", "import math \n", "from numpy import *\n", "from matplotlib.pyplot import *\n", "\n", "\n", "# Variables\n", "antoine_const_benzene = [6.87987,1196.760,219.161]\n", "antoine_const_toluene = [6.95087,1342.310,219.187]\n", "t = 95.\n", "P = 101.325\n", "\n", "# Calculations\n", "P1_s = 10**(antoine_const_benzene[0]-(antoine_const_benzene[1]/(t+antoine_const_benzene[2])))\t\t\t \n", "P2_s = 10**(antoine_const_toluene[0]-(antoine_const_toluene[1]/(t+antoine_const_toluene[2])))\t\t\t\n", "x1 = linspace(0,1,10)\n", "i = 0;\t\t\t #iteration parameter\n", "n = len(x1);\t\t\t #iteration parameter\n", "P_tot = zeros(10)\n", "y1 = zeros(10)\n", "\n", "while i" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.2 Page No : 384" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "# Variables\n", "T = 95. \t\t \t #temperature of the equimolar vapour mixture of benzene and toluene in degree celsius\n", "y1 = 0.5\t \t\t #mole fraction of benzene in vapour phase (no unit)\n", "y2 = 0.5 \t\t\t #mole fraction of toluene in vapour phase (no unit)\n", "P1_s = 1176.21\t\t\t #saturation pressure of benzene at T, taken from Example 11.1 in Torr\n", "P2_s = 477.03\t\t\t #saturation pressure of toluene at T, taken from Example 11.1 in Torr\n", "\n", "# Calculations\n", "P = 1./((y1/P1_s)+(y2/P2_s))\n", "x1 = (y1*P)/P1_s;\t\t\t \n", "x2 = 1-x1\n", "\n", "# Results\n", "print 'The composition of the liquid which is in equilibrium with the equimolar vapour mixture of\\\n", " benzene and toluene at 95 degree celsius is mole fraction of benzene\\\n", " in liquid phase x1 = %f mole fraction of toluene in liquid phase x2 = %f '%(x1,x2);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The composition of the liquid which is in equilibrium with the equimolar vapour mixture of benzene and toluene at 95 degree celsius is mole fraction of benzene in liquid phase x1 = 0.288542 mole fraction of toluene in liquid phase x2 = 0.711458 \n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.5 page no : 386" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Variables\n", "n_pentaneA = 6.87632 # Antoine constants\n", "n_hexaneA = 6.91058\n", "n_heptanA = 6.89386\n", "n_pentaneB = 1075.780 \n", "n_hexaneB = 1189.640\n", "n_heptanB = 1264.370\n", "n_pentaneC = 233.205\n", "n_hexaneC = 226.205\n", "n_heptanC = 216.640\n", "pressure = 90 # pressure\n", "\n", "# Calculations\n", "logP1 = n_pentaneA - (n_pentaneB/(90 + n_pentaneC))\n", "P1 = round(10**logP1 *133.322 /1000,1)\n", "logP2 = n_hexaneA - (n_hexaneB/(90 + n_hexaneC))\n", "P2 = round(10**logP2 *133.322 /1000,2)\n", "logP3 = n_heptanA - (n_heptanB/(90 + n_heptanC))\n", "P3 = round(10**logP3 *133.322 /1000,2)\n", "P = 200\n", "K1 = round(P1/P,3)\n", "K2 = round(P2/P,2)\n", "K3 = P3/P\n", "\n", "# assume L/F = 0.4\n", "L_F = 0.4\n", "x1 = 0.3/(L_F + (1-L_F) * K1)\n", "x2 = 0.3/(L_F + (1-L_F) * K2)\n", "x3 = 0.4/(L_F + (1-L_F) * K3)\n", "sum_x = x1+x2+x3\n", "\n", "# assume L/F = 0.752\n", "L_F = 0.752\n", "x1 = 0.3/(L_F + (1-L_F) * K1)\n", "x2 = 0.3/(L_F + (1-L_F) * K2)\n", "x3 = 0.4/(L_F + (1-L_F) * K3)\n", "sum_x = round(x1+x2+x3,1) # which is equal to 1 \n", "\n", "# Hence, L/F = 0.752 is correct\n", "y1 = K1*x1\n", "y2 = K2*x2\n", "y3 = K3*x3\n", "\n", "# Results\n", "print \"Hence, fraction vaporized, V/F = 1-(L-F) = %.3f\"%(1-L_F)\n", "print \"Compositions of liquid and vapor leaving the flash unit are :\"\n", "print \"x1 = %.4f y1 = %.4f\"%(x1,y1)\n", "print \"x2 = %.4f y2 = %.4f\"%(x2,y2)\n", "print \"x3 = %.4f y3 = %.4f\"%(x3,y3)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Hence, fraction vaporized, V/F = 1-(L-F) = 0.248\n", "Compositions of liquid and vapor leaving the flash unit are :\n", "x1 = 0.2246 y1 = 0.5285\n", "x2 = 0.3045 y2 = 0.2863\n", "x3 = 0.4709 y3 = 0.1851\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.7 Page No : 397" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Variables\n", "T = 45.\t \t\t #temperature of the mixture in degree celsius\n", "A = 2.230\t\t\t #van laar constant for the system at T (no unit)\n", "B = 1.959\t\t\t #van laar constant for the system at T (no unit)\n", "n1 = 30. \t\t #mole percentage of nitromethane in the mixture ( in percentage)\n", "\n", "# Calculations\n", "n2 = 100-n1\n", "x1 = n1/100\n", "x2 = 1-x1\n", "gaamma1 = math.exp(A/(1+((A/B)*(x1/x2)))**2)\n", "gaamma2 = math.exp(B/(1+((B/A)*(x2/x1)))**2)\n", "\n", "# Results\n", "print 'The activity coefficients for the system using van laar equation is : gamma1 \\\n", " = %f, gamma2 = %f \\t '%( gaamma1,gaamma2);\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The activity coefficients for the system using van laar equation is : gamma1 = 2.738343, gamma2 = 1.234443 \t \n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.8 Page No : 397" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Variables\n", "n_azeo = 44.8;\t\t\t #azeotropic composition given as mole percentage\n", "Tb = 68.24;\t\t\t #boiling point of mixture in degree celsius\n", "P = 760.;\t\t\t #pressure in Torr\n", "P1_s = 506.;\t\t\t #saturation pressure of ethanol at Tb in Torr\n", "P2_s = 517.;\t\t\t #saturation pressure of benzene at Tb in Torr\n", "n1 = 10.;\t\t\t #mole percentage of ethanol in the mixture (in percentage)\n", "\n", "# Calculations\n", "x1 = n_azeo/100\n", "x2 = 1-x1;\t\t\n", "gaamma1 = P/P1_s\n", "gaamma2 = P/P2_s\n", "A = math.log(gaamma1)*(1+((x2*math.log(gaamma2))/(x1*math.log(gaamma1))))**2\n", "B = math.log(gaamma2)*(1+((x1*math.log(gaamma1))/(x2*math.log(gaamma2))))**2\n", "x1 = n1/100\n", "x2 = 1-x1;\t\n", "gaamma1 = math.exp(A/(1+((A/B)*(x1/x2)))**2)\n", "gaamma2 = math.exp(B/(1+((B/A)*(x2/x1)))**2)\n", "\n", "# Results\n", "print 'The van Laar constants for the system are : A = %f \\t B = %f '%(A,B)\n", "print 'The activity coefficients for the system using van laar equation are\\\n", " : gamma1 = %f \\t gamma2 = %f \\t '%( gaamma1,gaamma2);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The van Laar constants for the system are : A = 1.910203 \t B = 1.328457 \n", "The activity coefficients for the system using van laar equation are : gamma1 = 4.137783 \t gamma2 = 1.025531 \t \n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.9 Page No : 399" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Variables\n", "\n", "T = 45. \t\t\t #temperature of the system in degree celsius\n", "A_12 = 0.1156;\t\t\t #Wilson's parameter for the system at T (no unit)\n", "A_21 = 0.2879;\t\t\t #Wilson's parameter for the system at T (no unit)\n", "x1 = 0.3;\t \t\t #mole fraction of nitromethane in the liquid mixture (no unit)\n", "\n", "# Calculations\n", "x2 = 1-x1\n", "ln_gaamma1 = -math.log(x1+(A_12*x2))+(x2*((A_12/(x1+(A_12*x2)))-(A_21/((A_21*x1)+x2))));\t\t\t\n", "gaamma1 = math.exp(ln_gaamma1)\n", "ln_gaamma2 = -math.log(x2+(A_21*x1))-(x1*((A_12/(x1+(A_12*x2)))-(A_21/((A_21*x1)+x2))));\t\t\t # Calculations of ln(activity coefficient) using Eq.(11.90) (no unit)\n", "gaamma2 = math.exp(ln_gaamma2)\n", "\n", "# Results\n", "print 'The activity coefficients for the system using Wilsons parameters are : gamma1 = %f \\\n", " \\t gamma2 = %f \\t '%( gaamma1,gaamma2);" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The activity coefficients for the system using Wilsons parameters are : gamma1 = 2.512605 \t gamma2 = 1.295788 \t \n" ] } ], "prompt_number": 18 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.10 Page No : 401" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Variables\n", "T = 345.\t\t\t #temperature of the mixture in K\n", "x1 = 0.8\t\t\t #mole fraction of ethanol in the liquid phase (no unit)\n", "\n", "nu_ki = [1,1,1,6]\t\t\t #number of groups of type: CH3, CH2, OH and ACH respectively (no unit)\n", "R_k = [0.9011,0.6744,1.0000,0.5313];\t\t\t #Group volume parameter for CH3, CH2, OH and ACH respectively (no unit)\n", "Q_k = [0.848,0.540,1.200,0.400];\t\t\t #Area parameter for CH3, CH2, OH and ACH respectively (no unit)\n", "R = 8.314;\t\t\t #universal gas constant in J/molK\n", "u12_u22 = -241.2287;\t\t#UNIQUAC parameter for the system in J/molK\n", "u21_u11 = 2799.5827;\t\t#UNIQUAC parameter for the system in J/molK\n", "z = 10. \t\t\t #co-ordination number usually taken as 10 (no unit)\n", "\n", "# Calculations\n", "x2 = 1-x1\n", "r1 = (nu_ki[0]*R_k[0])+(nu_ki[1]*R_k[1])+(nu_ki[2]*R_k[2]);\t\t\t \n", "r2 = (nu_ki[3]*R_k[3])\n", "phi1 = (x1*r1)/((x1*r1)+(x2*r2));\t\t\t \n", "phi2 = (x2*r2)/((x2*r2)+(x1*r1));\t\t\t \n", "q1 = (nu_ki[0]*Q_k[0])+(nu_ki[1]*Q_k[1])+(nu_ki[2]*Q_k[2])\t\t\t \n", "q2 = (nu_ki[3]*Q_k[3])\t\t\t\n", "theta1 = (x1*q1)/((x1*q1)+(x2*q2))\n", "theta2 = (x2*q2)/((x1*q1)+(x2*q2))\n", "l1 = ((z/2)*(r1-q1))-(r1-1);\t\t\n", "l2 = ((z/2)*(r2-q2))-(r2-1);\t\t\n", "tau_12 = math.exp(-(u12_u22)/(R*T));\t\t\n", "tau_21 = math.exp(-(u21_u11)/(R*T));\t\t\n", "tau_11 = 1.0;\t\t\t \n", "tau_22 = 1.0;\t\t\t \n", "\n", "ln_gaamma1_c = math.log(phi1/x1)+((z/2)*q1*math.log(theta1/phi1))+l1-((phi1/x1)*((x1*l1)+(x2*l2)));\n", "ln_gaamma2_c = math.log(phi2/x2)+((z/2)*q2*math.log(theta2/phi2))+l2-((phi2/x2)*((x1*l1)+(x2*l2)));\n", "ln_gaamma1_r = q1*(1-math.log((theta1*tau_11)+(theta2*tau_21))-(((theta1*tau_11)/((theta1*tau_11)+(theta2*tau_21)))+((theta2*tau_12)/((theta1*tau_12)+(theta2*tau_22)))));\n", "ln_gaamma2_r = q2*(1-math.log((theta1*tau_12)+(theta2*tau_22))-(((theta1*tau_21)/((theta1*tau_11)+(theta2*tau_21)))+((theta2*tau_22)/((theta1*tau_12)+(theta2*tau_22)))));\n", "ln_gaamma1 = ln_gaamma1_c+ln_gaamma1_r\n", "ln_gaamma2 = ln_gaamma2_c+ln_gaamma2_r\n", "gaamma1 = math.exp(ln_gaamma1);\t\t\t \n", "gaamma2 = math.exp(ln_gaamma2);\t\t\t \n", "\n", "# Results\n", "print 'The activity coefficients for the system using the UNIQUAC equation are : gamma1 \\\n", " = %f \\t gamma2 = %f \\t '%( gaamma1,gaamma2);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The activity coefficients for the system using the UNIQUAC equation are : gamma1 = 1.060567 \t gamma2 = 3.679066 \t \n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 11.11 Page No : 405" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Variables\n", "T = 307.\t\t\t #temperature of the mixture in K\n", "x1 = 0.3\t\t\t #mole fraction of acetone in the liquid phase (no unit)\n", "\n", "nu_ki = [1.,1.,2.,3.]\n", "R_k = [0.9011,1.6724,0.6744]\n", "Q_k = [0.848,1.488,0.540];\t\t\t \n", "a_19 = 476.40;\t\t\t #group interaction parameter for the system in K\n", "a_91 = 26.760;\t\t\t #group interaction parameter for the system in K\n", "z = 10. \t\t\t #co-ordination number usually taken as 10 (no unit)\n", "\n", "# Calculations\n", "x2 = 1-x1;\t\t\t # Calculations of mole fraction of benzene in liquid phase (no unit)\n", "r1 = (nu_ki[0]*R_k[0])+(nu_ki[1]*R_k[1])\n", "r2 = (nu_ki[2]*R_k[0])+(nu_ki[3]*R_k[2])\n", "phi1 = (x1*r1)/((x1*r1)+(x2*r2))\n", "phi2 = (x2*r2)/((x2*r2)+(x1*r1))\n", "q1 = (nu_ki[0]*Q_k[0])+(nu_ki[1]*Q_k[1])\t\t\t\n", "q2 = (nu_ki[2]*Q_k[0])+(nu_ki[3]*Q_k[2])\n", "theta1 = (x1*q1)/((x1*q1)+(x2*q2));\n", "theta2 = (x2*q2)/((x1*q1)+(x2*q2));\n", "l1 = ((z/2)*(r1-q1))-(r1-1);\t\t\n", "l2 = ((z/2)*(r2-q2))-(r2-1);\t\t\n", "ln_gaamma1_c = math.log(phi1/x1)+((z/2)*q1*math.log(theta1/phi1))+l1-((phi1/x1)*((x1*l1)+(x2*l2)));\n", "ln_gaamma2_c = math.log(phi2/x2)+((z/2)*q2*math.log(theta2/phi2))+l2-((phi2/x2)*((x1*l1)+(x2*l2)));\n", "a_11 = 0.\n", "a_99 = 0.\n", "psi_19 = math.exp(-(a_19)/(T));\t\t\t\n", "psi_91 = math.exp(-(a_91)/(T));\t\t\t\n", "psi_11 = 1.;\t\t\t \n", "psi_99 = 1.;\t\t\t \n", "x1_1 = nu_ki[0]/(nu_ki[0]+nu_ki[1]);\t\t\t\n", "x1_18 = nu_ki[1]/(nu_ki[0]+nu_ki[1]);\t\t\n", "theta1_1 = (Q_k[0]*x1_1)/((Q_k[0]*x1_1)+(Q_k[1]*x1_18))\n", "theta1_18 = (Q_k[1]*x1_18)/((Q_k[1]*x1_18)+(Q_k[0]*x1_1))\n", "ln_tau1_1 = Q_k[0]*(1-math.log((theta1_1*psi_11)+(theta1_18*psi_91))-(((theta1_1*psi_11)/((theta1_1*psi_11)+(theta1_18*psi_91)))+((theta1_18*psi_19)/((theta1_1*psi_19)+(theta1_18*psi_11)))));\n", "ln_tau1_18 = Q_k[1]*(1-math.log((theta1_1*psi_19)+(theta1_18*psi_99))-(((theta1_1*psi_91)/((theta1_1*psi_99)+(theta1_18*psi_91)))+((theta1_18*psi_99)/((theta1_1*psi_19)+(theta1_18*psi_99)))));\n", "x2_1 = nu_ki[2]/(nu_ki[2]+nu_ki[3]);\t\t\t \n", "x2_2 = nu_ki[3]/(nu_ki[2]+nu_ki[3]);\t\t\t \n", "ln_tau2_1 = 0;\n", "ln_tau2_2 = 0;\n", "x_1 = ((x1*nu_ki[0])+(x2*nu_ki[2]))/((((x1*nu_ki[0])+(x1*nu_ki[1])))+((x2*nu_ki[2])+(x2*nu_ki[3])));\n", "x_2 = ((x2*nu_ki[3]))/((((x1*nu_ki[0])+(x1*nu_ki[1])))+((x2*nu_ki[2])+(x2*nu_ki[3])));\n", "x_18 = ((x1*nu_ki[1]))/((((x1*nu_ki[0])+(x1*nu_ki[1])))+((x2*nu_ki[2])+(x2*nu_ki[3])));\n", "theta_1 = (Q_k[0]*x_1)/((Q_k[0]*x_1)+(Q_k[1]*x_18)+(Q_k[2]*x_2));\t\t\t\n", "theta_2 = (Q_k[2]*x_2)/((Q_k[0]*x_1)+(Q_k[1]*x_18)+(Q_k[2]*x_2));\t\t\t\n", "theta_18 = (Q_k[1]*x_18)/((Q_k[0]*x_1)+(Q_k[1]*x_18)+(Q_k[2]*x_2));\t\t\t\n", "ln_tau_1 = Q_k[0]*(1-math.log((theta_1*psi_11)+(theta_2*psi_11)+(theta_18*psi_91))-((((theta_1*psi_11)+(theta_2*psi_11))/((((theta_1*psi_11)+(theta_2*psi_11))+(theta_18*psi_91)))+((theta_18*psi_19)/((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_11))))));\n", "ln_tau_2 = Q_k[2]*(1-math.log((theta_1*psi_11)+(theta_2*psi_11)+(theta_18*psi_91))-((((theta_1*psi_11)+(theta_2*psi_11))/((((theta_1*psi_11)+(theta_2*psi_11))+(theta_18*psi_91)))+((theta_18*psi_19)/((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_11))))));\n", "ln_tau_18 = Q_k[1]*(1-math.log((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_99))-(((((theta_1+theta_2)*psi_91)/((theta_1*psi_11)+(theta_2*psi_11)+(theta_18*psi_91)))+((theta_18*psi_99)/((theta_1*psi_19)+(theta_2*psi_19)+(theta_18*psi_11))))));\n", "ln_gaamma1_r = (nu_ki[0]*(ln_tau_1-ln_tau1_1))+(nu_ki[1]*(ln_tau_18-ln_tau1_18));\n", "ln_gaamma2_r = (nu_ki[2]*(ln_tau_1-ln_tau2_1))+(nu_ki[3]*(ln_tau_2-ln_tau2_2));\n", "ln_gaamma1 = ln_gaamma1_c+ln_gaamma1_r\n", "ln_gaamma2 = ln_gaamma2_c+ln_gaamma2_r\n", "gaamma1 = math.exp(ln_gaamma1);\t\t\t\n", "gaamma2 = math.exp(ln_gaamma2);\t\t\t\n", "\n", "# Results\n", "print 'The activity coefficients for the system using the UNIFAC method are\\\n", " : gamma1 = %f \\t gamma2 = %f \\t '%( gaamma1,gaamma2);\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The activity coefficients for the system using the UNIFAC method are : gamma1 = 2.149891 \t gamma2 = 1.191192 \t \n" ] } ], "prompt_number": 4 } ], "metadata": {} } ] }