SET-NAME-TEMPERATURE-PRESSURE-FOR-A-STREAM
Use TQSTTP to define a stream and set its temperature and pressure.
Synopsis
FORTRAN: CALL TQSTTP(IDENTS,VALS,NOERR)
C: tqsttp(idents,vals,&noerr)
;
Pascal: tqsttp(idents,vals,noerr)
;
Basic: Call tqsttp(idents,vals,noerr)
Name |
Type |
Value set on call or returned
|
IDENTS |
CHARACTER |
Set to a name for the stream
|
VALS |
Array of DOUBLE PRECISION |
Set to temperature and pressure for a stream
|
NOERR |
INTEGER |
Returns an error number
|
The input variable IDENTS can have a maximum length of 24
characters. VALS must be an array of 2 real values, containing the
temperature and pressure of the stream. These are entered with the
default unit, or a unit set using TQCSU (see Chapter
2).
A stream is a means for transferring non-reacted matter (see also the
notes in Appendix B.1) to a reaction zone. It has
constant temperature and pressure, and contains one or more phases of
fixed composition. (see also Chapter 1.6.1). Stream
input is required whenever differences in extensive properties between
the initial and the equilibrium state are desired; for example, in
calculations of the heat evolving from a combustion process, or of the
entropy change caused by a phase transition.
The maximum number of streams which are defined must not be greater
than the maximum number of constituents permitted in the ChemApp
version currently used (see TQSIZE, parameter 'NA').
See also
TQSTCA, TQSTEC, TQSTRM, TQSTXP
Examples
C Equilibrium calculations using streams
PROGRAM CAF17
IMPLICIT NONE
INTEGER NOERR, ISIO2, IO2, ICO2, I, NPHASE
DOUBLE PRECISION TPSOL(2), TPGAS(2), VALS(2), AMOUNT,
* VALUE
CHARACTER PNAME*24, SNAME*24
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 Two input streams will subsequently be defined: The first one,
C labelled 'STREAM_QUARTZ', will be solid SiO2(quartz) at 500 K, the
C second one, labelled 'STREAM_GAS', will consist of a gas phase at room
C temperature consisting of O2 and CO2. By using streams instead of
C global conditions we will be able to get information about the
C extensive property balance of this process.
C Define the first stream ('STREAM_QUARTZ')
C Use the array called TPSOL to pass the information on temperature and
C pressure (500 K and 1 bar) of the stream to TQSTTP
TPSOL(1) = 500.D0
TPSOL(2) = 1.D0
CALL TQSTTP('STREAM_QUARTZ ', TPSOL, NOERR)
C Define the amounts of constituents of this stream (1 mol quartz)
CALL TQINP('SiO2(quartz)', ISIO2, NOERR)
CALL TQSTCA('STREAM_QUARTZ ', ISIO2, 0, 1.D0, NOERR)
C Define second stream ('STREAM_GAS')
TPGAS(1) = 298.15D0
TPGAS(2) = 1.D0
CALL TQSTTP('STREAM_GAS ', TPGAS, NOERR)
C Define the amounts of constituents of this stream (0.5 mol O2/GAS/ and
C 0.5 mol CO2/GAS/)
CALL TQINPC('O2 ', 1, IO2, NOERR)
CALL TQSTCA('STREAM_GAS ', 1, IO2, 0.5D0, NOERR)
CALL TQINPC('CO2 ', 1, ICO2, NOERR)
CALL TQSTCA('STREAM_GAS ', 1, ICO2, 0.5D0, NOERR)
C Set the temperature at which the two streams should react
CALL TQSTEC('T ', 0, 2500.D0, NOERR)
C Define a third stream for the sole purpose of demonstrating how to
C remove it subsequently
CALL TQSTTP('DUMMY ', TPGAS, NOERR)
CALL TQSTCA('DUMMY ', 1, 1, 1.D0, NOERR)
C Display what we have set so far
CALL TQSHOW(NOERR)
Output:
T = 2500.00 K
P = 1.00000E+00 bar
STREAM NAME STREAM NUMBER TEMPERATURE/K PRESSURE/bar
STREAM_QUARTZ 1 500.00 1.0000E+00
STREAM_GAS 2 298.15 1.0000E+00
DUMMY 3 298.15 1.0000E+00
STREAM NUMBER STREAM CONSTITUENT
1 SiO2(quartz)
AMOUNT/mol = 1.00000E+00
2 O2/GAS/
AMOUNT/mol = 5.00000E-01
2 CO2/GAS/
AMOUNT/mol = 5.00000E-01
3 C/GAS/
AMOUNT/mol = 1.00000E+00 |
C Remove the 'DUMMY' stream
CALL TQSTRM('DUMMY ', NOERR)
C Call TQSHOW again to demonstrate that the last stream has been removed
CALL TQSHOW(NOERR)
Output:
T = 2500.00 K
P = 1.00000E+00 bar
STREAM NAME STREAM NUMBER TEMPERATURE/K PRESSURE/bar
STREAM_QUARTZ 1 500.00 1.0000E+00
STREAM_GAS 2 298.15 1.0000E+00
STREAM NUMBER STREAM CONSTITUENT
1 SiO2(quartz)
AMOUNT/mol = 1.00000E+00
2 O2/GAS/
AMOUNT/mol = 5.00000E-01
2 CO2/GAS/
AMOUNT/mol = 5.00000E-01 |
C Calculate the equilibrium
CALL TQCEL(' ', 0, 0, VALS, NOERR)
Output:
T = 2500.00 K
P = 1.00000E+00 bar
V = 2.11729E+02 dm3
STREAM CONSTITUENTS AMOUNT/mol TEMPERATURE/K PRESSURE/bar STREAM
SiO2(quartz) 1.0000E+00 500.00 1.0000E+00 1
O2/GAS/ 5.0000E-01 298.15 1.0000E+00 2
CO2/GAS/ 5.0000E-01 298.15 1.0000E+00 2
EQUIL AMOUNT MOLE FRACTION FUGACITY
PHASE: GAS mol bar
O2 5.0755E-01 4.9829E-01 4.9829E-01
CO2 4.7466E-01 4.6599E-01 4.6599E-01
CO 2.5340E-02 2.4877E-02 2.4877E-02
O 1.0519E-02 1.0327E-02 1.0327E-02
SiO 2.8827E-04 2.8300E-04 2.8300E-04
SiO2 2.3878E-04 2.3442E-04 2.3442E-04
O3 T 1.1157E-07 1.0954E-07 1.0954E-07
Si 2.7197E-12 2.6701E-12 2.6701E-12
C 8.5771E-16 8.4205E-16 8.4205E-16
Si2 4.6313E-23 4.5467E-23 4.5467E-23
SiC 1.0075E-23 9.8915E-24 9.8915E-24
C2 1.1127E-24 1.0924E-24 1.0924E-24
Si2C 4.9282E-30 4.8382E-30 4.8382E-30
C3 4.4137E-32 4.3332E-32 4.3332E-32
Si3 4.3927E-33 4.3125E-33 4.3125E-33
TOTAL: 1.0186E+00 1.0000E+00 1.0000E+00
mol ACTIVITY
SiO2(liquid) 9.9947E-01 1.0000E+00
SiO2(cristobalite) 0.0000E+00 8.9012E-01
SiO2(tridymite) T 0.0000E+00 8.5795E-01
SiO2(quartz) T 0.0000E+00 7.4840E-01
C 0.0000E+00 5.0218E-09
Si 0.0000E+00 5.7669E-10
SiC 0.0000E+00 1.3051E-17
********************************************************************
DELTA_Cp DELTA_H DELTA_S DELTA_G DELTA_V
J.K-1 J J.K-1 J dm3
********************************************************************
9.48537E+01 2.72660E+05 2.18581E+02 -8.84766E+05 1.86939E+02
Mole fraction of system components:
GAS
C 1.9987E-01
O 7.9992E-01
Si 2.1068E-04
Data on 3 constituents marked with 'T' are extrapolated outside their valid
temperature range |
50 FORMAT(1X,A,G12.5,A)
C Get the enthalpies of the two streams (note that as of version 3.2.0
C of ChemApp, TQSTXP can also be called _before_ the equilibrium
C calculation)
SNAME = 'STREAM_QUARTZ'
CALL TQSTXP(SNAME, 'H ', VALUE, NOERR)
WRITE(*,FMT=50) 'Enthalpy of stream '// SNAME // ': ',
* VALUE, ' J'
SNAME = 'STREAM_GAS'
CALL TQSTXP(SNAME, 'H ', VALUE, NOERR)
WRITE(*,FMT=50) 'Enthalpy of stream '// SNAME // ': ',
* VALUE, ' J'
Output:
Enthalpy of stream STREAM_QUARTZ : -0.90000E+06 J
Enthalpy of stream STREAM_GAS : -0.19675E+06 J |
C Get the list of stable phases
WRITE(*,FMT='(A)') ' List of stable phases:'
CALL TQNOP(NPHASE, NOERR)
DO I=1, NPHASE
CALL TQGETR('A ', I, 0, AMOUNT, NOERR)
IF (AMOUNT .GT. 0) THEN
CALL TQGNP(I, PNAME, NOERR)
WRITE(*,FMT=50) 'Phase: ' // PNAME //
* 'amount: ', AMOUNT, ' mol'
ENDIF
ENDDO
Output:
List of stable phases:
Phase: GAS amount: 1.0186 mol
Phase: SiO2(liquid) amount: 0.99947 mol |
C Get the changes in the extensive property values in the current units
WRITE(*,'(A)') ' Changes in extensive properties:'
CALL TQGETR('CP ', 0, 0, VALUE, NOERR)
WRITE(*,FMT=50) 'Delta CP: ', VALUE, ' J/K'
CALL TQGETR('H ', 0, 0, VALUE, NOERR)
WRITE(*,FMT=50) 'Delta H: ', VALUE, ' J'
CALL TQGETR('S ', 0, 0, VALUE, NOERR)
WRITE(*,FMT=50) 'Delta S: ', VALUE, ' J/K'
CALL TQGETR('G ', 0, 0, VALUE, NOERR)
WRITE(*,FMT=50) 'Delta G: ', VALUE, ' J'
CALL TQGETR('V ', 0, 0, VALUE, NOERR)
WRITE(*,FMT=50) 'Delta V: ', VALUE, ' dm^3'
Output:
Changes in extensive properties:
Delta CP: 94.854 J/K
Delta H: 0.27266E+06 J
Delta S: 218.58 J/K
Delta G: -0.88477E+06 J
Delta V: 186.94 dm^3 |
C To retrieve the *total* volume, use the option 'VT'
CALL TQGETR('VT ', 0, 0, VALUE, NOERR)
WRITE(*,FMT=50) 'Total volume: ', VALUE, ' dm^3'
Output:
Total volume: 211.73 dm^3 |
END
/* Program cac17 */
/* Equilibrium calculations using streams */
#include "cacint.h"
int main()
{
LI noerr, iSiO2, iO2, iCO2, i, nphase;
DB TP_sol[2], TP_gas[2], vals[2], amount, value;
char pname[TQSTRLEN], sname[TQSTRLEN];
/* 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);
/* Two input streams will subsequently be defined: The first one,
labelled "STREAM_QUARTZ", will be solid SiO2(quartz) at 500 K,
the second one, labelled "STREAM_GAS", will consist of a gas
phase at room temperature consisting of O2 and CO2. By using
streams instead of global conditions we will be able to get
information about the extensive property balance of this
process. */
/* Define the first stream ("STREAM_QUARTZ") */
/* Use the array called TP_sol to pass the information on temperature and
pressure (500 K and 1 bar) of the stream to tqsttp */
TP_sol[0] = 500.0;
TP_sol[1] = 1.0;
tqsttp("STREAM_QUARTZ", TP_sol, &noerr);
/* Define the amounts of constituents of this stream
(1 mol quartz)*/
tqinp("SiO2(quartz)", &iSiO2, &noerr);
tqstca("STREAM_QUARTZ", iSiO2, 0, 1.0, &noerr);
/* Define second stream ("STREAM_GAS") */
TP_gas[0] = 298.15;
TP_gas[1] = 1.0;
tqsttp("STREAM_GAS", TP_gas, &noerr);
/* Define the amounts of constituents of this stream (0.5 mol O2/GAS/ and
0.5 mol CO2/GAS/) */
tqinpc("O2", 1, &iO2, &noerr);
tqstca("STREAM_GAS", 1, iO2, 0.5, &noerr);
tqinpc("CO2", 1, &iCO2, &noerr);
tqstca("STREAM_GAS", 1, iCO2, 0.5, &noerr);
/* Set the temperature at which the two streams should react */
tqstec("T", 0, 2500.0, &noerr);
/* Define a third stream for the sole purpose of demonstrating how
to remove it subsequently */
tqsttp("DUMMY", TP_gas, &noerr);
tqstca("DUMMY", 1, 1, 1.0, &noerr);
/* Display what we have set so far */
tqshow(&noerr);
Output:
T = 2500.00 K
P = 1.00000E+00 bar
STREAM NAME STREAM NUMBER TEMPERATURE/K PRESSURE/bar
STREAM_QUARTZ 1 500.00 1.0000E+00
STREAM_GAS 2 298.15 1.0000E+00
DUMMY 3 298.15 1.0000E+00
STREAM NUMBER STREAM CONSTITUENT
1 SiO2(quartz)
AMOUNT/mol = 1.00000E+00
2 O2/GAS/
AMOUNT/mol = 5.00000E-01
2 CO2/GAS/
AMOUNT/mol = 5.00000E-01
3 C/GAS/
AMOUNT/mol = 1.00000E+00 |
/* Remove the "DUMMY" stream */
tqstrm("DUMMY", &noerr);
/* Call tqshow again to demonstrate that the last stream has been removed */
tqshow(&noerr) ;
Output:
T = 2500.00 K
P = 1.00000E+00 bar
STREAM NAME STREAM NUMBER TEMPERATURE/K PRESSURE/bar
STREAM_QUARTZ 1 500.00 1.0000E+00
STREAM_GAS 2 298.15 1.0000E+00
STREAM NUMBER STREAM CONSTITUENT
1 SiO2(quartz)
AMOUNT/mol = 1.00000E+00
2 O2/GAS/
AMOUNT/mol = 5.00000E-01
2 CO2/GAS/
AMOUNT/mol = 5.00000E-01 |
/* Calculate the equilibrium */
tqcel(" ", 0, 0, vals, &noerr);
/* Get the enthalpies of the two streams (note that as of version
3.2.0 of ChemApp, TQSTXP can also be called _before_ the
equilibrium calculation) */
strcpy(sname,"STREAM_QUARTZ");
tqstxp(sname, "H", &value, &noerr);
printf("Enthalpy of stream %-24s: %g J\n", sname, value);
strcpy(sname,"STREAM_GAS");
tqstxp(sname, "H", &value, &noerr);
printf("Enthalpy of stream %-24s: %g J\n", sname, value);
Output:
T = 2500.00 K
P = 1.00000E+00 bar
V = 2.11729E+02 dm3
STREAM CONSTITUENTS AMOUNT/mol TEMPERATURE/K PRESSURE/bar STREAM
SiO2(quartz) 1.0000E+00 500.00 1.0000E+00 1
O2/GAS/ 5.0000E-01 298.15 1.0000E+00 2
CO2/GAS/ 5.0000E-01 298.15 1.0000E+00 2
EQUIL AMOUNT MOLE FRACTION FUGACITY
PHASE: GAS mol bar
O2 5.0755E-01 4.9829E-01 4.9829E-01
CO2 4.7466E-01 4.6599E-01 4.6599E-01
CO 2.5340E-02 2.4877E-02 2.4877E-02
O 1.0519E-02 1.0327E-02 1.0327E-02
SiO 2.8827E-04 2.8300E-04 2.8300E-04
SiO2 2.3878E-04 2.3442E-04 2.3442E-04
O3 T 1.1157E-07 1.0954E-07 1.0954E-07
Si 2.7197E-12 2.6701E-12 2.6701E-12
C 8.5771E-16 8.4205E-16 8.4205E-16
Si2 4.6313E-23 4.5467E-23 4.5467E-23
SiC 1.0075E-23 9.8915E-24 9.8915E-24
C2 1.1127E-24 1.0924E-24 1.0924E-24
Si2C 4.9282E-30 4.8382E-30 4.8382E-30
C3 4.4137E-32 4.3332E-32 4.3332E-32
Si3 4.3927E-33 4.3125E-33 4.3125E-33
TOTAL: 1.0186E+00 1.0000E+00 1.0000E+00
mol ACTIVITY
SiO2(liquid) 9.9947E-01 1.0000E+00
SiO2(cristobalite) 0.0000E+00 8.9012E-01
SiO2(tridymite) T 0.0000E+00 8.5795E-01
SiO2(quartz) T 0.0000E+00 7.4840E-01
C 0.0000E+00 5.0218E-09
Si 0.0000E+00 5.7669E-10
SiC 0.0000E+00 1.3051E-17
********************************************************************
DELTA_Cp DELTA_H DELTA_S DELTA_G DELTA_V
J.K-1 J J.K-1 J dm3
********************************************************************
9.48537E+01 2.72660E+05 2.18581E+02 -8.84766E+05 1.86939E+02
Mole fraction of system components:
GAS
C 1.9987E-01
O 7.9992E-01
Si 2.1068E-04
Data on 3 constituents marked with 'T' are extrapolated outside their valid
temperature range
Enthalpy of stream STREAM_QUARTZ : -899999 J
Enthalpy of stream STREAM_GAS : -196752 J |
/* Get the list of stable phases */
printf("List of stable phases:\n");
tqnop(&nphase, &noerr);
for (i = 1; i <= nphase; i++) {
tqgetr("A", i, 0, &amount, &noerr);
if (amount > 0.0) {
tqgnp(i, pname, &noerr);
printf("Phase: %-24s amount: %g mol\n", pname, amount);
}
}
Output:
List of stable phases:
Phase: GAS amount: 1.0186 mol
Phase: SiO2(liquid) amount: 0.999473 mol |
/* Get the changes in the extensive property values in the current units */
printf("Changes in extensive properties:\n");
tqgetr("CP", 0, 0, &value, &noerr);
printf("Delta CP: %g J/K\n", value);
tqgetr("H", 0, 0, &value, &noerr);
printf("Delta H : %g J\n", value);
tqgetr("S", 0, 0, &value, &noerr);
printf("Delta S : %g J/K\n", value);
tqgetr("G", 0, 0, &value, &noerr);
printf("Delta G : %g J\n", value);
tqgetr("V", 0, 0, &value, &noerr);
printf("Delta V : %g dm^3\n", value);
Output:
Changes in extensive properties:
Delta CP: 94.8537 J/K
Delta H : 272660 J
Delta S : 218.581 J/K
Delta G : -884766 J
Delta V : 186.939 dm^3 |
/* To retrieve the *total* volume, use the option "VT" */
tqgetr("VT", 0, 0, &value, &noerr);
printf("Total volume: %g dm^3\n", value);
Output:
Total volume: 211.729 dm^3 |
return 0;
}