GET-STATUS-OF-PHASE
Use TQGSP to get the status of a specified phase.
Synopsis
FORTRAN: CALL TQGSP(INDEXP,OPTION,NOERR)
C: tqgsp(indexp,option,&noerr)
;
Pascal: tqgsp(indexp,option,noerr)
;
Basic: Call tqgsp(indexp,option,noerr)
Name |
Type |
Value set on call or returned
|
INDEXP |
INTEGER |
Set to the index number for a phase
|
OPTION |
CHARACTER |
Returns a string as shown in Table 11
|
NOERR |
INTEGER |
Returns an error number
|
INDEXP is integer input and OPTION is character output identifying the
status (see Table 11).
See also
TQCSP, TQGSPC, TQCSPC
Examples
C Changing the status of phases
SUBROUTINE TABLE
IMPLICIT NONE
INTEGER I, NOERR, NPHASE
DOUBLE PRECISION AMOUNT, ACT
CHARACTER NAME*24
C Retrieve and display the activities and equilibrium
C amounts of all phases
C Get number of phases
CALL TQNOP(NPHASE, NOERR)
C Print table header
write(*,FMT='(A10,17X,A14,2X,A14)') 'Phase name',
* 'amount/mol',
* 'activity'
DO I=1, NPHASE
C Get the phase name
CALL TQGNP(I, NAME, NOERR)
C Get its equilibrium amount
CALL TQGETR('A ', I, 0, AMOUNT, NOERR)
C Get its activity
CALL TQGETR('AC ', I, 0, ACT, NOERR)
write(*,FMT='(A24,2X,F14.5,2X,F14.5)') NAME,AMOUNT,ACT
ENDDO
RETURN
END
PROGRAM CAF14
IMPLICIT NONE
INTEGER NOERR, NUMCON
INTEGER ISIC, ISIO2, IC
DOUBLE PRECISION VALS(2)
CHARACTER STATUS*24
C Initialise ChemApp
CALL TQINI(NOERR)
C Open data-file for reading
CALL TQOPNA('cosi.dat', 10, NOERR)
C Read data-file
CALL TQRFIL(NOERR)
C Close data-file
CALL TQCLOS(10, NOERR)
C Get the phase index number of SiC
CALL TQINP('SiC ', ISIC, NOERR)
C Get the status of this phase
CALL TQGSP(ISIC, STATUS, NOERR)
WRITE(*,FMT='(A)') 'The status of SiC is currently ' //
* STATUS
Output:
The status of SiC is currently ENTERED |
C Unless a phase is marked "dormant" or "eliminated" in the data-file
C itself, the status is by default always "entered". This means it is
C considered in the subsequent equilibrium calculations and is included
C in the mass balance.
C Set some conditions and perform a simple calculation to
C demonstrate the effect of the different statuses
C Set temperature to 1900 K
CALL TQSETC('T ', 0, 0, 1900.D0, NUMCON, NOERR)
C Set incoming amount to 1 mol SiO2(quartz) and 2 mol C
CALL TQINP('SiO2(quartz)', ISIO2, NOERR)
CALL TQSETC('IA ', ISIO2, 0, 1.D0, NUMCON, NOERR)
CALL TQINP('C ', IC, NOERR)
CALL TQSETC('IA ', IC, 0, 2.D0, NUMCON, NOERR)
C Calculate the equilibrium
CALL TQCE(' ', 0, 0, VALS, NOERR)
C Print a table containing the phase names, their
C equilibrium amounts, and activities
CALL TABLE
Output:
Phase name amount/mol activity
GAS 1.39778 1.00000
C 0.00000 0.43860
Si 0.00000 0.07912
SiC 0.65059 1.00000
SiO2(quartz) 0.00000 0.90635
SiO2(tridymite) 0.00000 0.99918
SiO2(cristobalite) 0.30105 1.00000
SiO2(liquid) 0.00000 0.97125 |
C From the above table it can be seen that SiC is stable
C under those conditions. Its activity is unity and its
C equilibrium amount is approx. 0.65 mol
C Now change the status of SiC to "dormant" and rerun the
C calculation
CALL TQCSP(ISIC, 'DORMANT ', NOERR)
CALL TQCE(' ', 0, 0, VALS, NOERR)
CALL TABLE
Output:
Phase name amount/mol activity
GAS 0.00000 0.74210
C 2.00000 1.00000
Si 0.00000 1.00000
SiC 0.00000 28.81864
SiO2(quartz) 0.00000 0.90635
SiO2(tridymite) 0.00000 0.99918
SiO2(cristobalite) 1.00000 1.00000
SiO2(liquid) 0.00000 0.97125 |
C Setting a phase to "dormant" tells ChemApp to exclude it from the mass
C balance, but still calculate its activity. This offers the
C possibility to consider a phase to be metastable, while still
C obtaining information about its activity. It can be seen from the
C above table that ChemApp sets the equilibrium amount of SiC to zero,
C and calculated its activity to be almost 30. Instead of SiC, ChemApp
C now calculates Si to be stable.
C If a phase is to be completely ignored during the equilibrium
C calculations, its status should be set to "eliminated", as in the
C following example.
CALL TQCSP(ISIC, 'ELIMINATED ', NOERR)
CALL TQCE(' ', 0, 0, VALS, NOERR)
CALL TABLE
Output:
Phase name amount/mol activity
GAS 0.00000 0.74210
C 2.00000 1.00000
Si 0.00000 1.00000
SiC 0.00000 0.00000
SiO2(quartz) 0.00000 0.90635
SiO2(tridymite) 0.00000 0.99918
SiO2(cristobalite) 1.00000 1.00000
SiO2(liquid) 0.00000 0.97125 |
C Now ChemApp ignored SiC during the equilibrium calculations, as if it
C were not even included in the data-file. The status "eliminated"
C allows one to selectively delete phases from equilibrium calculations,
C for instance to increase computational efficiency.
END
/* Program cac14 */
/* Changing the Status of Phases */
#include "cacint.h"
void table()
{
LI i, noerr, nphase;
DB amount, act;
char name[TQSTRLEN];
/* Retrieve and display the activities and equilibrium
amounts of all phases */
/* Get number of phases */
tqnop(&nphase, &noerr);
/* Print table header */
printf("%-27s%-16s%-16s\n", "Phase name", "amount/mol", "activity");
for(i = 1; i <= nphase; i++) {
/* Get the phase name */
tqgnp(i, name, &noerr);
/* Get its equilibrium amount */
tqgetr("a", i, 0, &amount, &noerr);
/* Get its activity */
tqgetr("ac", i, 0, &act, &noerr);
printf("%-24s%14.5f%14.5f\n", name, amount, act);
}
}
int main()
{
LI noerr, numcon;
LI iSiC, iSiO2, iC;
DB vals[2];
char status[TQSTRLEN];
/* Initialise ChemApp */
tqini(&noerr);
/* Open data-file for reading */
tqopna("cosi.dat",10,&noerr);
/* Read data-file */
tqrfil(&noerr);
/* Close data-file */
tqclos(10,&noerr);
/* Get the phase index number of SiC */
tqinp("SiC", &iSiC, &noerr);
/* Get the status of this phase */
tqgsp(iSiC, status, &noerr);
printf("The status of SiC is currently %s\n", status);
Output:
The status of SiC is currently ENTERED |
/* Unless a phase is marked "dormant" or "eliminated" in the data-file
itself, the status is by default always "entered". This means it is
considered in the subsequent equilibrium calculations and is included
in the mass balance. */
/* Set some conditions and perform a simple calculation to
demonstrate the effect of the different statuses */
/* Set temperature to 1900 K */
tqsetc("T", 0, 0, 1900.0, &numcon, &noerr);
/* Set incoming amount to 1 mol SiO2(quartz) and 2 mol C */
tqinp("SiO2(quartz)", &iSiO2, &noerr);
tqsetc("ia", iSiO2, 0, 1.0, &numcon, &noerr);
tqinp("C", &iC, &noerr);
tqsetc("ia", iC, 0, 2.0, &numcon, &noerr);
/* Calculate the equilibrium */
tqce(" ", 0, 0, vals, &noerr);
/* Print a table containing the phase names, their
equilibrium amounts, and activities */
table();
Output:
Phase name amount/mol activity
GAS 1.39778 1.00000
C 0.00000 0.43860
Si 0.00000 0.07912
SiC 0.65059 1.00000
SiO2(quartz) 0.00000 0.90635
SiO2(tridymite) 0.00000 0.99918
SiO2(cristobalite) 0.30105 1.00000
SiO2(liquid) 0.00000 0.97125 |
/* From the above table it can be seen that SiC is stable
under those conditions. Its activity is unity and its
equilibrium amount is approx. 0.65 mol */
/* Now change the status of SiC to "dormant" and rerun the
calculation */
tqcsp(iSiC, "dormant", &noerr);
tqce(" ", 0, 0, vals, &noerr);
table();
Output:
Phase name amount/mol activity
GAS 0.00000 0.74210
C 2.00000 1.00000
Si 0.00000 1.00000
SiC 0.00000 28.81864
SiO2(quartz) 0.00000 0.90635
SiO2(tridymite) 0.00000 0.99918
SiO2(cristobalite) 1.00000 1.00000
SiO2(liquid) 0.00000 0.97125 |
/* Setting a phase to "dormant" tells ChemApp to exclude it from the
mass balance, but still calculate its activity. This offers the
possibility to consider a phase to be metastable, while still
obtaining information about its activity. It can be seen from
the above table that ChemApp sets the equilibrium amount of SiC
to zero, and calculated its activity to be almost 30. Instead of
SiC, ChemApp now calculates Si to be stable. */
/* If a phase is to be completely ignored during the equilibrium
calculations, its status should be set to "eliminated", as in the
following example. */
tqcsp(iSiC, "eliminated", &noerr);
tqce(" ", 0, 0, vals, &noerr);
table();
Output:
Phase name amount/mol activity
GAS 0.00000 0.74210
C 2.00000 1.00000
Si 0.00000 1.00000
SiC 0.00000 0.00000
SiO2(quartz) 0.00000 0.90635
SiO2(tridymite) 0.00000 0.99918
SiO2(cristobalite) 1.00000 1.00000
SiO2(liquid) 0.00000 0.97125 |
/* Now ChemApp ignored SiC during the equilibrium calculations, as
if it were not even included in the data-file. The status
"eliminated" allows one to selectively delete phases from
equilibrium calculations, for instance to increase computational
efficiency. */
return 0;
}