## Optimal Reactor Length of an Auto-Thermal

## Ammonia Synthesis Reactor

### M.S.M.Ksasy, F Areed, S Saraya, Mostafa A. khalik

*1_{ Mansoura University, Faculty of Engineering Computers & Systems Dept., P. O. 35516 }

**Abstract--**

**This paper presents the simulation of auto-thermal**

**ammonia synthesis reactor. Our target here is to estimate the**

**optimal reactor length which will give the maximum profit from**

**the ammonia reactor. There are many literatures which are**

**interested in ammonia simulation in the past but all need some**

**corrections due to either uncorrected model used or uncorrected**

**algorithm. We used here the ODE45 solver of MatLab from**

**Mathworks, along with real-coded genetic algorithm GA and**

**solve for every 0.0001 m from the reactor length. It is found that**

**no spikes, no reverse reaction can take place even at higher top**

**temperature of 800 K. the maximum value of ammonia objective**

**is 5.6635e+006 at optimal reactor length of 6.4253**

**Index Term-- ****Ammonia synthesis reactor, Dynamic Mutation, **
**Elitism, Optimization, Real-coded GA. **

1. INT RODUCT ION

The synthesis reactor is treated as a separate unit with the object of understanding its behavior and obtaining the key variables that lead to its stable, sustained optimum operation. We are interested mainly in predicting the reactor behavior when changes are made in the controllable variables of the reactor and specifically in studying the variation of ammonia yield as a result of the changes. Thus a mathematical model which approximates the reactor to the point that it predicts the trends of the reactor output and reactor stability with reasonable accuracy will be adequate for our simulation.

Ammonia is one of the most chemicals used in indust ry. It is used in the manufacture of fertilizers, chemicals, explosives, fibers, plastics, refrigeration, pharmaceuticals, pulp, paper, mining, metallurgy, and cleaning. It is produced from the reaction of hydrogen and nitrogen at high temperature and high pressures in the existence of catalyst

*N*

2###

### 3

*H*

2 ###

### 2

*NH*

3###

###

*H*

(Eq. 1)

*mole*

*kj*

*H*

###

###

### 92

### /

###

This exothermic reversible reaction has been carried out in the

most important unit of ammonia plant; *ammonia synthesis *

*reactor*. Due to high pressure used, more electric power is
needed to drive compressor, and makes more stringent the
requirements to be met by the plant. The wall of the reactor
has special design and it needs certain alloys to withstand

these higher pressures. Feed gas temperature

*T*

*f*, reacting gas

temperature

*T*

*, nitrogen flow rate*

_{g}*N*

_{n}_{2}, all are function of

reactor length and they are related to the optimization of the objective function of ammonia.

Many literatures discuss the modeling and simulation of an

auto-thermal ammonia synthesis reactor [1], [2], [3], [4], [5],

[12], [14], [15], [17], [18], [20].

*Annable* in [4] compared the performance of an auto-thermal
ammonia synthesis reactor with the maximum yield that could
be obtained if one had direct control of the temperature
profile; he found that conversion could be increased by 14 %.

*Dyson* in [5] considered the general problem of determining
the heat transfer coefficient vs. length function that would

maximize the yield of auto-thermal reactor. Murase [1] used

the maximum principle to design a variable heat transfer coefficient ammonia synthes is reactor.

*Edgar and Himmelblau* [20] used the lasdon's generalized
reduced-gradient (LGRG) method to arrive at an optimal
reactor length corresponding to a particular reactor top
temperature of 694 K. however they ignored a term

mentioned in the *Murase's* formulation [1], 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.

*Upreti and Deb* [18] present an optimal procedure of an
ammonia synthesis reactor using genetic algorithm. They used

correct objective function and correct stoichiometric

expression of the partial pressures of

*N*

_{2},

*H*

_{2},

*NH*

_{3}. They

used simple GA in combination with Gear package of NAG library's subroutine, D02EBF, for the optimization of ammonia synthesis reactor. They obtained mass flow rate of nitrogen, feed gas temperature and reaction gas temperature at every 0.01 m of 10 m reactor length. Moreover there is a contradiction in the temperatures and gas flow rate profiles obtained. They reported the profiles that were not smooth as in earlier literature. Also, they reported reverse reaction condition at the top temperature of 664K which was not found

