Go to the documentation of this file.
60 int main(
int argc,
char *argv[])
64 "Calculate the equilibrium flame temperature for a given fuel and"
65 " pressure for a range of unburnt gas temperatures and equivalence"
67 "Includes the effects of dissociation on O2, H2O and CO2."
79 IFstream controlFile(controlFileName);
82 if (!controlFile.good())
85 <<
"Cannot read file " << controlFileName
92 const scalar P(control.get<scalar>(
"P"));
93 const word fuelName(control.get<
word>(
"fuel"));
94 const scalar
n(control.get<scalar>(
"n"));
95 const scalar m(control.get<scalar>(
"m"));
98 Info<<
nl <<
"Reading thermodynamic data dictionary" <<
endl;
103 IFstream thermoDataFile(thermoDataFileName);
106 if (!thermoDataFile.good())
109 <<
"Cannot read file " << thermoDataFileName
116 Info<<
nl <<
"Reading thermodynamic data for relevant species"
120 thermo FUEL(thermoData.subDict(fuelName)); FUEL *= FUEL.W();
123 thermo O2(thermoData.subDict(
"O2")); O2 *= O2.W();
127 thermo H2(thermoData.subDict(
"H2")); H2 *= H2.W();
130 thermo CO2(thermoData.subDict(
"CO2")); CO2 *= CO2.W();
132 thermo CO(thermoData.subDict(
"CO")); CO *= CO.W();
149 scalar stoicO2 =
n + m/4.0;
150 scalar stoicN2 = (0.79/0.21)*(
n + m/4.0);
152 scalar stoicH2O = m/2.0;
164 "stoichiometricAirFuelMassRatio",
169 Info<<
"stoichiometricAirFuelMassRatio "
170 << stoichiometricAirFuelMassRatio <<
';' <<
endl;
172 Info<<
"Equilibrium flame temperature data ("
173 << P/1e5 <<
" bar)" <<
nl <<
nl
179 <<
setw(12) <<
"Terror"
180 <<
setw(20) <<
"O2res (mole frac)" <<
nl
185 for (
int i=0; i<16; i++)
187 scalar equiv = 0.6 + i*0.05;
188 scalar ft = 1/(1 + stoichiometricAirFuelMassRatio.value()/equiv);
191 for (
int j=0; j<28; j++)
193 scalar
T0 = 300.0 + j*100.0;
196 scalar o2 = (1.0/equiv)*stoicO2;
197 scalar n2 = (0.79/0.21)*o2;
198 scalar fres =
max(1.0 - 1.0/equiv, 0.0);
199 scalar fburnt = 1.0 - fres;
203 scalar oresInit =
max(1.0/equiv - 1.0, 0.0)*stoicO2;
204 scalar co2Init = fburnt*stoicCO2;
205 scalar h2oInit = fburnt*stoicH2O;
207 scalar ores = oresInit;
208 scalar co2 = co2Init;
209 scalar h2o = h2oInit;
215 scalar
N = fres + n2 + co2 + h2o + ores;
219 scalar adiabaticFlameTemperature =
221 + (fburnt/(1.0 + o2 + n2))/(1.0/(1.0 + (1.0 + 0.79/0.21)*stoicO2))
224 scalar equilibriumFlameTemperature = adiabaticFlameTemperature;
228 for (
int j=0; j<20; j++)
235 CO2BreakUp.Kn(P, equilibriumFlameTemperature,
N)
243 H2OBreakUp.Kn(P, equilibriumFlameTemperature,
N)
250 ores = oresInit + 0.5*co + 0.5*h2;
260 fres*FUEL + ores*O2 + n2*
N2
261 + co2*CO2 + h2o*
H2O + co*CO + h2*H2
265 scalar equilibriumFlameTemperatureNew =
266 products.THa(reactants.Ha(P,
T0), P, adiabaticFlameTemperature);
270 adiabaticFlameTemperature = equilibriumFlameTemperatureNew;
274 equilibriumFlameTemperature = 0.5*
276 equilibriumFlameTemperature
277 + equilibriumFlameTemperatureNew
285 <<
setw(12) << adiabaticFlameTemperature
286 <<
setw(12) << equilibriumFlameTemperature
288 << adiabaticFlameTemperature - equilibriumFlameTemperature
289 <<
setw(12) << ores/
N
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
A class for handling words, derived from Foam::string.
A class for handling file names.
Input from file stream, using an ISstream.
psiReactionThermo & thermo
Thermodynamics mapping class to expose the absolute enthalpy functions.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Extract command arguments and options from the supplied argc and argv parameters.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar W() const
Molecular weight [kg/kmol].
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
fileName findEtcFile(const fileName &name, const bool mandatory=false, unsigned short location=0777)
Search for a single FILE within the etc directories.
messageStream Info
Information stream (uses stdout - output is on the master only)
Istream and Ostream manipulators taking arguments.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
errorManip< error > abort(error &err)
Omanip< int > setw(const int i)
Functions to search 'etc' directories for configuration files etc.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedScalar sqrt(const dimensionedScalar &ds)
const Vector< label > N(dict.get< Vector< label >>("N"))
static void noParallel()
Remove the parallel options.
Foam::argList args(argc, argv)