3.23: TQGSPC

TOCGroup 3TQCSPTQCSPCGroup 4A-ZGroup 3

GET-STATUS-OF-PHASE-CONSTITUENT

Use TQGSPC to get the status of a specified phase constituent.

Synopsis

FORTRAN: CALL TQGSPC(INDEXP,INDEXC,OPTION,NOERR)

C: tqgspc(indexp,indexc,option,&noerr);

Pascal: tqgspc(indexp,indexc,option,noerr);

Basic: Call tqgspc(indexp,indexc,option,noerr)


Name Type Value set on call or returned
INDEXP INTEGER Set to the index number for a phase
INDEXC INTEGER Set to the index number for a constituent
OPTION CHARACTER Returns a string as shown in Table 11
NOERR INTEGER Returns an error number

INDEXP and INDEXC are integer input and OPTION is character output identifying the status (see Table 11).

See also

TQCSPC, TQGSP, TQCSP

Examples

FORTRAN:View plain source code



C Changing the status of phase constituents
SUBROUTINE TABLE IMPLICIT NONE
INTEGER I, NOERR, NPCON DOUBLE PRECISION AMOUNT, FUG CHARACTER NAME*24, STATUS*24
C Retrieve and display the fugacities, equilibrium C amounts, and statuses of all phase constituents in the gas phase
C Get number of gas phase constituents CALL TQNOPC(1, NPCON, NOERR)
C Print table header WRITE(*,FMT='(A17,9X,A14,2X,A14,3X,A6)') * 'Phase const. name', * 'amount/mol', * 'fugacity', * 'status'
DO I=1, NPCON C Get the phase constituent name CALL TQGNPC(1, I, NAME, NOERR)
C Get its equilibrium amount CALL TQGETR('A ', 1, I, AMOUNT, NOERR)
C Get its fugacity CALL TQGETR('AC ', 1, I, FUG, NOERR)
C Get its status CALL TQGSPC(1, I, STATUS, NOERR) WRITE(*,FMT='(A24,2X,G14.5,2X,G14.5,2X,A10)') * NAME, AMOUNT, FUG, STATUS ENDDO RETURN END
PROGRAM CAF15 IMPLICIT NONE
INTEGER I, NOERR, NUMCON, NPCON INTEGER ISIO2, IC, ISI DOUBLE PRECISION VALS(2), STOI(3), WMASS
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 Unless a phase constituent is marked "dormant" or "eliminated" in the C data-file itself, the status is by default always "entered". This C means it is considered in the subsequent equilibrium calculation and C is included in the mass balances.
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 constituent names, their C equilibrium amounts, activities, and status CALL TABLE

Output:
Phase const. name             amount/mol        fugacity   status
C                            0.19355E-11     0.13847E-11  ENTERED   
C2                           0.42921E-13     0.30707E-13  ENTERED   
C3                           0.29728E-12     0.21268E-12  ENTERED   
CO                            1.3493         0.96531      ENTERED   
CO2                          0.12171E-03     0.87076E-04  ENTERED   
O                            0.21225E-10     0.15185E-10  ENTERED   
O2                           0.35711E-14     0.25548E-14  ENTERED   
O3                           0.60783E-29     0.43486E-29  ENTERED   
Si                           0.13427E-05     0.96060E-06  ENTERED   
Si2                          0.94642E-09     0.67709E-09  ENTERED   
Si2C                         0.23037E-07     0.16481E-07  ENTERED   
Si3                          0.16040E-10     0.11475E-10  ENTERED   
SiC                          0.74337E-11     0.53182E-11  ENTERED   
SiO                          0.48362E-01     0.34599E-01  ENTERED   
SiO2                         0.55877E-07     0.39975E-07  ENTERED

C To demonstrate the effect of assigning a different status to phase C constituents, set the status of all those phase constituents of the C gas phase to "dormant" which contain Si.
C Get number of gas phase constituents CALL TQNOPC(1, NPCON, NOERR)
C Get the index number of system component Si CALL TQINSC("Si", ISI, NOERR)
C Use TQSTPC to determine for each phase constituent whether it C contains Si, and set its status to "dormant" if it does DO I=1, NPCON CALL TQSTPC(1, I, STOI, WMASS, NOERR) IF (STOI(ISI) .GT. 0.D0) THEN CALL TQCSPC(1, I, 'DORMANT ', NOERR) ENDIF ENDDO
C Calculate the equilibrium and print the table again CALL TQCE(' ', 0, 0, VALS, NOERR) CALL TABLE

Output:
Phase const. name             amount/mol        fugacity   status
C                            0.18901E-11     0.14176E-11  ENTERED   
C2                           0.42909E-13     0.32183E-13  ENTERED   
C3                           0.30425E-12     0.22820E-12  ENTERED   
CO                            1.3332         0.99991      ENTERED   
CO2                          0.12168E-03     0.91262E-04  ENTERED   
O                            0.20485E-10     0.15364E-10  ENTERED   
O2                           0.34873E-14     0.26155E-14  ENTERED   
O3                           0.60057E-29     0.45044E-29  ENTERED   
Si                            0.0000         0.93832E-06  DORMANT   
Si2                           0.0000         0.64603E-09  DORMANT   
Si2C                          0.0000         0.16099E-07  DORMANT   
Si3                           0.0000         0.10695E-10  DORMANT   
SiC                           0.0000         0.53182E-11  DORMANT   
SiO                           0.0000         0.34195E-01  DORMANT   
SiO2                          0.0000         0.39975E-07  DORMANT

