30 template<
class CompType,
class ThermoType>
38 searchInitSet_(this->coeffsDict_.subDict(
"initialSet").size())
44 if (initSet.
found(chemistry.
Y()[i].name()))
46 searchInitSet_[j++] = i;
49 if (j<searchInitSet_.size())
52 << searchInitSet_.size()-j
53 <<
" species in the intial 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;
258 Info<<
"Badly Conditioned rAB : " << rAB
259 <<
"species involved : " << u <<
"," << otherSpec
268 rAB >= this->tolerance()
269 && !this->activeSpecies_[otherSpec]
273 this->activeSpecies_[otherSpec] =
true;
281 forAll(this->chemistry_.reactions(), i)
284 this->chemistry_.reactionsDisabled()[i] =
false;
291 if (!this->activeSpecies_[ss])
294 this->chemistry_.reactionsDisabled()[i] =
true;
300 if (!this->chemistry_.reactionsDisabled()[i])
305 if (!this->activeSpecies_[ss])
307 this->chemistry_.reactionsDisabled()[i] =
true;
314 this->NsSimp_ = speciesNumber;
315 this->chemistry_.simplifiedC().setSize(this->NsSimp_+2);
316 this->chemistry_.simplifiedToCompleteIndex().setSize(this->NsSimp_);
319 for (
label i=0; i<this->nSpecie_; i++)
321 if (this->activeSpecies_[i])
323 this->chemistry_.simplifiedToCompleteIndex()[j] = i;
324 this->chemistry_.simplifiedC()[j] = c[i];
325 this->chemistry_.completeToSimplifiedIndex()[i] = j++;
326 if (!this->chemistry_.active(i))
328 this->chemistry_.setActive(i);
333 this->chemistry_.completeToSimplifiedIndex()[i] = -1;
337 this->chemistry_.simplifiedC()[this->NsSimp_] =
T;
338 this->chemistry_.simplifiedC()[this->NsSimp_+1] =
p;
339 this->chemistry_.setNsDAC(this->NsSimp_);
343 this->chemistry_.setNSpecie(this->NsSimp_);
A FIFO stack based on a singly-linked list.
Extends chemistryModel by adding the TDAC method.
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()
const List< specieCoeffs > & lhs() const
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
virtual label nSpecie() const
The number of species.
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.
psiChemistryModel & chemistry
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
T pop()
Pop the bottom element off the stack.
An abstract class for methods of chemical mechanism reduction.
const List< specieCoeffs > & rhs() const