TQCE and TQCEL are the only subroutines that need to be called to carry out a single equilibrium calculation (TQCEL additionally displays results from a calculation in form of a ChemSage result table). When an equilibrium state variable other than pressure, temperature, or composition is defined as input, a target variable must be defined upon calling TQCE/TQCEL; for example, when defining enthalpy or the amount of a phase as a condition instead of temperature.

As of version 3.0.0, ChemApp is able to perform *one-dimensional
phase mapping* calculations. This type of calculation is done using
the subroutines TQMAP/TQMAPL.

TQSHOW displays a table of the present settings. Using TQCLIM it is possible to modify the upper and lower limits of target variables.

Results from an equilibrium calculation are retrieved using the subroutine TQGETR. Thermodynamic data for phase constituents can be obtained using TQGDPC, while thermodynamic properties of streams are accessible through TQSTXP. TQGTLC is used to get calculated equilibrium sublattice site fractions for phases modelled according to the sublattice formalism.

TQERR can be used to retrieve ChemApp error messages after any ChemApp subroutine indicated that an error occurred.

These subroutines are summarised below in Table 15, while Tables 16 to 21 list possible values of variables used as parameters to the various subroutines in this group.

**Table 15: ChemApp subroutines for calculating and getting results**

Subroutine |
Function |

TQCE |
Calculates the chemical equilibrium |

TQCEL |
Calculates the chemical equilibrium and gives a result table (ChemSage format) |

TQCEN |
Calculates the chemical equilibrium, taking results from the
previous equilibrium calculation as initial estimates |

TQCENL |
Calculates the chemical equilibrium, taking results from the
previous equilibrium calculation as initial estimates,
and gives a result table (ChemSage format) |

TQMAP |
Calculates a one-dimensional phase map |

TQMAPL |
Calculates a one-dimensional phase map and gives a result table (ChemSage
format) |

TQCLIM |
Changes limits of target variables |

TQSHOW |
Shows present settings |

TQGETR |
Gets calculated equilibrium results |

TQGDPC |
Gets thermodynamic data for a phase constituent |

TQSTXP |
Gets thermodynamic properties of a stream |

TQGTLC |
Gets the calculated equilibrium sublattice site fraction |

TQERR |
Gets an error message |

**Table 16: State variables for defining targets when calling
TQCE/TQCEL**

Option |
Variable |
Comment |

P | Total pressure | Pressure is a target variable. The value VALS(1)
serves as an initial estimate, VALS(2) is not used. |

V | Total volume | Volume is a target variable. The value VALS(1) serves as
an initial estimate, VALS(2) is not used. |

T | Temperature | Temperature is a target variable. The value VALS(1)
serves as an initial estimate, VALS(2) is not used. |

IA, IA0 MU |
Incoming amount Chemical potential |
Incoming amount is a target variable. The values VALS(1) and
VALS(2) denote lower and upper limits, respectively. When defining
streams, the constituent is included in the last stream
considered. If incoming amounts for more then one
substance need to be defined, all except the last one have to
be called using 'IA0' as option to TQCE/TQCEL. Once 'IA' is
passed for the last incoming amount, the first calculation is
made. |

Blank | - | Calculate without any target variable, VALS is not used. |

**Table 17: Options for modifying upper and lower limits of target variables
using TQCLIM**

Option |
Variable |
Default value |

PLOW | Low pressure limit | 10^{-50} bar |

PHIGH | High pressure limit | 10^{7} bar |

VLOW | Low volume limit | 10^{-7} dm^{3} |

VHIGH | High volume limit | 10^{50} dm^{3} |

TLOW | Low temperature limit | 298.15 K |

THIGH | High temperature limit | 6000 K |

**Table 18: Definition of the indices INDEXP
(for phases) and INDEX (for components or constituents) in the subroutine
TQGETR. Index numbers are obtained by the appropriate
subroutine calls (see TQINSC, TQINP, TQINPC). Indices may be
chosen arbitrarily when pressure, volume, or temperature is
selected. When a negative number is required, this may be chosen
freely.**

