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

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-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     mixtureAdiabaticFlameT
00027 
00028 Description
00029     Calculates the adiabatic flame temperature for a given mixture
00030     at a given temperature.
00031 
00032 \*---------------------------------------------------------------------------*/
00033 
00034 #include "argList.H"
00035 #include "dictionary.H"
00036 #include "IFstream.H"
00037 #include "OSspecific.H"
00038 
00039 #include "specieThermo.H"
00040 #include "janafThermo.H"
00041 #include "perfectGas.H"
00042 #include "mixture.H"
00043 
00044 using namespace Foam;
00045 
00046 typedef specieThermo<janafThermo<perfectGas> > thermo;
00047 
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 int main(int argc, char *argv[])
00052 {
00053     argList::validArgs.clear();
00054     argList::validArgs.append("controlFile");
00055     argList args(argc, argv);
00056 
00057     fileName controlFileName(args.additionalArgs()[0]);
00058 
00059     // Construct control dictionary
00060     IFstream controlFile(controlFileName);
00061 
00062     // Check controlFile stream is OK
00063     if (!controlFile.good())
00064     {
00065         FatalErrorIn(args.executable())
00066             << "Cannot read file " << controlFileName
00067             << abort(FatalError);
00068     }
00069 
00070     dictionary control(controlFile);
00071 
00072 
00073     scalar T0(readScalar(control.lookup("T0")));
00074     mixture rMix(control.lookup("reactants"));
00075     mixture pMix(control.lookup("products"));
00076 
00077 
00078     Info<< nl << "Reading Burcat data dictionary" << endl;
00079 
00080     fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
00081 
00082     // Construct control dictionary
00083     IFstream BurcatCpDataFile(BurcatCpDataFileName);
00084 
00085     // Check BurcatCpData stream is OK
00086     if (!BurcatCpDataFile.good())
00087     {
00088         FatalErrorIn(args.executable())
00089             << "Cannot read file " << BurcatCpDataFileName
00090             << abort(FatalError);
00091     }
00092 
00093     dictionary CpData(BurcatCpDataFile);
00094 
00095 
00096     thermo reactants
00097     (
00098         rMix[0].volFrac()*thermo(CpData.lookup(rMix[0].name()))
00099     );
00100 
00101     for (label i = 1; i < rMix.size(); i++)
00102     {
00103         reactants = reactants
00104             + rMix[i].volFrac()*thermo(CpData.lookup(rMix[i].name()));
00105     }
00106 
00107 
00108     thermo products
00109     (
00110         2*pMix[0].volFrac()*thermo(CpData.lookup(pMix[0].name()))
00111     );
00112 
00113     for (label i = 1; i < pMix.size(); i++)
00114     {
00115         products = products
00116             + 2*pMix[i].volFrac()*thermo(CpData.lookup(pMix[i].name()));
00117     }
00118 
00119     Info << "Adiabatic flame temperature of mixture " << rMix.name() << " = "
00120          << products.TH(reactants.H(T0), 1000.0) << " K" << endl;
00121 
00122     return 0;
00123 }
00124 
00125 
00126 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd