TQCE
Fortran |
TQCE(TARGET, INDEXP, INDEXC, VALUE, IWSG, IWSE) |
|
---|---|---|
C-interface |
tq_ce(TC_STRING var,TC_INT indexp,TC_INT indexc,TC_FLOAT value,TC_INT* iwsg,TC_INT* iwse); |
|
Full name: |
Calculate Equilibrium. |
|
Purpose: |
Calculate the equilibrium with current settings of conditions or streams. |
|
Comments: |
Some software needs a TARGET specified for certain types of calculations. A TARGET is a state variable as specified in TQSETC. When working with Thermo‑Calc, it is only useful in stream reaction calculations, where an initial guess of the target variable may be of some help. Otherwise, TARGET is normally set as an empty string and the values of INDEXP, INDEXC, and VALUE are irrelevant. |
|
Arguments |
||
Name |
Type |
Value set on call or returned |
TARGET |
Character*8 |
Set to a state variable, if necessary. |
INDEXP |
Integer |
Set to a phase index, if necessary. |
INDEXC |
Integer |
Set to a component index, if necessary. |
VALUE |
Double precision |
Set to an estimate of the target variable. |
IWSG |
Integer array |
Workspace |
IWSE |
Integer array |
Workspace |

Calculate enthalpy for an equilibrium gas mixture SO3, SO2 and O2. Input SO3 2%, O2 10% and 88% SO2.
CALL TQGPI('GAS',INDEXP,IWSG,IWSE)
C...set temperature, pressure and total amount of moles
CALL TQSETC('T',-1,-1,800.0D0,NCOND,IWSG,IWSE)
CALL TQSETC('P',-1,-1,1.0D5,NCOND,IWSG,IWSE)
CALL TQSETC('N',-1,-1,1.0D0,NCOND,IWSG,IWSE)
C...set mole fraction of SO3 and O2
CALL TQGPI(INDEXP,'GAS',IWSG,IWSE)
CALL TQGPCI(INDEXP,INDEXC,'SO2',IWSG,IWSE)
CALL TQSETC('IN',INDEXP,INDEXC,8.8D-1,NCOND,IWSG,IWSE)
CALL TQGPCI(INDEXP,INDEXC,'O2',IWSG,IWSE)
CALL TQSETC('IN',INDEXP,INDEXC,1.0D-1,NCOND,IWSG,IWSE)
CALL TQGPCI(INDEXP,INDEXC,'SO3',IWSG,IWSE)
CALL TQSETC('IN',INDEXP,INDEXC,2.0D-2,NCOND,IWSG,IWSE)
CALL TQCE(' ',0,0,0.0D+0,IWSG,IWSE)
CALL TQGETV1('H',-1,-1,ENT,IWSG,IWSE)
In this way an application program can calculate the incoming enthalpy into the system. If there is more than one incoming flow it can calculate the enthalpies for each flow and sum them up.

Note the following conventions to distinguish between the programming languages.
- Routines starting with TQXXX, for example, TQGDAT, are in the Fortran interface
- Routines starting with tq_xxxx, for example tq_gdat, are in the C-interface.
- In Fortran, all routines are subroutines and do not return any values except where explicitly declared as functions.
- All the C procedures are declared as void and do not return any values except where explicitly otherwise declared.
An example of how to read the subroutine definitions.