33 namespace combustionModels
38 template<
class ReactionThermo,
class ThermoType>
42 const scalar Wu = mixture_.specieThermos()[fuelIndex_].W();
46 const label speciei = reaction.
lhs()[i].index;
47 const scalar stoichCoeff = reaction.
lhs()[i].stoichCoeff;
48 specieStoichCoeffs_[speciei] = -stoichCoeff;
49 qFuel_.value() += mixture_.specieThermos()[speciei].hc()*stoichCoeff/Wu;
54 const label speciei = reaction.
rhs()[i].index;
55 const scalar stoichCoeff = reaction.
rhs()[i].stoichCoeff;
56 specieStoichCoeffs_[speciei] = stoichCoeff;
57 qFuel_.value() -= mixture_.specieThermos()[speciei].hc()*stoichCoeff/Wu;
58 specieProd_[speciei] = -1;
61 Info <<
"Fuel heat of combustion :" << qFuel_.value() <<
endl;
65 template<
class ReactionThermo,
class ThermoType>
68 const label O2Index = mixture_.species()[
"O2"];
69 const scalar Wu = mixture_.specieThermos()[fuelIndex_].W();
72 (mixture_.specieThermos()[inertIndex_].W()
73 * specieStoichCoeffs_[inertIndex_]
74 + mixture_.specieThermos()[O2Index].W()
75 *
mag(specieStoichCoeffs_[O2Index]))
76 / (Wu*
mag(specieStoichCoeffs_[fuelIndex_]));
79 (mixture_.specieThermos()[O2Index].W()
80 *
mag(specieStoichCoeffs_[O2Index]))
81 / (Wu*
mag(specieStoichCoeffs_[fuelIndex_]));
83 Info <<
"stoichiometric air-fuel ratio :" << stoicRatio_.value() <<
endl;
85 Info <<
"stoichiometric oxygen-fuel ratio :" << s_.value() <<
endl;
89 template<
class ReactionThermo,
class ThermoType>
95 scalar totalMol = 0.0;
98 label speciei = reaction.
rhs()[i].index;
99 totalMol +=
mag(specieStoichCoeffs_[speciei]);
106 const label speciei = reaction.
rhs()[i].index;
107 Xi[i] =
mag(specieStoichCoeffs_[speciei])/totalMol;
108 Wm += Xi[i]*mixture_.specieThermos()[speciei].W();
113 const label speciei = reaction.
rhs()[i].index;
114 Yprod0_[speciei] = mixture_.specieThermos()[speciei].W()/Wm*Xi[i];
117 Info <<
"Maximum products mass concentrations:" <<
nl;
122 Info<<
" " << mixture_.species()[i] <<
": " << Yprod0_[i] <<
nl;
127 forAll(specieStoichCoeffs_, i)
129 specieStoichCoeffs_[i] =
130 specieStoichCoeffs_[i]
131 * mixture_.specieThermos()[i].W()
132 / (mixture_.specieThermos()[fuelIndex_].W()
133 *
mag(specieStoichCoeffs_[fuelIndex_]));
140 template<
class ReactionThermo,
class ThermoType>
143 const word& modelType,
144 const ReactionThermo& thermo,
146 const word& combustionProperties
159 mixture_.specieThermos(),
160 this->subDict(
"reaction")
166 specieStoichCoeffs_(mixture_.species().size(), 0.0),
167 Yprod0_(mixture_.species().size(), 0.0),
168 fres_(Yprod0_.size()),
169 inertIndex_(mixture_.species()[thermo.
lookup(
"inertSpecie")]),
170 fuelIndex_(mixture_.species()[thermo.
lookup(
"fuel")]),
171 specieProd_(Yprod0_.size(), 1),
176 this->
thermo().phasePropertyName(
"wFuel"),
185 semiImplicit_(
readBool(this->coeffs_.lookup(
"semiImplicit")))
191 "fres_" + mixture_.species()[fresI],
192 this->
mesh().time().timeName(),
210 massAndAirStoichRatios();
212 calculateMaxProducts();
216 Info<<
"Combustion mode: semi-implicit" <<
endl;
220 Info<<
"Combustion mode: explicit" <<
endl;
227 template<
class ReactionThermo,
class ThermoType>
234 template<
class ReactionThermo,
class ThermoType>
240 const label specieI = mixture_.species()[Y.
member()];
244 wFuel_*specieStoichCoeffs()[specieI]
249 const label fNorm = specieProd()[specieI];
251 wSpecie /=
max(fNorm*(Y - fres), scalar(1
e-2));
253 return -fNorm*wSpecie*fres + fNorm*
fvm::Sp(wSpecie, Y);
257 return wSpecie +
fvm::Sp(0.0*wSpecie, Y);
262 template<
class ReactionThermo,
class ThermoType>
266 const label fuelI = fuelIndex();
270 return -qFuel()*(
R(YFuel) & YFuel);
274 template<
class ReactionThermo,
class ThermoType>
288 template<
class ReactionThermo,
class ThermoType>
293 const label O2Index = mixture_.species()[
"O2"];
300 const label speciei = reaction.
lhs()[i].index;
301 if (speciei == fuelIndex_)
303 fres_[speciei] =
max(YFuel - YO2/s_, scalar(0));
305 else if (speciei == O2Index)
307 fres_[speciei] =
max(YO2 - YFuel*s_, scalar(0));
314 const label speciei = reaction.
rhs()[i].index;
315 if (speciei != inertIndex_)
317 forAll(fres_[speciei], celli)
319 if (fres_[fuelIndex_][celli] > 0.0)
322 fres_[speciei][celli] =
324 * (1.0 + YO2[celli]/s_.value() - YFuel[celli]);
329 fres_[speciei][celli] =
333 - YO2[celli]/s_.value()*stoicRatio_.value()
334 + YFuel[celli]*stoicRatio_.value()
void calculateMaxProducts()
Calculate maximum products at stoichiometric mixture.
#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.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
rhoReactionThermo & thermo
static word member(const word &name)
Return member (name without the extension)
void calculateqFuel()
Calculate qFuel.
const dimensionSet dimVolume(pow3(dimLength))
A class for handling words, derived from string.
Foam::multiComponentMixture.
CombustionModel< rhoReactionThermo > & reaction
Thermo model wrapper for combustion models.
word name(const complex &)
Return a string representation of a complex.
virtual tmp< volScalarField > Qdot() const
Heat release rate [kg/m/s^3].
virtual bool read()
Update properties from given dictionary.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
#define R(A, B, C, D, E, F, K, M)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
PtrList< volScalarField > & Y
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual ~singleStepCombustion()
Destructor.
singleStepCombustion(const word &modelType, const ReactionThermo &thermo, const compressibleMomentumTransportModel &turb, const word &combustionProperties)
Construct from components.
const doubleScalar e
Elementary charge.
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void fresCorrect()
Calculates the residual for all components.
void massAndAirStoichRatios()
Calculate air/fuel and oxygen/fuel ratio.
Abstract base class for turbulence models (RAS, LES and laminar).
Calculate the matrix for implicit and explicit sources.
virtual tmp< fvScalarMatrix > R(volScalarField &Y) const
Fuel consumption rate matrix.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dimensionSet dimVelocity