initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / thermophysical / mixtureAdiabaticFlameT / mixtureAdiabaticFlameT.C
blob277a4e787fbbf40809c8b1ca53d01724f4db2baa
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Application
26     mixtureAdiabaticFlameT
28 Description
29     Calculates the adiabatic flame temperature for a given mixture
30     at a given temperature.
32 \*---------------------------------------------------------------------------*/
34 #include "argList.H"
35 #include "dictionary.H"
36 #include "IFstream.H"
37 #include "OSspecific.H"
39 #include "specieThermo.H"
40 #include "janafThermo.H"
41 #include "perfectGas.H"
42 #include "mixture.H"
44 using namespace Foam;
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())
64     {
65         FatalErrorIn(args.executable())
66             << "Cannot read file " << controlFileName
67             << abort(FatalError);
68     }
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())
87     {
88         FatalErrorIn(args.executable())
89             << "Cannot read file " << BurcatCpDataFileName
90             << abort(FatalError);
91     }
93     dictionary CpData(BurcatCpDataFile);
96     thermo reactants
97     (
98         rMix[0].volFrac()*thermo(CpData.lookup(rMix[0].name()))
99     );
101     for (label i = 1; i < rMix.size(); i++)
102     {
103         reactants = reactants
104             + rMix[i].volFrac()*thermo(CpData.lookup(rMix[i].name()));
105     }
108     thermo products
109     (
110         2*pMix[0].volFrac()*thermo(CpData.lookup(pMix[0].name()))
111     );
113     for (label i = 1; i < pMix.size(); i++)
114     {
115         products = products
116             + 2*pMix[i].volFrac()*thermo(CpData.lookup(pMix[i].name()));
117     }
119     Info << "Adiabatic flame temperature of mixture " << rMix.name() << " = "
120          << products.TH(reactants.H(T0), 1000.0) << " K" << endl;
122     return 0;
126 // ************************************************************************* //