Solving Nonlinear Simultaneous Equations by the Method of

Applications to Equations of State. J. G. Eberhart. University of Colorado, Colorado Springs, CO 80933. Many of the practical calculations of physical...
0 downloads 0 Views 2MB Size
Solving Nonlinear Simultaneous Equations by the Method of Successive Substitution Applications to Equations of State J. G. Eberhart University of Colorado, Colorado Springs, CO 80933 Many of the practical calculations of physical chemistry require the solution of a nonlinear equation or a system of simultaneous nonlinear equations. One of the simplest and most versatile numerical methods for solving these equations is the technique of successive substitution ( 1 4 ) . The approach is easily adapted to a microcomputer and can provide physical chemistry students with the experience of applying their programming skills to the task of scientific prediction. For several years now our physical chemistry laboratory course has included several student programming exerclses based primanly on the use of various equations of state to predict a variety of fluid properties. The computational tasks accomplished are the calculation of

.

-

the~.molar volume or densitv of a fluid from a eiven temoerarum and pressuretone equatron in one unknown. t h e limit of superheat temperature and molar volume of a liquid at a given pressure (two equations in two unknowns) the bailing point and the liquid- and gas-phase molar "01umis of a fluid for a given pressure (three equations in three unknowns).

where critical constants with a prime are theoretical values, and those without a prime are experimental. To illustrate successive substitution for one equation in one unknown, the following problem is considered. Problem 1 Using the Redlich-Knong equation of state, find the molar volume ofn-hexane at 298.15 K and 1 utm. The n~uuirt:d critical constants are T,= 507.4 K andp, = 29.3 atm (8j. Solution The two parameters are calculated from eqs 3 and 4, yielding b = 0.12312 dm3mol-' and a = 569.72 atm Km dm6m01-~. To annlv the method of successive substitution.. ea 1is rearranged so that one of the molar volume terms is transposed to the left-hand side. and all the other terms arc broueht to the righhhand side. If the molar volume in the repulsiv~term of eq 1 is selected for the left-hand side, the result is

.. .

.

a

+

The exercises are illustrated here with the RedlichKwong equation of state for a fluid. One Equation in One Unknown The Redlich-Kwong two-parameter equation of state (5)has the form

RT

u=b+

+ +"(" b)

Then the algorithm for taking a n approximation of the molar volume, ul, and calculating a better approximation, uz, is RT

uz=b+

P+

where b and a characterize the molecular size and intermolecular attraction of the fluid; and u is the molar volume of the fluid. The constants b and a are usually determined through the critical conditions and the critical properties of the fluid. Because there are three critical conditions and only two parameters, a relationship is obtained among the three constants (6)that states that the critical compressibility factor has a theoretical value of Ec = 113 (7).If the critical temperature and pressure are assigned their expenmental values and the critical molar volume its theoretical value, then the parameters are found from the relationships (7)

(5)

a

T*",(", + b)

(6)

An initial approximation to the molar volume must now be found. If the temperature and pressure selected corresponded to a gaseous ~ t u t forn-heianc, e then the ideal gas law miaht be used yielding u, = RT D . However, n-hexane is a liq;id a t the conditionsofthe problem. The liquid state has a minimum molar volume of b, according to eq 1. Thus, a first approximation is selected with a somewhat larger molar volume (20% larger) of ul = 1.2b. Finally, a simple program provides the actual successive approximations. Seven iterations are required to obtain convergence on the root of eq 1 to five significant figures. They are shown in Table 1 and yield the result u = 0.15506 dm3 mol-'. Two Equations in Two Unknowns To illustrate the solution of two equations in two unknowns, the calculation of the limit of superheat or spinodal temperature and the spinodal molar volume of a liquid (9-11) is considered. Liquids that are stable (below the boiling point) or metastable and superheated (above the boiling point) obey the mechanical stability condition of thermodynamics, (apt Ju)=< 0 . The boundary between metastable states, where ( a p l a u ) ~is negative, and unstable

1038

Journal of Chemical Education

Table 1. Successive states, where ( a p l a ~is) positive, ~ Approximations is the spinodal state, where for the Molar Volume

