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

mixtureAdiabaticFlameT.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     mixtureAdiabaticFlameT
00026 
00027 Description
00028     Calculates the adiabatic flame temperature for a given mixture
00029     at a given temperature.
00030 
00031 Usage
00032 
00033     - mixtureAdiabaticFlameT [OPTIONS] <controlFile>
00034 
00035     @param <controlFile> \n
00036     @todo Detailed description of argument.
00037 
00038     @param -case <dir>\n
00039     Case directory.
00040 
00041     @param -parallel \n
00042     Run in parallel.
00043 
00044     @param -help \n
00045     Display help message.
00046 
00047     @param -doc \n
00048     Display Doxygen API documentation page for this application.
00049 
00050     @param -srcDoc \n
00051     Display Doxygen source documentation page for this application.
00052 
00053 \*---------------------------------------------------------------------------*/
00054 
00055 #include <OpenFOAM/argList.H>
00056 #include <OpenFOAM/dictionary.H>
00057 #include <OpenFOAM/IFstream.H>
00058 #include <OpenFOAM/OSspecific.H>
00059 
00060 #include <specie/specieThermo.H>
00061 #include <specie/janafThermo.H>
00062 #include <specie/perfectGas.H>
00063 #include "mixture.H"
00064 
00065 using namespace Foam;
00066 
00067 typedef specieThermo<janafThermo<perfectGas> > thermo;
00068 
00069 
00070 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00071 
00072 int main(int argc, char *argv[])
00073 {
00074     argList::validArgs.clear();
00075     argList::validArgs.append("controlFile");
00076     argList args(argc, argv);
00077 
00078     fileName controlFileName(args.additionalArgs()[0]);
00079 
00080     // Construct control dictionary
00081     IFstream controlFile(controlFileName);
00082 
00083     // Check controlFile stream is OK
00084     if (!controlFile.good())
00085     {
00086         FatalErrorIn(args.executable())
00087             << "Cannot read file " << controlFileName
00088             << abort(FatalError);
00089     }
00090 
00091     dictionary control(controlFile);
00092 
00093 
00094     scalar T0(readScalar(control.lookup("T0")));
00095     mixture rMix(control.lookup("reactants"));
00096     mixture pMix(control.lookup("products"));
00097 
00098 
00099     Info<< nl << "Reading Burcat data dictionary" << endl;
00100 
00101     fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
00102 
00103     // Construct control dictionary
00104     IFstream BurcatCpDataFile(BurcatCpDataFileName);
00105 
00106     // Check BurcatCpData stream is OK
00107     if (!BurcatCpDataFile.good())
00108     {
00109         FatalErrorIn(args.executable())
00110             << "Cannot read file " << BurcatCpDataFileName
00111             << abort(FatalError);
00112     }
00113 
00114     dictionary CpData(BurcatCpDataFile);
00115 
00116 
00117     thermo reactants
00118     (
00119         rMix[0].volFrac()*thermo(CpData.lookup(rMix[0].name()))
00120     );
00121 
00122     for (label i = 1; i < rMix.size(); i++)
00123     {
00124         reactants = reactants
00125             + rMix[i].volFrac()*thermo(CpData.lookup(rMix[i].name()));
00126     }
00127 
00128 
00129     thermo products
00130     (
00131         2*pMix[0].volFrac()*thermo(CpData.lookup(pMix[0].name()))
00132     );
00133 
00134     for (label i = 1; i < pMix.size(); i++)
00135     {
00136         products = products
00137             + 2*pMix[i].volFrac()*thermo(CpData.lookup(pMix[i].name()));
00138     }
00139 
00140     Info << "Adiabatic flame temperature of mixture " << rMix.name() << " = "
00141          << products.TH(reactants.H(T0), 1000.0) << " K" << endl;
00142 
00143     return 0;
00144 }
00145 
00146 
00147 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines