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 #include <OpenFOAM/argList.H>
00056 #include <OpenFOAM/Time.H>
00057 #include <OpenFOAM/dictionary.H>
00058 #include <OpenFOAM/IFstream.H>
00059 #include <OpenFOAM/OSspecific.H>
00060
00061 #include <specie/specieThermo.H>
00062 #include <specie/janafThermo.H>
00063 #include <specie/perfectGas.H>
00064
00065 using namespace Foam;
00066
00067 typedef specieThermo<janafThermo<perfectGas> > thermo;
00068
00069
00070
00071
00072 int main(int argc, char *argv[])
00073 {
00074 argList::validArgs.clear();
00075 argList::validArgs.append("controlFile");
00076 argList args(argc, argv);
00077
00078 fileName controlFileName(args.additionalArgs()[0]);
00079
00080
00081 IFstream controlFile(controlFileName);
00082
00083
00084 if (!controlFile.good())
00085 {
00086 FatalErrorIn(args.executable())
00087 << "Cannot read file " << controlFileName
00088 << exit(FatalError);
00089 }
00090
00091 dictionary control(controlFile);
00092
00093
00094 scalar T0(readScalar(control.lookup("T0")));
00095 word fuelName(control.lookup("fuel"));
00096 scalar n(readScalar(control.lookup("n")));
00097 scalar m(readScalar(control.lookup("m")));
00098
00099
00100 Info<< nl << "Reading Burcat data dictionary" << endl;
00101
00102 fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
00103
00104
00105 IFstream BurcatCpDataFile(BurcatCpDataFileName);
00106
00107
00108 if (!BurcatCpDataFile.good())
00109 {
00110 FatalErrorIn(args.executable())
00111 << "Cannot read file " << BurcatCpDataFileName
00112 << exit(FatalError);
00113 }
00114
00115 dictionary CpData(BurcatCpDataFile);
00116
00117
00118 scalar stoicO2 = n + m/4.0;
00119 scalar stoicN2 = (0.79/0.21)*(n + m/4.0);
00120 scalar stoicCO2 = n;
00121 scalar stoicH2O = m/2.0;
00122
00123 thermo fuel
00124 (
00125 "fuel",
00126 thermo(CpData.lookup(fuelName))
00127 );
00128
00129 thermo oxidant
00130 (
00131 "oxidant",
00132 stoicO2*thermo(CpData.lookup("O2"))
00133 + stoicN2*thermo(CpData.lookup("N2"))
00134 );
00135
00136 dimensionedScalar stoichiometricAirFuelMassRatio
00137 (
00138 "stoichiometricAirFuelMassRatio",
00139 dimless,
00140 (oxidant.W()*oxidant.nMoles())/fuel.W()
00141 );
00142
00143 Info<< "stoichiometricAirFuelMassRatio "
00144 << stoichiometricAirFuelMassRatio << ';' << endl;
00145
00146 for (int i=0; i<300; i++)
00147 {
00148 scalar equiv = (i + 1)*0.01;
00149 scalar ft = 1/(1 + stoichiometricAirFuelMassRatio.value()/equiv);
00150
00151 Info<< "phi = " << equiv << nl
00152 << "ft = " << ft << endl;
00153
00154 scalar o2 = (1.0/equiv)*stoicO2;
00155 scalar n2 = (0.79/0.21)*o2;
00156 scalar fres = max(1.0 - 1.0/equiv, 0.0);
00157 scalar ores = max(1.0/equiv - 1.0, 0.0);
00158 scalar fburnt = 1.0 - fres;
00159
00160 thermo fuel
00161 (
00162 "fuel",
00163 thermo(CpData.lookup(fuelName))
00164 );
00165 Info<< "fuel " << fuel << ';' << endl;
00166
00167 thermo oxidant
00168 (
00169 "oxidant",
00170 o2*thermo(CpData.lookup("O2"))
00171 + n2*thermo(CpData.lookup("N2"))
00172 );
00173 Info<< "oxidant " << (1/oxidant.nMoles())*oxidant << ';' << endl;
00174
00175 thermo reactants
00176 (
00177 "reactants",
00178 fuel + oxidant
00179 );
00180 Info<< "reactants " << (1/reactants.nMoles())*reactants << ';' << endl;
00181
00182 thermo burntProducts
00183 (
00184 "burntProducts",
00185 + (n2 - (0.79/0.21)*ores*stoicO2)*thermo(CpData.lookup("N2"))
00186 + fburnt*stoicCO2*thermo(CpData.lookup("CO2"))
00187 + fburnt*stoicH2O*thermo(CpData.lookup("H2O"))
00188 );
00189 Info<< "burntProducts "
00190 << (1/burntProducts.nMoles())*burntProducts << ';' << endl;
00191
00192 thermo products
00193 (
00194 "products",
00195 fres*fuel
00196 + n2*thermo(CpData.lookup("N2"))
00197 + fburnt*stoicCO2*thermo(CpData.lookup("CO2"))
00198 + fburnt*stoicH2O*thermo(CpData.lookup("H2O"))
00199 + ores*stoicO2*thermo(CpData.lookup("O2"))
00200 );
00201
00202 Info<< "products " << (1/products.nMoles())*products << ';' << endl;
00203
00204 scalar Tad = products.TH(reactants.H(T0), 1000.0);
00205 Info<< "Tad = " << Tad << nl << endl;
00206 }
00207
00208 Info<< nl << "end" << endl;
00209
00210 return 0;
00211 }
00212
00213
00214