FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

equilibriumCO.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Application
00025     equilibriumCO
00026     freefoam-equilibriumCO
00027 
00028 Description
00029     Calculates the equilibrium level of carbon monoxide
00030 
00031 Usage
00032 
00033     - equilibriumCO [OPTIONS]
00034 
00035     @param -case <dir>\n
00036     Case directory.
00037 
00038     @param -parallel \n
00039     Run in parallel.
00040 
00041     @param -help \n
00042     Display help message.
00043 
00044     @param -doc \n
00045     Display Doxygen API documentation page for this application.
00046 
00047     @param -srcDoc \n
00048     Display Doxygen source documentation page for this application.
00049 
00050 \*---------------------------------------------------------------------------*/
00051 
00052 #include <OpenFOAM/argList.H>
00053 #include <OpenFOAM/Time.H>
00054 #include <OpenFOAM/dictionary.H>
00055 #include <OpenFOAM/IFstream.H>
00056 #include <OpenFOAM/OSspecific.H>
00057 #include <OpenFOAM/IOmanip.H>
00058 
00059 #include <specie/specieThermo.H>
00060 #include <specie/janafThermo.H>
00061 #include <specie/perfectGas.H>
00062 #include <OpenFOAM/SLPtrList.H>
00063 
00064 using namespace Foam;
00065 
00066 typedef specieThermo<janafThermo<perfectGas> > thermo;
00067 
00068 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00069 // Main program:
00070 
00071 int main(int argc, char *argv[])
00072 {
00073 
00074 #   include <OpenFOAM/setRootCase.H>
00075 
00076 #   include <OpenFOAM/createTime.H>
00077 
00078     Info<< nl << "Reading Burcat data IOdictionary" << endl;
00079 
00080     IOdictionary CpData
00081     (
00082         IOobject
00083         (
00084             "BurcatCpData",
00085             runTime.constant(),
00086             runTime,
00087             IOobject::MUST_READ,
00088             IOobject::NO_WRITE,
00089             false
00090         )
00091     );
00092 
00093 
00094 
00095     scalar T = 3000.0;
00096 
00097     SLPtrList<thermo> EQreactions;
00098 
00099     EQreactions.append
00100     (
00101         new thermo
00102         (
00103             thermo(CpData.lookup("CO2"))
00104          ==
00105             thermo(CpData.lookup("CO"))
00106           + 0.5*thermo(CpData.lookup("O2"))
00107         )
00108     );
00109 
00110     EQreactions.append
00111     (
00112         new thermo
00113         (
00114             thermo(CpData.lookup("O2"))
00115          ==
00116             2.0*thermo(CpData.lookup("O"))
00117         )
00118     );
00119 
00120     EQreactions.append
00121     (
00122         new thermo
00123         (
00124             thermo(CpData.lookup("H2O"))
00125          ==
00126             thermo(CpData.lookup("H2"))
00127           + 0.5*thermo(CpData.lookup("O2"))
00128         )
00129     );
00130 
00131     EQreactions.append
00132     (
00133         new thermo
00134         (
00135             thermo(CpData.lookup("H2O"))
00136          ==
00137             thermo(CpData.lookup("H"))
00138           + thermo(CpData.lookup("OH"))
00139         )
00140     );
00141 
00142 
00143     for
00144     (
00145         SLPtrList<thermo>::iterator EQreactionsIter = EQreactions.begin();
00146         EQreactionsIter != EQreactions.end();
00147         ++EQreactionsIter
00148     )
00149     {
00150         Info<< "Kc(EQreactions) = " << EQreactionsIter().Kc(T) << endl;
00151     }
00152 
00153 
00154     Info<< nl << "end" << endl;
00155 
00156     return 0;
00157 }
00158 
00159 
00160 // ************************ vim: set sw=4 sts=4 et: ************************ //
00161 
00162 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines