3.7: TQINP

TOCGroup 2TQCSCTQGNPGroup 3A-ZGroup 2

GET-INDEX-NUMBER-OF-PHASE

Use TQINP to get the index number for a specified phase.

Synopsis

FORTRAN: CALL TQINP(NAME,INDEXP,NOERR)

C: tqinp(name,&indexp,&noerr);

Pascal: tqinp(name,indexp,noerr);

Basic: Call tqinp(name,indexp,noerr)


Name Type Value set on call or returned
NAME CHARACTER Set to a phase name
INDEXP INTEGER Returns the index number for the phase
NOERR INTEGER Returns an error number

The input variable NAME cannot exceed 24 characters in length. For a mixture phase that might de-mix and is included twice in the data-file, '#1' and '#2' are automatically added to its name. The value of INDEXP returned is normally used as input to other ChemApp subroutines. The index number of a phase remains the same throughout an application.

See also

TQNOP, TQGNP, TQMODL

Examples

FORTRAN:View plain source code



C Handling phases
PROGRAM CAF12 IMPLICIT NONE
INTEGER NOERR, NPHASE, I CHARACTER PNAME*24, MNAME*24
C Initialise ChemApp CALL TQINI(NOERR)
C Open the thermochemical data-file cosi.dat (system C-O-Si) C 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 number of phases CALL TQNOP(NPHASE, NOERR)
WRITE(*,FMT='(A,I3)') 'Number of phases in file cosi.dat: ', * NPHASE

Output:
Number of phases in file cosi.dat:   8

C Print the names and models of all phases WRITE(*,FMT='(A)') * 'No. Name of phase Model'
DO I=1, NPHASE CALL TQGNP(I, PNAME, NOERR) CALL TQMODL(I, MNAME, NOERR) WRITE(*,FMT='(I3,A30,A6)') I, PNAME, MNAME ENDDO

Output:
No.      Name of phase           Model
  1      GAS                     IDMX  
  2      C                       PURE  
  3      Si                      PURE  
  4      SiC                     PURE  
  5      SiO2(quartz)            PURE  
  6      SiO2(tridymite)         PURE  
  7      SiO2(cristobalite)      PURE  
  8      SiO2(liquid)            PURE

C Get the index number of a phase CALL TQINP('SiC ', I, NOERR) WRITE(*,FMT='(A,I2,A)') 'SiC is phase no. ', I, * ' in file cosi.dat'

Output:
SiC is phase no.  4 in file cosi.dat

END

C:View plain source code




/* Program cac12 */ /* Handling phases */
#include "cacint.h"
int main() { LI noerr, nphase, i; char pname[TQSTRLEN], mname[TQSTRLEN];

/* Initialise ChemApp */ tqini(&noerr);
/* Open the thermochemical data-file cosi.dat (system C-O-Si) for reading */ tqopna("cosi.dat",10,&noerr);
/* Read data-file */ tqrfil(&noerr);
/* Close data-file */ tqclos(10,&noerr);
/* Get the number of phases */ tqnop(&nphase, &noerr);
printf("Number of phases in file cosi.dat: %li\n", nphase);

Output:
Number of phases in file cosi.dat: 8

/* Print the names and models of all phases */ printf("No. Name of phase Model\n");
for (i = 1; i <= nphase; i++) { tqgnp(i, pname, &noerr); tqmodl(i, mname, &noerr); printf("%3li %-24s %-6s\n", i, pname, mname); }

Output:
No.  Name of phase            Model
  1  GAS                      IDMX  
  2  C                        PURE  
  3  Si                       PURE  
  4  SiC                      PURE  
  5  SiO2(quartz)             PURE  
  6  SiO2(tridymite)          PURE  
  7  SiO2(cristobalite)       PURE  
  8  SiO2(liquid)             PURE

/* Get the index number of a phase */ tqinp("SiC", &i, &noerr); printf("SiC is phase no. %li in file cosi.dat\n", i);

Output:
SiC is phase no. 4 in file cosi.dat

return 0;
}


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