Computers chem. Engng Vol. 21, No. I, pp. 87-92, 1997
Pergamon
0098-1354(95)00251-0
Copyright © 1996 Elsevier Science Ltd Printed in Great Britain. All rights reserved 0098-1354/96 $15.00+0.00
OPTIMAL DESIGN OF AN AMMONIA SYNTHESIS REACTOR USING GENETIC ALGORITHMS SIMANTR. UPRETI and KALYANMOYDEB Department of Chemical Engineering Indian Institute of Technology Kanpur UP 208 016 India Department of Mechanical Engineering Indian Institute of Technology Kanpur UP 208 016 India (Received 21 September 1994; accepted 12 June 1995) Abstract--This paper presents an optimal design procedure of an ammonia synthesis reactor using genetic algorithms (GAs)-search and optimization techniques based on principles of natural genetics. GAs are chosen as an optimization tool simply because of their successful application to many engineering optimization problems. The optimal problem requires maximisation of an objective function subject to a number of equality constraints involving solution of coupled differential equations. Although there exist at least a couple of other studies on the optimal design of ammonia synthesis reactor, they have ignored some terms in the formulation of the objective function, for which the reported optimal solution does not match with the solution obtained using an enumerative search technique. This paper includes those terms and applies GAs to find the optimal reactor length. Simulation results with GAs find optimal reactor lengths at various feed gas temperatures at the top of the reactor. The results of this paper are also found to agree with the reactors used in industries. The successful application of GAs in ammonia reactor design suggests GAs immediate application to other reactor designs or modelling. Copyright © 1996 Elsevier Science Ltd
perature trajectory along the reactor length applying the Pontryagin's maximum principle. Although their formulation was correct, the stated objective function was wrong. Edgar and Himmelblau (1988) identified this error, rectified the same and used Lasdon's generalized reduced-gradient method to arrive at an optimal reactor length corresponding to a particular reactor top temperature of 694 K. However they also ignored a term mentioned in Murase's formulation, pertaining to the cost of ammonia already present in the feed gas, in the objective function. Also the expressions of the partial pressures of nitrogen, hydrogen and ammonia-used to simulate the temperature and flow rate profiles across the length of the reactor-were not correct. Vasantharajan et al. (1990) obtained the optimal combination of the feed gas temperature at the top of the reactor and reactor length using a non-linear programming technique. Only a few internal points along the length of the reactor were selected for the simulation of the reactor profiles. This does not appear to do justice to the not-so-smooth reactor profiles and leaves behind an uncertainty of the globality of the obtained optimal solution. In this paper, we rectify all the above shortcomings present either in the formulation of the problem or in the part of the optimization process. Specifically, we use the Murase's formulation with the correct objective function. The correct stoichometric expressions of the partial pressures are applied. In order to obtain solutions with adequate accuracy, sufficient number of internal points are taken in the solution of the differential equations. Over last decade, genetic algorithms (GAs) have enjoyed a large scale application to a wide spectrum of
INTRODUCTION
This paper considers the problem of optimally designing an ammonia synthesis reactor described by Murase et al. (1970). The reactor is based on the Haber's process: N 2+ 3H, ,--. 2NH3. Feed gas with nitrogen, hydrogen, ammonia, methane, and argon enters the bottom of the reactor. Before reversing its flow-path to undergo reversible exothermic reaction in the catalyst basket, the feed gas gets preheated by the counter-current flowing reaction gas. Ammonia is then produced in the catalyst basket due to the reaction between nitrogen and hydrogen in the presence of the catalyst. Unconverted nitrogen and hydrogen, ammonia and the inerts constitute the reaction gas which leaves the bottom of the reactor after crossexchanging heat with the incoming feed gas. The optimization problem consists of maximizing the economic return subject to three equality constraints based on energy and mass balance of the governing reactionsthree coupled ordinary differential equations (ODE's)and three inequality constraints. Since there are four problem variables and three equality constraints, we have only one degree of freedom. The reactor length is chosen as an independent variable. Mass flow rate of nitrogen, temperature of feed gas and temperature of the reaction gas mixture at the exit of the reactor are the three dependent variables related to each other as well as to the reactor length through the above mentioned equality constraints. Murase et al. (1970), computed the optimum tem~cE 2,-~-~
87
88
S, R. UPRETIand K. DEa
engineering design problems (Deb, 1993; Goldberg, 1989). GAs are optimization techniques that artificially simulate the gradual adaptation of natural chromosomes in the quest of producing better and more suitable individuals. In principle, GAs are very different search algorithms than the traditional search and optimization techniques (Rao, 1984; Reklaitis et al., 1983). The main reason of the success of GAs is their simplicity, global perspective, and parallel processing capabilities. In the remainder of this paper, we first describe the formulation of the optimal ammonia reactor problem. Thereafter, a brief description of the working principle of genetic algorithms is presented. Simulation results of GAs for different top temperatures are presented next. Results show that the optimal reactor length is constant for a wide range of the top temperature. These results seem to be supporting the practice in industry as documented in Eymery (1964). The success story of GAs in this paper suggests further use of GAs in similar design problems. PROBLEM
FORMULATION
The formulation used in this paper is similar to that in M urase et al. (1970). The modi fications to that model are mentioned in this section. Feed gas contains 21.75 mole% nitrogen, 65.25 mole% hydrogen, 5 mole% ammonia, 4 mole% methane and 4 mole% argon. In a typical ammonia reactor, feed gas enters the bottom of the reactor. The production of ammonia depends on the temperature of feed gas at the top of the reactor (henceforth called as top temperature), the partial pressures of the reactants (nitrogen and hydrogen), and the reactor length. The optimal design problem requires to obtain the optimal reactor length yielding maximum economic returns from the reactor operation corresponding to various top temperatures.
Objective function The objective function is the economic return based on the difference between the value of the product gas (heating value and the ammonia value) and the value of feed gas (as a source of heat only) less the amortisation of reactor capital costs. Originally, an expression of this objective was formulated by Murase et al. Unfortunately, the stated objective function was incorrect. That error was corrected by Edgar and Himmelblau (1988), but they ignored the term involving the cost of the ammonia present in the feed gas. If this cost term is not included in the optimization problem, the reverse reaction may make the overall cost value negative. In the following, we present the revised objective function:
f(x, NN,., Tl, Tx)= 1.33563 X 107- 1.70843 × I04NN, +704.09(Tx - T0)
(1)
- 699.27(TI - T~,) -
[3.45663 × 107+ 1.98365 × 109x]j~.
It is clear from the above expression that the objective function depends on four variables: the reactor length x, proportion of nitrogen NN:, the top temperature Tx, the feed gas temperature TI. In order to maintain the energy balance of reactions, three coupled differential equations must be satisfied. It turns out that three of above variables can be eliminated by satisfying those energy balance equations. Thus, practically, there is only one design variable for a given top temperature.
Equality constraints The model of ammonia reactor involves three energy balance equations (Edgar and Himmelblau, 1988). First of all, the increase in temperature of the feed gas, as it goes up the reactor, must be according to the heat gained from the reaction gas. Thereafter, the change in the reaction gas temperature must be according to the heat lost to the feed gas as well as the heat generated in the reaction. The third differential equation is obtained from the mass balance of nitrogen. The partial pressures appearing in the differential equations are computed as follows: 286NN., PN_,-2.598NN:+ 2NN,_' PH_,= 3pN,, 286(2.23NN,0 -- 2u~,;) Pun'= 2.598Nu:, + 2Nu: The three differential equations are coupled to each other. The boundary conditions are:
T](x=O)=To, T~(x=0)=Tl, NN:(X=0)=701.2 kmol/(m2h). In this paper, we study the effect of the top temperature To on the optimal reactor length. For each value of T0, the optimization algorithm is simulated and an optimal reactor length is obtained. Before we present the simulation results, let us mention the three inequality constraints that limit the values of three of the design variables.
Inequality constraints As considered in earlier studies, we set the lower and upper bounds of the design variables as follows: 0.0-
Design of an ammonia synthesis reactor
89
800 700 mass flow rate,
600
km°l/m2"h 500 or
temp., K
4OO 300 r e a c t i o n l~as t e m p I
200 0
2
4
I
1
6
8
reactor length, m Fig. 1. Reactor profiles at a top temperature of 694 K. (Both mass flow rate and temperature have the same range) GENETIC ALGORITHMS
N U M E R I C A L S I M U L A T I O N AND RESULTS
Genetic algorithms (GAs) are search and optimization procedures motivated by natural principles and selection (Goldberg, 1989; Holland, 1975). GAs has been developed by John Holland of University of Michigan and later modified by a number of researchers. Detailed discussion of the working of GAs can be found in Goldberg (1989). It will suffice here to mention that GAs begin with a population of random solutions represented in some string structures. Thereafter, three main operators (reproduction, crossover, and mutation) are repeatedly applied to create new and hopefully better populations. This procedure continues until some user-defined termination criterion is satisfied. One reason of GA's popularity is that unlike many traditional optimization methods, GAs demand less from the underlying problem: GAs do not require the objective function to be continuous and/or differentiable. GAs do not require extensive problem formulation. GAs are not sensitive to the starting point. GAs usually do not get stuck into so-called local optima. GAs processing is inherently parallel, thereby making the search process faster. These characteristics enhance their application to a broad spectrum of optimization problems and have been found useful in many engineering design problems (Belew and Booker, 1991; Goldberg, 1989; Grefenstette, 1985, 1987; Forrest, 1993). Although, to date, there exists approximate mathematical analysis to explain why GAs work, but like many other optimization methods for solving NLP problems, GAs do not yet have a formal mathematical convergence proof.
The equality constraints-three coupled ODEs-are solved using Gear package of NAG library's subroutine, D02EBF, for various top temperatures of the reactor. Mass flow rate of nitrogen, feed gas temperature and reaction gas temperature at every 0.01 m of 10 m reactor length are obtained. For a typical top temperature of 694 K, Fig. I shows their profiles along the length of the reactor. In contrast, we observe that reverse reaction starts below 666 K top temperature and the inequality constraint for the feed gas temperature is violated. Figure 2 shows the variation of the mass flow rate of nitrogen and variation of T8 and TI along the reactor length at a top temperature 664 K. It is clear that the mass flow rate of nitrogen is increasing along the reactor length and after certain length the solution of three differential equations produces inexact flow rate. ~ The feed gas temperature is higher than the reaction gas temperature in most part of the reactor. These profiles suggest that the reverse reaction is taking place at a top temperature lower than 666 K. We also observe that when the top temperature is higher than 706 K, all three differential equations become numerically instable. Therefore, it becomes difficult to solve those ODEs for the complete reactor length. Moreover, the solutions obtained from the ODEs violate the inequality constraints for the feed gas temperature. In order to find an optimal reactor length at a wide range of top temperatures (from 666 to 706 K),
With an initial flow rate of 701.2 kmol/(sq.m-h) and with 125.7 kmol/(sq.m-h) of ammonia present in the feed gas, the flow rate of nitrogen leaving the reactor must not be more than 826.9 kmol/(sq.m-h).
90
s. R. UPRETIand K. DEB 1400 1300 1200 m ~
~ow
rate,
1100
k m ° l / m 2 " h 1000 or
temp., K
900 800 700 r e a c t i o n gas t e r n p 600 0
l
I
I
1
2
4
6
8
I0
reactor length, m Fig. 2. Reactor profiles at a top temperature of 664 K. (Reverse reaction occurs almost throughout the reactor length)
Table 1. Simulation results obtained using GAs and direct computations. Top Temp K
664 666 668 670 672 674 676 678 680 682 684
Optimal length Enomer. m
GAs m
Profit S/year xl0 '~
0.63 0.63 5.31 5.31 5.31 5.31 5.31 5.31 5.31 5.31 5.31
0.64 0.64 5.32 5.32 5.32 5.32 5.32 5.32 5.32 5.32 5.32
1.69 1.71 3.21 3.26 3.30 3.36 3.39 3.43 3.48 3.54 3.62
we apply genetic algorithms to the above reactor model at 22 different top temperatures. To have a least count of 0.01 m in the range 0-10 m, the reactor length is encoded in a ten-bit binary string. Roulette wheel proportionate selection is applied for the reproduction operation. A single-point crossover operator and a bitwise mutation operator are used. The following GA parameters are used: Crossover probability =0.9 Mutation probability =0.2 Population size = 25 Maximum generations = 25 Table 1 shows the optimal reactor length obtained at different top temperatures using GAs as well as using an exhaustive search method. In the latter method, the economic return is computed at thousand equi-spaced points along the reactor length satisfying all equality and inequality constraints. It is noteworthy that the latter computations are performed only to verify the accuracy of GA search method. It is interesting to observe that the optimal reactor length remains virtually constant in the range 668-706 K of top temperature. This reactor length
Top Temp K
686 688 690 692 694 696 698 700 702 704 706
Optimal length Enumer. m
GAs m
Profit S/year xl0 -6
5.31 5.31 5.32 5.32 5.32 5.32 5.32 5.32 5.32 5.32 5.30
5.32 5.32 5.33 5.33 5.33 5.33 5.33 5.33 5.33 5.33 5.33
3.72 3.83 3.96 4.09 4.23 4.37 4.49 4.59 4.67 4.73 4.77
is lying in the range 5.30-5.33 m. Eymery (1964), in his doctoral dissertation, documented industrial ammonia reactor design data. Above results are obtained with the same feed gas composition and other inputs as mentioned in Eymery's work. He reported that the typical reactor length of industrial ammonia reactors operating under the similar conditions is 5.18 m. Our results agree with his documented results. Moreover, the fact that the optimal reactor length found in this paper is invariant with respect to the top temperature agrees with the industrial practice. It is also clear from the table that the optimal profit increases monotonically for reactors operating at higher top temperatures. In order to investigate the effect of GA parameters on the optimal reactor length, we have applied GAs with three different initial populations. The progress of those simulation runs is shown in Fig. 3. A top temperature of 694 K is considered. The results show that in all cases GAs have been able to converge closer to the optimal reactor length. In other GA simulations with different parameter values, identical results were obtained. One of the advantages of using GAs is that they
Design of an ammonia synthesis reactor
5.45
I
length, m
I
I
I
I
I
I
I
I
5.35 reactor
I
91
5.3 5.25 i
5.2 t
seed = 0.0001 0 seed = 0.5000 I seed = 0.8431 0 o p t i m a l level . . . .
5.15 5.1 ~
0
I
i
i
t
i
i
t
J
i
5
I0
15
20
25
30
35
40
45
50
# of g e n e r a t i o n s Fig. 3. Reactor lengths obtained from three different GA simulations. 5.0
_
,
.
.
' . . . . ,
. . . .
!
.
.
.|
4.5 4.0 I 3.5 profits, x lO-6$/yr
3.0
2.5 2.0 1.5 1.0 0.5 0.0 0
2
4
6
8
10
r e a c t o r length, rn Fig. 4. Profit from the reactor operation at different top temperatures.
usually do not get trapped into local optimal solutions. In order to show the multimodality of the search space of the above problem, we have also plotted the profit versus reactor length in Fig. 4 at various top temperatures. The figure shows that each profit function has about three optimum points, of which one is the global optimum point. Although the multimodality is not severe, the results of the previous simulations show that in all cases GAs did not get trapped into one of those two local optimum solutions. This distinguishes GAs from many traditional optimization methods. It is worth mentioning here that if a gradient-based optimization technique (Reklaitis et al., 1983) is used instead and an initial guess of a reactor length of 1 m or so is used, the algorithm may have got stuck at a solution with a much
lower profit. Another advantage of using GAs is their inherent capability to better solve noisy and nonstationary problems (Goldberg, 1989). GAs can be used in the modelling of reactors, even in the presence of inexact information of reactor parameters. CONCLUSIONS
This paper solved a problem of optimal design of an ammonia reactor using genetic algorithm (GA)---a new yet potential search algorithm. In the range from 668 to 706 K operable range of top temperature of the reactor, the profit corresponding to the optimal reactor length is found to increase monotonically. Beyond 706 K top temperature, the simulation of the reactor model is not
92
S. R. UPRETIand K. DEB
feasible. The optimal reactor length found using GAs shoots suddenly at a top temperature of 668 K from 0.63 m to 5.31 m (probably due to the dominating reverse reaction in the former case) and then remains more or less constant. Typical economic return from the reactor operation with a top temperature of 694 K and 5.33 m reactor length comes out to be 4.23 million dollars per year. Besides finding the optimal reactor length, this paper has achieved a number of other aspects related to ammonia reactor design. This paper has included a term in the formulation of the objective function, which was ignored by Murase et al. (1970) and Edgar and Himmelblau (1988). The optimal results obtained with the revised formulation are found to agree with industrial practice as documented by Eymery. Moreover, GAs have been found to be suitable in the design of reactors which are found to be multimodal in nature. These results are encouraging and suggest the use of GAs in similar reactor design problems. REFERENCES
Belew R. and L. B. Booker (Eds.), Proceedings of the Fourth International Conference on Genetic Algorithms. San Mateo: Morgan Kaufmann ( 1991 ).
Deb K., Genetic algorithms for engineering design optimization. In C. S. Krishnamoorthy (Ed.) Proceedings of the Advanced Study Institute on Computational Methods for Engineering Analysis and Design (pp. 12.1-12.25) (1993). Edgar T. E and D. M. Himmelblau, Optimization of chemical processes. New York: McGraw-Hill (1988). Eymery J., Dynamic behavior of an ammonia synthesis reactor. (D.Sc. thesis). MIT (1964). Forrest S. (Ed.), Proceedings of the fifth international conference on genetic algorithms. San Mateo, CA: Morgan Kaufmann (1993). Goldberg D. E., Genetic algorithms in search, optimization, and machine learning. Reading, MA: Addison-Wesley (1989). Grefenstette J. J. (Ed.), Proceedings of an international conference on genetic algorithms and their applications. Hillsdale, N.I: Lawrence Erlbaum Associates (1985). Grefenstette J. J. (Ed.), Proceedings of the second international conference on genetic algorithms. Hillsdale, NJ: Lawrence Erlbaum Associates (1987). Holland J. H., Adaptation in natural and artificial systems. Ann Arbor: University of Michigan Press (1975). Murase A., H. L. Roberts and A. O. Converse, Optimal thermal design of an autothermal ammonia synthesis reactor. Ind. Eng. Chem. Process Des. Develop., 9, 503-513 (1970). Rao S. S., Optimization theory and applications. New Delhi: Wiley Eastern Limited (1984). Reklaitis G. V., A. Ravindran and K. M. Ragsdell, Engineering optimization-Methods and applications. New York: Wiley (1983). Vasantharajan S., J. Viswanathan and L. T. Beigler, Reduced successive quadratic programming implementation for large scale optimization problems with smaller degrees of freedom. Comp. Chem. Eng. 14(8), 907-915 (1990).