1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 mixtureAdiabaticFlameT
29 Calculates the adiabatic flame temperature for a given mixture
30 at a given temperature.
32 \*---------------------------------------------------------------------------*/
35 #include "dictionary.H"
37 #include "OSspecific.H"
39 #include "specieThermo.H"
40 #include "janafThermo.H"
41 #include "perfectGas.H"
46 typedef specieThermo<janafThermo<perfectGas> > thermo;
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 int main(int argc, char *argv[])
53 argList::validArgs.clear();
54 argList::validArgs.append("controlFile");
55 argList args(argc, argv);
57 fileName controlFileName(args.additionalArgs()[0]);
59 // Construct control dictionary
60 IFstream controlFile(controlFileName);
62 // Check controlFile stream is OK
63 if (!controlFile.good())
65 FatalErrorIn(args.executable())
66 << "Cannot read file " << controlFileName
70 dictionary control(controlFile);
73 scalar T0(readScalar(control.lookup("T0")));
74 mixture rMix(control.lookup("reactants"));
75 mixture pMix(control.lookup("products"));
78 Info<< nl << "Reading Burcat data dictionary" << endl;
80 fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
82 // Construct control dictionary
83 IFstream BurcatCpDataFile(BurcatCpDataFileName);
85 // Check BurcatCpData stream is OK
86 if (!BurcatCpDataFile.good())
88 FatalErrorIn(args.executable())
89 << "Cannot read file " << BurcatCpDataFileName
93 dictionary CpData(BurcatCpDataFile);
98 rMix[0].volFrac()*thermo(CpData.lookup(rMix[0].name()))
101 for (label i = 1; i < rMix.size(); i++)
103 reactants = reactants
104 + rMix[i].volFrac()*thermo(CpData.lookup(rMix[i].name()));
110 2*pMix[0].volFrac()*thermo(CpData.lookup(pMix[0].name()))
113 for (label i = 1; i < pMix.size(); i++)
116 + 2*pMix[i].volFrac()*thermo(CpData.lookup(pMix[i].name()));
119 Info << "Adiabatic flame temperature of mixture " << rMix.name() << " = "
120 << products.TH(reactants.H(T0), 1000.0) << " K" << endl;
126 // ************************************************************************* //