Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #include <OpenFOAM/argList.H>
00059 #include <OpenFOAM/Time.H>
00060 #include <OpenFOAM/dictionary.H>
00061 #include <OpenFOAM/IFstream.H>
00062 #include <OpenFOAM/OSspecific.H>
00063 #include <OpenFOAM/IOmanip.H>
00064
00065 #include <specie/specieThermo.H>
00066 #include <specie/janafThermo.H>
00067 #include <specie/perfectGas.H>
00068
00069 using namespace Foam;
00070
00071 typedef specieThermo<janafThermo<perfectGas> > thermo;
00072
00073
00074
00075 int main(int argc, char *argv[])
00076 {
00077 argList::validArgs.clear();
00078 argList::validArgs.append("controlFile");
00079 argList args(argc, argv);
00080
00081 fileName controlFileName(args.additionalArgs()[0]);
00082
00083
00084 IFstream controlFile(controlFileName);
00085
00086
00087 if (!controlFile.good())
00088 {
00089 FatalErrorIn(args.executable())
00090 << "Cannot read file " << controlFileName
00091 << abort(FatalError);
00092 }
00093
00094 dictionary control(controlFile);
00095
00096
00097 scalar P(readScalar(control.lookup("P")));
00098 word fuel(control.lookup("fuel"));
00099 scalar n(readScalar(control.lookup("n")));
00100 scalar m(readScalar(control.lookup("m")));
00101
00102
00103 Info<< nl << "Reading Burcat data dictionary" << endl;
00104
00105 fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
00106
00107
00108 IFstream BurcatCpDataFile(BurcatCpDataFileName);
00109
00110
00111 if (!BurcatCpDataFile.good())
00112 {
00113 FatalErrorIn(args.executable())
00114 << "Cannot read file " << BurcatCpDataFileName
00115 << abort(FatalError);
00116 }
00117
00118 dictionary thermoData(BurcatCpDataFile);
00119
00120
00121 Info<< nl << "Reading Burcat data for relevant species" << nl << endl;
00122
00123
00124 thermo FUEL(thermoData.lookup(fuel));
00125 thermo O2(thermoData.lookup("O2"));
00126 thermo N2(thermoData.lookup("N2"));
00127
00128
00129 thermo CO2(thermoData.lookup("CO2"));
00130 thermo H2O(thermoData.lookup("H2O"));
00131
00132
00133 thermo CO(thermoData.lookup("CO"));
00134 thermo H2(thermoData.lookup("H2"));
00135
00136
00137
00138
00139 thermo CO2BreakUp
00140 (
00141 CO2 == CO + 0.5* O2
00142 );
00143
00144 thermo H2OBreakUp
00145 (
00146 H2O == H2 + 0.5*O2
00147 );
00148
00149
00150
00151 scalar stoicO2 = n + m/4.0;
00152 scalar stoicN2 = (0.79/0.21)*(n + m/4.0);
00153 scalar stoicCO2 = n;
00154 scalar stoicH2O = m/2.0;
00155
00156
00157 thermo oxidant
00158 (
00159 "oxidant",
00160 stoicO2*O2
00161 + stoicN2*N2
00162 );
00163
00164 dimensionedScalar stoichiometricAirFuelMassRatio
00165 (
00166 "stoichiometricAirFuelMassRatio",
00167 dimless,
00168 (oxidant.W()*oxidant.nMoles())/FUEL.W()
00169 );
00170
00171 Info<< "stoichiometricAirFuelMassRatio "
00172 << stoichiometricAirFuelMassRatio << ';' << endl;
00173
00174 Info<< "Equilibrium flame temperature data ("
00175 << P/1e5 << " bar)" << nl << nl
00176 << setw(3) << "Phi"
00177 << setw(12) << "ft"
00178 << setw(7) << "T0"
00179 << setw(12) << "Tad"
00180 << setw(12) << "Teq"
00181 << setw(12) << "Terror"
00182 << setw(20) << "O2res (mole frac)" << nl
00183 << endl;
00184
00185
00186
00187 for (int i=0; i<16; i++)
00188 {
00189 scalar equiv = 0.6 + i*0.05;
00190 scalar ft = 1/(1 + stoichiometricAirFuelMassRatio.value()/equiv);
00191
00192
00193 for (int j=0; j<28; j++)
00194 {
00195 scalar T0 = 300.0 + j*100.0;
00196
00197
00198 scalar o2 = (1.0/equiv)*stoicO2;
00199 scalar n2 = (0.79/0.21)*o2;
00200 scalar fres = max(1.0 - 1.0/equiv, 0.0);
00201 scalar fburnt = 1.0 - fres;
00202
00203
00204
00205 scalar oresInit = max(1.0/equiv - 1.0, 0.0)*stoicO2;
00206 scalar co2Init = fburnt*stoicCO2;
00207 scalar h2oInit = fburnt*stoicH2O;
00208
00209 scalar ores = oresInit;
00210 scalar co2 = co2Init;
00211 scalar h2o = h2oInit;
00212
00213 scalar co = 0.0;
00214 scalar h2 = 0.0;
00215
00216
00217 scalar N = fres + n2 + co2 + h2o + ores;
00218
00219
00220
00221 scalar adiabaticFlameTemperature =
00222 T0
00223 + (fburnt/(1.0 + o2 + n2))/(1.0/(1.0 + (1.0 + 0.79/0.21)*stoicO2))
00224 *2000.0;
00225
00226 scalar equilibriumFlameTemperature = adiabaticFlameTemperature;
00227
00228
00229
00230 for (int j=0; j<20; j++)
00231 {
00232
00233 if (j > 0)
00234 {
00235 co = co2*
00236 min
00237 (
00238 CO2BreakUp.Kn(equilibriumFlameTemperature, P, N)
00239 /::sqrt(max(ores, 0.001)),
00240 1.0
00241 );
00242
00243 h2 = h2o*
00244 min
00245 (
00246 H2OBreakUp.Kn(equilibriumFlameTemperature, P, N)
00247 /::sqrt(max(ores, 0.001)),
00248 1.0
00249 );
00250
00251 co2 = co2Init - co;
00252 h2o = h2oInit - h2;
00253 ores = oresInit + 0.5*co + 0.5*h2;
00254 }
00255
00256 thermo reactants
00257 (
00258 FUEL + o2*O2 + n2*N2
00259 );
00260
00261 thermo products
00262 (
00263 fres*FUEL + ores*O2 + n2*N2
00264 + co2*CO2 + h2o*H2O + co*CO + h2*H2
00265 );
00266
00267
00268 scalar equilibriumFlameTemperatureNew =
00269 products.TH(reactants.H(T0), adiabaticFlameTemperature);
00270
00271 if (j==0)
00272 {
00273 adiabaticFlameTemperature = equilibriumFlameTemperatureNew;
00274 }
00275 else
00276 {
00277 equilibriumFlameTemperature = 0.5*
00278 (
00279 equilibriumFlameTemperature
00280 + equilibriumFlameTemperatureNew
00281 );
00282 }
00283 }
00284
00285 Info<< setw(3) << equiv
00286 << setw(12) << ft
00287 << setw(7) << T0
00288 << setw(12) << adiabaticFlameTemperature
00289 << setw(12) << equilibriumFlameTemperature
00290 << setw(12)
00291 << adiabaticFlameTemperature - equilibriumFlameTemperature
00292 << setw(12) << ores/N
00293 << endl;
00294 }
00295 }
00296
00297 Info<< nl << "end" << endl;
00298
00299 return 0;
00300 }
00301
00302
00303