55 int main(
int argc,
char *argv[])
63 IFstream controlFile(controlFileName);
66 if (!controlFile.good())
69 <<
"Cannot read file " << controlFileName
77 const word fuelName(control.lookup(
"fuel"));
82 Info<<
nl <<
"Reading thermodynamic data dictionary" <<
endl;
87 IFstream thermoDataFile(thermoDataFileName);
90 if (!thermoDataFile.good())
93 <<
"Cannot read file " << thermoDataFileName
100 Info<<
nl <<
"Reading thermodynamic data for relevant species" 104 thermo FUEL(thermoData.subDict(fuelName)); FUEL *= FUEL.W();
107 thermo O2(thermoData.subDict(
"O2")); O2 *= O2.W();
108 thermo N2(thermoData.subDict(
"N2")); N2 *= N2.W();
111 thermo H2(thermoData.subDict(
"H2")); H2 *= H2.W();
114 thermo CO2(thermoData.subDict(
"CO2")); CO2 *= CO2.W();
115 thermo H2O(thermoData.subDict(
"H2O")); H2O *= H2O.W();
116 thermo CO(thermoData.subDict(
"CO")); CO *= CO.W();
133 scalar stoicO2 =
n + m/4.0;
134 scalar stoicN2 = (0.79/0.21)*(
n + m/4.0);
136 scalar stoicH2O = m/2.0;
148 "stoichiometricAirFuelMassRatio",
153 Info<<
"stoichiometricAirFuelMassRatio " 154 << stoichiometricAirFuelMassRatio <<
';' <<
endl;
156 Info<<
"Equilibrium flame temperature data (" 157 << P/1e5 <<
" bar)" <<
nl <<
nl 163 <<
setw(12) <<
"Terror" 164 <<
setw(20) <<
"O2res (mole frac)" <<
nl 169 for (
int i=0; i<16; i++)
171 scalar equiv = 0.6 + i*0.05;
172 scalar ft = 1/(1 + stoichiometricAirFuelMassRatio.value()/equiv);
175 for (
int j=0; j<28; j++)
177 scalar T0 = 300.0 + j*100.0;
180 scalar o2 = (1.0/equiv)*stoicO2;
181 scalar n2 = (0.79/0.21)*o2;
182 scalar fres =
max(1.0 - 1.0/equiv, 0.0);
183 scalar fburnt = 1.0 - fres;
187 scalar oresInit =
max(1.0/equiv - 1.0, 0.0)*stoicO2;
188 scalar co2Init = fburnt*stoicCO2;
189 scalar h2oInit = fburnt*stoicH2O;
191 scalar ores = oresInit;
192 scalar co2 = co2Init;
193 scalar h2o = h2oInit;
199 scalar
N = fres + n2 + co2 + h2o + ores;
203 scalar adiabaticFlameTemperature =
205 + (fburnt/(1.0 + o2 + n2))/(1.0/(1.0 + (1.0 + 0.79/0.21)*stoicO2))
208 scalar equilibriumFlameTemperature = adiabaticFlameTemperature;
212 for (
int j=0; j<20; j++)
219 CO2BreakUp.Kn(P, equilibriumFlameTemperature,
N)
227 H2OBreakUp.Kn(P, equilibriumFlameTemperature,
N)
234 ores = oresInit + 0.5*co + 0.5*h2;
244 fres*FUEL + ores*O2 + n2*N2
245 + co2*CO2 + h2o*H2O + co*CO + h2*H2
249 scalar equilibriumFlameTemperatureNew =
250 products.THa(reactants.Ha(P, T0), P, adiabaticFlameTemperature);
254 adiabaticFlameTemperature = equilibriumFlameTemperatureNew;
258 equilibriumFlameTemperature = 0.5*
260 equilibriumFlameTemperature
261 + equilibriumFlameTemperatureNew
269 <<
setw(12) << adiabaticFlameTemperature
270 <<
setw(12) << equilibriumFlameTemperature
272 << adiabaticFlameTemperature - equilibriumFlameTemperature
273 <<
setw(12) << ores/
N A class for handling file names.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Thermodynamics mapping class to expose the absolute enthalpy functions.
psiReactionThermo & thermo
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A class for handling words, derived from string.
Functions to search 'etc' directories for configuration files etc.
Extract command arguments and options from the supplied argc and argv parameters. ...
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
errorManip< error > abort(error &err)
fileName findEtcFile(const fileName &, bool mandatory=false)
Search for a file using findEtcFiles.
Istream and Ostream manipulators taking arguments.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Omanip< int > setw(const int i)
Foam::argList args(argc, argv)