in the literature earlier. *Babu and Angira* [2] [3] used a correct

objective function and correct stoichometeric expression of

pressures of

*N*

_{2},

*H*

_{2},

*NH*

_{3}but there is a contradiction in the

temperatures and gas flow rate profiles obtained. Hence, our research is carried out in order to take care of bad models or bad computations.

real-coded GA. The performance of the GA [7] [8] [9] [10]

[19] [22] depends on many parameters like , population size,

probability of crossover, probability of mutation, the way you encode your variable, …etc. Encoding may be carried out

using binary strings. Binary encoding for function

optimization problems is known to have severe drawbacks due

to the existence of Hamming cliffs [13]. With some

modifications of genetic operators, real-coded GAs have resulted in better performance than binary -coded GA for

certain problems [10] [11] [21]. Our algorithm is real-coded

GA enhanced with *biased initialization*, *Elitism*, *dynamic *

*parameter settings*.

It is found that the maximum objective function of ammonia has the value of 5.6635e+006 at an optimal reactor length of 6.4253.

In the first section we made introduction of this paper. In the second section we will present for the Ammonia synthesis reactor model, followed by the real-coded genetic algorithm. Results and simulation are presented in section 4, and we will make conclusion in the last section.

2. AMMONIA SYNT HESIS REACT OR MODEL

Optimization in the design and operation of a reactor focuses on formulating a suitable objective function plus a mathematical description of the reactor; the latter forms a set of constraints. Any mathematical description of a chemical reactor heavily relies on balance equations which express the general laws of conservation of mass and Energy.

The objective function for the reactor optimization is 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 amortization of reactor capital

costs. All symbols and variables used are listed in *Appendix A*

at the end of this paper

###

###

###

###

###

###

###

### 1

### .

### 33563

### 10

### 1

### .

### 70843

### 10

### 704

### .

### 09

### (

### )

### )

### ,

### ,

### ,

### (

7 4_{0}

2

2

*T*

*T*

*N*

*T*

*T*

*N*

*x*

*f*

_{N}

_{f}

_{g}

_{N}

_{g}2 / 1 9 7

0

### )

### [

### 3

### .

### 45663

### 10

### 1

### .

### 98365

### 10

### ]

### (

### 27

### .

### 699

*T*

_{f}###

*T*

###

###

###

###

*x*

(Eq. 2)

It is clear from the above expression that the objective

function depends on four variables: the reactor length

*x*

,
proportion of nitrogen

2
*N*

*N*

, the reacting gas temperature*T*

*,*

_{g}and the feed gas temperature

*T*

*, for a given top temperature*

_{f}0

*T*

.
The model below can be derived using the material and energy balance

### )

### (

1*f*

*g*

*pf*

*f*

*T*

*T*

*WC*

*US*

*dx*

*dT*

###

###

(Eq. 3)

### )

### (

### )

### (

### )

### (

2 21

*dx*

*dN*

*WC*

*S*

*H*

*T*

*T*

*WC*

*US*

*dx*

*dT*

_{N}*pg*

*f*

*g*

*pg*

*g*

_{}

_{}

_{}

_{}

###

###

###

(Eq. 4)

###

###

###

###

###

###

###

###

###

###

###

2_{1}

_{.}

_{5}

5
.
1
1
2
3
3
2
2
2
*H*
*NH*
*NH*
*H*
*N*
*N*

*p*

*p*

*k*

*p*

*p*

*p*

*k*

*f*

*dx*

*dN*

(Eq. 5)

2 2 2 2

### 2

### 598

### .

### 2

### 286

*N*

*N*

*N*

*N*

*N*

*N*

*N*

*p*

###

###

(Eq. 6)

2 2

### 3

*N*

*H*

*p*

*p*

###

(Eq. 7)2 2 0

2 2 0

3

_{2}

_{.}

_{598}

_{2}

### )

### 2

### 23

### .

### 2

### (

### 286

*N*

*N*

*N*

*N*

*NH*

*N*

*N*

*N*

*N*

*p*

###

###

###

(Eq. 8)

### 0

### .

### 0

### 3220

2

###

###

*N*

