30 template<
class ThermoType>
51 phiTol_(this->tolerance()),
55 dict.subDict(
"reduction").lookupOrDefault<
word>
62 dict.subDict(
"reduction").lookupOrDefault<
word>
69 dict.subDict(
"reduction").lookupOrDefault<
word>
76 dict.subDict(
"reduction").lookupOrDefault<
word>
83 dict.subDict(
"reduction").lookupOrDefault<
word>
88 forceFuelInclusion_(
false)
90 const wordHashSet initSet(this->coeffsDict_.lookup(
"initialSet"));
93 searchInitSet_.append(chemistry.
mixture().species()[iter.key()]);
96 if (this->coeffsDict_.found(
"automaticSIS"))
98 automaticSIS_.readIfPresent(
"automaticSIS", this->coeffsDict_);
101 if (this->coeffsDict_.found(
"forceFuelInclusion"))
103 forceFuelInclusion_.readIfPresent
105 "forceFuelInclusion",this->coeffsDict_
109 if (this->coeffsDict_.found(
"phiTol"))
111 phiTol_ = this->coeffsDict_.template lookup<scalar>(
"phiTol");
114 if (this->coeffsDict_.found(
"NOxThreshold"))
117 this->coeffsDict_.template lookup<scalar>(
"NOxThreshold");
123 chemistry.
mixture().specieComposition(i);
126 forAll(curSpecieComposition, j)
129 curSpecieComposition[j];
130 if (curElement.
name() ==
"C")
132 sC_[i] = curElement.
nAtoms();
134 else if (curElement.
name() ==
"H")
136 sH_[i] = curElement.
nAtoms();
138 else if (curElement.
name() ==
"O")
140 sO_[i] = curElement.
nAtoms();
142 else if (curElement.
name() ==
"N")
144 sN_[i] = curElement.
nAtoms();
148 Info<<
"element not considered"<<
endl;
151 if (this->chemistry_.Y()[i].member() == CO2Name_)
155 else if (this->chemistry_.Y()[i].member() == COName_)
159 else if (this->chemistry_.Y()[i].member() == HO2Name_)
163 else if (this->chemistry_.Y()[i].member() == H2OName_)
167 else if (this->chemistry_.Y()[i].member() == NOName_)
173 if ((CO2Id_==-1 || COId_==-1 || HO2Id_==-1 || H2OId_==-1) && automaticSIS_)
176 <<
"The name of the species used in automatic SIS are not found in " 177 <<
" the mechanism. You should either set the name for CO2, CO, H2O" 178 <<
" and HO2 properly or set automaticSIS to off " 188 this->coeffsDict_.lookup(
"fuelSpecies")
191 fuelSpecies_.
setSize(fuelSpeciesEntry.size());
192 fuelSpeciesID_.setSize(fuelSpeciesEntry.size());
193 fuelSpeciesProp_.setSize(fuelSpeciesEntry.size());
196 forAll(fuelSpeciesEntry, i)
198 fuelSpecies_[i] = fuelSpeciesEntry[i].first();
199 fuelSpeciesProp_[i] = fuelSpeciesEntry[i].second();
201 this->chemistry_.mixture().species()[fuelSpecies_[i]];
203 this->chemistry_.specieThermos()[fuelSpeciesID_[i]].W();
204 Mmtot += fuelSpeciesProp_[i]/curMm;
207 this->coeffsDict_.readIfPresent(
"nbCLarge", nbCLarge_);
214 label curID = fuelSpeciesID_[i];
215 scalar curMm = this->chemistry_.specieThermos()[curID].W();
217 nbC += fuelSpeciesProp_[i]*Mmtot/curMm*sC_[curID];
218 nbO += fuelSpeciesProp_[i]*Mmtot/curMm*sO_[curID];
227 template<
class ThermoType>
234 template<
class ThermoType>
268 forAll(this->chemistry_.reactions(), i)
273 scalar omegaf, omegar;
274 const scalar omegai = R.
omega(p, T, c1, li, omegaf, omegar);
292 scalar sl = -R.
lhs()[
s].stoichCoeff;
311 while(!usedIndex.empty())
314 if (deltaBi[curIndex])
317 deltaBi[curIndex] =
false;
319 if (rABPos(ss, curIndex)==-1)
322 rABPos(ss, curIndex) = NbrABInit[ss];
325 rABNum(ss, rABPos(ss, curIndex)) = sl*omegai;
327 rABOtherSpec(ss, rABPos(ss, curIndex)) = curIndex;
331 rABNum(ss, rABPos(ss, curIndex)) += sl*omegai;
347 wA.append(sl*omegai);
355 scalar sl = R.
rhs()[
s].stoichCoeff;
374 while(!usedIndex.empty())
377 if (deltaBi[curIndex])
380 deltaBi[curIndex] =
false;
383 if (rABPos(ss, curIndex) == -1)
386 rABPos(ss, curIndex) = NbrABInit[ss];
388 rABNum(ss, rABPos(ss, curIndex)) = sl*omegai;
389 rABOtherSpec(ss, rABPos(ss, curIndex)) = curIndex;
393 rABNum(ss, rABPos(ss, curIndex)) += sl*omegai;
409 wA.append(sl*omegai);
422 if (PA[wAID[
id]] == 0.0)
424 PA[wAID[id]] = wA[id];
428 PA[wAID[id]] += wA[id];
433 if (CA[wAID[
id]] == 0.0)
435 CA[wAID[id]] = -wA[id];
439 CA[wAID[id]] += -wA[id];
446 scalar phiLarge(0.0);
447 scalar phiProgress(0.0);
463 this->chemistry_.Y()[i].member() ==
"CO2" 464 || this->chemistry_.Y()[i].member() ==
"H2O" 469 Na[0] += sC_[i]*c[i];
470 Na[1] += sH_[i]*c[i];
471 Na[2] += sO_[i]*c[i];
472 if (sC_[i]>nbCLarge_ || this->chemistry_.Y()[i].member() ==
"O2")
474 Nal[0] += sC_[i]*c[i];
475 Nal[1] += sH_[i]*c[i];
476 Nal[2] += sO_[i]*c[i];
485 phiProgress = (2*Na[0]+Na[1]/2-zprime_*Na[0])/(Na[2]-zprime_*Na[0]);
490 phiLarge = (2*Nal[0]+Nal[1]/2)/Nal[2];
501 this->activeSpecies_[i] =
false;
513 if (phiLarge >= phiTol_ && phiProgress >= phiTol_)
518 this->activeSpecies_[COId_] =
true;
521 this->activeSpecies_[HO2Id_] =
true;
522 Rvalue[HO2Id_] = 1.0;
525 Q.
push(fuelSpeciesID_[i]);
526 this->activeSpecies_[fuelSpeciesID_[i]] =
true;
527 Rvalue[fuelSpeciesID_[i]] = 1.0;
531 else if (phiLarge < phiTol_ && phiProgress >= phiTol_)
536 this->activeSpecies_[COId_] =
true;
539 this->activeSpecies_[HO2Id_] =
true;
540 Rvalue[HO2Id_] = 1.0;
542 if (forceFuelInclusion_)
546 Q.
push(fuelSpeciesID_[i]);
547 this->activeSpecies_[fuelSpeciesID_[i]] =
true;
548 Rvalue[fuelSpeciesID_[i]] = 1.0;
557 this->activeSpecies_[CO2Id_] =
true;
558 Rvalue[CO2Id_] = 1.0;
561 this->activeSpecies_[H2OId_] =
true;
562 Rvalue[H2OId_] = 1.0;
563 if (forceFuelInclusion_)
567 Q.
push(fuelSpeciesID_[i]);
568 this->activeSpecies_[fuelSpeciesID_[i]] =
true;
569 Rvalue[fuelSpeciesID_[i]] = 1.0;
574 if (T>NOxThreshold_ && NOId_!=-1)
577 this->activeSpecies_[NOId_] =
true;
586 this->activeSpecies_[q] =
true;
596 scalar Den =
max(PA[u],CA[u]);
599 for (
label v=0; v<NbrABInit[u]; v++)
601 label otherSpec = rABOtherSpec(u, v);
602 scalar rAB =
mag(rABNum(u, v))/Den;
608 if (rAB >= this->tolerance())
610 scalar Rtemp = Rvalue[u]*rAB;
614 if ((Rvalue[otherSpec]<Rtemp) && (Rtemp>=this->tolerance()))
617 Rvalue[otherSpec] = Rtemp;
618 if (!this->activeSpecies_[otherSpec])
620 this->activeSpecies_[otherSpec] =
true;
A FIFO stack based on a singly-linked list.
A HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
scalar omega(const scalar p, const scalar T, const scalarField &c, const label li, scalar &omegaf, scalar &omegar) const
Net reaction rate.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const dimensionedScalar c1
First radiation constant: default SI units: [W/m^2].
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling words, derived from string.
const word & name() const
Return the name of the element.
label nAtoms() const
Return the number of atoms of this element in the specie.
basicChemistryModel & chemistry
const multiComponentMixture< ThermoType > & mixture() const
Return reference to the mixture.
virtual ~DAC()
Destructor.
void setSize(const label)
Reset size of List.
Extends base chemistry model by adding a thermo package, and ODE functions. Introduces chemistry equa...
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
#define R(A, B, C, D, E, F, K, M)
DAC(const IOdictionary &dict, chemistryModel< ThermoType > &chemistry)
Construct from components.
void push(const T &a)
Push an element onto the stack.
dimensioned< scalar > mag(const dimensioned< Type > &)
T pop()
Pop the bottom element off the stack.
An abstract class for methods of chemical mechanism reduction.
virtual void reduceMechanism(const scalar p, const scalar T, const scalarField &c, List< label > &ctos, DynamicList< label > &stoc, const label li)
Reduce the mechanism.