59 int 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." 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);
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void noParallel()
Remove the parallel options.
Thermodynamics mapping class to expose the absolute enthalpy functions.
const dimensionSet dimless
Dimensionless.
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 Foam::string.
Functions to search 'etc' directories for configuration files etc.
scalar W() const
Molecular weight [kg/kmol].
Extract command arguments and options from the supplied argc and argv parameters. ...
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Input from file stream, using an ISstream.
T get(const label index) const
Get a value from the argument at index.
fileName findEtcFile(const fileName &name, const bool mandatory=false, unsigned short location=0777)
Search for a single FILE within the etc directories.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::argList args(argc, argv)