*N*(Eq. 9)

### 800

### 400

###

*T*

*f*

###

(Eq. 10)### 0

### .

### 10

### 0

### .

### 0

###

*x*

###

(Eq. 11)The boundary conditions are:

*T*

_{f}###

*T*

_{0}at

*x*

###

### 0

;*T*

_{g}###

*T*

_{f}at

*x*

###

### 0

; 0### 701

### .

### 2

### /

22

*kmol*

*hm*

*N*

_{N}###

at*x*

###

### 0

;3. MAIN ALGORIT HM

Since genetic algorithms are inspired from the idea of evolution, it is natural to expect that the adaptation is used not only for finding solutions to a given problem, but also for

tuning genetic algorithms to the particular problem [13]. The

issue of controlling values of various parameters of a genetic algorithm is one of the most important and promising area of

research in evolutionary computation [6]: it has the potential

of adjusting the algorithm to the problem while solving the problem. The performance of GA depends on the initial population from which the solution starts to evolve; being near or far from the global point. You may start from any generation but you may converge slower than you start from certain acceptable generation.

Elitism [16] can very rapidly increase performance of

GA, because it prevents losing the best found solution to date. A variation is to eliminate an equal number of the worst solutions, i.e. for each "best chromosome" carried over a "worst chromosome" is deleted.

research in evolutionary computation [6]: it has the potential of adjusting the algorithm to the problem while solving the

problem. A non-uniform mutation [6] was been used here.

Listed below is our main core algorithm

Step 1: Randomly Generate Initial population, average

fitness of initial population must exceed certain limit (30 %)

Step 2: Evaluate the fitness function for all chromosomes,

Step 3: Certain amount of chromosomes are passed to the

next generation without modification, “Elitism”,

Step 4: Select the most fittest individuals to survive in the

next generation ( our code contains Roulette-wheel, Rank, tournament, …)

Step 5: Perturbation can be done through crossover and

mutation

Step 6: Check evaluation criteria, if satisfied, end

Step 7: If not, go step 2

4. COMPUT ER SIMULAT ION AND RESULT S

The three differential equations (model equations) were solved using non stiff ode45 function built in MatLab 7.1 from Mathworks. The ammonia objective function is optimized using the Real-coded Genetic algorithm discussed above.

the feed gas temperature

*T*

*, reacting gas temperature*

_{f}*T*

*,*

_{g}and the nitrogen flow rate

2
*n*

*N*

are shown below in Fig. 1
against every 0.0001 m of 10 m of the reactor length at top

temperature

*T*

_{0}= 694 K. the maximum ammonia profit is $

5.66353e+006 at optimal reactor length equal to 6.42535 m. the ammonia profit is plotted against reactor length in Fig. 2 with a marker at the optimal reactor length

Fig. 1. Ammonia profile at

*T*

_{0}

###

### 694

*K*

, step size = 0.0001 m
Fig. 2. Ammonia profit against reactor length (x) at

*T*

_{0}

###

### 694

*K*

Table I below shows the values of

*T*

*,*

_{f}*T*

*,*

_{g}2
*n*

*N*

in addition to
the ammonia maximum profit and the optimal reactor length

at

*T*

_{0}= 694 K.

TABLE I

MODEL P ARAMETERS VALUES AT

*T*

0 =694K
**Top Temperature Reactor****694 K**

Reactor Step Size 0.0001** **

Optimum Reactor Length 6.4253

Objective Function (million $ / Year) 5.6635

Feed Gas Temperature

*T*

*308.36 K*

_{f}Reacting Gas Temperature

*T*

*583.9876 K*

_{g}Nitrogen Flow Rate

2
*n*

*N*

454.9166
Our method is better in maximizing the ammonia profit and is shown below in Table II a comparison between our method and all previous work in this field. The step size used to solve the system model was set to 0.0001 to make sure that the profiles are smooth and there are no spikes, and also to make sure that no spikes were missed.

TABLE II

COMP ARISON BETWEEN OUR WORK AND P REVIOUS WORK

### Optimum

### Reactor Length

### (m)

### Ammonia

### profit

### (Million

### $

### /Year)

### [1]

### 5.18

### Not

### Reported

### [20]

### 2.58