INDEXP |
INDEX |
Type of VAL |
Components, phases, or constituents for which value is
returned |

>0 | >0 | DOUBLE PRECISION | Constituent INDEX of phase INDEXP (INDEX=1 for
stoichiometric condensed phases), or system component INDEX of
phase INDEXP |

>0 | <0 | Array of DOUBLE PRECISION |
All constituents of phase INDEXP, or all system components of
phase INDEXP (for options XP and AP) |

>0 | 0 | DOUBLE PRECISION | Phase INDEXP |

<0 | 0 | Array of DOUBLE PRECISION |
All phases |

<= 0 | >0 | DOUBLE PRECISION | System component INDEX |

<= 0 | <0 | Array of DOUBLE PRECISION |
All system components |

0 | 0 | DOUBLE PRECISION | Entire system |

**Table 19: State variables for which results can be obtained with the
subroutine TQGETR**

Option |
Variable |
Comment |

P | Total pressure | - |

VT | Total volume | - |

T | Temperature | - |

A | Equilibrium amount | - |

IA | Incoming amount | Not valid for phases or for the entire system |

MU AC |
Chemical potential Activity/fugacity |
Relative values for phases and constituents; absolute values
for system components; fugacities in current pressure unit for
gas phase constituents. |

CP H S G V |
Heat capacity Enthalpy Entropy Gibbs energy Volume |
Not valid for system components.
Extensive properties for the equilibrium state
dependent on the inherent reference state of
the data.
However, when the entire
system is selected and streams are used, the values
represent balances, i.e. the extensive property for the
equilibrium state minus the sum of values for all streams.
To obtain the total volume in
this case, use option 'VT'. |

CPM HM SM GM VM |
Heat capacity/amount unit Enthalpy/amount unit Entropy/amount unit Gibbs energy/amount unit Volume/amount unit |
Not valid for system components.
Partial values are returned for constituents,
integral values for phases. Values are valid for default
or selected amount units. |

X | Fraction | Mass or mole fraction of a system component in the
system, depending on the default or selected amount unit |

XP | Fraction | Mass or mole fraction of a system component in a phase,
depending on the default or selected amount unit |

AP | Equilibrium amount | Equilibrium amount of system component in a phase |

**Table 20: Thermodynamic quantities that can be calculated using
TQGDPC and TQSTXP**

OPTION |
Variable |

CP |
Heat capacity |

H |
Enthalpy |

S |
Entropy |

G |
Gibbs energy |

V |
Volume |

T |
Temperature (used to retrieve the upper limit of the
current temperature interval for a given phase constituent or
a stoichiometric condensed phase, not for use with TQSTXP) |

**Table 21: State variables for defining one-dimensional phase mapping
calculations using TQMAP / TQMAPL**

Option |
Variable |
Comment |

PF PN |
Total pressure | Pressure is the search variable. The upper and lower bounds
of the pressure search interval are in VALS(1)
and VALS(2). Use option 'PF' for the first call to TQMAP, 'PN'
for all subsequent ones. |

TF TN |
Temperature | Temperature is the search variable. The upper and lower bounds
of the temperature search interval are in VALS(1) and
VALS(2). Use option 'TF' for the first call to TQMAP, 'TN'
for all subsequent ones. |

IA0 IAF IAN |
Incoming amount | Incoming amount is the search variable. The upper and
lower bounds of the composition search interval are in
VALS(1) and VALS(2). If incoming amounts for more than one
substance need to be defined, all except the last one have to
be called using 'IA0' as option to TQMAP. Once 'IAF' is
passed for the last incoming amount, the first calculation is
made. Use option 'IAN' for all subsequent ones. |

ChemApp Programmer's Manual, Edition 3.6 | © GTT-Technologies, 2003 |