30 template<
class ThermoType>
40 const wordHashSet initSet(this->coeffsDict_.lookup(
"initialSet"));
43 searchInitSet_.append(chemistry.
mixture().species()[iter.key()]);
50 template<
class ThermoType>
57 template<
class ThermoType>
66 scalarField& completeC(this->chemistry_.completeC());
69 for (
label i=0; i<this->nSpecie_; i++)
75 c1[this->nSpecie_] =
T;
76 c1[this->nSpecie_+1] =
p;
91 forAll(this->chemistry_.reactions(), i)
96 scalar omegaf, omegar;
97 const scalar omegai = R.
omega(p, T, c1, li, omegaf, omegar);
109 scalar sl = -R.
lhs()[
s].stoichCoeff;
122 wA.append(sl*omegai);
129 scalar sl = R.
rhs()[
s].stoichCoeff;
142 wA.append(sl*omegai);
150 label curID = wAID[id];
151 scalar curwA = wA[id];
167 deltaBi[curID] =
false;
169 while(!usedIndex.empty())
173 if (deltaBi[curIndex])
175 deltaBi[curIndex] =
false;
176 if (rABPos(curID, curIndex)==-1)
178 rABPos(curID, curIndex) = NbrABInit[curID];
179 rABOtherSpec(curID, NbrABInit[curID]) = curIndex;
182 PAB(curID, NbrABInit[curID]) = curwA;
186 CAB(curID, NbrABInit[curID]) = -curwA;
194 PAB(curID, rABPos(curID, curIndex)) += curwA;
198 CAB(curID, rABPos(curID, curIndex)) += -curwA;
208 if (PA[curID] == 0.0)
219 if (CA[curID] == 0.0)
251 this->nSpecie_, this->nSpecie_, -1
256 for (
int i=0; i<NbrABInit[A]; i++)
258 label ri = rABOtherSpec(A, i);
259 scalar maxPACA =
max(PA[ri],CA[ri]);
260 if (maxPACA > vSmall)
262 for (
int j=0; j<NbrABInit[ri]; j++)
264 label B = rABOtherSpec(ri, j);
267 if (rABPos2nd(A, B)==-1)
269 rABPos2nd(A, B) = NbrABInit2nd[A]++;
270 rABOtherSpec2nd(A, rABPos2nd(A, B)) = B;
271 PAB2nd(A, rABPos2nd(A, B)) =
272 PAB(A, i)*PAB(ri, j)/maxPACA;
273 CAB2nd(A, rABPos2nd(A, B)) =
274 CAB(A, i)*CAB(ri, j)/maxPACA;
278 PAB2nd(A, rABPos2nd(A, B)) +=
279 PAB(A, i)*PAB(ri, j)/maxPACA;
280 CAB2nd(A, rABPos2nd(A, B)) +=
281 CAB(A, i)*CAB(ri, j)/maxPACA;
290 label speciesNumber = 0;
294 for (
label i=0; i<this->nSpecie_; i++)
296 this->activeSpecies_[i] =
false;
300 const labelList& SIS(this->searchInitSet_);
306 this->activeSpecies_[q] =
true;
315 scalar Den =
max(PA[u],CA[u]);
320 for (
label v=0; v<NbrABInit[u]; v++)
322 label otherSpec = rABOtherSpec(u, v);
323 scalar rAB = (PAB(u, v)+CAB(u, v))/Den;
324 label id2nd = rABPos2nd(u, otherSpec);
327 rAB += (PAB2nd(u, id2nd)+CAB2nd(u, id2nd))/Den;
332 rAB >= this->tolerance()
333 && !this->activeSpecies_[otherSpec]
337 this->activeSpecies_[otherSpec] =
true;
343 for (
label v=0; v<NbrABInit2nd[u]; v++)
345 label otherSpec = rABOtherSpec2nd(u, v);
346 scalar rAB = (PAB2nd(u, v)+CAB2nd(u, v))/Den;
350 rAB >= this->tolerance()
351 && !this->activeSpecies_[otherSpec]
355 this->activeSpecies_[otherSpec] =
true;
363 forAll(this->chemistry_.reactions(), i)
366 this->chemistry_.reactionsDisabled()[i] =
false;
371 if (!this->activeSpecies_[ss])
373 this->chemistry_.reactionsDisabled()[i] =
true;
377 if (!this->chemistry_.reactionsDisabled()[i])
382 if (!this->activeSpecies_[ss])
384 this->chemistry_.reactionsDisabled()[i] =
true;
391 this->NsSimp_ = speciesNumber;
392 scalarField& simplifiedC(this->chemistry_.simplifiedC());
393 simplifiedC.
setSize(this->NsSimp_+2);
396 Field<label>& c2s(this->chemistry_.completeToSimplifiedIndex());
399 for (
label i=0; i<this->nSpecie_; i++)
401 if (this->activeSpecies_[i])
404 simplifiedC[j] = c[i];
406 if (!this->chemistry_.active(i))
408 this->chemistry_.setActive(i);
416 simplifiedC[this->NsSimp_] =
T;
417 simplifiedC[this->NsSimp_+1] =
p;
418 this->chemistry_.setNsDAC(this->NsSimp_);
421 this->chemistry_.setNSpecie(this->NsSimp_);
A FIFO stack based on a singly-linked list.
Extends standardChemistryModel by adding the TDAC method.
A HashTable with keys but without contents.
#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.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void size(const label)
Override size to be inconsistent with allocated storage.
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...
void omega(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dcdt) const
Net reaction rate for individual species.
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))
void setSize(const label)
Alter the addressed list size.
PFA(const IOdictionary &dict, TDACChemistryModel< ThermoType > &chemistry)
Construct from components.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
basicChemistryModel & chemistry
virtual void reduceMechanism(const scalar p, const scalar T, const scalarField &c, const label li)
Reduce the mechanism.
virtual ~PFA()
Destructor.
void setSize(const label)
Reset size of List.
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
#define R(A, B, C, D, E, F, K, M)
void push(const T &a)
Push an element onto the stack.
const multiComponentMixture< ThermoType > & mixture() const
Return reference to the mixture.
T pop()
Pop the bottom element off the stack.
An abstract class for methods of chemical mechanism reduction.