31 template<
class ThermoType>
35 const scalar Wu = this->speciesData()[fuelIndex_].W();
39 const label speciei = reaction.
lhs()[i].index;
40 const scalar stoichCoeff = reaction.
lhs()[i].stoichCoeff;
41 specieStoichCoeffs_[speciei] = -stoichCoeff;
42 qFuel_.value() += this->speciesData()[speciei].hc()*stoichCoeff/Wu;
47 const label speciei = reaction.
rhs()[i].index;
48 const scalar stoichCoeff = reaction.
rhs()[i].stoichCoeff;
49 specieStoichCoeffs_[speciei] = stoichCoeff;
50 qFuel_.value() -= this->speciesData()[speciei].hc()*stoichCoeff/Wu;
51 specieProd_[speciei] = -1;
54 Info <<
"Fuel heat of combustion :" << qFuel_.value() <<
endl;
58 template<
class ThermoType>
61 const label O2Index = this->species()[
"O2"];
62 const scalar Wu = this->speciesData()[fuelIndex_].W();
65 (this->speciesData()[inertIndex_].W()
66 * specieStoichCoeffs_[inertIndex_]
67 + this->speciesData()[O2Index].W()
68 *
mag(specieStoichCoeffs_[O2Index]))
69 / (Wu*
mag(specieStoichCoeffs_[fuelIndex_]));
72 (this->speciesData()[O2Index].W()
73 *
mag(specieStoichCoeffs_[O2Index]))
74 / (Wu*
mag(specieStoichCoeffs_[fuelIndex_]));
76 Info <<
"stoichiometric air-fuel ratio :" << stoicRatio_.value() <<
endl;
78 Info <<
"stoichiometric oxygen-fuel ratio :" << s_.value() <<
endl;
82 template<
class ThermoType>
88 scalar totalMol = 0.0;
91 label speciei = reaction.
rhs()[i].index;
92 totalMol +=
mag(specieStoichCoeffs_[speciei]);
99 const label speciei = reaction.
rhs()[i].index;
100 Xi[i] =
mag(specieStoichCoeffs_[speciei])/totalMol;
102 Wm += Xi[i]*this->speciesData()[speciei].W();
107 const label speciei = reaction.
rhs()[i].index;
108 Yprod0_[speciei] = this->speciesData()[speciei].W()/Wm*Xi[i];
111 Info <<
"Maximum products mass concentrations:" <<
nl;
116 Info<<
" " << this->species()[i] <<
": " << Yprod0_[i] <<
nl;
121 forAll(specieStoichCoeffs_, i)
123 specieStoichCoeffs_[i] =
124 specieStoichCoeffs_[i]
125 * this->speciesData()[i].W()
126 / (this->speciesData()[fuelIndex_].W()
127 *
mag(specieStoichCoeffs_[fuelIndex_]));
132 template<
class ThermoType>
137 label O2Index = this->species()[
"O2"];
144 const label speciei = reaction.
lhs()[i].index;
145 if (speciei == fuelIndex_)
147 fres_[speciei] =
max(YFuel - YO2/s_, scalar(0.0));
149 else if (speciei == O2Index)
151 fres_[speciei] =
max(YO2 - YFuel*s_, scalar(0.0));
159 const label speciei = reaction.
rhs()[i].index;
160 if (speciei != inertIndex_)
162 forAll(fres_[speciei], celli)
164 if (fres_[fuelIndex_][celli] > 0.0)
167 fres_[speciei][celli] =
169 * (1.0 + YO2[celli]/s_.value() - YFuel[celli]);
174 fres_[speciei][celli] =
178 - YO2[celli]/s_.value()*stoicRatio_.value()
179 + YFuel[celli]*stoicRatio_.value()
190 template<
class ThermoType>
195 const word& phaseName
202 specieStoichCoeffs_(this->species_.size(), 0.0),
203 Yprod0_(this->species_.size(), 0.0),
204 fres_(Yprod0_.size()),
205 inertIndex_(this->species()[thermoDict.lookup(
"inertSpecie")]),
206 fuelIndex_(this->species()[thermoDict.lookup(
"fuel")]),
207 specieProd_(Yprod0_.size(), 1)
209 if (this->size() == 1)
215 "fres_" + this->species()[fresI],
216 mesh.time().timeName(),
236 massAndAirStoichRatios();
238 calculateMaxProducts();
245 <<
"Only one reaction required for single step reaction" 253 template<
class ThermoType>
const List< specieCoeffs > & lhs() const
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
Single step reacting mixture.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void massAndAirStoichRatios()
Calculate air/fuel and oxygen/fuel ratio.
const List< specieCoeffs > & rhs() const
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
A class for handling words, derived from string.
word name(const complex &)
Return a string representation of a complex.
void calculateMaxProducts()
Calculate maximum products at stoichiometric mixture.
void read(const dictionary &)
Read dictionary.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Info<< "Creating reaction model\n"<< endl;autoPtr< combustionModels::psiCombustionModel > reaction(combustionModels::psiCombustionModel::New(mesh))
PtrList< volScalarField > & Y
Mesh data needed to do the Finite Volume discretisation.
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
void fresCorrect()
Calculates the residual for all components.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void calculateqFuel()
Calculate qFuel.
const dimensionSet dimVelocity