33template<
class ThermoType>
41 const label speciei =
reaction.lhs()[i].index;
42 const scalar stoichCoeff =
reaction.lhs()[i].stoichCoeff;
49 const label speciei =
reaction.rhs()[i].index;
50 const scalar stoichCoeff =
reaction.rhs()[i].stoichCoeff;
56 Info<<
"Fuel heat of combustion :" << qFuel_.value() <<
endl;
60template<
class ThermoType>
63 const label O2Index = this->species().find(
"O2");
64 const scalar Wu = this->speciesData()[fuelIndex_].W();
67 (this->speciesData()[inertIndex_].W()
68 * specieStoichCoeffs_[inertIndex_]
69 + this->speciesData()[O2Index].W()
70 * mag(specieStoichCoeffs_[O2Index]))
71 / (Wu*mag(specieStoichCoeffs_[fuelIndex_]));
74 (this->speciesData()[O2Index].W()
75 * mag(specieStoichCoeffs_[O2Index]))
76 / (Wu*mag(specieStoichCoeffs_[fuelIndex_]));
80 Info<<
"stoichiometric oxygen-fuel ratio :" <<
s_.value() <<
endl;
84template<
class ThermoType>
90 scalar totalMol = 0.0;
93 label speciei =
reaction.rhs()[i].index;
94 totalMol +=
mag(specieStoichCoeffs_[speciei]);
97 scalarList Xi(
reaction.rhs().size());
101 const label speciei =
reaction.rhs()[i].index;
102 Xi[i] = mag(specieStoichCoeffs_[speciei])/totalMol;
104 Wm += Xi[i]*this->speciesData()[speciei].W();
109 const label speciei =
reaction.rhs()[i].index;
110 Yprod0_[speciei] = this->speciesData()[speciei].W()/Wm*Xi[i];
113 Info<<
"Maximum products mass concentrations:" <<
nl;
118 Info<<
" " << this->species()[i] <<
": " << Yprod0_[i] <<
nl;
123 forAll(specieStoichCoeffs_, i)
125 specieStoichCoeffs_[i] =
126 specieStoichCoeffs_[i]
127 * this->speciesData()[i].W()
134template<
class ThermoType>
137 const Reaction<ThermoType>&
reaction = this->operator[](0);
139 const label O2Index = this->species().find(
"O2");
140 const volScalarField& YFuel = this->
Y()[fuelIndex_];
141 const volScalarField& YO2 = this->
Y()[O2Index];
146 const label speciei =
reaction.lhs()[i].index;
147 if (speciei == fuelIndex_)
149 fres_[speciei] = max(YFuel - YO2/s_, scalar(0));
151 else if (speciei == O2Index)
153 fres_[speciei] =
max(YO2 - YFuel*s_, scalar(0));
161 const label speciei =
reaction.rhs()[i].index;
162 if (speciei != inertIndex_)
164 forAll(fres_[speciei], celli)
166 if (fres_[fuelIndex_][celli] > 0.0)
169 fres_[speciei][celli] =
171 * (1.0 + YO2[celli]/s_.value() - YFuel[celli]);
176 fres_[speciei][celli] =
180 - YO2[celli]/s_.value()*stoicRatio_.value()
181 + YFuel[celli]*stoicRatio_.value()
192template<
class ThermoType>
193Foam::singleStepReactingMixture<ThermoType>::singleStepReactingMixture
197 const word& phaseName
201 stoicRatio_(dimensionedScalar(
"stoicRatio", dimless, Zero)),
202 s_(dimensionedScalar(
"s", dimless, Zero)),
203 qFuel_(dimensionedScalar(
"qFuel", sqr(dimVelocity), Zero)),
204 specieStoichCoeffs_(this->species_.size(), Zero),
205 Yprod0_(this->species_.size(), Zero),
206 fres_(Yprod0_.size()),
207 inertIndex_(this->species().find(
thermoDict.get<word>(
"inertSpecie"))),
208 fuelIndex_(this->species().find(
thermoDict.get<word>(
"fuel"))),
209 specieProd_(Yprod0_.size(), 1)
211 if (this->
size() == 1)
217 "fres_" + this->species()[fresI],
218 mesh.time().timeName(),
245 <<
"Only one reaction required for single step reaction"
253template<
class ThermoType>
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
label size() const noexcept
chemistryReader< ThermoType > * get() noexcept
speciesTable species_
Table of specie names.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
label find(const word &val) const
Find index of the value (searches the hash).
const word & operator[](const label index) const
Return name corresponding to specified index.
const PtrList< ThermoType > & speciesData() const
Return the raw specie thermodynamic data.
dimensionedScalar s_
Stoichiometric oxygen-fuel mass ratio.
void fresCorrect()
Calculates the residual for all components.
label fuelIndex_
Fuel specie index.
scalarList Yprod0_
Mass concentrations at stoichiometric mixture for fres.
dimensionedScalar stoicRatio_
Stoichiometric air-fuel mass ratio.
void calculateMaxProducts()
Calculate maximum products at stoichiometric mixture.
void read(const dictionary &)
Read dictionary.
label inertIndex_
Inert specie index.
List< int > specieProd_
List to indicate if specie is produced/consumed.
PtrList< volScalarField > fres_
List of components residual.
void massAndAirStoichRatios()
Calculate air/fuel and oxygen/fuel ratio.
scalarList specieStoichCoeffs_
Stoichiometric coefficient for the reaction.
void calculateqFuel()
Calculate qFuel.
dimensionedScalar qFuel_
Heat of combustion [J/Kg].
A class for handling words, derived from Foam::string.
PtrList< volScalarField > & Y
const dictionary & thermoDict
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
CombustionModel< rhoReactionThermo > & reaction
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVelocity
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< scalar > scalarList
List of scalar.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.