Material and Energy Balances An EXCEL Spreadsheet for Solving the Peng-Robinson Equation of State for Real Gas Mixtures Brice Carnahan – University of Michigan Introduction The Peng-Robinson Equation of State for Pure Substances The Peng-Robinson (P-R) equation of state [D.Y. Peng and D.B. Robinson, Industrial and Engineering Chemistry Fundamentals, 15, p 59 (1976)] is one of the most popular equations for describing the PVT (Pressure-Volume-Temperature) behavior of real, i.e., nonideal, pure substances, in particular of liquid and gaseous hydrocarbons and common inorganic gases such as oxygen, nitrogen, and hydrogen sulfide. The PR equation is similar to the SRK equation of state shown in Section 5.3b of Felder, and has the following form: P = R T ----------v -b - a(T) ------------------------------v (v + b) + b (v - b) (1) Here, R is the gas constant, P is the absolute pressure, T is the absolute temperature, v is the molar volume, and b and a(T) are given by: b = R Tc 0.07780 ---------Pc (2) R 2 Tc 2 a(T) = 0.45724 ------------- (T) Pc (3) T) = [1 + k (1 - ( T/Tc ) 0.5) ]2 (4) k = 0.37464 + 1.54226 - 0.26992 2 (5) Here, Tc is the critical (absolute) temperature, Pc is the critical (absolute) pressure, and is the Pitzer acentric factor shown for several gases in Table 5.3b of Felder. Thus the P-R equation has in effect just three compound-specific experimentally-determined physical properties: Tc , Pc , and . Note that if the compressibility factor z =Pv /(RT) [see equation (5.3-11) in Felder], then (1) can be written as a cubic equation in z : z3 - (1 - B) z 2 + (A - 3 B 2 - 2 B) z - (A B - B 2 - B 3) = 0 (6) Here, B = Pb /(RT) and A = aP/(RT)2. Hence, using experimental values for , Tc, and Pc (see Tables 5.3b and B.1 in Appendix B of Felder) and given values for temperature T and pressure P, you can find v from equation (1) or z from equation (6). Either of the equations can be solved numerically by using a root-finding algorithm such as Newton's method described in Section A.2e (Appendix A) of Felder. 1 Also note that k and (T) are dimensionless, b has units of vol/mol, a(T) has units of Pressure*(vol/mol)2 and R must be in units appropriate for those chosen for P, T, and v. For this problem, the parameters in the equations should be in units of oK forT, atm for P, and m3/mole for v. The Peng-Robinson Equation of State for Mixtures As written, the P-R equation is intended for description of the PVT behavior of pure compounds. However, it can also be used for mixtures of compounds by using "mixture-averaged" values for the equation parameters. Let the values of parameters aii(T) and bi be the pure-component values of a(T) and b, respectiverly, for the i(th) compound in a mixture. Also, let yi be the mole fraction of component i in the mixture. Then "mixing" rules are applied to compute the mixture-averaged values of a(T) and b for a mixture of n different compounds as follows: b = a (T) = where aij = n yi bi i =1 (7) n yi i =1 (8) aji n yj aij j =1 = ( aii ajj ) 0.5 (9) Problem Statement Prepare a general-purpose EXCEL spreadsheet that: (1) Contains bordered cells where the user will enter values for: a) The mixture temperature, T (deg C) b) The mixture pressure, P (atm) c) The moles of each compound in a mixture containing any of the 14 different (2) Computes the parameters for the Peng-Robinson (P-R) equation of state for all 14 of the pure (3) Computes the mole fractions yi of components i compound (i =1,2,...n ) in the mixture, (4) Determines "mixture-average" values of the P-R parameters b and a(T) for the specified mixture using the mixing rules of equations (7) through (9), (5) Solves equation (1) for the molar volume v (m3/mol) or equation (6) for the compressibility factor z of the mixture (6) Calculates z or v as appropriate (depending on whether equation (1) or equation (6) is solved in part (5)). 2 (7) Computes the following associated information once z and v are known: a) total actual volume of the mixture, V in m3 b) the Pseudocritical Temperature T 'c in oK and Pseudocritical Pressure P'c in atm using c) the Pseudoreduced Temperature T 'r = T/T 'c and the Pseudoreduced Pressure, P'r = P/P'c, as described in Section 5.4c of Felder. Organize your spreadsheet as you like, clearly labeling and outlining the cells to be filled in with data (use the Bordering feature from the Format menu). Gridlines and the row and column labels can be removed from the printed spreadsheet by checking appropriate entries in the dialog box for the Page Setup entry of the "File" Menu (e.g., by printing in horizontal (landscape) mode). The reduce/enlarge feature for laser printing can be used to fit the entire sheet onto one or two pages if it is too big otherwise. Test Cases You should test your spreadsheet carefully to insure that it can handle general mixtures of the given compounds. Once you have done that, use your spreadsheet to solve the following problems: 1. 10 moles of pure N2 at -100 oC and 100 atm. 2. 100 moles of pure CO2 at 27 oC and 6.8 atm (see example 5.3-3 in Felder). 3. a mixture containing 30 moles of ethane, 15 moles of hydrogen sulfide, 20 moles of methane, and 50 4. a mixture containing 1 mole of each of the 14 substances at 50 oC and 1000 atm. In each case, use the values computed in your spreadsheet for the pseudoreduced temperature and pressure to determine the compressibility factor z predicted by the Generalized Compressibility Charts in Section 5.3 of Felder. Write the values from the charts by hand on the corresponding spreadsheets, and note the degree of agreement (or disagreement) with the compressibility factors computed from the P-R equation of state. What to turn in You have one week to complete the problem. Please hand in: 1. One printed spreadsheet showing the cell formulas (use the View feature of the Options menu to see the formulas). If a cell formula cannot be seen completely (because of limited cell space), widen the columns before printing so that the complete formula in every cell on the spreadsheet will show up. 2. A printed spreadsheet for each of the four problems assigned above. Hints The easiest way to implement the Newton's method solution of an equation f(x) = 0 is to set up several cells as follows: 1) A "trigger" cell that normally contains a 0; when the content is set to something else, the iterative calculation is triggered, and proceeds until no cell in the sheet changes by more than a specified tolerance value during one complete iteration. 3 moles of n 2) A cell for holding xold, the "old" value of the solution variable x. It should be conditionally assigned 3. A cell that evaluates f(xold). 4. A cell that evaluates f'(xold). 5. A cell that calculates xnew, the new value of x using Newton's formula (A.2-2): x new = xold - f(xold) /f'(xold). Once the sheet is set up, choose the Calculations tab from the Preferences entry of the File menu, click on the Iteration box. You can set the maximum number of iterations (default value = 100) and the relative tolerance to be used in testing for convergence (default value = 0.001) if you like. Then click on the OK button. To begin the iterative solution, set the trigger cell in the spreadsheet to a nonzero value. Note that Stanley Sandler, in his thermodynamics text Chemical and Engineering Thermodynamics, suggests that Newton's Method usually converges faster and is somewhat more reliable for solving equation (6) than equation (1). However, you may choose to solve either of the equations in your spreadsheet. One easy way to implement the mixing rule calculations of equations (7) through (9) is to use the array functions MMULT and TRANSPOSE in appropriate cell formulas. For example, if the 14 yi values are in one column (say C21:C34) and the 14 bi values are in another column (say G21:G34), then the parameter b given by equation (7) could be computed in a cell with the array formula: = MMULT(TRANSPOSE(C21:C34),G21:G34)) i.e., b is given by the matrix product of the one row matrix (row vector) TRANSPOSE(C21:C43) and the one column matrix (column vector) G21:G34. Once the formula is typed into the formula bar, you must hold down the command key and then press the return key (on a Mac) to enter the array formula into the cell. On the PC, the key combination for entering the formula is <Ctrl><Enter>. BC 4 the initial v