31 template<
class ThermoType>
57 this->
coeffDict(dict).template lookup<label>(
"NGroupBased");
66 forAll(curSpecieComposition, j)
69 curSpecieComposition[j];
70 if (curElement.
name() ==
"C")
72 sC_[i] = curElement.
nAtoms();
74 else if (curElement.
name() ==
"H")
76 sH_[i] = curElement.
nAtoms();
78 else if (curElement.
name() ==
"O")
80 sO_[i] = curElement.
nAtoms();
82 else if (curElement.
name() ==
"N")
84 sN_[i] = curElement.
nAtoms();
88 Info<<
"element not considered"<<
endl;
97 template<
class ThermoType>
104 template<
class ThermoType>
137 scalarField omegaV(this->chemistry_.reactions().size());
138 forAll(this->chemistry_.reactions(), i)
143 scalar omegaf, omegar;
144 const scalar omegai =
R.omega(
p,
T,
c1, li, omegaf, omegar);
156 scalar sl = -
R.lhs()[
s].stoichCoeff;
161 label sj =
R.lhs()[j].index;
167 label sj =
R.rhs()[j].index;
175 while(!usedIndex.empty())
178 if (deltaBi[curIndex])
181 deltaBi[curIndex] =
false;
183 if (rABPos(ss, curIndex)==-1)
185 rABPos(ss, curIndex) = NbrABInit[ss];
187 rABNum(ss, rABPos(ss, curIndex)) = sl*omegai;
188 rABOtherSpec(ss, rABPos(ss, curIndex)) = curIndex;
192 rABNum(ss, rABPos(ss, curIndex)) += sl*omegai;
216 scalar sl =
R.rhs()[
s].stoichCoeff;
221 label sj =
R.lhs()[j].index;
227 label sj =
R.rhs()[j].index;
235 while(!usedIndex.empty())
238 if (deltaBi[curIndex])
241 deltaBi[curIndex] =
false;
243 if (rABPos(ss, curIndex)==-1)
245 rABPos(ss, curIndex) = NbrABInit[ss];
247 rABNum(ss, rABPos(ss, curIndex)) = sl*omegai;
248 rABOtherSpec(ss, rABPos(ss, curIndex)) = curIndex;
252 rABNum(ss, rABPos(ss, curIndex)) += sl*omegai;
281 if (PA[wAID[
id]] == 0.0)
283 PA[wAID[id]] = wA[id];
287 PA[wAID[id]] += wA[id];
292 if (CA[wAID[
id]] == 0.0)
294 CA[wAID[id]] = -wA[id];
298 CA[wAID[id]] += -wA[id];
313 Pa[0] += sC_[i]*
max(0.0,(PA[i]-CA[i]));
314 Ca[0] += sC_[i]*
max(0.0,-(PA[i]-CA[i]));
315 Pa[1] += sH_[i]*
max(0.0,(PA[i]-CA[i]));
316 Ca[1] += sH_[i]*
max(0.0,-(PA[i]-CA[i]));
317 Pa[2] += sO_[i]*
max(0.0,(PA[i]-CA[i]));
318 Ca[2] += sO_[i]*
max(0.0,-(PA[i]-CA[i]));
319 Pa[3] += sN_[i]*
max(0.0,(PA[i]-CA[i]));
320 Ca[3] += sN_[i]*
max(0.0,-(PA[i]-CA[i]));
330 label NActiveSpecies = 0;
333 this->activeSpecies_[i] =
false;
338 const labelList& SIS(this->searchInitSet_);
352 scalar alphaTmp = (sC_[q]*
mag(PA[q]-CA[q])/Pa[0]);
353 if (alphaTmp > alphaA)
361 scalar alphaTmp = (sH_[q]*
mag(PA[q]-CA[q])/Pa[1]);
362 if (alphaTmp > alphaA)
370 scalar alphaTmp = (sO_[q]*
mag(PA[q]-CA[q])/Pa[2]);
371 if (alphaTmp > alphaA)
379 scalar alphaTmp = (sN_[q]*
mag(PA[q]-CA[q])/Pa[3]);
380 if (alphaTmp > alphaA)
385 if (alphaA > this->tolerance())
387 this->activeSpecies_[q] =
true;
408 if (Rvalue[SIS[i]] > Rmax)
410 Rmax = Rvalue[SIS[i]];
418 Rvalue[specID] = 1.0;
419 this->activeSpecies_[specID] =
true;
426 scalar Den =
max(PA[u],CA[u]);
429 for (
label v=0; v<NbrABInit[u]; v++)
431 label otherSpec = rABOtherSpec(u, v);
432 scalar rAB =
mag(rABNum(u, v))/Den;
438 scalar Rtemp = Rvalue[u]*rAB;
440 if (Rvalue[otherSpec] < Rtemp)
442 Rvalue[otherSpec] = Rtemp;
444 if (Rtemp >= this->tolerance())
447 if (!this->activeSpecies_[otherSpec])
449 this->activeSpecies_[otherSpec] =
true;
460 label NDisabledSpecies(this->
nSpecie() - NActiveSpecies);
467 while(NDisabledSpecies > NGroupBased_)
474 forAll(disabledSpecies, i)
477 if (!this->activeSpecies_[i] && !disabledSpecies[i])
480 Rdisabled[nD] = Rvalue[i];
489 for (
label i=0; i<NGroupBased_; i++)
491 disabledSpecies[Rindex[tmpIndex[i]]] =
true;
493 NDisabledSpecies -= NGroupBased_;
499 for (
label v=0; v<NbrABInit[i]; v++)
504 forAll(this->chemistry_.reactions(), i)
508 scalar omegai = omegaV[i];
513 scalar sl = -
R.lhs()[
s].stoichCoeff;
515 bool alreadyDisabled(
false);
519 label sj =
R.lhs()[j].index;
522 if (disabledSpecies[sj])
524 alreadyDisabled=
true;
529 label sj =
R.rhs()[j].index;
532 if (disabledSpecies[sj])
534 alreadyDisabled=
true;
544 for (
label v=0; v<NbrABInit[ss]; v++)
546 rABNum(ss, v) += sl*omegai;
551 while(!usedIndex.empty())
554 if (deltaBi[curIndex])
557 deltaBi[curIndex] =
false;
558 rABNum(ss, rABPos(ss, curIndex)) += sl*omegai;
567 scalar sl =
R.rhs()[
s].stoichCoeff;
569 bool alreadyDisabled(
false);
573 label sj =
R.lhs()[j].index;
576 if (disabledSpecies[sj])
578 alreadyDisabled=
true;
583 label sj =
R.rhs()[j].index;
586 if (disabledSpecies[sj])
588 alreadyDisabled=
true;
598 for (
label v=0; v<NbrABInit[ss]; v++)
600 rABNum(ss, v) += sl*omegai;
605 while(!usedIndex.empty())
608 if (deltaBi[curIndex])
610 deltaBi[curIndex] =
false;
611 rABNum(ss, rABPos(ss, curIndex)) += sl*omegai;
620 label u = QStart[qi];
627 scalar Den =
max(PA[u],CA[u]);
630 for (
label v=0; v<NbrABInit[u]; v++)
632 label otherSpec = rABOtherSpec(u, v);
633 if (!disabledSpecies[otherSpec])
635 scalar rAB =
mag(rABNum(u, v))/Den;
641 scalar Rtemp = Rvalue[u]*rAB;
643 if (Rvalue[otherSpec] < Rtemp)
645 Rvalue[otherSpec] = Rtemp;
646 if (Rtemp >= this->tolerance())
649 if (!this->activeSpecies_[otherSpec])
651 this->activeSpecies_[otherSpec] =
true;
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
A FIFO stack based on a singly-linked list.
void push(const T &a)
Push an element onto the stack.
T pop()
Pop the bottom element off the stack.
A HashTable with keys but without contents.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
Simple extension of ThermoType to handle reaction kinetics in addition to the equilibrium thermodynam...
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
void partialSort(int M)
Partial sort the list (if changed after construction time)
Extends base chemistry model by adding a thermo package, and ODE functions. Introduces chemistry equa...
An abstract class for methods of chemical mechanism reduction.
const dictionary & coeffDict(const dictionary &dict) const
Protected Member Functions.
void initReduceMechanism()
Initialise reduction of the mechanism.
label nSpecie()
Return the number of species.
void endReduceMechanism(List< label > &ctos, DynamicList< label > &stoc)
End reduction of the mechanism.
virtual ~DRGEP()
Destructor.
DRGEP(const dictionary &dict, chemistryModel< ThermoType > &chemistry)
Construct from components.
virtual void reduceMechanism(const scalar p, const scalar T, const scalarField &c, List< label > &ctos, DynamicList< label > &stoc, const label li)
Reduce the mechanism.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
label nAtoms() const
Return the number of atoms of this element in the specie.
const word & name() const
Return the name of the element.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const dimensionedScalar c1
First radiation constant: default SI units: [W/m^2].
const dimensionedScalar c
Speed of light in a vacuum.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
static scalar R(const scalar a, const scalar x)
basicChemistryModel & chemistry