1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
25 mixtureAdiabaticFlameT
28 Calculates the adiabatic flame temperature for a given mixture
29 at a given temperature.
31 \*---------------------------------------------------------------------------*/
34 #include "dictionary.H"
36 #include "OSspecific.H"
38 #include "specieThermo.H"
39 #include "janafThermo.H"
40 #include "perfectGas.H"
45 typedef specieThermo<janafThermo<perfectGas> > thermo;
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 int main(int argc, char *argv[])
52 argList::validArgs.append("controlFile");
53 argList args(argc, argv);
55 const fileName controlFileName(args[1]);
57 // Construct control dictionary
58 IFstream controlFile(controlFileName);
60 // Check controlFile stream is OK
61 if (!controlFile.good())
63 FatalErrorIn(args.executable())
64 << "Cannot read file " << controlFileName
68 dictionary control(controlFile);
71 scalar T0(readScalar(control.lookup("T0")));
72 mixture rMix(control.lookup("reactants"));
73 mixture pMix(control.lookup("products"));
76 Info<< nl << "Reading Burcat data dictionary" << endl;
78 fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
80 // Construct control dictionary
81 IFstream BurcatCpDataFile(BurcatCpDataFileName);
83 // Check BurcatCpData stream is OK
84 if (!BurcatCpDataFile.good())
86 FatalErrorIn(args.executable())
87 << "Cannot read file " << BurcatCpDataFileName
91 dictionary CpData(BurcatCpDataFile);
96 rMix[0].volFrac()*thermo(CpData.lookup(rMix[0].name()))
99 for (label i = 1; i < rMix.size(); i++)
101 reactants = reactants
102 + rMix[i].volFrac()*thermo(CpData.lookup(rMix[i].name()));
108 2*pMix[0].volFrac()*thermo(CpData.lookup(pMix[0].name()))
111 for (label i = 1; i < pMix.size(); i++)
114 + 2*pMix[i].volFrac()*thermo(CpData.lookup(pMix[i].name()));
117 Info<< "Adiabatic flame temperature of mixture " << rMix.name() << " = "
118 << products.TH(reactants.H(T0), 1000.0) << " K" << endl;
124 // ************************************************************************* //