30 template<
class CompType,
class ThermoType>
38 searchInitSet_(this->coeffsDict_.subDict(
"initialSet").size())
44 if (initSet.
found(chemistry.
Y()[i].member()))
46 searchInitSet_[j++] = i;
49 if (j<searchInitSet_.size())
52 << searchInitSet_.size()-j
53 <<
" species in the initial set is not in the mechanism " 62 template<
class CompType,
class ThermoType>
69 template<
class CompType,
class ThermoType>
79 for(
label i=0; i<this->nSpecie_; i++)
84 c1[this->nSpecie_] =
T;
85 c1[this->nSpecie_+1] =
p;
100 scalar pf, cf, pr, cr;
102 forAll(this->chemistry_.reactions(), i)
106 scalar omegai = this->chemistry_.omega
108 R, c1, T, p, pf, cf, lRef, pr, cr, rRef
121 scalar sl = -R.
lhs()[
s].stoichCoeff;
134 wA.append(sl*omegai);
141 scalar sl = R.
rhs()[
s].stoichCoeff;
154 wA.append(sl*omegai);
165 label curID = wAID[id];
168 scalar curwA = ((wA[id]>=0) ? wA[
id] : -wA[
id]);
186 deltaBi[curID] =
false;
187 while(!usedIndex.empty())
191 if (deltaBi[curIndex])
194 deltaBi[curIndex] =
false;
197 if (rABPos(curID, curIndex)==-1)
199 rABPos(curID, curIndex) = NbrABInit[curID];
201 rABNum(curID, rABPos(curID, curIndex)) = curwA;
202 rABOtherSpec(curID, rABPos(curID, curIndex)) = curIndex;
206 rABNum(curID, rABPos(curID, curIndex)) += curwA;
210 if (rABDen[curID] == 0.0)
212 rABDen[curID] = curwA;
216 rABDen[curID] +=curwA;
222 label speciesNumber = 0;
226 for (
label i=0; i<this->nSpecie_; i++)
228 this->activeSpecies_[i] =
false;
235 for (
label i=0; i<searchInitSet_.size(); i++)
237 label q = searchInitSet_[i];
238 this->activeSpecies_[q] =
true;
247 scalar Den = rABDen[u];
251 for (
label v=0; v<NbrABInit[u]; v++)
253 label otherSpec = rABOtherSpec(u, v);
254 scalar rAB = rABNum(u, v)/Den;
265 rAB >= this->tolerance()
266 && !this->activeSpecies_[otherSpec]
270 this->activeSpecies_[otherSpec] =
true;
278 forAll(this->chemistry_.reactions(), i)
281 this->chemistry_.reactionsDisabled()[i] =
false;
288 if (!this->activeSpecies_[ss])
291 this->chemistry_.reactionsDisabled()[i] =
true;
297 if (!this->chemistry_.reactionsDisabled()[i])
302 if (!this->activeSpecies_[ss])
304 this->chemistry_.reactionsDisabled()[i] =
true;
311 this->NsSimp_ = speciesNumber;
312 this->chemistry_.simplifiedC().setSize(this->NsSimp_+2);
313 this->chemistry_.simplifiedToCompleteIndex().setSize(this->NsSimp_);
316 for (
label i=0; i<this->nSpecie_; i++)
318 if (this->activeSpecies_[i])
320 this->chemistry_.simplifiedToCompleteIndex()[j] = i;
321 this->chemistry_.simplifiedC()[j] = c[i];
322 this->chemistry_.completeToSimplifiedIndex()[i] = j++;
323 if (!this->chemistry_.active(i))
325 this->chemistry_.setActive(i);
330 this->chemistry_.completeToSimplifiedIndex()[i] = -1;
334 this->chemistry_.simplifiedC()[this->NsSimp_] =
T;
335 this->chemistry_.simplifiedC()[this->NsSimp_+1] =
p;
336 this->chemistry_.setNsDAC(this->NsSimp_);
340 this->chemistry_.setNSpecie(this->NsSimp_);
A FIFO stack based on a singly-linked list.
virtual label nSpecie() const
The number of species.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#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.
PtrList< volScalarField > & Y()
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...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
DRG(const IOdictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry)
Construct from components.
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
BasicChemistryModel< rhoReactionThermo > & chemistry
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 dictionary & subDict(const word &) const
Find and return a sub-dictionary.
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...
virtual void reduceMechanism(const scalarField &c, const scalar T, const scalar p)
Reduce the mechanism.
#define R(A, B, C, D, E, F, K, M)
void push(const T &a)
Push an element onto the stack.
const dimensionedScalar c1
First radiation constant: default SI units: [W/m^2].
T pop()
Pop the bottom element off the stack.
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
An abstract class for methods of chemical mechanism reduction.