### 1.29

### [18]

### 5.33

### 4.23

### [2]

### 6.586

### 5

### Our

Also there is no reverse reaction noticed here even at lower

Top temperature

*T*

_{0}equal to 580 K. the profiles are shown

below in Fig. 3 and Table III for which the profiles are

smooth and no spikes exist.

Fig. 3. Ammonia profile and ammonia profit at

*T*

_{0}

###

### 580

a TABLE IIIPROFILE AT TOP TEMP ERATURE

*T*

0=580K
**Top Temperature Reactor****580 K **

Reactor Step Size 0.0001** **

Optimum Reactor Length 7.86009

Objective Function (million $ / Year) 2.53

Feed Gas Temperature

*T*

*446.80 K*

_{f}Reacting Gas Temperature

*T*

*527.26 K*

_{g}Nitrogen Flow Rate

2
*n*

*N*

629.61
In contrast to *Upreti and Deb* [18], the three differential

equations are stable at top temperature 706 K and this profile

is sown below in Fig. 4and Table IV, and still stable even at a

top temperature as high as 820 K as shown in Fig. 5 and Table V.

Fig. 4. Ammonia profile and ammonia profit at

*T*

_{0}

###

### 706

*K*

TABLE IV
PROFILE AT TOP TEMP ERATURE

*T*

0 =706K
**Top Temperature Reactor****706 K **

Reactor Step Size 0.0001** **

Optimum Reactor Length 6.63861

Objective Function (million $ / Year) 5.66

Feed Gas Temperature

*T*

*307.698 K*

_{f}Reacting Gas Temperature

*T*

*583.52 K*

_{g}Nitrogen Flow Rate

2
*n*

*N*

454.93
Fig. 5. Ammonia profile and ammonia profit at

*T*

_{0}

###

### 820

*K*

TABLE V
PROFILE AT TOP TEMP ERATURE

*T*

0 =820K
**Top Temperature Reactor****820 K **

Reactor Step Size 0.0001** **

Optimum Reactor Length 9.73830

Objective Function (million $ / Year) 5.63

Feed Gas Temperature

*T*

*299.073 K*

_{f}Reacting Gas Temperature

*T*

*576.662 K*

_{g}Nitrogen Flow Rate

2
*n*

*N*

455.18
CONCLUSION

temperature. We are sure that the model equations are stable even at top temperature 820K. The algorithm used is a new real-coded one, with biased initialization, dynamic mutation,

and elitism. The results and simulation show that our algorithm gives better and maximum profit of ammonia.

APPENDIX A

**List of Symbols **

### Parameters

### Meaning

### Units

*U*

### overall heat transfer coefficient

_{kcal}

_{kcal}

_{m}

2_{m}

_{hK}

_{hK}

### /

1

*S*

### Surface area of cooling tubes per unit length of reactor

### (

*m*

### )

*W*

### Total mass flow rate

### (

*kg*

### /

*h*

### )

*pf*

*C*

### Heat Capacity of feed gas

### (

*kcal*

### /

*kgK*

### )

*H*

###

### heat of reaction

###

###

2

### /

*kg*

*mole*

*of*

*N*

*kcal*

2

*S*

### Cross-sectional Area of catalyst zone

### (

*m*

2### )

*dx*

*dN*

_{N}### /

2

###

### reaction rate

_{(}

_{/}

3_{)}

2

*hm*

*N*

*of*

*moles*

*kg*

*pg*

*C*

### heat capacity of reacting gas

### (

*kcal*

### /

*kgK*

### )

*f*

### catalyst activity

3 2 2

### ,

*H*

### ,

*NH*

*N*

*p*

*p*

*p*

### Partial pressures of

*N*

2### ,

*H*

2### ,

*NH*

3
2 1

### ,

*k*

*k*

### Rate constants

*R*

### Ideal Gas Constant

*kcal*

### /(

*kg*

*mol*

### )(

*K*

### )

### (.)

*f*

### Objective function

### $/year

0

*T*

### Reference Temperature

*K*

ACKNOWLEDGEMENT

