FreeFOAM The Cross-Platform CFD Toolkit
mixtureAdiabaticFlameT.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Application
25  mixtureAdiabaticFlameT
26 
27 Description
28  Calculates the adiabatic flame temperature for a given mixture
29  at a given temperature.
30 
31 Usage
32 
33  - mixtureAdiabaticFlameT [OPTIONS] <controlFile>
34 
35  @param <controlFile> \n
36  @todo Detailed description of argument.
37 
38  @param -case <dir>\n
39  Case directory.
40 
41  @param -parallel \n
42  Run in parallel.
43 
44  @param -help \n
45  Display help message.
46 
47  @param -doc \n
48  Display Doxygen API documentation page for this application.
49 
50  @param -srcDoc \n
51  Display Doxygen source documentation page for this application.
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #include <OpenFOAM/argList.H>
56 #include <OpenFOAM/dictionary.H>
57 #include <OpenFOAM/IFstream.H>
58 #include <OpenFOAM/OSspecific.H>
59 
60 #include <specie/specieThermo.H>
61 #include <specie/janafThermo.H>
62 #include <specie/perfectGas.H>
63 #include "mixture.H"
64 
65 using namespace Foam;
66 
68 
69 
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 
72 int main(int argc, char *argv[])
73 {
75  argList::validArgs.append("controlFile");
76  argList args(argc, argv);
77 
78  fileName controlFileName(args.additionalArgs()[0]);
79 
80  // Construct control dictionary
81  IFstream controlFile(controlFileName);
82 
83  // Check controlFile stream is OK
84  if (!controlFile.good())
85  {
87  << "Cannot read file " << controlFileName
88  << abort(FatalError);
89  }
90 
91  dictionary control(controlFile);
92 
93 
94  scalar T0(readScalar(control.lookup("T0")));
95  mixture rMix(control.lookup("reactants"));
96  mixture pMix(control.lookup("products"));
97 
98 
99  Info<< nl << "Reading Burcat data dictionary" << endl;
100 
101  fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
102 
103  // Construct control dictionary
104  IFstream BurcatCpDataFile(BurcatCpDataFileName);
105 
106  // Check BurcatCpData stream is OK
107  if (!BurcatCpDataFile.good())
108  {
110  << "Cannot read file " << BurcatCpDataFileName
111  << abort(FatalError);
112  }
113 
114  dictionary CpData(BurcatCpDataFile);
115 
116 
117  thermo reactants
118  (
119  rMix[0].volFrac()*thermo(CpData.lookup(rMix[0].name()))
120  );
121 
122  for (label i = 1; i < rMix.size(); i++)
123  {
124  reactants = reactants
125  + rMix[i].volFrac()*thermo(CpData.lookup(rMix[i].name()));
126  }
127 
128 
129  thermo products
130  (
131  2*pMix[0].volFrac()*thermo(CpData.lookup(pMix[0].name()))
132  );
133 
134  for (label i = 1; i < pMix.size(); i++)
135  {
136  products = products
137  + 2*pMix[i].volFrac()*thermo(CpData.lookup(pMix[i].name()));
138  }
139 
140  Info << "Adiabatic flame temperature of mixture " << rMix.name() << " = "
141  << products.TH(reactants.H(T0), 1000.0) << " K" << endl;
142 
143  return 0;
144 }
145 
146 
147 // ************************ vim: set sw=4 sts=4 et: ************************ //