5.12: TQGTLC | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
TOC | Group 5 | TQSTXP | TQERR | Group 1 | A-Z | Group 5 |
Use TQGTLC to get the calculated equilibrium sublattice site fraction.
Added for ChemApp version 3.3.1
FORTRAN: CALL TQGTLC(INDEXP,INDEXL,INDEXC,VAL,NOERR)
C: tqgtlc(indexp,indexl,indexc,&val,&noerr)
;
Pascal: tqgtlc(indexp,indexl,indexc,val,noerr)
;
Basic: Call tqgtlc(indexp,indexl,indexc,val,noerr)
Name | Type | Value set on call or returned |
INDEXP | INTEGER | Set to the index number for a phase |
INDEXL | INTEGER | Set to the index number for a sublattice |
INDEXC | INTEGER | Set to the index number for a sublattice constituent |
VAL | DOUBLE PRECISION | Returns the value of the calculated sublattice site fraction |
NOERR | INTEGER | Returns an error number |
The input variables have to be set to index numbers which identify a sublattice constituent (INDEXC) of a sublattice (INDEXL) of a phase (INDEXP). The output variable VAL contains the calculated sublattice site fraction of the sublattice constituent with respect to the last equilibrium calculation.
All solution phases are considered to be modelled with one or several sublattices. For one-sublattice models, the mole and site fractions are equal.
TQINLC, TQGNLC, TQNOSL, TQNOLC
FORTRAN: | View plain source code |
C Retrieving results for sublattice constituents
PROGRAM CAF27 IMPLICIT NONE
INTEGER NOERR, ISLITE, NUMCON, I, INDEXP, INDEXL, * INDEXC, NPHASE, NSL, NSLCON DOUBLE PRECISION VAL, VALS(2), RESULT CHARACTER PNAME*24, MNAME*24, CNAME*24
C Initialise ChemApp CALL TQINI(NOERR)
C Open the thermochemical data-file subl-ex.dat for reading. It contains C an extract of the system Co-Cr-Fe: the phase SIGMA:30, which is C modelled according to the sublattice formalism, and the BCC phase, C described by a Redlich-Kister polynomial. Both phases are each C included twice, to account for miscibility gaps. CALL TQOPNA('subl-ex.dat', 10, NOERR)
C Read data-file CALL TQRFIL(NOERR)
C Close data-file CALL TQCLOS(10, NOERR)
C Set the temperature to 1000 K CALL TQSETC('T ', 0, 0, 1000.D0, NUMCON, NOERR)
C Set the incoming amounts to 0.25 mol Co, 0.25 mol Cr, and 0.5 mol Fe CALL TQINSC('Co ', INDEXC, NOERR) CALL TQSETC('IA ', 0, INDEXC, 0.25D0, NUMCON, NOERR)
CALL TQINSC('Cr ', INDEXC, NOERR) CALL TQSETC('IA ', 0, INDEXC, 0.25D0, NUMCON, NOERR)
CALL TQINSC('Fe ', INDEXC, NOERR) CALL TQSETC('IA ', 0, INDEXC, 0.50D0, NUMCON, NOERR)
C Calculate the equilibrium CALL TQCEL(' ', 0, 0, VALS, NOERR)
Output:
T = 1000.00 K P = 1.00000E+00 bar V = 0.00000E+00 dm3 |
C As can be seen in the output above, the standard ChemSage result table C obtained with TQCEL contains a section with details on the stable C sublattice phases. The following code shows how to retrieve similar C information with ChemApp.
C Loop over all phases, and if a phase is stable and a sublattice phase, C print information about the sublattices CALL TQNOP(NPHASE, NOERR) DO INDEXP=1, NPHASE
C Check if the phase is stable, otherwise we don't need to consider it CALL TQGETR('A ', INDEXP, 0, VAL, NOERR) IF (VAL .GT. 0.D0) THEN
C Get the name and model of the phase CALL TQGNP(INDEXP, PNAME, NOERR) CALL TQMODL(INDEXP, MNAME, NOERR)
C If the model name of the phase starts with 'SUB' we have a sublattice C phase IF (INDEX(MNAME,'SUB') .GT. 0) then
C Print a header similar to the one in the ChemSage output table WRITE(*,*) 'Mole fraction of the sublattice ' // * 'constituents in ', PNAME
C Get the number of sublattices CALL TQNOSL(INDEXP, NSL, NOERR)
C Loop over all sublattices DO INDEXL=1, NSL
write(*,*) 'Sublattice ',INDEXL,' :' C Get the number of sublattice constituents CALL TQNOLC(INDEXP, INDEXL, NSLCON, NOERR)
DO INDEXC=1, NSLCON C Get the name of each sublattice constituent... CALL TQGNLC(INDEXP, INDEXL, INDEXC, CNAME, NOERR)
C ... and its mole fraction in the sublattice CALL TQGTLC(INDEXP, INDEXL, INDEXC, VAL, NOERR)
WRITE(*,*) CNAME, VAL
ENDDO ENDDO ENDIF ENDIF ENDDO
Output:
Mole fraction of the sublattice constituents in SIGMA:30#1 Sublattice 1 : Co 0.542377368 Fe 0.457622632 Sublattice 2 : Cr 1. Sublattice 3 : Co 0.109259364 Cr 0.691919882 Fe 0.198820755 |
END
C: | View plain source code |
/* Program cac27 */ /* Retrieving results for sublattice constituents */
#include "cacint.h"
int main() {
LI noerr, islite, numcon, i, indexp, indexl, indexc, nphase, nsl, nslcon; DB val, vals[2], result; char pname[TQSTRLEN], mname[TQSTRLEN], cname[TQSTRLEN];
/* Initialise ChemApp */ tqini(&noerr);
/* Open the thermochemical data-file subl-ex.dat for reading. It contains an extract of the system Co-Cr-Fe: the phase SIGMA:30, which is modelled according to the sublattice formalism, and the BCC phase, described by a Redlich-Kister polynomial. Both phases are each included twice, to account for miscibility gaps. */ tqopna("subl-ex.dat",10,&noerr);
/* Read data-file */ tqrfil(&noerr);
/* Close data-file */ tqclos(10, &noerr);
/* Set the temperature to 1000 K */ tqsetc("T", 0, 0, 1000.0, &numcon, &noerr);
/* Set the incoming amounts to 0.25 mol Co, 0.25 mol Cr, and 0.5 mol Fe */ tqinsc("Co", &indexc, &noerr); tqsetc("ia", 0, indexc, 0.25, &numcon, &noerr);
tqinsc("Cr", &indexc, &noerr); tqsetc("ia", 0, indexc, 0.25, &numcon, &noerr);
tqinsc("Fe", &indexc, &noerr); tqsetc("ia", 0, indexc, 0.50, &numcon, &noerr);
/* Calculate the equilibrium */ tqcel(" ", 0, 0, vals, &noerr);
Output:
T = 1000.00 K P = 1.00000E+00 bar V = 0.00000E+00 dm3 |
/* As can be seen in the output above, the standard ChemSage result table obtained with TQCEL contains a section with details on the stable sublattice phases. The following code shows how to retrieve similar information with ChemApp. */
/* Loop over all phases, and if a phase is stable and a sublattice phase, print information about the sublattices */ tqnop(&nphase, &noerr); for (indexp = 1; indexp<=nphase; indexp++) {
/* Check if the phase is stable, otherwise we don't need to consider it */ tqgetr("a", indexp, 0, &val, &noerr); if (val > 0) {
/* Get the name and model of the phase */ tqgnp(indexp, pname, &noerr); tqmodl(indexp, mname, &noerr);
/* If the model name of the phase starts with 'SUB' we have a sublattice phase */ if (strncmp(mname, "SUB", 3) == 0) {
/* Print a header similar to the one in the ChemSage output table */ printf("Mole fraction of the sublattice constituents in %s\n", pname);
/* Get the number of sublattices */ tqnosl(indexp, &nsl, &noerr);
/* Loop over all sublattices */ for (indexl=1; indexl<=nsl; indexl++) {
printf("Sublattice %li\n", indexl); /* Get the number of sublattice constituents */ tqnolc(indexp, indexl, &nslcon, &noerr);
for (indexc=1; indexc<=nslcon; indexc++) { /* Get the name of each sublattice constituent... */ tqgnlc(indexp, indexl, indexc, cname, &noerr);
/* ... and its mole fraction in the sublattice */ tqgtlc(indexp, indexl, indexc, &val, &noerr);
printf("%-25s %f\n", cname, val); } } } } }
Output:
Mole fraction of the sublattice constituents in SIGMA:30#1 Sublattice 1 Co 0.542377 Fe 0.457623 Sublattice 2 Cr 1.000000 Sublattice 3 Co 0.109259 Cr 0.691920 Fe 0.198821 |
return 0;
}
ChemApp Programmer's Manual, Edition 3.6 | © GTT-Technologies, 2003 |