C As can be seen from the table above, all phase constituents of the gas C phase that contain Si have been set to "dormant". ChemApp considers C them in the activity calculation, but does not include them in the C mass balances: their equilibrium amount is always zero. Since this C forces ChemApp to keep the gas phase free of Si compounds, the 1 mol C of Si input into the system can thus only be found in the condensed C phases.
C Setting the status of these phase constituents to "eliminated" instead C would cause ChemApp to exclude them completely from the equilibrium C calculation.
END

C:View plain source code




/* Program cac15 */ /* Changing the status of phase constituents*/
#include "cacint.h"
void table() {
LI i, noerr, npcon; DB amount, fug; char name[TQSTRLEN], status[TQSTRLEN];
/* Retrieve and display the fugacities, equilibrium amounts, and statuses of all phase constituents in the gas phase */
/* Get number of phase constituents */ tqnopc(1, &npcon, &noerr);
/* Print table header */ printf("%-24s %-12s %-12s%s\n", "Phase const. name", "amount/mol", "fugacity", "status");
for(i = 1; i <= npcon; i++) {
/* Get the phase constituent name */ tqgnpc(1, i, name, &noerr);
/* Get its equilibrium amount */ tqgetr("a", 1, i, &amount, &noerr);
/* Get its fugacity */ tqgetr("ac", 1, i, &fug, &noerr);
/* Get its status */ tqgspc(1, i, status, &noerr);
printf("%-24s %10.5g %10.5g %-6s\n", name, amount, fug, status);
} }
int main() { LI i, noerr, numcon, npcon; LI iSiO2, iC, iSi; DB vals[2], stoi[3], wmass;
/* 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);
/* Unless a phase constituent 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 calculation and is included in the mass balances. */
/* 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 constituent names, their equilibrium amounts, activities, and status */ table();

Output:
Phase const. name         amount/mol    fugacity    status
C                         1.9355e-12  1.3847e-12   ENTERED
C2                        4.2921e-14  3.0707e-14   ENTERED
C3                        2.9728e-13  2.1268e-13   ENTERED
CO                            1.3493     0.96531   ENTERED
CO2                       0.00012171  8.7076e-05   ENTERED
O                         2.1225e-11  1.5185e-11   ENTERED
O2                        3.5711e-15  2.5548e-15   ENTERED
O3                        6.0783e-30  4.3486e-30   ENTERED
Si                        1.3427e-06   9.606e-07   ENTERED
Si2                       9.4642e-10  6.7709e-10   ENTERED
Si2C                      2.3037e-08  1.6481e-08   ENTERED
Si3                        1.604e-11  1.1475e-11   ENTERED
SiC                       7.4337e-12  5.3182e-12   ENTERED
SiO                         0.048362    0.034599   ENTERED
SiO2                      5.5877e-08  3.9975e-08   ENTERED


/* To demonstrate the effect of assigning a different status to phase constituents, set the status of all those phase constituents of the gas phase to "dormant" which contain Si. */
/* Get number of gas phase constituents */ tqnopc(1, &npcon, &noerr);
/* Get the index number of system component Si */ tqinsc("Si", &iSi, &noerr);
/* Use tqstpc to determine for each phase constituent whether it contains Si, and set its status to "dormant" if it does */ for (i = 1; i <= npcon; i++) { tqstpc(1, i, stoi, &wmass, &noerr); if (stoi[iSi-1] > 0.0) { tqcspc(1, i, "dormant", &noerr); } }
/* Calculate the equilibrium and print the table again */ tqce(" ", 0, 0, vals, &noerr); table();

Output:
Phase const. name         amount/mol    fugacity    status
C                         1.8901e-12  1.4176e-12   ENTERED
C2                        4.2909e-14  3.2183e-14   ENTERED
C3                        3.0425e-13   2.282e-13   ENTERED
CO                            1.3332     0.99991   ENTERED
CO2                       0.00012168  9.1262e-05   ENTERED
O                         2.0485e-11  1.5364e-11   ENTERED
O2                        3.4873e-15  2.6155e-15   ENTERED
O3                        6.0057e-30  4.5044e-30   ENTERED
Si                                 0  9.3832e-07   DORMANT
Si2                                0  6.4603e-10   DORMANT
Si2C                               0  1.6099e-08   DORMANT
Si3                                0  1.0695e-11   DORMANT
SiC                                0  5.3182e-12   DORMANT
SiO                                0    0.034195   DORMANT
SiO2                               0  3.9975e-08   DORMANT

/* As can be seen from the table above, all phase constituents of the gas phase that contain Si have been set to "dormant". ChemApp considers them in the activity calculation, but does not include them in the mass balances: their equilibrium amount is always zero. Since this forces ChemApp to keep the gas phase free of Si compounds, the 1 mol of Si input into the system can thus only be found in the condensed phases. */
/* Setting the status of these phase constituents to "eliminated" instead would cause ChemApp to exclude them completely from the equilibrium calculation. */
return 0;
}


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