6.4 ChemApp is fast, but I need it to be even faster, what can I do?

Although ChemApp calculates even complex equilibria remarkably fast (see section 6.2), “speed” is always a relative thing. If one is frequently doing 100000 equilibrium calculations in a row as part of a simulation program, one is interested in every possible technique that saves computation time.

Here are a few techniques that help speeding up the calculations. Not all of them are suitable for every kind of application.

  1. Since release V4.1.2 of ChemApp, we are providing “optimized” versions of ChemApp for many ChemApp distributions. These optimized versions have been created by using the highest available optimization setting for the compiler that was used to produce the ChemApp library or DLL for that particular distribution. In most cases, these optimized versions of ChemApp can be recognized by their file names, they contain the string_opt_

    By using these optimized static libraries or DLLs instead of the standard ones, you might achieve some significant speed gain.

    Check theREADME.TXTfile of your ChemApp distribution for important notes on using these optimized versions.

    If your distribution of ChemApp does not contain these optimized versions, but you are interested in using them, please contact us for an update.

  2. Since release V5.0.0, ChemApp contains the two subroutines TQCEN and TQCENL. These two subroutines calculate the chemical equilibrium, taking results from the previous equilibrium calculation as initial estimates. 

    Once an equilibrium has been calculated with TQCE or TQCEL, subsequent equilibria can be executed using TQCEN or TQCENL. When the two latter subroutines are called, results from the previous equilibrium calculation are used as initial estimates. This will usually result in a noticable increase of the computational efficiency, especially when the current settings of global conditions or streams are close to those of the previous calculation.

  3. There are certain programming techniques that can be used, depending on the type of application, that result in a faster calculation speed. The key point is that the smaller the chemical system is ChemApp has to consider, the faster the equilibrium can be calculated. It is important to realize that not all kinds of thermochemical data (in particular mixture phases and the models on which they are based) need the same amount of computation time when an equilibrium is calculated. A slag based on the Gaye model requires a multiple of the computation time that a Redlich-Kister phase requires. If the slag based on the Gaye additionally contains sulphur, it requires even more time, and if there’s also a miscibility gap to consider in the slag (i.e. two copies of the phase are present), even more time is needed. 

    It is thus recommended to check if the complex phases that use most of the calculation time do in fact need to be considered for the calculation. For instance, if previous calculations have shown that for the incoming amounts used the activity for a complex phase indicates that it is very far away from stability, one can consider setting the status of this phase to “eliminated” for the next intermediate calculations. One should of course make sure that this is only done if the incoming amounts of the subsequent intermediate calculations are not too different from the previous ones, and one should always calculate the “final” results with all phases set to “entered” that are of interest.

    Sometimes one uses only one data-file, in one configuration (i.e. one never changes the phase status at run time) for simplicity reasons. If the process one simulates consists of more than one logical part, for instance a metallurgical process that consists of a part that involves a wide range of condensed phases, and another part that only involves a gas phase and a number of stoichiometric compounds, it might by useful to consider disabling the complex condensed phases in the part that only involves the gas phase and the stoichiometric compounds. If one knows that this part of the process will not contain certain complex phases in non-zero amounts at equilibrium, ChemApp can calculate the equilibrium faster if it is told that these phases need not be considered. Again, one should always check this assumption at some point, in particular before “final” results are calculated, by running the process simulation with the original number of phases set to “entered”.