All thanks go to Dr. Housam Binous , Assistant Professor at The Department of Chemical Engineering, The National Institute of Applied Science and Technology in Tunis for his support and his appreciated efforts. Also thanks go to Prof. Dr. / said Elnashaie, Professor of chemical engineering at Penn State University, USA for his help and support. I can not forget the patience and help of my colleagues and staff of Mubarak City for Scientific Research and technology Applications.

REFERENCES

[1] A.Murase, H. L. Roberts, and A. O. Converse, "Optimal thermal design of an auto-thermal ammonia synthesis reactor", Industrial and Engineering Chemistry Process Design Development, Vol. 9, No. 4, 1970

[2] B. V. Babu, R. Angira , "Optimal design of an auto-thermal ammonia synthesis reactor", science direct, Computers and chemical engineering journal, 2005

[3] B**.**V**. **Babu, R. Angira, and A. Nilekar, "Optimal Design of an
Auto-T hermal Ammonia Synthesis Reactor Using Differential Evolution",
Proceedings of T he Eighth World Multi-Conference on Systemics,
Cybernet ics and Informatics (SCI-2004),Orlando, Florida, USA, July
18-21, 2004

[4] D.Annable, "Application of the T emkin kinetic equation to ammonia synthesis in the large-scale reactors", Chemical Engineering Science, July 1952

[5] D.C. Dyson, "Optimal Design of Reactors for single Exothermic Reversible Reactions", Ph.D. thesis, London University, 1965 [6] E.Eiben, R Hinterding, Z Michalewicz, “Parameter Control in

Evolutionary Algorithms”, IEEE Trans. on Evolutionary Computation, July 1999, Vol. 3, Issue 2, pp. 124-141

[7] E.K. Nyarko, R. Scitovski, “Solving the parameter identification

problem of mathematical models using genetic algorithm”, Applied mathematics and Computation, June 2004, Vol. 153, Issue 3, pp. 651 -658

[8] H.B. Kamepalli, “The optimal basics for GAs”, IEEE Potentials,

Apr-May 2001, Vol. 20, Issue 20, pp. 25 -27

[9] J.R. Jang, C. Sun, E. Mizutani, “Neuro-Fuzzy and Soft Computing: a

Computational Approach to Learning and Machine Intelligence”, PRENT ICE HALL, 1997

[10] J.Yen and R. Langrai, “Fuzzy Logic: Intelligence, Control, and

Information”, PRENT ICE HALL 1999

[11] L.Chambers, “Practical Handbook of Genetic Algorithms: New

Frontiers Volume II”, CRC Press, 1995

[12] M.E. E. Abashar, "application of heat interchange systems to enhance the performance of ammonia reactors", science direct, Chemical Engineering Journal, 2000

[13] M.Gen and R. Cheng, “Genetic Algorithms and Engineering Optimization”, A Wiley-Interscience Publication, 2000

[15] M.Pedernera, D. O. Borio, J.A. Porras, "A new cocurrent reactor for ammonia synthesis", chemical engineering science, vol. 51, No. 11, pp. 2927-2932, 1996

[16] R.E. King, “Computational Intelligence in Control Engineering”, Marcel Decker NY 2005

[17] R.F. Baddour, P. L. T . Brian, B. A. Logeais, J. P. Eymery, "Steady-state simulation of an ammonia synthesis converter", Chemical Engineering Science, Vol. 20, pp. 281-292, 1965

[18] S.R. Upreti and K. Deb, "Optimal design of an ammonia synthesis reactor using genetic algorithms", Computers and Chemical Engineering, Vol. 21, No. 1, pp. 87 -92, 1997

[19] S.Smith, “An evolutionary program for a class of continuous optimal

control problems”, IEEE Int. Conf. on Evolutionary Computation, 29 Nov. 1995, Vol. 1, pp. 418}

[20] T .F. Edgar, D. M. Himmelblau, “Optimization of Chemical Processes”, McGraw-Hill Science, Jan 2001

[21] T .T . H. Luong and Q. T. Pham, “A comparison of the performance of classical methods and genetic algorithms for optimization problems involving numerical models”, IEEE Congress on Evolutionary Computation CEC, 8-12 Dec., 2003, Vol. 3, pp. 2019 – 2025

[22]W.Banzhaf, P. Nordin, R. E. Keller, F. D. Francone, “Genetic