[$l=

0

v/dm3mol-'

The limit of superheat of a liquid is thus provided by the minimum point on the van der Waals loop on the p-u isotherm of the fluid so that (a2p/a~2)T > 0. The limit of supercooling of the vapor is the maximum point on the loop, where (a2plau2)T < 0. As a result of the spinodal condition, an equation of state can be used to predict the spinodal temperature and molar volume of a liquid at a specified pressure, as illustrated by the following exercise. 0.14774 0.15275 0.15433 0.15483 0.15498 0.15503 0.15505 0.15506

Problem 2

the coexisting liquid Table 2. Successive Approxiand gaseous phases, mations for the Spinodal Mothen T., UI, and u,will be lar Volume and Temoerature found for a specified value of p. The calmlavddm3mo14 TdK tion is based on the Max0.29723 454.06 well equal-area theorem (12),which provides the 0,29863 455.23 equilibrium vapor pres0,29888 455.44 sure as having the value 455.47 whose plateau cuts the 029893 van der Waals loop ofthe 0.29894 455.48 fluid p-u isotherm into two equal areas. The result can be obtained from the Gibbs equation for the molar Helmholtz function, a, namely da = -sdT -pdu (13) where s is the molar entropy. The change in a between the equilibrium gas and liquid phases at the same temperature is

Using the Redlich-Kwong equation of state, 6nd the spinodal temperature and molar volume of n-hexane at 1 atm. Solution Equation 1is first used to fmd (aplau)~, which is

where p depends on u and T. The molar Helmholtz function is related to the molar Gibbs function,g, or chemical potential, p, via the equation

The spinodal temperature and molar volume, T,and us, can thus be found from eqs 1.7, and 8, which yield eqs 9 and 10. p=-- RT. (us

- b)

Thus,

a

~pu.(u, + b)

(9)

At equilibrium pl = k,which yields the Maxwell equalarea relationship. "a

The algorithm for computing T,and u. is obtained by selecting the first u, from the attractive term of eq 9 and the term obtained from eq 10. The result is

cA

P@,- UI) = ~ P ( v .TJ du

(14)

"I

When this result is combined with the fact that the pressure is the same in both phases, the two additional required equations are P =P(UI, TJ =p(ug.TJ

(15)

The solution of these three equations is illustrated in the following exercise. Problem 3

In this two-equation algorithm, improved approximations for us are used immediately in subsequent calculations of T.. An initial approximation for T,and u. can be obtained by assumingp = 0 in eq 9 and solving eqs 9 and 10 algebraically. This yields u., = (2'" + l ) b and (2% + 3)Rb

When a program is used to carry out the calculations, the algorithm converges on the mots us = 0.29894 dm3mol-' and T,= 455.48 K. The four successive approximations required to obtain these results are shown in Table 2. Three Equations in Three Unknowns To illustrate the solution of three equations in three unknowns, the calculation of the boiling point or equilibrium temperature of a liquid will be examined. If T . is the equilibrium temperature and ul and u, are the molar volumes of

Using the Redlich-Kwong equation of state, find the equilibrium temperature and the liquid and gaseous molar volumes of n-hexane a t 1atm. Solution Integrating eq 14 using eq 1, we get for the Maxwell equal-area condition, for the Redlich-Kwong equation,

Equation 15 yields p=-- RTe (UI - b)

Volume 71

a

'@ol(ul

+ b)

Number 12 December 1994

(17)

1039

Equations 17 and 18 can be solved for the molar volume appearing in the repulsive term, yielding "12

=b

+

Table 3. Successive Approximations for Liquid and Gaseous Molar Volumes and Equilibrium Temperature

RTd

Equation 16 is solved for the temperature in the first term of the right-hand side, giving

Again, in this three-equation algorithmof eqs 19-21, improved approximations are used a s soon as they are available. Initial approximations that are fairly good a t atmospheric pressure are ull = 12b, v,l = 200b, and T.1 = 0.6TC.The initial approximations converge on the roots of the three equations, u, = 0.16071 dm3 mol-', u, = 25.144 dm3mol-', and T . = 320.20 K. Ten iterations were required for five-significant-figure accuracy. The successive approximations are shown in Table 3. Summary and Comments Some examples are provided here of nonlinear equations or systems of equations that can be solved by the method of successive substitution. Of course, other numerical methods also can be used (13,141. Finally, various choices are possible in setting up the algorithm in each problem. The choice made, as well as the

1040

Journal of Chemical Education

initial approximations, determine whether the calculations converge on the solution or diverge away from the solution. Sometimes several algorithms must he tried before one is found that converges. It is also possible to use Atkins method (13)to construct a converging sequence out of a diverging one. Literature Cited 1. Norris, A C. Computotlmol Chemistry: An Infmducfion to Numark1 Methods; John Wiley and Sons: New York, 1981;pp 62-68. 2. Hildehrand, F B. lnlmduclion lo Numricol Analysis; Dover: New Ymk, 1981: pp

178 and 209-211. 5 . Redlieh, 0.;Kwong, J. N. S. C h m . Re". 1949.44.233-243 8. Eherhart. J. 0. J Chem. Edue 1989.66.906909.