16th European Symposium on Computer Aided Process Engineering and 9th International Symposium on Process Systems Engineering W. Marquardt, C. Pantelides (Editors) © 2006 Published by Elsevier B.V.
OPEN CHEMASIMrM: Breaking Paradigms in Process Simulation Hans Hasse a, Bernd Bessling b, Roger B/3ttcher c
aInstitute of Thermodynamics and Thermal Process Engineering (ITT), University of Stuttgart, D-70550 Stuttgart, Germany b Chemical Engineering, BASF AG, D 67056 Ludwigshafen, Germany c Corporate Engineering, BASF AG, D 67056 Ludwigshafen, Germany Email : hasse@itt, uni-stuttgart, de Internet : http ://c hemasim, itt. uni-stuttgart. de
Abstract Since September 2005 OPEN CHEMASIM TM, a process simulator with features similar to commercial programs is available to the academic community as an Open Source Code. The code was developed by BASF for over 30 years as an in-house tool, and has now been transformed into an Open Source Code for academic use. For the distribution, the internet platform http://chemasim, itt. uni-stuttgart, de was set up at ITT, University of Stuttgart. Academic institutions may use OPEN CHEMASIIVFM freely for teaching and in research as long as the results are published unrestrictedly. The code can be distributed to students, e.g., for project work. The present paper reports on this unprecedented project in process simulation. Features of the OPEN CHEMASIM TM program are briefly described and it is explained how the OPEN CHEMASIM TM as an academic noncommercial project works.
Keywords: Process Simulation, Open Source, OPEN CHEMASIM TM, Software, BASF. 1. Introduction It is well known, that if the same problem is solved with different codes, even for only moderately complex problems, the solutions often differ outside the numerical uncertainty [1 ]. It is therefore highly desirable that, it can be tracked in the code what really was done. This is only possible with Open Source Codes. Furthermore, as in principle an unlimited number of people can actively participate in debugging an Open Source Code, these codes will in the long run generally be more reliable than undisclosed codes. More fundamentally, it can be argued that black box simulations are unacceptable for any scientific purpose. One of the most essential requirements of scientific work is repeatability and, more stringent, traceability. Reports on scientific experiments or simulations must put other scientists in a position as to be able to repeat the described experiments or simulations and to trace what has been done in all relevant aspects. Of course this ideal can not always be reached, but it is scientific practice to try to come close to it. Using a commercial program often does not even allow repeating the simulations as the program version with which the simulations were made may no longer be available by the time the repeatability is to be checked. Scientifically more important is the fact that in simulations with black box programs it is generally not fully traceable what has been done. Questions that can arise at any point in a scientific discussion may, hence, not be clarified. Open Source Codes do not have that problem as, at least in principle, everything can be traced down to the roots. Of course, with rising complexity of their studies, scientists often have no choice: they need to use powerful commercial software even if it is only poorly documented. But if there is a choice, from a scientific standpoint, it is surely more attractive to use an Open Source Code.
2. OPEN CHEMASIM TM OPEN CHEMASIM TM breaks many paradigms in process simulation: it is neither a commercial product by a software company nor is it a shareware or commercial product created by an academic institution. It started with the decision of BASF to share its in-house process simulator CHEMASIM with the academic community - in a non-commercial way. CHEMASIM has a long history within BASF [2-5]. In the early seventies process developers at BASF, as in many other chemical companies, realized that process simulation was a key to success in their business. As there were no commercial process simulators then, BASF started developing their own simulator, called CHEMASIM (German: CHEMic Anlagen SIMulation). Since then, CHEMASIM was continuously improved
255
256
H. H a s s e et al.
by a highly motivated and skilled group of mathematicians and software engineers at BASF who always worked closely together with the engineers who applied the tool. Over the years CHEMASIM steadily grew, and became more powerful and versatile. Since the eighties CHEMASIM had to compete with commercial process simulators, and the question arose if the development of the in-house tool was to be supported further. Up to now, CHEMASIM was successful in that competition. But the fact remains that BASF is no software company and that commercial programs get better: it is a race, and the question is how long it is going to continue as it did now for more than 20 years. OPEN CHEMASIM TM is a completely unexpected solution to that puzzle. BASF has decided in 2005 to open their process simulator to the academic community, not only the executable objects but also the source code. CHEMASIM became OPEN CHEMASIM TM. Never before has the academic community had access to a similar process simulation source code. There are no limitations; OPEN CHEMASIM TM users can use all parts of the software; they can add their own software. They can freely use OPEN CHEMASIM TM for teaching and academic research. Also BASF will continue to use CHEMASIM in the future, hopefully in a new active "Verbund" with academic partners.
3. OPEN CHEMASIM TM Program Features OPEN CHEMASIM TM is a package of several programs originally created to meet the requirements of chemical engineers working in the field of process design and development in the chemical industry. The program CHEMASIM is the heart of OPEN CHEMASIMrM: it is a process simulator suited for simulations of large chemical plants. In CHEMASIM basically, mass and energy balances are solved based on equilibrium thermodynamics. CHEMASIM contains models of all important unit operations like reactors, distillation, absorption, and extraction columns, evaporators, condensers etc. The most important thermodynamic fluid property models are implemented. The features provided by CHEMASIM are similar to those of the well-known commercial process simulators. The main focus of CHEMASIM is the simulation of processes with extremely non-ideal multicomponent mixtures; e.g., three phase distillations with chemical reactions can routinely be handled. CHEMASIM also allows automatic parameter variation and optimization. The philosophy behind CHEMASIM has always been to solve the given process simulation problem equation-oriented, simultaneously, i.e., the full set of equations describing the problem is set up and solved numerically, unlike in many commercial process simulators which are based on solving subproblems representing different units and iterating to find the solution for the entire flow sheet [6]. The equation oriented approach is especially advantageous for simulations of complex processes with many recycles [7]. Like in all process simulators, the basic mathematical task in CHEMASIM is solving a large set of non-linear equations fix) = 0 (1), where f : IR n --> IR n contains all equations describing the flowsheet, i.e. mass- and energy balances, equilibrium and stoichiometric equations, reaction balances [5]. x e IR ~ is the vector of the variables for which values are found by CHEMASIM. n is typically of the order of 103 - 104. In CHEMASIM, first the structure of the flowsheet is defined, i.e., the user input of streams, process units, reactions and specifications is translated into the form of the functionf Due to a dynamic allocation of storage the absolute size of the problem in CHEMASIM is not fixed or bounded. The next step is to initialise all the variables x, which may be done by user estimates or with information from old solutions, either of the entire problem or of subproblems. Finally the set of equations (1) is solved by a Newton method using a relaxation technique based on a Gauss algorithm. Figure 1 shows this structure in a flowchart. Building up the structure of the flowsheet and solving the equations is done simultaneously in CHEMASIM, cf. inner loop over all units in Figure 1. This is one of the reasons for the fast response of CHEMASIM. Especially the thermodynamics part of CHEMASIM contains many features developed over the years to keep the iterations in the calculation robust und reliable.
OPEN CHEMASIM~M: Breaking Paradigms in Process Simulation user input
257
y
defining structure f
v
!
creating ~ 1 ~ initial values x
last solution
Thermodynamics Reaction balances and further more
L(x,),L'(x,)
creating and inversion of block structure up to unit v:
[. a~l
• .....
/
a~2 f~'(x,)
...l£(x,))
solving the linear system aflx,)/ax ~ k = -fix,)
relaxation and up date: xk+l = xk + (ok LLrk
output
Figure 1: Structure of CHEMASIM. CHEMASIM has been shown to be able to solve problems for which commercial process simulators fail. A recently published example is the simulation of a process for trioxane production from aqueous formaldehyde [8, 9]. The process has three major recycle streams and is characterized by the oligomerization reactions of formaldehyde with water that lead to complex multicomponent mixtures. Meaningful simulations of that process can only be performed by explicitly accounting for at least 10 chemical reactions on every stage of the process.
H. Hasse et al.
258
CHEMASIM is a FORTRAN 90 program. An example for a CHEMASIM output is presented in Figure 2. CHEMASIM was developed in Germany and was, up to 2005, mainly used in BASF AG in Ludwigshafen, Germany. The CHEMASIM input/output and documentation is therefore presently in German. However, OPEN CHEMASIM T M is set up as an international project; the OPEN CHEMASIM T M language is English. We hope that an English version of the program will be made available through OPEN CHEMASIM T M before long. Together with CHEMASIM some other programs are supplied in OPEN CHEMASIM T M . They mainly help creating reliable fluid property models (data fitting, setting up the fluid property data file, visualization, evaluation, calculations of azeotropic points, distillation and residue curves, miscibility gaps).
pile 6~wal'~li)ialog
~tanda~Ber~hl
Eilanz
Re@'-Zion
Fi~ien
~;j~!:/!~.-,~:../~.::.~.t~vi:s, n/,/.FOr,,<~ fools
_@J~..UI
W101"
~
~i;;;i;
i
.................. .......................................................
Tempe;aiu;................................... 9"9";626'6;:;dC"
1.ooo B~,
1~."
~,o~,~o,~
I REAL
it, kg/h o.ooo
AnteiliApparat Strom
o.ooo
99.999
1801.482 100"000 W101 0.000 W102
........... I
1801.482
00.000
3204.300 100.000 K100
0.001
0•032
von W101
~
SLIMPF I
1011
I
i
................................... ............ .......................
Gas-Konzent,atior,it, mol/rnol,'on K100
........................................
!
~ .-_,.oi.• _E
1010
.2de~n . . . i[,/102
1021
[
101[
................... 'WAS SER METHANOL qETHYLACETAT
Es
1,4eOh
99.988 W101
7102
...ii±~iT~olegi~
1010 1021
~.indoe: ?
20;..::.!:i ......................................
99.999
,ii.StrEbene ~
Strom
~
~m°!thi ..........................................................................................................
.
4 -
Str6me
.....
=~
Stufe
1o,,.,~.
~in~ellungen
~ . ~
1o
~ -+4
.
"~; ........... i ........... 2.:.,:.i....2 .......... /.....-~.o . . . . . ~+--.~ . . . . . 4-. . . . 4--.,-4-.,-4--~-4---+-+-.+.-~
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Ga~.-Kor,zentrationin mol/rr,ol von K100
1021
_
yon Appafat
K 180
W101
zu Appa~at zu Stule
W101
100
Aggregat
Fluss
F'has.e
FIu~;?~
Wll31 Fluss.-Konzentrationin tool/tool yon K100
Gas Fluss ~Gas Russ. akt. W ~ lak~.'w'ert lakt We~ I ...i{E: Eigen,t,c,haffen Einh~ 9 9 . 6 1 6 _ 93.6261 89..6261 Temperatuf G~adC r;uuck bar 1.000 1..0001 1.0001 E nthalpie k.'v¢ 742.440 3709.9911 197.6201 SpezifischeW~r kJ/kglK 3..7121 1.8811 3.7121 Dichte 347.4331 kg/m3 947,4111 13,5811 Mengenstrom kmol/h 3..757e+021 2.757e+021 1.000e+021
50~ ........................ ; - : :
0.999933I
~IETHANOL mollrnol ~4ETHYLACETA ES
0
0.9999151
0.9999801
b ppml
10 ppml
ppbI
7 ppn-,I
i Simulationsaa: Cheroo.*im
Sta~t~erte [kon~te~gentt
......... : - . - ........ .
.
40 > 8 ! _~ 301
•.................W A S S E R
:iii
P-
20 i~. . . . . . . . . . . . . . . . . . . . . . . 10
WASSER
-
i
:
/i!,...! ......... i....:
:
...!
METHANOL METHYLACETAT ES
...... ~
0.0 0.1 0.2 03 0.4 0.5 06 0.7 08 0.9 1.0 Fluss.-Konzentrattonin rnol/molyon K100
Rechen-Ve~,ion 5,0.4-15,04.
Rechen-Dattma: 27,06,2005 03:30:26
Figure 2: Example for a CHEMASIM output (distillation column with profiles).
4. The O P E N C H E M A S I M
TM
Project
OPEN CHEMASIM T M is more than just a downloadable process simulation software. The idea behind OPEN CHEMASIM TM is to create a living system in which CHEMASIM will continue to develop and grow. OPEN CHEMASIM T M users agree to share their own contributions to CHEMASIM with the OPEN CHEMASIM TM community, in a non-commercial way. The system is organized like a star, cf. Figure 3.
OPEN CHEMASIMrM.• Breaking Paradigms in Process Simulation
259
Figure 3: The OPEN CHEMASIM TM Star
The OPEN CHEMASIM TM forum allows users to exchange ideas and experiences, to download software and upload their own versions. The forum is moderated by ITT, University of Stuttgart. ITT also supplies a master version of OPEN CHEMASIM TM (executable object and source code), and will try to keep track of new developments in the forum, test them and continuously improve the master version. Note that only non-profit academic institutions or natural persons working at a university or non-profit research institution can become OPEN CHEMASIM TM users, not companies. The source code is only made available to academic institutions, not to individual natural persons. Users must agree to use OPEN CHEMASIM TM only for academic research and teaching, any commercial activity is excluded. The use of OPEN CHEMASIMT M by academic users in joint projects with industrial partners is allowed only if the results are published unrestrictedly. Standard Users get access to the OPEN CHEMASIM TM executable objects and installation routines, Developers get full access, which includes the source code. It is legal to make copies of CHEMASIM for scientific or educational use within the working group, also for use by students. Working groups at academic institutions only need to register once either as Standard User or Developer. OPEN CHEMASIM TM users do not have to pay for the software itself. There is only a one-off registration fee. There are no annual fees. The money from the registration fee is used for keeping the OPEN CHEMASIM TM project alive, to run the server, to handle registration, to support users getting started, and last but not least to supply up-to-date master copies of the OPEN CHEMASIM TM source code and the executable objects. The fee is presently 490 C for Standard Users, and 990 E for Developers. 5. Current State a n d O u t l o o k OPEN CHEMASIM TM was presented to the academic community first in a German chemical engineering national conference in September 2005 [ 10]. By the time this paper is written, it is too early for predictions on the further evolution of the project. More information will be available in June 2006 when the ESCAPE 16 conference will be held. Presently, for the reasons given above, registrations come only from Germany. Besides chemical engineers also mathematicians and software engineers have shown their interest in OPEN CHEMASIM TM. Dechema has declared its willingness to supply fluid property data by linking the DETHERM data bank to OPEN CHEMASIM TM. The executable version will be distributed to chemical engineering students for project work in several German universities in 2006.
260
H. Hasse et al.
In the near future an English version of OPEN CHEMASIM T M should be made available to enlarge the potential user group. If the academic OPEN CHEMASIM T M project turns out to be successful, ways should be discussed how to open the project also to interested industrial parties.
Acknowledgements Many people in BASF have contributed to CHEMASIM over the years. Their work is gratefully acknowledged. Thanks are also due to all those who have supported the idea of OPEN CHEMASIM T M and have helped to make it real. Special thanks are due to C. Adami, C. Grote, B. Hegner, F. GtRtner, A. Klein, A. Polt, H. Schoenmakers (from BASF), and M. Bidner, O. Ryll, J. Vrabec, F. Schaal (from ITT).
References [1] F. Y. Dupradeau, J. Rochette: Bugs in Computational Chemistry Software and their Consequences: the Importance of the Source Code. J. Mol. Model (2003) 271 - 272. [2] B. Hegner, D. Hesse, D. Wolf: M6glichkeiten der Berechnung bei heteroazeotroper Destillation, Chem. Ing. Techn. 45 (1973) 942-945. [3] U. Block, B. Hegner: Aufstellung und Anwendung eines Rechenmodells fiir die Dreiphasen-Rektifikation, AIChE J. 22 (1976) 582-589. [4] D. G~irtner, B. Hegner, M. Molzahn, R. Schmidt: Simulation des gekoppelten Stoff- und W~irmeiiberganges in Gegenstromapparaten, Chem. Ing. Techn. 51 (1979) 322- 323. [5] B. Hegner: Steady state simulation, Dechema-Monographie 115, p. 85-98, Dechema, Frankfurt (1988). [6] B. Hegner, H. Schoenmakers: Die Berechnung gekoppelter thermischer Trennungen mit simultanem L6sungsalgorithmus, Chem. Ing. Techn., 56 (1984) 229. [7] B. Hegner, H. Schoenmakers: CHEMASIM - experience with BASF's simultaneous process simulator, Inst. Chem. Eng. Symp. Ser. 92 (1985) 365-375. [8] T. Griitzner, H. Hasse, N. Lang, M. Siegert, E. Str6fer: Development of a New Distillation Based Process for the Production of Trioxane, AIChE Spring National Meeting, 11.- 13.04.2005, Atlanta, GA, USA. [9] T. Grtitzner: Entwicklung eines neuen destillationsbasierten Verfahrens zur Herstellung von Trioxan, PhD Dissertation, Universit~it Stuttgart (2006). [10] H. Hasse: Open Source Prozesssimulation- Eine Chance ~ r die Verfahrenstechnik, GVC/Dechema-Jahrestagungen, 06.-08.09.2005, Wiesbaden.