59int main(
int argc,
char *argv[])
63 "Calculate the adiabatic flame temperature for a given fuel over a "
64 " range of unburnt temperatures and equivalence ratios."
67 argList::noParallel();
68 argList::noFunctionObjects();
70 argList::addArgument(
"controlFile");
77 IFstream controlFile(controlFileName);
80 if (!controlFile.good())
83 <<
"Cannot read file " << controlFileName
90 const scalar P(control.get<scalar>(
"P"));
91 const scalar
T0(control.get<scalar>(
"T0"));
92 const word fuelName(control.get<
word>(
"fuel"));
93 const scalar
n(control.get<scalar>(
"n"));
94 const scalar m(control.get<scalar>(
"m"));
96 Info<<
nl <<
"Reading thermodynamic data dictionary" <<
endl;
101 IFstream thermoDataFile(thermoDataFileName);
104 if (!thermoDataFile.good())
107 <<
"Cannot read file " << thermoDataFileName
114 scalar stoicO2 =
n + m/4.0;
115 scalar stoicN2 = (0.79/0.21)*stoicO2;
117 scalar stoicH2O = m/2.0;
122 thermo(thermoData.subDict(fuelName))
124 Info<<
"fuel " << FUEL <<
';' <<
endl;
130 thermo(thermoData.subDict(
"O2"))
137 thermo(thermoData.subDict(
"N2"))
144 thermo(thermoData.subDict(
"CO2"))
151 thermo(thermoData.subDict(
"H2O"))
161 Info<<
"oxidant " << (1/oxidant.Y())*oxidant <<
';' << endl;
165 "stoichiometricAirFuelMassRatio",
170 Info<<
"stoichiometricAirFuelMassRatio "
171 << stoichiometricAirFuelMassRatio <<
';' <<
endl;
173 for (
int i=0; i<300; i++)
175 scalar equiv = (i + 1)*0.01;
176 scalar ft = 1/(1 + stoichiometricAirFuelMassRatio.value()/equiv);
178 Info<<
"phi = " << equiv <<
nl
179 <<
"ft = " << ft <<
endl;
181 scalar o2 = (1.0/equiv)*stoicO2;
182 scalar n2 = (0.79/0.21)*o2;
183 scalar fres =
max(1.0 - 1.0/equiv, 0.0);
184 scalar ores =
max(1.0/equiv - 1.0, 0.0);
185 scalar fburnt = 1.0 - fres;
190 FUEL + (1.0/equiv)*oxidant
192 Info<<
"reactants " << (1/reactants.Y())*reactants <<
';' << endl;
197 + (n2 - (0.79/0.21)*ores*stoicO2)*
N2
198 + fburnt*stoicCO2*CO2
199 + fburnt*stoicH2O*
H2O
201 Info<<
"burntProducts "
202 << (1/burntProducts.Y())*burntProducts <<
';' << endl;
209 + fburnt*stoicCO2*CO2
210 + fburnt*stoicH2O*
H2O
214 Info<<
"products " << (1/products.Y())*products <<
';' << endl;
216 scalar Tad = products.THa(reactants.Ha(P,
T0), P, 1000.0);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Input from file stream, using an ISstream.
Thermodynamics mapping class to expose the absolute enthalpy functions.
Extract command arguments and options from the supplied argc and argv parameters.
T get(const label index) const
Get a value from the argument at index.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
scalar W() const
Molecular weight [kg/kmol].
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Functions to search 'etc' directories for configuration files etc.
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName findEtcFile(const fileName &name, const bool mandatory=false, unsigned short location=0777)
Search for a single FILE within the etc directories.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)