diff options
Diffstat (limited to 'Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb')
-rw-r--r-- | Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb | 129 |
1 files changed, 7 insertions, 122 deletions
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb index 84d35a73..c6d63f53 100644 --- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:503de9d648d2755ec204b8822b124187c44f6b43ec4e442774530019aef1c520" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,27 +28,18 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Calculate mole fraction of water vapour in air in equilibrium\n", "\n", "import math \n", "\n", - "# Variables\n", "T = 20. #[C]\n", "P = 1. #[atm]\n", - "# From Raoult's law y_i*P = x_i*p_i\n", - "# Rearranging\n", - "#y_i = x_i*p_i/P\n", "\n", - "# Calculations\n", "x_N2 = 0\n", "x_O2 = 0\n", "x_water = 1-x_N2-x_O2\n", - "# From any steam table we may look up the value of the vapour pressure of water at 20C, finding\n", "p_water = 0.023 #[atm]\n", - "# So \n", "y_water = x_water*p_water/P\n", "\n", - "# Results\n", "print \"The mole fraction of water vapour in air in equilibrium with water is %f\"%(y_water)\n" ], "language": "python", @@ -75,44 +67,24 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Calculate concentration of oxygen\n", "\n", "import math \n", "\n", - "# Variables\n", "T = 20. #[C]\n", "P = 1. #[atm]\n", - "# From previous example i.e. example 3.1\n", "y_water = 0.023\n", - "#so that \n", - "#y = y_N2+y_O2\n", "y = 1-y_water\n", - "# The oxygen is 0.21 mole fraction of this mix, so that\n", "y_O2 = y*0.21\n", - "# It is reported in the book in table A.3 (page 419) that Henry's law cinsmath.tant for oxygen in water at 20C is \n", "H_O2 = 40100 #[atm]\n", - "# From Henry's law, we have \n", - "# y_i = x_i*H_i/P\n", - "# rearranging\n", - "# x_i = y_i*P/H_i\n", - "# so \n", "x_O2 = y_O2*P/H_O2\n", - "# By the same math.logic we find that\n", "y_N2 = y*0.79\n", - "#and Henry's law consmath.tant for nitrogen in water at 20C is\n", "H_N2 = 80400. #[atm]\n", "\n", - "# Calculations\n", - "# hence \n", "x_N2 = y_N2*P/H_N2\n", - "# Now expresmath.sing the dissolved oxygen concentration in terms of the volume of the oxygen at STP viz. taken as 1 atm and 20C\n", - "# c = (concentration of dissolved oxygen in equilibrium with air at 1 atm and 20C)\n", "c = x_O2*998.2/18 #[(mole O2)/(L solution)]\n", - "# V = (volume of O2, STP)/(L solution)\n", "V = c*24.06 #[(L O2, STP)/(L solution)]\n", "V = V*1000 #[(ml O2, STP)/(L solution)]\n", "\n", - "# Results\n", "print \"Concentration of oxygen dissolved in water at equilibrium is %f mL O2, STP)/L solution)\"%(V)\n" ], "language": "python", @@ -140,43 +112,23 @@ "cell_type": "code", "collapsed": false, "input": [ - "# calculate composition in liquied and vapor phase.\n", "\n", "import math \n", "from numpy import *\n", "\n", - "# Variables\n", "P = 1.0 #[atm]\n", "p_w = 0.023 #[atm] Vapor pressure of pure water\n", "H_o = 40100 #[atm] Vapor pressure of pure oxygen\n", "H_n = 80400. #[atm] Vapor pressure of pure nitrogen\n", "\n", - "# From Raoult's law, we have\n", - "# ( y_i*P ) = ( x_i*p_i )\n", - "# So \n", - "#For water\n", - "# ( y_w*P ) = ( x_w*p_i )\n", - "# For oxygen\n", - "#( y_o*P ) = ( x_o*p_i )\n", - "# And for nitrogen\n", - "#( y_n*P ) = ( x_n*p_i )\n", - "\n", - "# Also\n", - "# ( y_w + y_o + y_n ) = 1\n", - "# ( x_w + x_o + x_n ) = 1\n", - "\n", - "# Calculations\n", - "# In air, the mole fraction of nitrogen and oxygen are 0.79 and 0.21 respectively. So,\n", - "# y_o/y_n = 0.21/0.79\n", - "\n", - "# We will take the help of matrix method to solve these six equations for six unknowns\n", + "\n", + "\n", + "\n", "A = matrix([[0.023, 0, 0, -1, 0, 0],[0, 40100, 0, 0, -1, 0],[0, 0 ,80400, 0, 0, -1],[0, 0, 0, 1, 1 ,1],[1 ,1, 1, 0, 0 ,0],[0, 0, 0, 0, 0.79, -0.21]]);\n", - "#A = matrix([[0.023, 0, 0, -1, 0, 0],[0, 40100, 0, 0, -1, 0],[0, 0, 80400, 0, 0, -1],[0, 0 ,0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[0, 0, 0, 0, 0.79, -0.21]])\n", "B = matrix([[0],[0],[0],[1],[1],[0]])\n", "X = linalg.inv(A)\n", "X = X * B\n", "\n", - "# Results\n", "print \" The composition in liquid and vapor phase are summarized in the following table:\"\n", "print \" y_water \\t %f\"%(X[3])\n", "print \" y_oxygen \\t %f\"%(X[4])\n", @@ -216,58 +168,29 @@ "cell_type": "code", "collapsed": false, "input": [ - "'''\n", - "Calculate\n", - "Vapour pressure of mixture.\n", - "Mole fraction of the benzene\n", - "Mole fraction of the toluene\n", - "'''\n", + "\n", "import math \n", "\n", "\n", - "# Variables\n", "T = 20. #[C]\n", "x_b = 0.80\n", "x_t = 0.20\n", - "# Here we calculate the vapour pressures of benzene and toluene at 20C umath.sing the Antoine equation\n", - "# math.log10(p) = A-B/(T+C)\n", - "# here pressure p is in torr and temperature T is in C\n", - "# From the reported table A.2 (page 418) in the book, the consmath.tant A,B,C in the above equation for benzene have the vaues as\n", "A_b = 6.90565\n", "B_b = 1211.033\n", "C_b = 220.79\n", "\n", - "# Calculations\n", - "# So, for benzene\n", "p_b = 10**(A_b-B_b/(T+C_b))\n", - "# now from the reported table A.2 (page 418) in the book, the consmath.tant A,B,C in the above equation for toluene have the vaues as\n", "A_t = 6.95334\n", "B_t = 1343.943\n", "C_t = 219.337\n", - "# So, for toluene\n", "p_t = 10**(A_t-B_t/(T+C_t))\n", - "# Now we can compute that for benzene\n", - "# y_b*P = x_b*p_b\n", - "# let y_b*P = p_1 , so\n", "p_1 = x_b*p_b\n", - "# and correspondingly for toluene\n", - "# y_t*P = x_t*p_t\n", - "# let y_t*P = p_2 , so\n", "p_2 = x_t*p_t\n", - "# Now adding these two values of benzene and toluene, we have \n", - "# y_b*P+y_t*P = (y_b+y_t)*P\n", - "# i.e.\n", - "# P = (p_1+p_2)/(y_b+y_t)\n", - "# But we know that (y_b+y_t) must be equal to one i.e.\n", "y = 1.00 # y =(y_b+y_t) sum of the mole fractions of the benzene and toluene in the gaseous phase\n", - "# Hence total pressure is\n", "P = (p_1+p_2)/y\n", - "# Now the mole fraction of either species in the gaseous phase will be ratio of the partial pressure of the species to the total pressure\n", - "# so\n", "y_b = x_b*p_b/P\n", "y_t = x_t*p_t/P\n", "\n", - "# Results\n", "print \" Vapour pressure of the mixture in the gaseous phase is %f torr\"%(P)\n", "print \" Mole fraction of the benzene in the vapour phase is %f\"%(y_b)\n", "print \" Mole fraction of the toluene in the vapour phase is %f\"%(y_t)\n" @@ -299,21 +222,17 @@ "cell_type": "code", "collapsed": false, "input": [ - "# calculate mole fraction of the benzene in air.\n", "\n", "import math \n", "\n", "\n", - "# Variables\n", "T = 20. #[C]\n", "x_benzene = 1.00\n", "p_i = 75.2 #[torr] vapour pressure of the benzene\n", "P = 760. #[torr] Pressure of the atmosphere\n", "\n", - "# Calculations\n", "y_benzene = (x_benzene*p_i)/P\n", "\n", - "# Results\n", "print \" Mole fraction of the benzene in air that is saturated with benzene is %0.1f\"%(y_benzene)\n" ], "language": "python", @@ -341,29 +260,23 @@ "cell_type": "code", "collapsed": false, "input": [ - "# calculate temperature at which the given benzene-toluene mixture will have vapor pressure\n", "\n", "import math \n", "\n", - "# Variables\n", "P = 760. #[mm Hg]\n", "x_b = 0.8 # Mole fraction of benzene in liquid phase\n", "x_t = 0.2 # Mole fraction of toluene in liquid phase\n", "\n", - "# We will take the help of trial and error method to solve this problem\n", - "# From the table A.2 ( page 418 ), Antoine equation consmath.tants for benzene are\n", "A_b = 6.90565\n", "B_b = 1211.003\n", "C_b = 220.79\n", "\n", - "# and that for the toluene are\n", "A_t = 6.95334\n", "B_t = 1343.943\n", "C_t = 219.337\n", "T = 82. #[C]\n", "err = 1.\n", "\n", - "# Calculations\n", "while err > 10**(-3):\n", " p_b = 10**(6.90565 - 1211.003/(T + 220.79))\n", " p_t = 10**(6.95334 - 1343.943/(T + 219.337))\n", @@ -372,7 +285,6 @@ " err = abs((y_b + y_t) - 1)\n", " T = T + 0.01\n", "\n", - "# Results\n", "print \" The temperature at which the given benzene-toluene mixture will have vapor pressure of 1 atm is %0.3f deg C\"%(T)\n", "\n", "\n" @@ -403,55 +315,37 @@ "cell_type": "code", "collapsed": false, "input": [ - "'''\n", - "Calculate\n", - "At equilibrium at 20 deg C the rejected amount of oxygen \n", - "At equilibrium at 20 deg C the rejected amount of nitrogen \n", - "And total amount of the air rejected from the water\n", - "'''\n", + "\n", "\n", "from numpy import *\n", "import math \n", "\n", "\n", - "# Variables\n", "V = 0.25 #[L] Volume of water \n", "T_1 = 0. #[C] Initial temperature of water\n", "T_2 = 20. #[C] Final temperature of water\n", "\n", - "# Calculations\n", - "# From the example 3.3 the mol fractions of oxygen and notrogen in water at temperature 20 deg C are\n", "x_o = 5.12*10**(-6) # mole fraction of oxygen\n", "x_n = 9.598*10**(-6) # mole fraction of nitrogen\n", "\n", "\n", - "# Now we will calculate the mole fraction of oxygen and nitrogen in water at 0 deg C in the same manner as in example 3.3\n", - "# From the table A.3( page 419), Henry's consmath.tant of oxygen and nitrogen are\n", "H_o = 2.55*10**(4) #[atm]\n", "H_n = 5.29*10**(4) #[atm]\n", "\n", - "# And vapor pressure of water at 0 deg C is \n", "p_w = 0.006 #[atm]\n", "\n", - "# Now umath.sing the same set of equations as in example 3.3, by changing only H_o, H_n and p_w and solving by matrix method we have \n", "\n", "A = matrix([[0.006, 0, 0, -1, 0, 0],[0, 25500, 0, 0, -1, 0],[0, 0 ,52900, 0, 0, -1],[0, 0, 0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[0, 0, 0, 0, 0.79, -0.21]])\n", "B = matrix([[0],[0],[0],[1],[1],[0]])\n", "X = linalg.inv(A)\n", "X = X*B\n", "\n", - "# Here the mole fraction of oxygen and nitrogen in water will be X(2) and X(3) respectively\n", - "# So oxygen rejected is\n", "M_o_rej = V*( X[1] - x_o )/0.018 #[mole] oxygen\n", - "# Now At STP volume of the rejected oxygen is given as \n", "V_o = M_o_rej*24200 #[ml] oxygen\n", "\n", - "# And rejected nitrogen is\n", "M_n_rej = V*( X[2] - x_n )/0.018 #[mole] nitrogen\n", - "# In terms of volume \n", "V_n = M_n_rej*24200 #[ml]\n", "\n", - "# Results\n", "print \" At equilibrium at 20 deg C the rejected amount of oxygen will be %0.2f ml\"%(V_o)\n", "print \" At equilibrium at 20 deg C the rejected amount of nitrogen will be %0.2f ml\"%(V_n)\n", "print \" And total amount of the air rejected from the water will be %0.2f ml\"%(V_o + V_n)\n" @@ -483,12 +377,10 @@ "cell_type": "code", "collapsed": false, "input": [ - "# calculate amount of rejected nitrogen.\n", "\n", "import math \n", "\n", "\n", - "# Variables\n", "P_1 = 5. #[atm]\n", "y_n = 0.79 # Mole fraction of nitrogen in atmosphere\n", "P_2 = 1.0 #[atm]\n", @@ -496,19 +388,12 @@ "x_w = 0.75 # Fraction of water in human body\n", "T = 37 #[C] Body temperature of the diver\n", "\n", - "# Calculations\n", - "# At 37 deg temperature, the Henry's consmath.tant for N2 from the table A.3 ( page 419 ) by the linear interpolation is \n", "H_n = 10.05*10**(4) # [atm]\n", "\n", - "# Now, moles of nitrogen rejected will be\n", - "# M_rej = (moles of body fluid)*( x_N2,5 atm - x_N2,1 atm)\n", - "# So\n", "M_rej = (M*1000*x_w/18)*( P_1*y_n/H_n - P_2*y_n/H_n) #[mol]\n", "\n", - "# At STP the volume of the rejected nitrogen will be\n", "V_n = M_rej*24.2 #[L]\n", "\n", - "# Results\n", "print \" Amount of rejected nitrogen will be %0.2f Litre\"%(V_n)\n" ], "language": "python", |