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
29 Calculates the adiabatic flame temperature for a given fuel over a
30 range of unburnt temperatures and equivalence ratios.
32 \*---------------------------------------------------------------------------*/
35 #include "objectRegistry.H"
37 #include "dictionary.H"
39 #include "OSspecific.H"
41 #include "specieThermo.H"
42 #include "janafThermo.H"
43 #include "perfectGas.H"
47 typedef specieThermo<janafThermo<perfectGas> > thermo;
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 int main(int argc, char *argv[])
54 argList::validArgs.clear();
55 argList::validArgs.append("controlFile");
56 argList args(argc, argv);
58 fileName controlFileName(args.additionalArgs()[0]);
60 // Construct control dictionary
61 IFstream controlFile(controlFileName);
63 // Check controlFile stream is OK
64 if (!controlFile.good())
66 FatalErrorIn(args.executable())
67 << "Cannot read file " << controlFileName
71 dictionary control(controlFile);
74 scalar T0(readScalar(control.lookup("T0")));
75 word fuelName(control.lookup("fuel"));
76 scalar n(readScalar(control.lookup("n")));
77 scalar m(readScalar(control.lookup("m")));
80 Info<< nl << "Reading Burcat data dictionary" << endl;
82 fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
84 // Construct control dictionary
85 IFstream BurcatCpDataFile(BurcatCpDataFileName);
87 // Check BurcatCpData stream is OK
88 if (!BurcatCpDataFile.good())
90 FatalErrorIn(args.executable())
91 << "Cannot read file " << BurcatCpDataFileName
95 dictionary CpData(BurcatCpDataFile);
98 scalar stoicO2 = n + m/4.0;
99 scalar stoicN2 = (0.79/0.21)*(n + m/4.0);
101 scalar stoicH2O = m/2.0;
106 thermo(CpData.lookup(fuelName))
112 stoicO2*thermo(CpData.lookup("O2"))
113 + stoicN2*thermo(CpData.lookup("N2"))
116 dimensionedScalar stoichiometricAirFuelMassRatio
118 "stoichiometricAirFuelMassRatio",
120 (oxidant.W()*oxidant.nMoles())/fuel.W()
123 Info<< "stoichiometricAirFuelMassRatio "
124 << stoichiometricAirFuelMassRatio << ';' << endl;
126 for (int i=0; i<300; i++)
128 scalar equiv = (i + 1)*0.01;
129 scalar ft = 1/(1 + stoichiometricAirFuelMassRatio.value()/equiv);
131 Info<< "phi = " << equiv << nl
132 << "ft = " << ft << endl;
134 scalar o2 = (1.0/equiv)*stoicO2;
135 scalar n2 = (0.79/0.21)*o2;
136 scalar fres = max(1.0 - 1.0/equiv, 0.0);
137 scalar ores = max(1.0/equiv - 1.0, 0.0);
138 scalar fburnt = 1.0 - fres;
143 thermo(CpData.lookup(fuelName))
145 Info<< "fuel " << fuel << ';' << endl;
150 o2*thermo(CpData.lookup("O2"))
151 + n2*thermo(CpData.lookup("N2"))
153 Info<< "oxidant " << (1/oxidant.nMoles())*oxidant << ';' << endl;
160 Info<< "reactants " << (1/reactants.nMoles())*reactants << ';' << endl;
165 + (n2 - (0.79/0.21)*ores*stoicO2)*thermo(CpData.lookup("N2"))
166 + fburnt*stoicCO2*thermo(CpData.lookup("CO2"))
167 + fburnt*stoicH2O*thermo(CpData.lookup("H2O"))
169 Info<< "burntProducts "
170 << (1/burntProducts.nMoles())*burntProducts << ';' << endl;
176 + n2*thermo(CpData.lookup("N2"))
177 + fburnt*stoicCO2*thermo(CpData.lookup("CO2"))
178 + fburnt*stoicH2O*thermo(CpData.lookup("H2O"))
179 + ores*stoicO2*thermo(CpData.lookup("O2"))
182 Info<< "products " << (1/products.nMoles())*products << ';' << endl;
184 scalar Tad = products.TH(reactants.H(T0), 1000.0);
185 Info<< "Tad = " << Tad << nl << endl;
188 Info<< nl << "end" << endl;
194 // ************************************************************************* //