summaryrefslogtreecommitdiff
path: root/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb')
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb159
1 files changed, 0 insertions, 159 deletions
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb
index fff7b6e8..24212b64 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb
@@ -27,31 +27,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The total number of the drops of the benznene required to saturate the water\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"V_water = 1. #[L] volume of the water\n",
"Temp = 25. #[C]\n",
"d_benzene = 0.88 #[g/ml] density of the benzene \n",
"M_benzene = 78. #[g/mol] molecular weight of the benzene\n",
"M_water = 18. #[g/mol]\n",
- "# Typically a buret will deliver about 20 drops of lliquid per millimeter, so moles of benzene in one drop is\n",
"\n",
- "# Calculations\n",
"n_1drop = 1./20*(d_benzene/M_benzene) #[mol/drop] \n",
"\n",
- "# No of moles in 1 litre of the water is \n",
"n_water = 1000./M_water #[mol]\n",
- "# Because 1 litre = 1000 g\n",
- "# Now from the table 11.1 (page 273), at the saturated condition at the temperature 25C, solubility of benzene in the water is\n",
"s_benzene = 0.000405\n",
"n_benzene_saturate = s_benzene*n_water #[mol]\n",
- "# Thus no of the drops of the benzene is\n",
"N_benzene = n_benzene_saturate/n_1drop #[drops]\n",
"\n",
- "# Results\n",
"print \"The total number of the drops of the benznene required to saturate the water is %0.0f drops\"%(N_benzene)\n"
],
"language": "python",
@@ -79,29 +70,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The amount of the ground water \n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"m_benzene = 1000. #[lbm]\n",
"M_benzene = 78. #[lbm/lbmol]\n",
- "# The total moles benzene are \n",
"n_benzene = m_benzene/M_benzene #[lbmol]\n",
- "# To saturate the water with benzene \n",
- "# the mole fraction of the benzene in the water will be \n",
"x_benzene = 0.000405\n",
- "# and \n",
- "# n_benzene = x_benzene*n_T\n",
- "# in this case n_benzene << n_water, so n_T = n_water\n",
- "# Thus\n",
- "#n_benzene = x_benzene*n_water\n",
"\n",
- "# Calculations\n",
"n_water = n_benzene/x_benzene #[lbmol]\n",
"m_water = n_water*18 #[lbm] \n",
"\n",
- "# Results\n",
"print \"The amount of the ground water that will make a saturated solution will be %e lbm\"%(m_water)\n"
],
"language": "python",
@@ -137,32 +116,23 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 25. #[C]\n",
"n_water = 3.75 #[mol]\n",
"n_ethanol = 2.5 #[mol]\n",
"n_benzene = 3.75 #[mol]\n",
"\n",
- "# By the simple stoichiomtetry the overall mole fractions are \n",
"x_water = 0.375\n",
"x_ethanol = 0.250\n",
"x_benzene = 0.375\n",
"\n",
- "# Calculations\n",
- "# We locate the point corresponding to this concentration on the diagram 11.1 (page 277), by drawing any two of the three straight lines corresponding to those mole fractions.\n",
- "# We find that the point falls almost exactly on the fifth tie line from the top.\n",
- "#For this the end-point values are read from the table 11.4 ( page 276 ), which is fifth row from the bottom \n",
- "# Thus in water reach phase we have the composition as\n",
"x_water_w = 64.9 #[%]\n",
"x_ethanol_w = 31.75 #[%]\n",
"x_benzene_w = 3.37 #[%]\n",
"\n",
- "# and in the benzene reach phase composition is \n",
"x_water_b = 6.43 #[%]\n",
"x_ethanol_b = 18.94 #[%]\n",
"x_benzene_b = 74.62 #[%]\n",
"\n",
- "# Results\n",
"print \"The composition of the two equilibrium phases i.e. water-reach phase and benzene reach phase is as \"\n",
"print \"\\t\\t\\t\\tWater-reach phase\\t\\tbenzene-reach phase\"\n",
"print \"Mol water\\t\\t\\t%f\\t\\t\\t\\t%f\"%(x_water_w,x_water_b)\n",
@@ -205,34 +175,20 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 25. #[C]\n",
- "# Here we assume benzene to be component 1 and water to be componenet 2\n",
- "# From table 11.1 given in the book(page 273) \n",
- "# The mole fraction of benzene in water is\n",
"x_1in2 = 405. #[ppm]\n",
- "# and the mole fraction of water in benzene is \n",
"x_2in1 = 3000. #[ppm]\n",
"\n",
- "# Calculations\n",
- "# Thus mole fraction of water in water rich phase is\n",
"x_water_w = (10**(6)-405.)/(10**(6))\n",
"x_benzene_w = 1-x_water_w\n",
"\n",
- "# and mole fraction of the benzene in benzene rich phase is\n",
"x_benzene_b =(10.**(6.)-3000.)/(10**(6))\n",
"x_water_b = 1-x_benzene_b\n",
"\n",
- "# Here both x_water and x_benzene are nearly equal to 1\n",
- "# Thus assumption used for derivation of the equation 11.4(page 282) are suitable here and the equation is \n",
- "# x_i_1 = y_i_1 , where y_i_1 is activity coefficient\n",
"\n",
- "# So activity coefficient of benzene in water is\n",
"y_benzene = 1/(x_benzene_w)\n",
- "# and activty coefficient of the water in benzene is\n",
"y_water = 1/(x_water_b)\n",
"\n",
- "# Results\n",
"print \" Activity coefficient of benzene in water is %f\"%(y_benzene)\n",
"print \" Activity coefficient of water in benzene is %f\"%(y_water)\n"
],
@@ -262,7 +218,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Draw Gibb's free energy vs mole fractions\n",
"\n",
"import math \n",
"from numpy import * \n",
@@ -270,13 +225,11 @@
"\n",
"%pylab inline\n",
"\n",
- "# Variables\n",
"R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n",
"T = 298.15 #[K] Temperature\n",
"g_a_0 = 2. #[kj/mol] Gibb's free energy of the pure species 'a'\n",
"g_b_0 = 1. #[kj/mol] Gibb's free energy of the pure species 'b'\n",
"\n",
- "# Calculations\n",
"for a in range(4):\n",
" def f(x): \n",
" return x*g_a_0 + (1-x)*g_b_0 + (R*T)/1000*(x*log(x) + (1-x)*log(1-x) + x*a*(1-x)**(2) + (1-x)*a*(x)**(2))\n",
@@ -294,7 +247,6 @@
"suptitle(\"Calculated values of the molar Gibbs energy of a binary mixture at 25 \u0014 C, assuming \\\n",
"the symmetrical activity coefficient equation, with various values of A.\")\n",
"\n",
- "# Results\n",
"show()\n",
"print \" The plot is shown in the graphic window.\"\n"
],
@@ -346,30 +298,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Draw two liquid phase\n",
"\n",
"import math \n",
"from matplotlib.pyplot import *\n",
"from numpy import *\n",
"\n",
"\n",
- "# Variables\n",
"T = 92 + 273.15 #[K] Temperature of the system\n",
"R = 8.314 #[m**(3)*Pa/(mol*K)] universal gas consmath.tant\n",
"\n",
- "# Van Laar equation coefficients are given\n",
"A = 1.2739\n",
"B = 3.9771\n",
"\n",
- "# From van laar equation, for water, we have\n",
- "# lnY_a = B**(2)*A*(1-x_a)**(2)/(A*x_a + B*(1-x_a))**(2)\n",
- "# Similarily for n-bumath.tanol\n",
- "# lnY_b = A**(2)*B*x_a**(2)/(A*x_a + B*(1-x_a))**(2)\n",
"\n",
- "# Let us say, g = g_mix - sum(x_i*g_i_0)\n",
- "# So, plotting g vs x_i we have\n",
"\n",
- "# Calculations\n",
"def f(x_a): \n",
"\t return (R*T/1000)*( x_a*log(x_a) + (1-x_a)*log(1-x_a) + \\\n",
" x_a*(B**(2)*A*(1-x_a)**(2)/(A*x_a + B*(1-x_a))**(2)) + (1-x_a)* \\\n",
@@ -378,23 +320,15 @@
"x_a = linspace(0.000001,0.99999,100)\n",
"a = f(x_a)\n",
"plot(x_a,a)\n",
- "#xlabel(\" Mol fraction of species a, x_a\")\n",
- "#ylabel(\" g_mix - sum(x_i*g_i0)\")\n",
"\n",
- "# Now drawing math.tangent \n",
- "#x = linspace(0.000001,0.99999,100)\n",
"x = linspace(0.0,0.99999,100)\n",
"a = 1.2090312*x-1.251495764\n",
- "#plot(x,a)\n",
"plot(x,1.2090312*x-1.251495764)\n",
"xlabel(\" Mol fraction of species a, x_a\");\n",
"ylabel(\" g_mix - sum(x_i*g_i0)\");\n",
"\n",
"show()\n",
"\n",
- "# Results\n",
- "# Figure shows the results of the calculation of the whole range of x_a \n",
- "# Drawing the math.tangent to the curve, the line touches the curve at two points x_a = 0.47 and 0.97\n",
"print \"Thus based on the several assumptions that the Van Laar equation is an accurate representation of LLE\"\n",
"print \"we would conclude that at 92 deg C water-n-butanol does form two liquid phases.\"\n",
"\n"
@@ -440,26 +374,14 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"R = 8.314 #[J/(ml*K)]\n",
- "# We find that the water in benzene least squares fit line has the equation \n",
- "# math.log(x_water(benzene-reach phase)) = 4.175-2967.7/T\n",
"\n",
- "# equation 11.7 in the book (page 286) is \n",
- "# math.log(x_i_1) = (h_i_0-h_i_average)/(RT) + consmath.tant of integration\n",
"\n",
- "# Comparing the two equations term by term, we have\n",
"\n",
- "# Calculations\n",
- "# (h_i_0-h_i_average)/(RT) = -2967.7/T\n",
- "# let us say (h_i_0-h_i_average) = h_mix\n",
- "# So that \n",
"h_mix = -2967.7*R/1000 #[kJ/mol] Heat of mixing of water-in-benzene\n",
"\n",
- "# Now, for benzene-in-water the consmath.tant in the above equation is -522.9K, so\n",
"h_mix_1 = 522.9*R/1000 #[kJ/mol] Heat of mixing of benzene-in-water\n",
"\n",
- "# Results\n",
"print \" Heat of mixing of water-in-benzene is given as %f kJ/mol\"%(h_mix)\n",
"print \" Heat of mixing of benzene-in-water is given as %f kJ/mol\"%(h_mix_1)\n"
],
@@ -489,30 +411,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The amount of water that will come out of the solution in the gasoline\n",
"import math \n",
"\n",
- "# Variables\n",
"T_i = 50. #[F] Initial temperature of the system \n",
"T_f = 20. #[F] Final temperature of the system\n",
"M_gas = 115. #[g/mol] Molecular weight of gasoline at room temperature\n",
"M_water = 18. #[g/mol] Molecular weight of water at the room temperaature\n",
"d = 720. #[g/L] density of gasoline at the room temperature\n",
"\n",
- "# From Figure 11.10 ( page 288 ), solubility of the water in gasoline ( similar to solubility of water in cyclohexane ) at 50 deg F is given as \n",
"s_50 = 0.00026 #[mol fraction]\n",
"\n",
- "# And linearly extraploting the cyclohexane curve in figure 11.10 to 20 deg F, we get the solubility of water at 20deg F as \n",
"s_20 = 0.0001 #[mol fraction]\n",
"\n",
- "# Calculations\n",
- "# So, rejected water is\n",
"s_rej = s_50 - s_20 # mol of water per mole of gasoline \n",
"\n",
- "# In terms of weight, rejected water will be\n",
"w = (s_rej*d*M_water)/M_gas #[g water/L gasoline]\n",
"\n",
- "# Results\n",
"print \" The amount of water that will come out of the solution in the gasoline will be %f g water/L gasoline\"%(w)\n",
"print \" At 20 deg F we would expect this water to become solid ice, forming a piece large enough to plug the fuel line of a parked auto.\"\n"
],
@@ -552,47 +466,30 @@
"from matplotlib.pyplot import *\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 25. #[C]\n",
"x_water = 5. #[mo]\n",
"x_benzene = 0.1 #[mol]\n",
"\n",
- "# The fugacity of the ethanol must be same in both phases so that we have distribution coefficient \n",
"\n",
- "# K = ( distribution coefficient ) = x_ethanol(water_rich phase)/x_ethanol(benzene-rich phase) = y_ethanol(benzene-rich phase)/y_ethanol(water-rich phase)\n",
- "# Here distribution coefficient is defined as rhe ratio of mole fractions of the distributed solute between the two phases.\n",
"\n",
- "# We observe that for the first experimental data set in table 11.4 in the book(page 276)\n",
"x_ethanol_water_rich = 3.817 #[%]\n",
"x_ethanol_benzene_rich = 1.010 #[%]\n",
"\n",
- "# So \n",
"K = x_ethanol_water_rich/x_ethanol_benzene_rich\n",
"\n",
- "# Calculations\n",
- "# Now for all the data set in the table 11.4 in the book(page 276), we wiil draw a plot \n",
"X = array([3.817,7.968,12.977,18.134,23.540,24.069,27.892,31.725,35.510,39.382,41.062,41.771])\n",
"Y = array([1.010,3.323,5.860,9.121,12.939,13.340,16.090,18.943,22.444,26.216,29.341,33.093])\n",
"Z = X/Y\n",
"\n",
- "# Plotting the graph between 'Z' and 'Y' \n",
"plot(Y,Z)\n",
"xlabel(\"Mol% ethanol in benzene-rich phase \");\n",
"ylabel(\"Distribution coefficient of ethanol, K_ethanol\");\n",
- "#xgrid()\n",
- "#xlabel(\"Mol% ethanol in benzene-rich phase \")\n",
- "#ylabel(\"Distribution coefficient of ethanol, K_ethanol\")\n",
"show()\n",
- "# We see from the plot that at the low mole percent of ethanol , the distribution coefficient is approximately \n",
"K_1 = 4\n",
"\n",
- "# Thus ratio of the amount of the ethanol distributed in the two phases will be 4\n",
- "#the amount in mol % is \n",
- "# for water rich phase \n",
"m_water_rich = 100*K_1/(K_1+1)\n",
"m_benzene_rich = 100/(K_1+1)\n",
"\n",
- "# Results\n",
"print \" Ethanol''s 0.1 mol distributed in the water rich phase will be %f mol%% of the total mol\"%(m_water_rich)\n",
"print \" Ethanol''s 0.1 mol distributed in the benzene rich phase will be %f mol%% of the total mol\"%(m_benzene_rich)\n"
],
@@ -638,25 +535,17 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 20. #[C]\n",
- "# At this temperature solubility of NaCl is \n",
"s = 36.0 #[g per 100 g of water]\n",
"M_NaCl = 58.5 #[g/mol] molecular weight of NaCl \n",
"M_water = 18. #[g/mol] molecular weight of water\n",
"\n",
- "# Calculations\n",
- "# weight fraction of NaCl\n",
"w = s/(s+100)\n",
- "# In weight percentage \n",
"w_percent = w*100 #[wt %]\n",
"\n",
- "# Mol fraction of the NaCl\n",
"x = (s/M_NaCl)/((s/M_NaCl)+(100/M_water))\n",
- "# In mol percentage\n",
"x_percent = x*100 #[mol %]\n",
"\n",
- "# Results\n",
"print \" Weight fraction of the NaCl in the saturated solution is %0.1f wt %%\"%(w_percent)\n",
"print \" Mol fraction of the NaCl in the saturated solution is %0.0f mol %%\"%(x_percent)\n",
"\n",
@@ -696,26 +585,19 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T_inlet = 68. #[F]\n",
"T_outlet = 110. #[F]\n",
"\n",
- "# from the figure 11.13 we read that at 68F the solubility of CaCO3 and CaSO4.2H2O are \n",
"s_inlet_carbonate = 60. #[ppm]\n",
"s_inlet_sulphate = 2020. #[ppm]\n",
"\n",
- "# At 110F the solubility of the CaCO3 is \n",
"s_outlet_carbonate = 30. #[ppm]\n",
- "# at 110F the least soluble form of the CaSO4 is anhydride with the solubility \n",
"s_outlet_sulphate = 2000. #[ppm]\n",
" # This is close enough to the solubility of the gypsum at 68F \n",
" # so we conclude that we would not expect either form of CaSO4 to prdcipitate\n",
" \n",
- "# Calculations\n",
- "# Thus total amount of the calcium carbonate which will cime out of the solution and will remain in the heater will be \n",
"w = s_inlet_carbonate - s_outlet_carbonate #[ppm]\n",
"\n",
- "# Results\n",
"print \" Total amount of the solid left behind in the heater will be %0.1f ppm\"%(w)\n",
"\n",
" # Now if a typical houshold water heater heats 100 gallons/per day , we would expect to deposite \n",
@@ -756,25 +638,14 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_2 = 0.1\n",
- "#y_i_1 = (x_i__ideal /x_i_1) , at consmath.tant temperature\n",
- "# From figures 11.15 and 11.16 given in the book (page 298-299) ( or the equations of the lines on those figures, presented in [14] ) we can compute the values in Table 11.6\n",
- "# We see that at x_solute = 10% \n",
- "# T_m/T for the solution in benzene at which math.log(x_experimental) = -1 is equal to 1.332\n",
- "# and that for the solution in CCl4 is equal to 1.288\n",
- "#Now at the that value of the T_m/T \n",
"x_ideal_benzene = 0.114\n",
"x_ideal_CCl4 = 0.152\n",
"\n",
- "# Calculations\n",
- "# In benzene the average these compounds is\n",
"y_i_1 = x_ideal_benzene/x_2# corresponding to practically ideal solution\n",
"\n",
- "# and in benzene the average of these compounds is \n",
"y_i_2 = x_ideal_CCl4/x_2# corresponding to mild type II behavior \n",
"\n",
- "# Results\n",
"print \" Activity coefficient in benzene corresponding to practically ideal solution is %0.2f\"%(y_i_1)\n",
"print \" Activity coefficient in CCl4 corresponding to mild type II behavior is %0.2f\"%(y_i_2)\n"
],
@@ -804,30 +675,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The solubility of the NaCl in water\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+20 #[K]\n",
"\n",
- "# The equation 11.15 (page 297) is given by \n",
- "# log(1/(x_i_1*y_i_1)) = math.log(p_i_solid_phase/p_i_subcooled_liquid) = delta_h_solid_to_liquid/(R*T_melting_point)*(T_melting_point/T-1)\n",
- "# Ignoring the moment the wild extraplation involved, we simply insert the appropriate values\n",
"T_m = 273.15+800 #[K]\n",
"delta_h_fusion = 30219. #[J/g]\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# Calculations\n",
- "# Let log(1/(x_i_1*y_i_1)) = a\n",
"a = delta_h_fusion/(R*T)*(T_m/T-1)\n",
"\n",
- "# Now \n",
"x_NaCl_into_y_i_1 = 1/math.exp(a)\n",
"\n",
- "# If we make the plausible assumption that y_i_1 = 1.00, then\n",
"x_NaCl = 1/math.exp(a)*1\n",
"\n",
- "# Results\n",
"print \" The solubility of the NaCl in water at 20 deg C is %e \"%( x_NaCl)\n",
"print \" But the experimental value is 0.1 so Similar to the results in book our results are very far wrong\"\n"
],
@@ -857,24 +718,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Equilibrium concentration of water vapour\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 1*14.7 #[psia]\n",
"T = 30. #[F]\n",
- "#******#\n",
- "#The vapour pressure of ice at 30F is 0.0808 psia i.e.\n",
"p_ice = 0.0808 #[psia]\n",
- "# We may assume that the solubility of nitrogen and oxygen in solid ice is negligible\n",
- "#Thus\n",
"x_water_in_ice = 1.00\n",
- "#and thus use Raoult's law,finding\n",
"\n",
- "# Calculations\n",
"y_water_vapour = x_water_in_ice*p_ice/P\n",
"\n",
- "# Results\n",
"print \" Equilibrium concentration of water vapour in the air is %0.4f\"%(y_water_vapour)\n"
],
"language": "python",
@@ -902,35 +754,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Estimated solubility of naphthalene in CO2\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+35 #[K]\n",
"p_d = 100. #[atm]\n",
"R = 82.06 #[(cm**(3)*atm)/(mol*K)]\n",
"\n",
- "#The calculated vapour pressure of naphthalene at 35C is\n",
"p_naphthalene = 0.00065 #[atm]\n",
"\n",
- "#The solid is practically pure naphthalene\n",
"x_naphthalene = 1.00\n",
- "#Total pressure \n",
"P = p_d\n",
"\n",
- "# Calculations\n",
- "#By Raoult's law\n",
"y_naphthalene = x_naphthalene*p_naphthalene/P\n",
- "#At this high a pressure the volume of solid naphthalene is\n",
"v = 132. #[cm**(3)/mol]\n",
- "# We have equation math.log(f_d/f_c) = v/(R*T)*(p_d-p_c)\n",
"p_c = 1. #[atm]\n",
"f_d_by_f_c = math.exp(v/(R*T)*(p_d-p_c))\n",
- "#and the estimated\n",
"y_naphthalene = f_d_by_f_c*y_naphthalene\n",
"\n",
- "# Results\n",
"print \"Estimated solubility of naphthalene in CO2 is %e\"%(y_naphthalene)\n",
"\n"
],