OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Application
00026     
00027 Description
00028     Calculates the equilibrium level of carbon monoxide
00029 
00030 \*---------------------------------------------------------------------------*/
00031 
00032 #include "argList.H"
00033 #include "Time.H"
00034 #include "dictionary.H"
00035 #include "IFstream.H"
00036 #include "OSspecific.H"
00037 #include "IOmanip.H"
00038 
00039 #include "specieThermo.H"
00040 #include "janafThermo.H"
00041 #include "perfectGas.H"
00042 #include "SLPtrList.H"
00043 
00044 using namespace Foam;
00045 
00046 typedef specieThermo<janafThermo<perfectGas> > thermo;
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 // Main program:
00050 
00051 int main(int argc, char *argv[])
00052 {
00053 
00054 #   include "setRootCase.H"
00055 
00056 #   include "createTime.H"
00057 
00058     Info<< nl << "Reading Burcat data IOdictionary" << endl;
00059 
00060     IOdictionary CpData
00061     (
00062         IOobject
00063         (
00064             "BurcatCpData",
00065             runTime.constant(),
00066             runTime,
00067             IOobject::MUST_READ,
00068             IOobject::NO_WRITE,
00069             false
00070         )
00071     );
00072 
00073 
00074 
00075     scalar T = 3000.0;
00076 
00077     SLPtrList<thermo> EQreactions;
00078 
00079     EQreactions.append
00080     (
00081         new thermo
00082         (
00083             thermo(CpData.lookup("CO2"))
00084          ==
00085             thermo(CpData.lookup("CO"))
00086           + 0.5*thermo(CpData.lookup("O2"))
00087         )
00088     );
00089 
00090     EQreactions.append
00091     (
00092         new thermo
00093         (
00094             thermo(CpData.lookup("O2"))
00095          ==
00096             2.0*thermo(CpData.lookup("O"))
00097         )
00098     );
00099 
00100     EQreactions.append
00101     (
00102         new thermo
00103         (
00104             thermo(CpData.lookup("H2O"))
00105          ==
00106             thermo(CpData.lookup("H2"))
00107           + 0.5*thermo(CpData.lookup("O2"))
00108         )
00109     );
00110 
00111     EQreactions.append
00112     (
00113         new thermo
00114         (
00115             thermo(CpData.lookup("H2O"))
00116          ==
00117             thermo(CpData.lookup("H"))
00118           + thermo(CpData.lookup("OH"))
00119         )
00120     );
00121 
00122 
00123     for
00124     (
00125         SLPtrList<thermo>::iterator EQreactionsIter = EQreactions.begin();
00126         EQreactionsIter != EQreactions.end();
00127         ++EQreactionsIter
00128     )
00129     {
00130         Info<< "Kc(EQreactions) = " << EQreactionsIter().Kc(T) << endl;
00131     }
00132 
00133 
00134     Info<< nl << "end" << endl;
00135 
00136     return 0;
00137 }
00138 
00139 
00140 // ************************************************************************* //
00141 
Copyright © 2000-2009 OpenCFD Ltd