FreeFOAM The Cross-Platform CFD Toolkit
equilibriumCO.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Application
25  equilibriumCO
26  freefoam-equilibriumCO
27 
28 Description
29  Calculates the equilibrium level of carbon monoxide
30 
31 Usage
32 
33  - equilibriumCO [OPTIONS]
34 
35  @param -case <dir>\n
36  Case directory.
37 
38  @param -parallel \n
39  Run in parallel.
40 
41  @param -help \n
42  Display help message.
43 
44  @param -doc \n
45  Display Doxygen API documentation page for this application.
46 
47  @param -srcDoc \n
48  Display Doxygen source documentation page for this application.
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #include <OpenFOAM/argList.H>
53 #include <OpenFOAM/Time.H>
54 #include <OpenFOAM/dictionary.H>
55 #include <OpenFOAM/IFstream.H>
56 #include <OpenFOAM/OSspecific.H>
57 #include <OpenFOAM/IOmanip.H>
58 
59 #include <specie/specieThermo.H>
60 #include <specie/janafThermo.H>
61 #include <specie/perfectGas.H>
62 #include <OpenFOAM/SLPtrList.H>
63 
64 using namespace Foam;
65 
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 // Main program:
70 
71 int main(int argc, char *argv[])
72 {
73 
74 # include <OpenFOAM/setRootCase.H>
75 
76 # include <OpenFOAM/createTime.H>
77 
78  Info<< nl << "Reading Burcat data IOdictionary" << endl;
79 
80  IOdictionary CpData
81  (
82  IOobject
83  (
84  "BurcatCpData",
85  runTime.constant(),
86  runTime,
89  false
90  )
91  );
92 
93 
94 
95  scalar T = 3000.0;
96 
97  SLPtrList<thermo> EQreactions;
98 
99  EQreactions.append
100  (
101  new thermo
102  (
103  thermo(CpData.lookup("CO2"))
104  ==
105  thermo(CpData.lookup("CO"))
106  + 0.5*thermo(CpData.lookup("O2"))
107  )
108  );
109 
110  EQreactions.append
111  (
112  new thermo
113  (
114  thermo(CpData.lookup("O2"))
115  ==
116  2.0*thermo(CpData.lookup("O"))
117  )
118  );
119 
120  EQreactions.append
121  (
122  new thermo
123  (
124  thermo(CpData.lookup("H2O"))
125  ==
126  thermo(CpData.lookup("H2"))
127  + 0.5*thermo(CpData.lookup("O2"))
128  )
129  );
130 
131  EQreactions.append
132  (
133  new thermo
134  (
135  thermo(CpData.lookup("H2O"))
136  ==
137  thermo(CpData.lookup("H"))
138  + thermo(CpData.lookup("OH"))
139  )
140  );
141 
142 
143  for
144  (
145  SLPtrList<thermo>::iterator EQreactionsIter = EQreactions.begin();
146  EQreactionsIter != EQreactions.end();
147  ++EQreactionsIter
148  )
149  {
150  Info<< "Kc(EQreactions) = " << EQreactionsIter().Kc(T) << endl;
151  }
152 
153 
154  Info<< nl << "end" << endl;
155 
156  return 0;
157 }
158 
159 
160 // ************************ vim: set sw=4 sts=4 et: ************************ //
161 
162