summaryrefslogtreecommitdiff
path: root/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb')
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb105
1 files changed, 4 insertions, 101 deletions
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb
index 55160b19..7020eec3 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:1516bb23afc335a7092a1afab7991f3ed9c5be7c83937717220b23a740bce801"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,38 +28,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Fugacity of propane gas\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
"\n",
- "# Variables\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",
- "# We will follow the method 'a' as the book has given the multiple methods to solve this problem\n",
- "# From the equation 7.10 given in the book(page 132), we have \n",
- "# (f/P) = exp((-1/(R*T))*intgrate(a*dp)) , with intgration limits from zero to 'P'\n",
- "# Where 'a' is known as volume residual\n",
- "# Let us say , I = intgrate(a*dp)\n",
"\n",
- "# From the table 7.A(page 134) given in the book, the average value of alpha(a) is \n",
"a = 4.256 #[ft**(3)/lbmol]\n",
- "# so \n",
"\n",
- "# Calculations\n",
"def f6(p): \n",
"\t return a*p**(0)\n",
"\n",
"I = quad(f6,0,P)[0]\n",
"\n",
"\n",
- "# Now \n",
"f = P*math.exp((-1/(R*T))*I) #[psia]\n",
"\n",
- "# Results\n",
"print \"Fugacity of propane gas at the given condition is %.0f psia\"%(round(f,1))\n"
],
"language": "python",
@@ -86,28 +75,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate\n",
- "Compresssibility factor the liquid water\n",
- "Volume residual for the liquid water \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\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",
- "# Calculations\n",
- "# From the steam table, the specific volume of the water at 101.7 F, which is nearly equal to 100 F, and 1 psia is\n",
"v = 0.016136*18 #[ft**(3)/lbmol]\n",
"z = round((P*v)/(R*T),5)\n",
"\n",
- "# and volume residual is given by\n",
"a = int(((R*T)/P))*(1-z) #[ft**(3)/lbmol]\n",
"\n",
- "# Results\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"
],
@@ -137,38 +117,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Fugacity of the pure liquid water\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
- "# Variables\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",
- "# From the figure 7.3(page 138) we see that as P tends to zero, (f/P) tends to 1, so f tends to 0. Therefore, f_a tends to zero also in the diagram\n",
- "# fugacity at point b is calculated by the equation\n",
- "# We have\n",
"f_b = 0.95 #[psia]\n",
- "# We also can write\n",
"f_c = f_b #[psia]\n",
- "# To find the value of f_d, we use the equation \n",
- "# here 'v' is practically consmath.tant(for a liquid), and\n",
"v = 0.016136*18 #[ft**(3)/lbmol]\n",
"\n",
- "# and from the figure 7.3, we have \n",
"P_d = 1000. #[psia]\n",
"P_c = 1. #[psia]\n",
"\n",
- "# Calculations\n",
- "# integrating the left hand side of the equation with the integration limits f_c and f_d and solving, we have\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",
- "# Results\n",
"print \"Fugacity of the pure liquid water at the given condition is %0.1f psia\"%(f_d)\n"
],
"language": "python",
@@ -196,63 +164,39 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate vapor and liquid \n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 78.15 #[C]\n",
"P = 1.0 #[atm]\n",
- "# Here we name ethanol as the species 'a', and water as the species 'b', and name the vapor as phase 1 and the liquid as the phase 2. \n",
- "# Thus vapor pressures of the pure species at the given temperature are\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",
- "# Also composition of the azeotrope is\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",
- "# Also, for an azeotrope mixture\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",
- "# For ideal gas , fugacity is equal to the total pressure of the system, i.e.\n",
- "# f_i_0 = P , (where P is the system pressure)\n",
- "# For pure liquid system, fugacity of a species is independent of the total pressure of the system and is equal to the pure species vapor pressure at this temprature, i.e.\n",
- "# f_i_0 = p_i\n",
"\n",
- "# Now, fugacity of each species in gaseous phase and liquid phase will be equal \n",
- "# so, writing the expression for both liquid and gas phase fugacity and equatinh them, we have\n",
- "# f_a_2 = f_a_1 = (y*Y*P)_a_1 = (x*Y*p)_a_2..........................................(1)\n",
- "# f_b_2 = f_b_1 = (y*Y*P)_b_1 = (x*Y*p)_b_2..........................................(2)\n",
"\n",
- "# We observe that this system has four values of 'Y', one for each of the two species in each of two phases.\n",
- "# Mixtures of the ideal gases are all ideal solutions and the value of 'Y' for all the species in ideal gas phase are unity, so for above two equations\n",
"Y_a_1 = 1.0\n",
"Y_b_1 = 1.0\n",
"\n",
- "# Calculations\n",
- "# Now putting the values these gaseous phase 'Y's in their respective equations 1 and 2, and solving for the liquid phase 'Y's, we have\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",
- "# From equations 1 and 2, the fugacity of each species in each phase is given by\n",
"f_a_1 = (y_a*Y_a_1*P) #[atm]\n",
"f_b_1 = (y_b*Y_b_1*P) #[atm]\n",
- "# and from the definition we have \n",
"f_a_2 = f_a_1 #[atm]\n",
"f_b_2 = f_b_1 #[atm]\n",
"\n",
- "# As we have defined above about the pure species fugacity, so \n",
- "# For vapor phase\n",
"f_a_1_0 = P #[atm]\n",
"f_b_1_0 = P #[atm]\n",
"\n",
- "# For liquid phase\n",
"f_a_2_0 = p_a_0 #[atm]\n",
"f_b_2_0 = p_b_0 #[atm]\n",
"\n",
- "# Results\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",
@@ -297,46 +241,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Fugacity of the methane in the gaseous mixture \n",
- "Fugacity of the butane in the gaseous mixture\n",
- "'''\n",
"\n",
"import math \n",
"\n",
- "# Variables\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",
- "# In this problem, we need the partial molar volume residual.\n",
- "# We find its value at 100 psia by plotting the volume resduals at 100 psia as a function of mole fraction, as shown in figure 7.9( page 150 )\n",
- "# drawing the math.tangent to the data points at x_methane = 0.784 and reading its intercept on the 100 mol% methane axis as 0.6 ft**(3)/lbmol\n",
- "# similarily volume residual is determined for all other pressures and plot them vs pressure, as shown in Figure 7.10 (page 151). \n",
- "# From this plot we find the integral we need by numerical integration ( trapazoid rule ) as 290 ft **(3)/lbmol.\n",
"\n",
- "# Thus, for methane \n",
- "# Let I = intefrate(a_i*dp)) and J = f_i/(P*y_i) , so\n",
"Im = 290. #[ft**(3)/lbmol]\n",
"\n",
- "# Calculations\n",
- "# and\n",
"Jm = math.exp((-1/(R*T))*Im)\n",
"\n",
- "# hence \n",
"f_methane = Jm*P*y_methane #[psia] fugacity of methane\n",
"\n",
- "# doing the same process for bumath.tane, we find \n",
"Ib = 5859. #[ft**(3)/lbmol]\n",
- "# so, for bumath.tane we find\n",
"Jb = math.exp((-1/(R*T))*Ib)\n",
- "# hence \n",
"f_butane = Jb*P*y_butane #[psia] fugacity of bumath.tane\n",
"\n",
- "# Results\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"
],
@@ -366,35 +290,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The value of v_i\n",
- "The value of Y_i\n",
- "The value of phi_cap_i\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\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",
- "# From the example 7.5, we found directly from the PvT data that for methane\n",
- "# (f_i/(P*x_i)) = 0.961 = (v_i*Y_i) = phi_cap_i\n",
- "# So, we can write that\n",
"v_i_into_Y_i = 0.961\n",
"phi_cap_i = 0.961\n",
"\n",
- "# Calculations\n",
- "# From Starling's tables of hydrocarbon properties we read that for pure methane at this T and P,\n",
- "# (F_i/P) = v_i = phi_i , from which it follows \n",
"v_i = 0.954\n",
"phi_i = v_i\n",
"Y_i = phi_cap_i/v_i\n",
"\n",
- "# Results\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"
@@ -426,24 +337,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The value of v=phi\n",
"import math \n",
"\n",
- "# Variables\n",
"T_r = 0.889\n",
"P_r = 1.815\n",
"\n",
- "# Using the properties of n-bumath.tane from appendix A.1 and the equation 7.W, we find that\n",
- "# (f/P) = v = phi = exp((P_r/T_r)*f(T_r,w))\n",
- "# Say, f(T_r,w) = f_f\n",
"f_f = -0.48553\n",
"\n",
- "# Calculations\n",
- "# so\n",
"v = math.exp((P_r/T_r)*f_f)\n",
"phi = v\n",
"\n",
- "# Results\n",
"print \" The value of v=phi for n-bumath.tane at given condition is %f\"%(v)\n"
],
"language": "python",