3.13: TQPCIS

TOCGroup 2TQGNPCTQNOPCGroup 3A-ZGroup 2

CHECK-IF-PHASE-CONSTITUENT-IS-PERMITTED-AS-INCOMING-SPECIES

Use TQPCIS to check if a phase constituent is permitted as incoming species.

Added for ChemApp version 3.1.0

Synopsis

FORTRAN: CALL TQPCIS(INDEXP,INDEXC,INPCIS,NOERR)

C: tqpcis(indexp,indexc,&inpcis,&noerr);

Pascal: tqpcis(indexp,indexc,inpcis,noerr);

Basic: Call tqpcis(indexp,indexc,inpcis,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
INPCIS INTEGER Returns 1 if permitted, 0 if not
NOERR INTEGER Returns an error number

INDEXP and INDEXC are input. If the specified phase constituent can be used as an incoming species using TQSETC/TQSTCA, INPCIS returns 1, otherwise it returns 0.

Note that only for the sparsely used solution model SUBS (see Tables 2 and 9) can INPCIS take values equal to zero.

See also

TQNOPC, TQINPC, TQGNPC, TQSTPC, TQGDPC

Examples

FORTRAN:View plain source code



C Determining whether phase constituents are permitted as incoming C species
PROGRAM CAF25 IMPLICIT NONE
INTEGER NOERR, NPHASE, NPCON, I, J, INPCIS, NNPERM CHARACTER PNAME*24, PCNAME*24
C Initialise the number of phase constituents which cannot be used as C incoming species to 0 NNPERM = 0
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 Check whether the data-file contains any phase constituents that C cannot be used as incoming species.
C Get the number of phases CALL TQNOP(NPHASE, NOERR)
100 FORMAT(1X,A,T26,A,T51,A)
C Print a table header WRITE(*,FMT=100) 'PHASE', 'PHASE CONSTITUENT', * 'O.K./NOT PERMITTED'
C Loop over all phases DO I=1, NPHASE CALL TQGNP(I, PNAME, NOERR) CALL TQNOPC(I, NPCON, NOERR)
C We only need to check mixture phases IF (NPCON .GT. 1) THEN C Loop over all constituents DO J=1, NPCON CALL TQGNPC(I, J, PCNAME, NOERR) C Check whether the current constituent is permitted to be used as C incoming species CALL TQPCIS(I, J, INPCIS, NOERR)
C Print a table entry, and if it is not permitted, increase the total C number of such phase constituents by 1 IF (INPCIS .EQ. 0) THEN NNPERM = NNPERM + 1 WRITE(*,FMT=100) PNAME, PCNAME, 'not permitted' ELSE WRITE(*,FMT=100) PNAME, PCNAME, 'o.k.' ENDIF ENDDO ENDIF ENDDO
C If there were phase constituents which cannot be used as incoming C species, print a note. IF (NNPERM .GT. 0) THEN WRITE(*,FMT='(1X,A,I3,A)') 'Note: ', NNPERM, ' phase ' // * 'constituent(s) is/are not permitted ' WRITE(*,FMT='(1X,A)') ' as incoming species.' ENDIF

Output:
 PHASE                   PHASE CONSTITUENT        O.K./NOT PERMITTED
 GAS                     C                        o.k.
 GAS                     C2                       o.k.
 GAS                     C3                       o.k.
 GAS                     CO                       o.k.
 GAS                     CO2                      o.k.
 GAS                     O                        o.k.
 GAS                     O2                       o.k.
 GAS                     O3                       o.k.
 GAS                     Si                       o.k.
 GAS                     Si2                      o.k.
 GAS                     Si2C                     o.k.
 GAS                     Si3                      o.k.
 GAS                     SiC                      o.k.
 GAS                     SiO                      o.k.
 GAS                     SiO2                     o.k.

END

C:View plain source code




/* Program cac25 */ /* Determining whether phase constituents are permitted as incoming species */
#include "cacint.h"
int main() { LI noerr, nphase, npcon, i, j, inpcis, nnperm; char pname[TQSTRLEN], pcname[TQSTRLEN];
/* Initialise the number of phase constituents which cannot be used as incoming species to 0 */ nnperm = 0;
/* 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);
/* Check whether the data-file contains any phase constituents that cannot be used as incoming species. */
/* Get the number of phases */ tqnop(&nphase, &noerr);
/* Print a table header */ printf("%-25s%-25s%-19s\n", "PHASE", "PHASE CONSTITUENT", "O.K./NOT PERMITTED");
/* Loop over all phases */ for (i=1; i<=nphase; i++) { tqgnp(i, pname, &noerr); tqnopc(i, &npcon, &noerr);
/* We only need to check mixture phases */ if (npcon > 1) { /* Loop over all constituents */ for (j=1; j<=npcon; j++) { tqgnpc(i, j, pcname, &noerr); /* Check whether the current constituent is permitted to be used as incoming species */ tqpcis(i, j, &inpcis, &noerr);
/* Print a table entry, and if it is not permitted, increase the total number of such phase constituents by 1 */ if (inpcis == 0) { nnperm++; printf("%-25s%-25s%-19s\n", pname, pcname, "not permitted"); } else { printf("%-25s%-25s%-19s\n", pname, pcname, "o.k."); } } } }
/* If there were phase constituents which cannot be used as incoming species, print a note. */ if (nnperm > 0) { printf("Note: %li phase constituent(s) is/are not permitted\n" " as incoming species.\n", nnperm); }

Output:
PHASE                    PHASE CONSTITUENT        O.K./NOT PERMITTED 
GAS                      C                        o.k.               
GAS                      C2                       o.k.               
GAS                      C3                       o.k.               
GAS                      CO                       o.k.               
GAS                      CO2                      o.k.               
GAS                      O                        o.k.               
GAS                      O2                       o.k.               
GAS                      O3                       o.k.               
GAS                      Si                       o.k.               
GAS                      Si2                      o.k.               
GAS                      Si2C                     o.k.               
GAS                      Si3                      o.k.               
GAS                      SiC                      o.k.               
GAS                      SiO                      o.k.               
GAS                      SiO2                     o.k.

return 0;
}


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