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>
80 for(
label i=0; i<this->nSpecie_; i++)
85 c1[this->nSpecie_] =
T;
86 c1[this->nSpecie_+1] =
p;
101 scalar pf, cf, pr, cr;
103 forAll(this->chemistry_.reactions(), i)
108 scalar omegai = this->chemistry_.omega
110 R, p, T, c1, li, pf, cf, lRef, pr, cr, rRef
123 scalar sl = -R.
lhs()[
s].stoichCoeff;
136 wA.append(sl*omegai);
143 scalar sl = R.
rhs()[
s].stoichCoeff;
156 wA.append(sl*omegai);
167 label curID = wAID[id];
170 scalar curwA = ((wA[id]>=0) ? wA[
id] : -wA[
id]);
188 deltaBi[curID] =
false;
189 while(!usedIndex.empty())
193 if (deltaBi[curIndex])
196 deltaBi[curIndex] =
false;
199 if (rABPos(curID, curIndex)==-1)
201 rABPos(curID, curIndex) = NbrABInit[curID];
203 rABNum(curID, rABPos(curID, curIndex)) = curwA;
204 rABOtherSpec(curID, rABPos(curID, curIndex)) = curIndex;
208 rABNum(curID, rABPos(curID, curIndex)) += curwA;
212 if (rABDen[curID] == 0.0)
214 rABDen[curID] = curwA;
218 rABDen[curID] +=curwA;
224 label speciesNumber = 0;
228 for (
label i=0; i<this->nSpecie_; i++)
230 this->activeSpecies_[i] =
false;
237 for (
label i=0; i<searchInitSet_.size(); i++)
239 label q = searchInitSet_[i];
240 this->activeSpecies_[q] =
true;
249 scalar Den = rABDen[u];
253 for (
label v=0; v<NbrABInit[u]; v++)
255 label otherSpec = rABOtherSpec(u, v);
256 scalar rAB = rABNum(u, v)/Den;
267 rAB >= this->tolerance()
268 && !this->activeSpecies_[otherSpec]
272 this->activeSpecies_[otherSpec] =
true;
280 forAll(this->chemistry_.reactions(), i)
283 this->chemistry_.reactionsDisabled()[i] =
false;
290 if (!this->activeSpecies_[ss])
293 this->chemistry_.reactionsDisabled()[i] =
true;
299 if (!this->chemistry_.reactionsDisabled()[i])
304 if (!this->activeSpecies_[ss])
306 this->chemistry_.reactionsDisabled()[i] =
true;
313 this->NsSimp_ = speciesNumber;
314 this->chemistry_.simplifiedC().setSize(this->NsSimp_+2);
315 this->chemistry_.simplifiedToCompleteIndex().setSize(this->NsSimp_);
318 for (
label i=0; i<this->nSpecie_; i++)
320 if (this->activeSpecies_[i])
322 this->chemistry_.simplifiedToCompleteIndex()[j] = i;
323 this->chemistry_.simplifiedC()[j] = c[i];
324 this->chemistry_.completeToSimplifiedIndex()[i] = j++;
325 if (!this->chemistry_.active(i))
327 this->chemistry_.setActive(i);
332 this->chemistry_.completeToSimplifiedIndex()[i] = -1;
336 this->chemistry_.simplifiedC()[this->NsSimp_] =
T;
337 this->chemistry_.simplifiedC()[this->NsSimp_+1] =
p;
338 this->chemistry_.setNsDAC(this->NsSimp_);
342 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.
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.
const dimensionedScalar & c1
First radiation constant: default SI units: [W/m^2].
DRG(const IOdictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry)
Construct from components.
const PtrList< volScalarField > & Y()
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
BasicChemistryModel< rhoReactionThermo > & chemistry
virtual void reduceMechanism(const scalar p, const scalar T, const scalarField &c, const label li)
Reduce the mechanism.
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))
#define R(A, B, C, D, E, F, K, M)
void push(const T &a)
Push an element onto the stack.
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.