Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / utilities / thermophysical / equilibriumCO / equilibriumCO.C
blobb49d30368eae7e6877d0b5f0a4e4f62fa83d5cbc
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Application
26 Description
27     Calculates the equilibrium level of carbon monoxide
29 \*---------------------------------------------------------------------------*/
31 #include "argList.H"
32 #include "objectRegistry.H"
33 #include "foamTime.H"
34 #include "dictionary.H"
35 #include "IFstream.H"
36 #include "OSspecific.H"
37 #include "IOmanip.H"
39 #include "specieThermo.H"
40 #include "janafThermo.H"
41 #include "perfectGas.H"
42 #include "SLPtrList.H"
44 using namespace Foam;
46 typedef specieThermo<janafThermo<perfectGas> > thermo;
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Main program:
51 int main(int argc, char *argv[])
54 #   include "setRootCase.H"
56 #   include "createTime.H"
58     Info<< nl << "Reading Burcat data IOdictionary" << endl;
60     IOdictionary CpData
61     (
62         IOobject
63         (
64             "BurcatCpData",
65             runTime.constant(),
66             runTime,
67             IOobject::MUST_READ,
68             IOobject::NO_WRITE,
69             false
70         )
71     );
75     scalar T = 3000.0;
77     SLPtrList<thermo> EQreactions;
79     EQreactions.append
80     (
81         new thermo
82         (
83             thermo(CpData.lookup("CO2"))
84          ==
85             thermo(CpData.lookup("CO"))
86           + 0.5*thermo(CpData.lookup("O2"))
87         )
88     );
90     EQreactions.append
91     (
92         new thermo
93         (
94             thermo(CpData.lookup("O2"))
95          ==
96             2.0*thermo(CpData.lookup("O"))
97         )
98     );
100     EQreactions.append
101     (
102         new thermo
103         (
104             thermo(CpData.lookup("H2O"))
105          ==
106             thermo(CpData.lookup("H2"))
107           + 0.5*thermo(CpData.lookup("O2"))
108         )
109     );
111     EQreactions.append
112     (
113         new thermo
114         (
115             thermo(CpData.lookup("H2O"))
116          ==
117             thermo(CpData.lookup("H"))
118           + thermo(CpData.lookup("OH"))
119         )
120     );
123     for
124     (
125         SLPtrList<thermo>::iterator EQreactionsIter = EQreactions.begin();
126         EQreactionsIter != EQreactions.end();
127         ++EQreactionsIter
128     )
129     {
130         Info<< "Kc(EQreactions) = " << EQreactionsIter().Kc(T) << endl;
131     }
134     Info<< nl << "end" << endl;
136     return 0;
140 // ************************************************************************* //