38 const scalar stoichCoeff =
reaction_.
lhs()[i].stoichCoeff;
47 const scalar stoichCoeff =
reaction_.
rhs()[i].stoichCoeff;
60 const label O2Index = thermo_.species()[
"O2"];
61 const scalar Wu = thermo_.WiValue(fuelIndex_);
65 thermo_.WiValue(thermo_.defaultSpecie())
66 *specieStoichCoeffs_[thermo_.defaultSpecie()]
67 + thermo_.WiValue(O2Index)*
mag(specieStoichCoeffs_[O2Index])
68 )/(Wu*
mag(specieStoichCoeffs_[fuelIndex_]));
70 s_ = thermo_.WiValue(O2Index)*
mag(specieStoichCoeffs_[O2Index])
71 /(Wu*
mag(specieStoichCoeffs_[fuelIndex_]));
73 Info <<
"stoichiometric air-fuel ratio: " << stoicRatio_.value() <<
endl;
74 Info <<
"stoichiometric oxygen-fuel ratio: " << s_.value() <<
endl;
81 scalar totalMol = 0.0;
84 label speciei = reaction_.rhs()[i].index;
85 totalMol +=
mag(specieStoichCoeffs_[speciei]);
92 const label speciei = reaction_.rhs()[i].index;
93 Xi[i] =
mag(specieStoichCoeffs_[speciei])/totalMol;
94 Wm += Xi[i]*thermo_.WiValue(speciei);
99 const label speciei = reaction_.rhs()[i].index;
100 Yprod0_[speciei] = thermo_.WiValue(speciei)/Wm*Xi[i];
103 Info <<
"Maximum products mass concentrations: " <<
nl;
108 Info<<
" " << thermo_.species()[i] <<
": " << Yprod0_[i] <<
nl;
113 forAll(specieStoichCoeffs_, i)
115 specieStoichCoeffs_[i] =
116 specieStoichCoeffs_[i]*thermo_.WiValue(i)
117 /(thermo_.WiValue(fuelIndex_)*
mag(specieStoichCoeffs_[fuelIndex_]));
126 const word& modelType,
129 const word& reactionProperties
133 reaction_(thermo_.species(), this->subDict(
"reaction")),
137 specieStoichCoeffs_(thermo_.species().size(), 0.0),
138 Yprod0_(thermo_.species().size(), 0.0),
139 fres_(Yprod0_.size()),
140 fuelIndex_(thermo_.species()[
thermo.properties().
lookup(
"fuel")]),
141 specieProd_(Yprod0_.size(), 1),
146 this->
thermo().phasePropertyName(
"wFuel"),
162 this->mesh().time().name(),
186 Info<<
"Reaction mode: semi-implicit" <<
endl;
190 Info<<
"Reaction mode: explicit" <<
endl;
206 return wFuel_()*specieStoichCoeffs()[speciei];
213 const label specieI = thermo_.species()[
Y.member()];
217 wFuel_*specieStoichCoeffs()[specieI]
222 const label fNorm = specieProd()[specieI];
224 wSpecie /=
max(fNorm*(
Y - fres), scalar(1
e-2));
226 return -fNorm*wSpecie*fres + fNorm*
fvm::Sp(wSpecie,
Y);
230 return wSpecie +
fvm::Sp(0.0*wSpecie,
Y);
238 const label fuelI = fuelIndex();
242 return -qFuel()*(
R(YFuel) & YFuel);
261 const label O2Index = thermo_.species()[
"O2"];
266 forAll(reaction_.lhs(), i)
268 const label speciei = reaction_.lhs()[i].index;
269 if (speciei == fuelIndex_)
271 fres_[speciei] =
max(YFuel - YO2/s_, scalar(0));
273 else if (speciei == O2Index)
275 fres_[speciei] =
max(YO2 - YFuel*s_, scalar(0));
280 forAll(reaction_.rhs(), i)
282 const label speciei = reaction_.rhs()[i].index;
283 if (speciei != thermo_.defaultSpecie())
285 forAll(fres_[speciei], celli)
287 if (fres_[fuelIndex_][celli] > 0.0)
290 fres_[speciei][celli] =
292 * (1.0 + YO2[celli]/s_.value() - YFuel[celli]);
297 fres_[speciei][celli] =
301 - YO2[celli]/s_.value()*stoicRatio_.value()
302 + YFuel[celli]*stoicRatio_.value()
#define forAll(list, i)
Loop across all elements in list.
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Base class for single-phase compressible momentum transport models.
const Type & value() const
Return const reference to value.
Base-class for multi-component fluid thermodynamic properties.
virtual scalar hfiValue(const label speciei) const =0
Enthalpy of formation [J/kg].
virtual const speciesTable & species() const =0
Return the table of species.
virtual scalar WiValue(const label speciei) const =0
Molecular weight [kg/kmol].
Base class for reaction models.
const fluidMulticomponentThermo & thermo_
Reference to the thermo.
const fvMesh & mesh() const
Return const access to the mesh database.
virtual bool read()
Update properties from given dictionary.
void fresCorrect()
Calculates the residual for all components.
label fuelIndex_
Fuel specie index.
void calculateMaxProducts()
Calculate maximum products at stoichiometric mixture.
reaction reaction_
The single-step reaction.
singleStepReaction(const word &modelType, const fluidMulticomponentThermo &thermo, const compressibleMomentumTransportModel &turb, const word &reactionProperties)
Construct from components.
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.
virtual ~singleStepReaction()
Destructor.
scalarList specieStoichCoeffs_
Stoichiometric coefficient for the reaction.
virtual tmp< volScalarField::Internal > R(const label speciei) const
Specie consumption rate field.
void calculateqFuel()
Calculate qFuel.
bool semiImplicit_
Semi-implicit (true) or explicit (false) treatment.
virtual tmp< volScalarField > Qdot() const
Heat release rate [kg/m/s^3].
dimensionedScalar qFuel_
Heat of reaction [J/Kg].
virtual bool read()
Update properties from given dictionary.
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
A class for managing temporary objects.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Calculate the matrix for implicit and explicit sources.
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
const dimensionSet & dimless
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const dimensionSet & dimMass
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet & dimVolume
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
const dimensionSet & dimVelocity
const dimensionSet & dimTime
static scalar R(const scalar a, const scalar x)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
PtrList< volScalarField > & Y
fluidMulticomponentThermo & thermo