1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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.clear();
53 argList::validArgs.append("controlFile");
54 argList args(argc, argv);
56 fileName controlFileName(args.additionalArgs()[0]);
58 // Construct control dictionary
59 IFstream controlFile(controlFileName);
61 // Check controlFile stream is OK
62 if (!controlFile.good())
64 FatalErrorIn(args.executable())
65 << "Cannot read file " << controlFileName
69 dictionary control(controlFile);
72 scalar T0(readScalar(control.lookup("T0")));
73 mixture rMix(control.lookup("reactants"));
74 mixture pMix(control.lookup("products"));
77 Info<< nl << "Reading Burcat data dictionary" << endl;
79 fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
81 // Construct control dictionary
82 IFstream BurcatCpDataFile(BurcatCpDataFileName);
84 // Check BurcatCpData stream is OK
85 if (!BurcatCpDataFile.good())
87 FatalErrorIn(args.executable())
88 << "Cannot read file " << BurcatCpDataFileName
92 dictionary CpData(BurcatCpDataFile);
97 rMix[0].volFrac()*thermo(CpData.lookup(rMix[0].name()))
100 for (label i = 1; i < rMix.size(); i++)
102 reactants = reactants
103 + rMix[i].volFrac()*thermo(CpData.lookup(rMix[i].name()));
109 2*pMix[0].volFrac()*thermo(CpData.lookup(pMix[0].name()))
112 for (label i = 1; i < pMix.size(); i++)
115 + 2*pMix[i].volFrac()*thermo(CpData.lookup(pMix[i].name()));
118 Info << "Adiabatic flame temperature of mixture " << rMix.name() << " = "
119 << products.TH(reactants.H(T0), 1000.0) << " K" << endl;
125 // ************************************************************************* //