ChemApp Frequently Asked Questions
Version 5.0, 14 April 2003
This is the ChemApp FAQ, which provides answers to frequently asked questions relating to ChemApp, ChemApp light, its documentation, example data-files, and distributions. It also provides answers to frequent questions about calculational and programming issues, platforms, and availability. Copyright © GTT-Technologies, 2003. To find out what has changed since the last version of this FAQ, please see section 10. If you have questions about ChemApp or ChemApp light, check out this FAQ (Frequently Asked Questions) first, it contains answers to many common questions.
Table of Contents
1. Introduction 2. General questions 3. Using ChemApp in application programs 4. ChemApp distributions 5. ChemApp and ChemSage/FactSage 6. Calculational aspects 7. Thermochemical data 8. Programming issues 9. Questions about particular compilers and development environments 10. List of recent changes to the FAQ
1.1 Where to obtain this document [TOP]
The latest version of this document can always be retrieved from GTT's Technical Thermochemistry Web Page. It is listed in the ChemApp section.
This is version 5.0 of the ChemApp FAQ, dated 14 April 2003. For a list of changes since the last version, see section 10.
If you have a question relating to ChemApp, please check the latest version of this FAQ before contacting GTT-Technologies' Technical Support.
1.2 About this document [TOP]
Whenever the ChemApp/ChemApp light documentation contains relevant further information on a subject, the following text will be used
-> ChemApp documentation light/regular
In the HTML version of this document, this text contains links to the online versions of the ChemApp documentation at GTT's Technical Thermochemistry Web Page. The link to the online documentation for the light version can be used by anyone, to access the latest version of the manual for the regular version of ChemApp you need to be a registered user of the regular version of ChemApp.
1.3 What if this FAQ does not answer my question? [TOP]
If you cannot find an answer to your question in this FAQ, please contact GTT's Technical Support firstname.lastname@example.org.
ChemApp light users Please note that in order to receive e-mail support for ChemApp light, you need to register. Registration is free and explained in the ChemApp light documentation (-> ChemApp documentation light/regular).
2. General questions
2.1 What is ChemApp? [TOP]ChemApp is a programming tool from the area of computational thermochemistry. It is a programmer's
library consisting of a rich set of subroutines, based on the thermodynamic phase equilibrium calculation
module of ChemSage (now FactSage). It permits the calculation of complex, multicomponent, multiphase
chemical equilibria and their associated energy balances. ChemApp is available as object code for a wide
range of platforms and as a Dynamic Link Library (DLL).
2.2 What is ChemApp NOT? [TOP]
ChemApp is not an interactive, standalone program, it does not contain a GUI or a user menu, since it is a library of subroutines. Thus programmers who wish to add a user interface to it can add anything they want. If you are interested in a standalone, interactive program, see FactSage .
ChemApp is not everything you need to perform equilibrium calculations. Apart from ChemApp, which is the calculational engine, you still need a data-file which contains the thermochemical data for all the phases and species in the chemical system you are interested in (see section 7.1).
ChemApp does not use systems of stoichiometric reactions to calculate chemical equilibria. It uses the concept of Gibbs energy minimisation (see section 6.1)
2.3 What is ChemApp light? [TOP]
ChemApp light is a free version of ChemApp, and although it is restricted in two ways compared to the regular version, it gives you almost the same functionality.
2.4 Where do I get ChemApp light? [TOP]
2.5 Why and how was ChemApp developed? [TOP]Many programs, whether existing or still in the planning stage, would benefit or even need to rely on the ability the calculate chemical equilibria. Since developing such an equilibrium code, even for modest chemical systems and simple mixture phase models, is a daunting task, the need for a specialised, reliable, third-party supported code became obvious. As no such tool was available, ChemApp was developed within the framework of a European "Science" program. Since the beginning of 1996, ChemApp is available for a wide range of platforms.
2.6 In which areas is ChemApp used? [TOP]
ChemApp is used in programs from such areas as process simulation and optimisation, computational fluid dynamics (CFD), solidification and casting simulation, crystal growth, kinetically controlled production processes, etc. The ChemApp web page contains examples from several application areas.
In general, ChemApp can be applied in all areas where ChemSage and FactSage have already been successfully applied, a brief list of which is given in the table below.
Sintering Aluminium electrolysis Roasting Silver alloys with SiC Purification of metals Casting processes Waste treatment Incineration Heat treatment cycles Electron beam melting Alloy research studies Ore reduction Precipitation studies Corrosion Dispersion strengthening Castings Hard metal compounds Extraction Combustion Electronic materials Nitrates in water High TC superconductors Steels Ceramics Tungsten halogenides Slags Cement manufacture Molten salts Dioxine Organics Glasses Geochemistry/planetology Silicides
2.7 Who is using ChemApp? [TOP]
ChemApp is used by many commercial and academic institutions around the world, here are a few of its users
Alcoa Technical Center
Betriebsforschungsinstitut (VDEh-Institut für angewandte Forschung)
Brandenburgische Technische Universität Cottbus
Cerro Matoso S.A.
Delft University of Technology
DLR (German Aerospace Center)
DuPont Engineering Technology
Fraunhofer Institut für Produktionstechnologie
Gesellschaft für Anlagen- und Reaktorsicherheit (GRS)
Helsinki University of Technology
Idaho National Engineering and Environmental Laboratory
Katholieke Universiteit Leuven
Korea Institute of Science and Technology (KIST)
National Sun Yat-sen University
Norsk Hydro ASA
Pechiney - CRV
Philips Lighting b.v.
Pohang University of Science and Technology (POSTECH)
Saint-Gobain Ceramics and Plastics
SINTEF Materials Technology
Samsung Heavy Industries Co.
SMS Siemag AG
St.Petersburg State Technical University
TU Bergakademie Freiberg
Technische Universität Chemnitz
The University of New South Wales
The University of Queensland
Ube Industries Ltd.
University of Missouri-Rolla
University of Newcastle
University of North Dakota
University of Science & Technology Beijing
Universität GH Essen
VAW aluminium AG
VTT Chemical Technology
VTT Manufacturing Technology
2.8 Where do I get more info about ChemApp? [TOP]
If you have not done so already, please visit our web page. The ChemApp section contains lots of information on ChemApp, like literature references, application examples, ongoing projects, etc.
If you need printed information on ChemApp, please contact GTT-Technologies or our agent closest to you.
2.9 What if I have a problem with ChemApp that might be a bug? [TOP]
Please use the ChemApp Bug Report Form on our web site to report the problem.
2.10 Does ChemApp require a hardware key, like FactSage and ChemSheet do? [TOP]
Starting with version 5.0.0, all distributions of ChemApp for Microsoft Windows platforms will require a hardware key (HASP dongle), just like FactSage and ChemSheet. In fact, ChemApp can make use of the same physical hardware key that's used for FactSage and/or ChemSheet, if you have one already.
Thus, when purchasing ChemApp, you have the following options
- If you do not have FactSage or ChemSheet, and thus do not have any hardware key, you are automatically supplied with a new hardware key (or more, if you ordered multi-developer licenses). Choose between parallel port and USB port hardware keys.
- If you already have FactSage or ChemSheet, and thus already have one or more hardware keys, you can choose between the following options:
- Have your existing hardware key remotely updated by us, so that it can also be used with ChemApp. The advantage is that ChemApp can be used with FactSage and/or ChemSheet on the same computer. The disadvantage is that you have to use them on same computer, since the one hardware key contains both (or more) licenses. This option is primarily used if the same person is working with all the programs (FactSage, ChemSheet, ChemApp, etc.) for which the hardware key contains licenses, on the same computer.
- Order a separate, new hardware key for use with ChemApp. Choose between parallel port and USB port hardware keys. The advantage is that ChemApp can be used on a different computer, independently of where FactSage or ChemSheet are used, since licenses are contained in different hardware keys. The disadvantage is that you cannot use both hardware keys on the same computer (the driver software would not be able to distinguish between the two hardware keys. Note that this issue does not apply to other hardware keys from different software suppliers, there should be no problem adding other programs' hardware keys to your computer). This option is primarily used if the different programs (e.g. FactSage and ChemApp) are used by different people on different computers.
If you're purchasing a multi-developer license of ChemApp, and already have existing FactSage and/or ChemSheet dongles, you can of course also select a mix of the previous two options, i.e. have some of your existing hardwre keys updated and order new hardware keys for the remaining licenses.
3. Using ChemApp in application programs
3.1 Can I add ChemApp to my own program ABC? [TOP]
If your program is running on any of the platforms (see section 4.1) ChemApp does, and if you are using any of the programming languages that are supported for that platform, you are able to add ChemApp to your program.
Possible languages include FORTRAN and C/C++ for Unix®, Microsoft Windows® and DOS platforms, as well as most other development environments running under Windows 95/Windows NT which let you use Dynamic Link Libraries (DLLs), for instance Borland Delphi® and Microsoft Visual Basic® and Visual C++ ®.
Please contact GTT-Technologies if you are unsure whether your programs will be able use ChemApp. We will be happy to help you finding out.
3.2 Can I add ChemApp to the third-party program XYZ? [TOP]
As most third-party programs do not come in source code, they need to provide a way to link other object code to it. On Windows platforms, many commercial programs in question can access DLLs from other suppliers, in which case a DLL-version of ChemApp would be used. Other programs provide a FORTRAN or C/C++ programming interface, and ChemApp can be linked to the application program.
Please contact GTT-Technologies if you are unsure whether a specific third-party program will be able access ChemApp. We will be happy to help you finding out.
3.3 Can I distribute/sell my programs which contain ChemApp? [TOP]
Yes, ChemApp is available for licensing. Please contact GTT-Technologies for details.
ChemApp light users ChemApp light is only available for restricted redistribution with other programs (please refer to the ChemApp light license for further information (-> ChemApp documentation light/regular). In brief, you need the regular version of ChemApp to distribute your programs for commercial purposes.
4. ChemApp distributions
4.1 For which platforms is ChemApp available? [TOP]
An up-to-date list of platforms where ChemApp has been tested and used can be found on the ChemApp web page.
The list of platforms for which ChemApp and ChemApp light are available might differ. Please check the ChemApp light section of the ChemApp web page.
If ChemApp or ChemApp light is not available yet for the platform of your choice, please contact us (email@example.com) to check whether this version is in the pipeline, or can be specially made for you.
4.2 The way ChemApp or ChemApp light has been compiled doesn't work for me, can you help? [TOP]
This happens sometimes with Unix versions of ChemApp/ChemApp light, for instance
- you need a 64-bit version but the distribution archive contains a 32-bit version,
- you need a version that does (or does not) have underscores prepended to the subroutine names, and you need a version that has been compiled exactly the other way.
In most cases, we'll be able to help you by compiling a custom version for you. Just contact us at firstname.lastname@example.org.
4.3 What does the program ChemFile, distributed with ChemApp, do? [TOP]
If you already have thermochemical data-files for ChemSage, you can use them with ChemApp as well
- If you are using ChemSage version 4.x, you can use these data-files with ChemApp right away.
- If you are using ChemSage version 3.x, you need to first translate them using the program ChemFile, which is included in the ChemApp distribution.
Note that recent versions of ChemApp do not contain the program ChemFile any longer. If you still happen to have old data-files in ChemSage V3.x format, please contact us.
5. ChemApp and ChemSage/FactSage
5.1 I already know about ChemSage and/or FactSage, how does ChemApp differ from it? [TOP]
- ChemSage/FactSage are interactive, standalone programs. They do not need any other tools apart from thermochemical data-files or databases. They are the tools of choice for users who do not wish to do any programming work. Compared to ChemApp, ChemSage/FactSage have only limited support to handle complex sets of repetitive calculations.
- ChemSage/FactSage have a menu interface and graphical output, and are thus better suited to quickly analyze problems and what-if scenarios in which a graph on screen or paper are regularly desired. For that purpose, ChemSage/FactSage are often used alongside ChemApp.
- ChemSage/FactSage can automatically calculate phase diagrams. If a user needs to calculate phase diagrams frequently, ChemSage/FactSage are the right programs to use. To add this feature to ChemApp would require the user to do extensive programming work.
The following are the main common features between ChemApp and ChemSage
- ChemApp and ChemSage/FactSage internally use the same code to calculate the chemical equilibrium (see section 6.1). Results of equilibrium calculations are thus identical between both programs.
- Related to the above, both programs also support the same wide range of non-ideal mixture phase models (-> ChemApp documentation light / regular).
- ChemApp and ChemSage use the same thermochemical data-file format. If you have already data-files for ChemSage, they can be used for calculations with ChemApp just as well. FactSage uses its own thermochemical database format, but data-files for ChemApp/ChemSage can be easily created.
5.2 For which problems is ChemApp the better tool, and for which is ChemSage/FactSage? [TOP]
If you need an interactive, standalone program that can output results in the form of tables and graphs, and can automatically calculate phase diagrams, use ChemSage/FactSage. It is an everyday desktop tool that is easy to learn and does not require programming knowledge at all.
If you need to perform equilibrium calculation from within your own or third-party programs, need to handle complex, repetitive calculations, and want a flexible programmer's library for your projects, use ChemApp.
Needless to say, many users utilise both tools.
5.3 I already have thermochemical data-files for ChemSage or ChemSheet, can I use them with ChemApp? [TOP]
Yes, you can. See section 4.3 for details.
5.4 I already have FactSage and the thermochemical databases it comes with, can I use the data with ChemApp? [TOP]
Yes, you can. See section 7.7 for details.
5.5 I'm using FACT-Win or FACT-DOS, can I use the data with ChemApp? [TOP]
No, you can't. You need to at least have FactSage V5.0 to be able to create thermochemical data-files for ChemApp
5.6 I would like to use data from my FactSage databases with ChemApp. Does ChemApp require direct access to the FactSage databases, i.e. does it have to be installed on the same machine? [TOP]
No, ChemApp need not and cannot directly access any FactSage database. Thermochemical data from FactSage databases is made available to ChemApp (and ChemSheet, for that matter; i.e. any software that internally contains ChemApp) via ChemSage-style data-files, which are user-defined subsets of the databases available for FactSage. See section 7.7 for more information. For general information on data-files, see section 7.1, section 7.2, and section 7.3.
5.7 Do I need FactSage or ChemSage in order to use ChemApp? [TOP]
No, no other software from us is required in order to run ChemApp. Many customers also use FactSage for instance, because they prefer to have an interactive program available too, but there is no technical reason why FactSage is required (see also section 5.2).
Of course customers who also have FactSage (or ChemSage) benefit from the fact that they can create thermochemical data-files for ChemApp using FactSage and the databases they have available for these programs (see section 7.7).
6. Calculational aspects
6.1 How does ChemApp calculate the chemical equilibria? [TOP]
The technique employed by ChemApp to calculate complex, multicomponent, multiphase chemical equilibria is called Gibbs energy minimisation (GEM). An outline of this technique can be found in an article on ChemSage, which internally uses the same calculational engine as ChemApp [Eri90].
More information on the GEM technique can be obtained from the following references -
[Smi82] - W. R. Smith and R. W. Missen: Chemical Reaction Equilibrium Analysis, Wiley-Interscience, New York, NY, 1982.
[Mat86] - A. E. Mather: Fluid Phase Equilib., 1986, vol. 30, pp. 83-100.
6.2 How is it possible that ChemApp calculates even complex equilibria so fast? [TOP]
Two main reasons can be given which are responsible for ChemApp's speed:
- The GEM code has been under constant development for the last 30 years, since the days of SOLGASMIX. Along with the robustness of the code, its speed has always had a high priority.
- When ChemApp begins an equilibrium calculation, it tries to guess which phases are stable before it numerically solves the equilibrium. These guesses have been refined during the development of the GEM code, and now account for a significant reduction of computing time when determining the equilibrium state.
6.3 Can I investigate time-dependent and kinetic phenomena with ChemApp? [TOP]
ChemApp itself does not contain any code to deal with kinetic issues, but the fact that ChemApp is available as an independent library makes it ideal to be used in programs that deal with these issues. In these cases, ChemApp is used to calculate a local equilibrium ("local" either meaning "local in time", or "local in space", or both), while the application program provides the necessary code to model the exchange of material and/or energy between these localised equilibria. This exchange of material could be diffusion, fluid flow (e.g. in CFD), or other modes of transport (e.g. in process simulation). Application examples of these concepts are introduced on the ChemApp web page. The possibilities in this respect are tremendous and are one of the prime application areas of ChemApp.
Recently other methods have been co-developed by GTT-Technologies for the introduction of kinetic controls into complex equilibrium calculations which can be used with ChemApp, and which might be useful to you [Kou01]
6.4: ChemApp is fast, but I need it to be even faster, what can I do? [TOP]
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.
- 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
By using these optimized static libraries or DLLs instead of the standard ones, you might achieve some significant speed gain.
README.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.
- 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.
- 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".
7. Thermochemical data
7.1 Why do I also need thermochemical data-files, is ChemApp itself not enough? [TOP]
To determine a chemical equilibrium, you need two things:
- A program which performs the necessary calculations (see section 6.1), which is what ChemApp does
- a data-file (also referred to as a ChemSage data-file) which contains the thermochemical data of all the phases and species in the chemical system you are investigating. ChemApp reads a thermochemical data-file at run-time of your application program by calling the appropriate subroutine.
7.2 From where do I get these thermochemical data-files? [TOP]
Thermochemical data-files for ChemApp (and ChemSage, for that matter) can come from a variety of sources:
- ChemApp, as well as ChemApp light, comes with several example data-files for various chemical systems, which let you start gathering programming experience right away. These example data-files are also used for the code example which are part of the ChemApp documentation (-> ChemApp documentation light/regular).
- If you are using FactSage, you can export data-files for use with ChemApp from the databases FactSage uses (e.g. the FACT or SGTE databases), see section 7.7 for details.
- If you are a user of ChemSage, you probably already have one or more thermochemical data-files for your specific needs. You can use these data-file with ChemApp too, see section 4.3 for details.
- Again, if you have ChemSage already, and a thermochemical database to go with it (e.g. the SGTE Pure Substance or the SGTE Solution Database), you can use the ChemAccess module of ChemSage to extract data-files for the systems of your choice. The resulting data-files you can use with ChemApp as well.
- Several other programs from the area of computational thermochemistry which have a database backend are also capable of writing data-files in ChemSage format.
- If you are looking for a data-file for a specific chemical system or an application, it is worth taking a look at GTT's repository of application-specific data-files. These are data-files which have been compiled already and are now available "off the shelf". Database Documentation serves as a searchable catalog program in this respect.
- Thermochemical data-files can be custom-made by GTT-Technologies. We specialise in the provision of thermochemical data and have access to all relevant sources and specialists around the world.
- And last but not least, you can create a thermochemical data by hand, either by starting from scratch, or by modifying an existing one. This might be a good alternative if you have the data already, if the thermochemical system in question is fairly simple, and if you have no access to any of the above alternatives.
7.3 What does such a data-file look like? [TOP]
The ChemApp distribution contains several example data-file for you to browse. The ChemApp documentation (-> ChemApp documentation light/regular) also has these data-files included, you can find them in the appendix. One data-file (cosi.dat, for the system C-O-Si), is explained very thoroughly, line-by-line.
7.4 I want to add other/my own non-ideal mixture phase models to ChemApp, is that possible? [TOP]
Support for user-defined models has been added to ChemApp, please contact GTT-Technologies for details if you are interested in this feature.
7.5 I'm trying to convert a data-file using ChemFile, but it crashes, what's wrong? [TOP]
There are two common reasons for this effect:
- If the data-file is in ASCII form, check whether the line endings are correct. If the data-file has been copied from a different platform (e.g. from a DOS to a Unix machine), it could be that the line endings have not been converted properly.
- ChemFile only converts data-files from ChemSage V3.x format to the current ChemApp/ChemSage V4 format. It will not work properly if you try to read a data-file which is in ChemApp/ChemSage V4 format already, nor will it convert data-files which are in the very old ChemSage V2/SOLGASMIX formats (if you still have such old data-files and would like to use them, please contact GTT-Technologies).
If you suspect none of the above points is the reason for your problem with ChemFile, please contact GTT-Technologies.
7.6 I have problems using binary data-files with ChemApp, what's wrong? [TOP]
As you might know, ChemSage data-files come in ASCII, binary, and transparent flavors. Whereas ASCII data-files are portable between platforms and compilers, binary files are not. There is no Fortran standard with respect to binary files, the result is that a binary file created on one platform or compiler (e.g. with ChemSage or FACTWin) is in most cases not readable by ChemApp.
The more recent transparent data-file format achieves some kind of portability between various compilers on DOS/Windows platforms. Thus, a transparent data-file created with FactSage can be read by a ChemApp DLL for Visual Basic®, for instance. To learn more about transparent data-files, please consult the ChemApp documentation (-> ChemApp documentation light/regular). ChemApp light users: Please note that ChemApp light does not support transparent data-files yet.
7.7 How do I prepare data-files for ChemApp using FactSage? [TOP]
FactSage V5.0 and more recent versions can be used to create thermochemical data-files for ChemSage, and also for ChemApp and ChemSheet. The type of thermochemical data-file FactSage writes are called "transparent" data-files, and can be used with virtually all versions of ChemApp running under the Microsoft Windows operating system.
Transparent data-files are usually not portable to other operating systems like Unix, ChemApp running on Unix will not be able to read such data-files. If you would like to use FactSage data with a Unix version of ChemApp, please contact GTT-Technologies.
Assuming you would like to use FactSage to create a thermochemical data-file for use with ChemApp, ChemSheet, or ChemSage running under Windows, here is a short description of the recommended procedure:
- Enter the Equilib module of FactSage and input your choice of reactants.
- Select the product compound species (i.e. the selected gas, liquid, and solid phases) and solution phases.
- Perform some equilibrium calculations for the temperature and concentration ranges that you're interested in, to make sure your selection of compound species and solution phases includes everything you want.
- Use "File|ChemSage|Save ChemSage File" to store your current selection of thermochemical data to the transparent ChemSage data-file ChemSage.cst, which is written to your FactSage directory.
Note that a thermochemical data-file for ChemSage contains only the thermochemical data for the system you selected in FactSage, but no input conditions for an equilibrium calculation of any sort (like temperature or amounts of reactants).
- After you have saved the data to a ChemSage file, we recommend saving your settings immediately to a FactSage EQUI*.DAT file, ("File|Save"), so that once you're already calculating equilibria with ChemApp, you can later always recall the same configuration in FactSage, in order to perform interactive calculations, for instance for verification or documentation purposes, or to easily change your selection of phases.
- See the ChemApp Programmer's Manual (-> ChemApp documentation light/regular) for details on how to load the transparent data-file ChemSage.cst you just created into ChemApp. In short, it involves using the ChemApp subroutines TQOPNT, TQRCST, and TQCLOS.
8. Programming issues
8.1 Why do TQSTSC and TQSTPC always return a molar mass of 1.0? [TOP]
Both TQSTSC (Get - Stoichiometry - System - Component) and TQSTPC (Get - Stoichiometry - Phase - Constituent) return a molecular mass via the parameter WMASS. If you did not change the mass unit using TQCSU (Change - System - Unit), it remains set to the default unit, which is 'mol'. The molecular mass is expressed in units of [current amount unit / mol] which can of course only result in the value of 1.0, if the current amount unit is 'mol'. Thus you would normally want to change the amount unit to 'gram', before a call to the functions TQSTSC and TQSTPC.
8.2 ChemApp does not read a data-file properly, how do I find out what is wrong? [TOP]
If an error occurs (error no. 103 or 102) while reading the thermodynamic data-file using TQRFIL (Read - File), the reason is typically one of the following:
- The file has not been opened properly.
This can especially happen when the subroutine TQOPEN (Open - File) is used (i.e. when programming in languages other than FORTRAN) and the file you are trying to open does not exist, at least not where you expect it to exist.
Note: If you are using ChemApp V3.3.0 or later, use TQOPNA (Open-ASCII-Data-File), TQOPNB (Open-Binary-Data-File), or TQOPNT (Open-Transparent-Data-File) instead or TQOPEN when opening data-files for reading.
The reason why this can happen with TQOPEN is that this subroutine can be used both for opening files for reading and writing, so if you are trying to open a file that does not exist, TQOPEN will not complain but create a file under this name, which is then existent and of zero length.
Thus, always check first if the file you are planning to open actually exists using appropriate functions of the language you are using for your application program. Only after you verified that the file really exists you should open it with TQOPEN. Special care should be taken when using Microsoft Visual Basic®, because it might look for the file you are trying to open in different places, depending on whether you run your Visual Basic program from Visual Studio, or as a standalone executable.
Thus, if you get errors 102 or 103, check if you find a file under the name you used as parameter to TQOPEN on your disk which has zero length. If you do, delete this file and run your program again. If the error is reported again and you find the zero length file again, you know you are not passing the right parameter to TQOPEN.
- The chemical system contained in the data-file is too big for the version of ChemApp you are using. Check the size of the chemical system in the data-file against the sizes of the ChemApp-internal arrays (see subroutine TQSIZE).
- If the data-file is in ASCII form, check whether the line endings are correct. If the data-file has been copied from a different platform (e.g. from a DOS to a Unix machine), it could be that the line endings have not been converted properly.
- If you are using ChemApp V3.3.0 or later, make sure you are using the correct procedure to open your data-file, depending on what format data-file you have: TQOPNA (Open-ASCII-Data-File) for ASCII data-files, TQOPNB (Open-Binary-Data-File) for binary data-files, or TQOPNT (Open-Transparent-Data-File) for transparent data-files.
If you have ChemSage available, try load the data-file with ChemSage. If ChemSage encounters a problem while reading a data-file, it interprets as much of it as it can and stores the intact part in a file called 'newdat.dat' before it aborts. The contents of this file (especially the very end) provides valuable hints as to where the problem might be located in the data-file.
If you cannot find the error, and other data-files load without problems, contact GTT's Technical Support, we will help you locate the problem.
8.3 ChemApp says it cannot calculate an equilibrium, what is wrong? [TOP]
If ChemApp indicates that it cannot calculate an equilibrium, typically returning error numbers 701 or 702 after a call to TQCE (Calculate - Equilibrium) or TQCEL (Calculate - Equilibrium - List - Results), check the conditions which are active for the equilibrium calculation in question using TQSHOW (Show - Present - Settings). Then check the comment section at the end of the data-file and make sure you are not violating any application ranges (e.g. relating to temperature, composition). Typical mistakes of this kind are:
- Using composition values which are not covered by the data (e.g. trying to use a file for a low-alloyed steel at high compositions of the alloying elements)
- Using temperatures not covered by the data in the file (e.g. at temperatures where an alloy would be liquid, but no liquid phase data is contained in the data-file).
If you have verified that the input conditions which led to the error are within the permitted ranges of the data-file, contact GTT's Technical Support for further help.
8.4 I want to retrieve Cp/H/S/G for a phase constituent, do I use TQGETR or TQGDPC? [TOP]
Both TQGETR (Get - Results) and TQGDPC (Get - Thermodynamic - Data - Phase - Constituent) allow you to retrieve the values for these thermodynamic functions for phase constituents. The difference is that TQGETR retrieves these values for the previously calculated equilibrium state. The values retrieved with TQGDPC, on the other hand, have nothing to do with an equilibrium state. What TQGDPC does is that it simply calculates the desired thermodynamic property by directly evaluating the polynomial expression for G (or Cp/Delta H298/S298) for the phase constituent in question and the temperature set. TQGDPC can thus for instance be used to produce graphs or tables of thermodynamic properties vs. temperature for any of the phase constituents in the data-file loaded.
8.5 I'm performing a calculation at constant volume and it fails, what can I do about it? [TOP]
The answer in short: Perform a target calculation with volume as target and pressure as target variable instead.
When calculations are made under constant product volume by using the option 'VT' of the subroutines TQSETC (Set - Equilibrium - Condition) or TQSTEC (Set - Equilibrium - Condition - When - Stream - Input), ChemApp will make a global minimisation of the Gibbs energy, changing the total pressure in accordance with the given volume. This is, however, a calculation which in rare occasions might fail to converge, for instance when for the given input the volume exhibits a discontinuous change at the appearance or disappearance of phases and the entered product volume lies within the interval of the discontinuity.
If the same situation would appear during a target calculation with volume as target and pressure as target variable, then ChemApp will weigh all numbers on both sides of the discontinuity and a converged solution will be obtained.
Because of these problems related to constant volume calculations, the decision has been made to delete 'VT' as a possible option for TQSETC and TQSTEC in future versions of ChemApp. In all application programs where it is currently being used, the option 'VT' should be replaced by option 'V', such defining a target calculation. Note that this does not affect the subroutine TQGETR (Get - Result) and its option 'VT' in any way.
8.6 Why do the results I retrieve with TQSTXP look wrong or are all zero? [TOP]
For users of ChemApp versions prior to 3.2.0: The values returned by TQSTXP (Get - Thermodynamic - Property - Of - A - Stream) always refer to the last calculated equilibrium state. If TQSTXP is called before the first equilibrium calculation has been performed using TQCE (Calculate - Equilibrium) or TQMAP (Calculate - One - Dimensional - Phase - Map), the value returned will be zero.
As of ChemApp version 3.2.0, TQSTXP can be called to get the calculated thermodynamic properties of a stream also before an equilibrium calculation has been performed.
If you are wondering about what exactly ChemApp takes into account when calculating extensive properties of streams, please refer to the section Advanced topics in the appendix of the Programmer's Manual (Edition 3.2 and later) (-> ChemApp documentation light/regular).
8.7 How do I get information about the individual sublattices in a SUBL phase? [TOP]
A set of subroutines to do exactly that will be included in the next release of ChemApp/ChemApp light (version 3.3.x).
9. Questions about particular compilers and development environments
9.1 I'm trying to set up a MFC application under Microsoft Visual C++, but I get error messages relating to precompiled header files, what to do? [TOP]
This problem is very likely not related to ChemApp, but to an incorrect setup of support for precompiled header files in your project.
One remedy is to open your "Project Settings" dialog, tab "C/C++", category "Precompiled Headers", and choose either "Not using precompiled headers" or "Automatic use of precompiled headers".
Both settings should work.
9.2 I'm using ChemApp on a Unix system and I get several "undefined symbol" errors during linking, what to do? [TOP]
The undefined symbols reported by the linker usually start with one or two underscores, and reported to be first referenced in the ChemApp library. This happens during the linking of any ChemApp application program, even the demo programs (e.g.
cademo1) included with the ChemApp distribution.
Solution: The cause of this error is typically related to the installation and setup of the compiler you are using. The undefined symbols are normally to be found in object files and libraries other than ChemApp or the application program's. The linker looks for them in system libraries installed on your computer. The reason why the linker isn't successful is typically because these libraries are not installed, their location is unknown to the linker, or the libraries are not suitable for the version of the compiler/linker you are using.
To track down the reason for this problem, you might want to take the following steps:
- Add the proper option to the linker command line so that it produces verbose output. This option is often
-v. This should reveal the real, complete linker command line. Identify the libraries and object files it tries to access during the linking process, and the directories it searches for these files. Check if all of the libaries and object files are actually present in these directories. If not, the compiler installation or update process was likely incomplete.
- Check the version of your compiler and verify with your system administrator that the matching system libraries are present in the proper directories. One typical clue is that the system libraries, if they are compiler version-dependent, are often located in subdirecties whose names reflect the version of the compiler.
- If you are using shared libraries, check if the environment variable pointing to the directories to search for these shared libraries (typically called
LD_LIBRARY_PATH) is properly set.
10. List of recent changes to the FAQ
10.1 V 5.0, 14 April 2003 [TOP]
- Added: section 2.10: Does ChemApp require a hardware key, like FactSage and ChemSheet do?
- Added: section 6.4: ChemApp is fast, but I need it to be even faster, what can I do?
- Added section 5.6: I would like to use data from my FactSage databases with ChemApp. Does ChemApp require direct access to the FactSage databases, i.e. does it have to be installed on the same machine?
- Added: section 5.7: Do I need FactSage or ChemSage in order to use ChemApp?
- Updated: section 4.3: What does the program ChemFile, distributed with ChemApp, do? (ChemFile is no longer distributed with ChemApp)
- The major version number of this FAQ has been set to 5, in order to correspond to the upcoming release of ChemApp V5.0.0.
[Eri90] G. Eriksson, K. Hack ChemSage - A Computer Program for the Calculation of Complex Chemical Equilibria, Metallurgical Transactions B, 21B (1990) p.1013
[Kou01] P. Koukkari, R. Pajarre, K. Hack Setting kinetic controls for complex equilibrium calculations, Z. Metallkde., 92 (2001) p.1151