BUGFIX: Illegal use of uninitialised value (backport)
[foam-extend-3.2.git] / applications / utilities / thermophysical / equilibriumCO / equilibriumCO.C
blob911eb8c61a22d8567826e3ee5220a6df4e83ffa4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Application
27 Description
28     Calculates the equilibrium level of carbon monoxide
30 \*---------------------------------------------------------------------------*/
32 #include "argList.H"
33 #include "objectRegistry.H"
34 #include "Time.H"
35 #include "dictionary.H"
36 #include "IFstream.H"
37 #include "OSspecific.H"
38 #include "IOmanip.H"
40 #include "specieThermo.H"
41 #include "janafThermo.H"
42 #include "perfectGas.H"
43 #include "SLPtrList.H"
45 using namespace Foam;
47 typedef specieThermo<janafThermo<perfectGas> > thermo;
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Main program:
52 int main(int argc, char *argv[])
55 #   include "setRootCase.H"
57 #   include "createTime.H"
59     Info<< nl << "Reading Burcat data IOdictionary" << endl;
61     IOdictionary CpData
62     (
63         IOobject
64         (
65             "BurcatCpData",
66             runTime.constant(),
67             runTime,
68             IOobject::MUST_READ,
69             IOobject::NO_WRITE,
70             false
71         )
72     );
76     scalar T = 3000.0;
78     SLPtrList<thermo> EQreactions;
80     EQreactions.append
81     (
82         new thermo
83         (
84             thermo(CpData.lookup("CO2"))
85          ==
86             thermo(CpData.lookup("CO"))
87           + 0.5*thermo(CpData.lookup("O2"))
88         )
89     );
91     EQreactions.append
92     (
93         new thermo
94         (
95             thermo(CpData.lookup("O2"))
96          ==
97             2.0*thermo(CpData.lookup("O"))
98         )
99     );
101     EQreactions.append
102     (
103         new thermo
104         (
105             thermo(CpData.lookup("H2O"))
106          ==
107             thermo(CpData.lookup("H2"))
108           + 0.5*thermo(CpData.lookup("O2"))
109         )
110     );
112     EQreactions.append
113     (
114         new thermo
115         (
116             thermo(CpData.lookup("H2O"))
117          ==
118             thermo(CpData.lookup("H"))
119           + thermo(CpData.lookup("OH"))
120         )
121     );
124     for
125     (
126         SLPtrList<thermo>::iterator EQreactionsIter = EQreactions.begin();
127         EQreactionsIter != EQreactions.end();
128         ++EQreactionsIter
129     )
130     {
131         Info<< "Kc(EQreactions) = " << EQreactionsIter().Kc(T) << endl;
132     }
135     Info<< nl << "end" << endl;
137     return 0;
141 // ************************************************************************* //