Program for Calculating Equilibrium Yields of Chemical Reaction Products on the PROMIN Electronic Digital Computer
Abstract Generated abstract
The paper presents a program for computing equilibrium yields of chemical reaction products on the PROMIN electronic digital computer, a machine with limited memory and a restricted command set. It discusses the limitations of standard root-finding methods for such hardware and adopts the Wegstein acceleration method to improve convergence of simple iterations, first demonstrating it on a cubic equation for which ordinary iteration diverges. The method is then applied to a nonlinear algebraic system describing thermodynamic equilibrium concentrations of six chemical components, with attention to program organization, readdressing of iterative values, and command economy. The resulting program was used for multiple temperature and parameter combinations, supporting faster calculation of equilibrium concentrations for selecting favorable chemical process conditions.
Full Text
PROGRAM FOR CALCULATING EQUILIBRIUM YIELDS OF CHEMICAL REACTION PRODUCTS ON THE “PROMIN” ELECTRONIC DIGITAL COMPUTER
I. G. Vintizenko, V. M. Reider
(Presented by the scientific seminar of the computing laboratory of TPI)
There are various methods for finding the roots of linear and nonlinear algebraic equations. These include the chord method, Newton’s method, iterative methods, etc. However, all of them, with the exception of the simple iterative method, are sufficiently complex and cannot be used on electronic digital computers of the “PROMIN” type, with small memory and a small number of operations.
The best-known and most frequently used methods are iterative ones, simple both in content and in their implementation on electronic digital computers.
Let there be an equation \(F(x)=0\), where \(F(x)\) is a real function. Two cases may occur: the equation \(F(x)=0\) can be represented directly in the form
\[ x = f(x), \tag{1} \]
and the iterative formula will have the form
\[ x_{n+1} = f x(x_n); \tag{2} \]
the equation \(F(x)=0\) cannot be written in the form (1), unless one takes into account the possibility of simply adding \(x\) to both sides of the equation; the iterative formula has the form
\[ x_{n+1}=x_n+AF(x_n), \tag{3} \]
where \(A\) is a suitably chosen nonzero constant.
However, iterative procedures may fail to lead to solutions (may diverge). If \(\alpha\) is the root of the equation and relation (2) is considered, then the following cases are possible:
a) the values \(x_i\) oscillate and converge; this occurs when
\[ -1 < f'(\alpha) < 0; \]
b) the values \(x_i\) oscillate and diverge; this occurs when
\[ f'(\alpha) \leq -1; \]
c) the values \(x_i\) converge monotonically; this occurs when
\[ 0 < f'(\alpha) < 1; \]
d) the values \(x_i\) diverge monotonically; this occurs when
\[ f'(\alpha) \geq 0 \quad [1]. \]
To ensure convergence of the iterative process in all four cases indicated above, various methods have been proposed. Let us consider one of them, the simplest, in our opinion, to implement on small electronic digital computers—the Wegstein method.
The essence of the method is that after the first step, when formula (2) or (3) has already been used in the form \(x_{n+1}=f(\bar{x}_n)\), formula (4) is applied to find a refined value
\[ \bar{x}_{n+1}=x_{n+1}- \frac{(x_{n+1}-x_n)(x_{n+1}-\bar{x}_n)} {(x_{n+1}-x_n-\bar{x}_n-\bar{x}_{n-1})}. \tag{4} \]
Then the quantity \((\bar{x}_n-\bar{x}_{n+1})\cdot(\bar{x}_{n-1})\) is calculated, and if it becomes less than the preassigned small quantity \(\varepsilon\), the process is terminated and the root of the equation is taken to be \(\bar{x}_{n+1}\); otherwise the operation is repeated.
When using the “PROMIN” electronic digital computer with relatively low accuracy, it is more convenient simply to find the quantity \((\bar{x}_n-\bar{x}_{n+1})\) and compare it with zero. In [1] a clear geometric interpretation of the process is given.
To test the method, a program was compiled for finding the root of the algebraic equation
\[ F(x)=x^3-x-1, \tag{5} \]
for which, when the simple iterative procedure
\[ x_{n+1}=x_n^3-1 \]
is used, the values \(x_n\) diverge.
Table 1
| 0 | 2.3333 | 1.3 |
| 1 | 0.734 | 1.197 |
| 2 | 0.9338 | 0.715 |
| 3 | 1.9552 | −0.634 |
| 4 | 1.1366 | −1.255 |
| 5 | 1.2421 | −2.977 |
| 6 | 1.3425 | −26.409 |
| 7 | 1.3233 | |
| 8 | 1.3247 | |
| 9 | 1.3247 |
The program (Appendix 1) contains 28 commands; of these, 4 commands are allocated for solving equation (5) and 24 for refining the value of the root by formula (4). The results of solving the equation on the electronic digital computer by the Wegstein method and by the method of ordinary iteration are summarized in Table 1. The Wegstein method provided rapid convergence of the iterative process.
This method was applied to solve a system of algebraic nonlinear equations describing the thermodynamic equilibrium of the concentrations of chemical components in a reaction. The original system of equations has the form:
\[ W_1+W_2+W_3+W_4+W_5+W_6=1; \tag{6} \]
\[ (2a+b)W_4=2W_1+W_2+6W_3; \tag{7} \]
\[ \frac{2a+b}{c}\,W_6=2W_1+W_2+6W_3; \tag{8} \]
\[ \frac{2a+b}{b}\,(W_2+2W_5)=2W_1+W_2+6W_3; \tag{9} \]
\[ W_3\cdot W_5^2\,Kp_1=W_2; \tag{10} \]
\[ W_1^2\,Kp_2=W_3\cdot W_4, \tag{11} \]
where \(a\), \(b\), \(c\) are constants, \(Kp_1\) and \(Kp_2\) are equilibrium constants, and \(W_j\) are the concentrations (partial pressures in the particular case) of the interacting components.
Calculations by formulas (6)—(11) and refinement of the value of each root \(W_j\) by formulas (4) are simple; when compiling the program, the bas-
Extraction of \(W_1^{n+1}, W_2^{n+1}, \ldots, W_6^{n+1}\)
↓
Calculation of the refined value \(\overline{W}_k^{\,n+1}\)
↓
Readdressing
↓
Counter (6 cycles)
↓
Clearing the counter
↓
Readdressing
\(\overline{W}_n - \overline{W}_{n-1}, \qquad \overline{W}_{n+1} - \overline{W}_n\)
↓
Counter (18 cycles)
↓
Readdressing
\(\overline{W}_{n+1} - \overline{W}_n\)
↓
Counter (6 cycles)
↓
Clearing the counters
(18 and 6 cycles)
↓
Restoration of working cells
↓
Reading the \(i\)-th iteration
↓
Stop
Fig. 1. Program block diagram
The main difficulty consists in readdressing the values \(\overline{W}_n, W_{n+1}\ldots\), since the values \(W_j\) used in the \(j\)-th iteration must be replaced by \(W_k(=W_{j+1})\) in the \(k\)-th iteration \((k=j+1)\) and simultaneously rewritten into the cells for the values \(W_{k-1}\).
To reduce the number of program instructions, the rewriting of the values \(\overline{W}_n, W_{n+1}, \overline{W}_{n-1}, W_n, \overline{W}_{n+1}\) of the root value of the \(n\)-th iteration into, respectively, \(\overline{W}_{n-1}, W_n, \overline{W}_n\) values in the \(n+1\)-th iteration is carried out by one cycle (instructions 66–85), for which it is recommended that the above-mentioned root values be written into the following cells:
\[ \overline{W}_n(01 \div 06), \]
\[ W_{n+1}(07 \div 12), \]
\[ \overline{W}_{n-1}(21 \div 26), \]
\[ W_n(27 \div 32), \]
\[ \overline{W}_{n+1}(13 \div 18). \]
The program is given in Appendix 2; in its working part it contains 100 instructions, of which 30 are used for calculating the roots \(W_j\), and 70 for refining the roots \(\overline{W}_j\) and readdressing. The construction of the program is illustrated by the flow chart in Fig. 1.
The calculations were carried out for 15 values of temperature (on which the values \(K_{p1}\) depend) and several tens of values of the parameters \(a, b, c\) and their various combinations.
Appendix 1
Program 1
| Instruction number | Operation | Address | Explanations |
|---|---|---|---|
| 00 | read | 01 | |
| 01 | multiply | 01 | |
| 02 | multiply | 01 | |
| 03 | subtract 1 | 86 | |
| 04 | store | 02 | |
| 05 | subtract 1 | 04 | |
| 06 | subtract 1 | 01 | |
| 07 | add | 03 | |
| 08 | store | 10 | |
| 09 | read | 02 | |
| 10 | subtract 1 | 04 | |
| 11 | store | 11 | |
| 12 | read | 02 | |
| 13 | subtract 1 | 01 | |
| 14 | multiply | 11 | |
| 15 | divide | 10 | |
| 16 | subtract 2 | 02 | |
| 17 | store | 05 | |
| 18 | read | 01 | |
| 19 | store | 03 | |
| 20 | read | 02 | |
| 21 | store | 04 | |
| 22 | read | 05 | |
| 23 | store | 01 | |
| 24 | subtract 1 | 03 | |
| 25 | divide | 01 | |
| 26 | subtract 2 | 12 | |
| 27 | conditional transfer 1 | 00 | |
| 28 | stop |
The use of electronic digital computers considerably speeds up the calculations, and knowledge of such a large number of variants of equilibrium-yield concentrations makes it possible to conduct the chemical process in the most advantageous direction.
REFERENCES
- J. N. Lance. Numerical Methods for High-Speed Computers. Foreign Literature Publishing House, Moscow, 1962.
Appendix 2
Program 2
| Command number | Operation | Address | Explanations |
|---|---|---|---|
| 00 | read | 04 | |
| 01 | mult. | 03 | |
| 02 | div. | 61 | |
| 03 | √ | ||
| 04 | store | 07 | |
| 05 | read | 01 | |
| 06 | add | 01 | |
| 07 | add | 02 | |
| 08 | div. | 62 | |
| 09 | add | 03 | |
| 10 | mult. | 72 | |
| 11 | store | 10 | |
| 12 | mult. | 53 | |
| 13 | store | 12 | |
| 14 | mult. | 64 | |
| 15 | sub. 1 | 02 | |
| 16 | mult. | 88 | |
| 17 | store | 11 | |
| 18 | read | 86 | |
| 19 | sub. 1 | 01 | |
| 20 | sub. 1 | 02 | |
| 21 | sub. 1 | 04 | |
| 22 | sub. 1 | 05 | |
| 23 | sub. 1 | 06 | |
| 24 | store | 09 | |
| 25 | read | 03 | |
| 26 | mult. | 60 | |
| 27 | √ | ||
| 28 | mult. | 05 | |
| 29 | √ | ||
| 30 | store | 08 | |
| 31 | read II | 50 | |
| 32 | store | 33 | |
| 33 | read II | 51 | |
| 34 | store | 34 | |
| 35 | read II | 53 | |
| 36 | store | 35 | |
| 37 | read II | 52 | |
| 38 | sub. 1 | 33 | |
| 39 | sub. 1 | 35 | |
| 40 | add | 34 | |
| 41 | store | 78 | |
| 42 | read | 34 | |
| 43 | sub. 1 | 35 | |
| 44 | store | 77 | |
| 45 | read | 34 | |
| 46 | sub. 1 | 33 | |
| 47 | mult. | 77 |
Continuation of Appendix 2
| Command number | Operation | Address | Explanations |
|---|---|---|---|
| 48 | div. | 78 | |
| 49 | sub. 2 | 34 | |
| 50 | store II | 54 | |
| 51 | read II | 40 | |
| 52 | add f. | 90 | |
| 53 | store II | 40 | |
| 54 | read | 40 | |
| 55 | add f. | 90 | |
| 56 | store | 40 | |
| 57 | sub. f. | 41 | |
| 58 | cond. 1 | 51 | |
| 59 | read | 42 | |
| 60 | store | 40 | |
| 61 | read | 71 | |
| 62 | add f. | 90 | |
| 63 | store | 71 | |
| 64 | sub. f. | 65 | |
| 65 | cond. 1 | 31 | |
| 66 | read | 66 | |
| 67 | store | 50 | |
| 68 | read | 68 | |
| 69 | store | 52 | |
| 70 | read II | 50 | |
| 71 | store II | 52 | |
| 72 | read | 52 | |
| 73 | add | 90 | |
| 74 | store | 52 | |
| 75 | read | 50 | |
| 76 | add f. | 90 | |
| 77 | store | 50 | |
| 78 | sub. f. | 44 | |
| 79 | cond. 1 | 70 | |
| 80 | read | 46 | |
| 81 | add f. | 90 | |
| 82 | store | 46 | |
| 83 | store | 52 | |
| 84 | sub. f. | 67 | |
| 85 | cond. 1 | 70 | |
| 86 | read | 66 | |
| 87 | store | 50 | |
| 88 | read | 67 | |
| 89 | store | 51 | |
| 90 | read | 68 | |
| 91 | store | 52 | |
| 92 | read | 69 | |
| 93 | store | 53 | |
| 94 | read | 70 | |
| 95 | store | 54 | |
| 96 | read | 00 | |
| 97 | store | 46 | |
| 98 | store | 71 | |
| 99 | stop |