3.11: TQINPC | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
TOC | Group 2 | TQNOP | TQGNPC | Group 3 | A-Z | Group 2 |
Use TQINPC to get the index number for a specified phase constituent.
FORTRAN: CALL TQINPC(NAME,INDEXP,INDEXC,NOERR)
C: tqinpc(name,indexp,&indexc,&noerr)
;
Pascal: tqinpc(name,indexp,indexc,noerr)
;
Basic: Call tqinpc(name,indexp,indexc,noerr)
Name | Type | Value set on call or returned |
NAME | CHARACTER | Set to a phase constituent name |
INDEXP | INTEGER | Set to the index number for a phase |
INDEXC | INTEGER | Returns the index number for the constituent |
NOERR | INTEGER | Returns an error number |
NAME and INDEXP are input. NAME cannot exceed 24 characters in length. The value of INDEXC returned is normally used as input to other subroutines of the interface. The number remains the same throughout the application.
TQNOPC, TQGNPC, TQSTPC, TQPCIS, TQGDPC
FORTRAN: | View plain source code |
C Handling phase constituents
PROGRAM CAF13 IMPLICIT NONE
INTEGER NOERR, NPCON, NSCOM, I CHARACTER PCNAME*24, SCNAME(3)*24 DOUBLE PRECISION WMASS, STOI(3)
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 phase constituents of the first phase in C cosi.dat, which is the gaseous mixture phase CALL TQNOPC(1, NPCON, NOERR)
WRITE(*,FMT='(A,I3)') 'Number of phase constituents of ' // * 'the gas phase in cosi.dat: ', NPCON
Output:
Number of phase constituents of the gas phase in cosi.dat: 15 |
C Print the names of all phase constituents of the gas phase, C their stoichiometry in terms of the system components, C and their molecular mass
C Get names of the system components CALL TQNOSC(NSCOM, NOERR) DO I=1, NSCOM CALL TQGNSC(I, SCNAME(I), NOERR) ENDDO
C Print header WRITE(*,FMT='(A)') ' ' // * 'Stoichiometry Mol. mass' WRITE(*,FMT='(A)') 'No. Name of phase const. ' // * SCNAME(1)(1:6) // * SCNAME(2)(1:6) // * SCNAME(3)(1:6) // * ' g/mol'
C Set amount unit to gram, so we get the molecular mass in g/mol CALL TQCSU('Amount ', 'gram ', NOERR)
C Get the information on all phase constituents of C the gas phase DO I=1, NPCON CALL TQGNPC(1, I, PCNAME, NOERR) CALL TQSTPC(1, I, STOI, WMASS, NOERR) WRITE(*,FMT='(I3,A26,3F6.1,2X,G12.5)') * I, PCNAME, STOI(1), STOI(2), STOI(3), * WMASS ENDDO
Output:
Stoichiometry Mol. mass No. Name of phase const. C O Si g/mol 1 C 1.0 0.0 0.0 12.011 2 C2 2.0 0.0 0.0 24.022 3 C3 3.0 0.0 0.0 36.033 4 CO 1.0 1.0 0.0 28.010 5 CO2 1.0 2.0 0.0 44.010 6 O 0.0 1.0 0.0 15.999 7 O2 0.0 2.0 0.0 31.999 8 O3 0.0 3.0 0.0 47.998 9 Si 0.0 0.0 1.0 28.086 10 Si2 0.0 0.0 2.0 56.172 11 Si2C 1.0 0.0 2.0 68.183 12 Si3 0.0 0.0 3.0 84.258 13 SiC 1.0 0.0 1.0 40.097 14 SiO 0.0 1.0 1.0 44.085 15 SiO2 0.0 2.0 1.0 60.085 |
C Get the index number of a phase constituent, C in this case, CO2 in the gas phase CALL TQINPC('CO2 ', 1, I, NOERR) WRITE(*,FMT='(A,I2,A)') 'CO2 is phase constituent no. ',I, * ' in the gas phase in file cosi.dat'
Output:
CO2 is phase constituent no. 5 in the gas phase in file cosi.dat |
END
C: | View plain source code |
/* Program cac13 */ /* Handling phase constituents*/
#include "cacint.h"
int main() { LI noerr, npcon, nscom, i; char pcname[TQSTRLEN], scname[3][TQSTRLEN]; DB wmass, stoi[3];
/* 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 phase constituents of the first phase in cosi.dat, which is the gaseous mixture phase */ tqnopc(1, &npcon, &noerr);
printf("Number of phase constituents of " "the gas phase in cosi.dat: %li\n", npcon);
Output:
Number of phase constituents of the gas phase in cosi.dat: 15 |
/* Print the names of all phase constituents of the gas phase, their stoichiometry in terms of the system components, and their molecular masses */
/* Get names of the system components */ tqnosc(&nscom, &noerr); for (i = 1; i <= nscom; i++) { tqgnsc(i, scname[i-1], &noerr); }
/* Print header */ printf(" " "Stoichiometry Mol. mass\n"); printf("No. Name of phase const. %6s%6s%6s g/mol\n", scname[0],scname[1],scname[2]);
/* Set amount unit to gram, so we get the molecular mass in g/mol */ tqcsu("Amount", "gram", &noerr);
/* Get the information on all phase constituents of the gas phase */ for (i = 1; i <= npcon; i++) { tqgnpc(1, i, pcname, &noerr); tqstpc(1, i, stoi, &wmass, &noerr); printf("%3li %-26s%6.1f%6.1f%6.1f %g\n", i, pcname, stoi[0], stoi[1], stoi[2], wmass); }
Output:
Stoichiometry Mol. mass No. Name of phase const. C O Si g/mol 1 C 1.0 0.0 0.0 12.011 2 C2 2.0 0.0 0.0 24.022 3 C3 3.0 0.0 0.0 36.033 4 CO 1.0 1.0 0.0 28.0104 5 CO2 1.0 2.0 0.0 44.0098 6 O 0.0 1.0 0.0 15.9994 7 O2 0.0 2.0 0.0 31.9988 8 O3 0.0 3.0 0.0 47.9982 9 Si 0.0 0.0 1.0 28.086 10 Si2 0.0 0.0 2.0 56.172 11 Si2C 1.0 0.0 2.0 68.183 12 Si3 0.0 0.0 3.0 84.258 13 SiC 1.0 0.0 1.0 40.097 14 SiO 0.0 1.0 1.0 44.0854 15 SiO2 0.0 2.0 1.0 60.0848 |
/* Get the index number of a phase constituent, in this case, CO2 in the gas phase */ tqinpc("CO2", 1, &i, &noerr); printf("CO2 is phase constituent no. %li " "in the gas phase in file cosi.dat\n", i);
Output:
CO2 is phase constituent no. 5 in the gas phase in file cosi.dat |
return 0;
}
ChemApp Programmer's Manual, Edition 3.6 | © GTT-Technologies, 2003 |