Reaction.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "Reaction.H"
27 #include "DynamicList.H"
28 
29 // * * * * * * * * * * * * * * * * Static Data * * * * * * * * * * * * * * * //
30 
31 template<class ReactionThermo>
33 
34 template<class ReactionThermo>
36 
37 template<class ReactionThermo>
39 
40 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
41 
42 template<class ReactionThermo>
44 (
45  OStringStream& reaction
46 ) const
47 {
48  for (label i = 0; i < lhs_.size(); ++i)
49  {
50  if (i > 0)
51  {
52  reaction << " + ";
53  }
54  if (mag(lhs_[i].stoichCoeff - 1) > small)
55  {
56  reaction << lhs_[i].stoichCoeff;
57  }
58  reaction << species_[lhs_[i].index];
59  if (mag(lhs_[i].exponent - lhs_[i].stoichCoeff) > small)
60  {
61  reaction << "^" << lhs_[i].exponent;
62  }
63  }
64 }
65 
66 
67 template<class ReactionThermo>
69 (
70  OStringStream& reaction
71 ) const
72 {
73  for (label i = 0; i < rhs_.size(); ++i)
74  {
75  if (i > 0)
76  {
77  reaction << " + ";
78  }
79  if (mag(rhs_[i].stoichCoeff - 1) > small)
80  {
81  reaction << rhs_[i].stoichCoeff;
82  }
83  reaction << species_[rhs_[i].index];
84  if (mag(rhs_[i].exponent - rhs_[i].stoichCoeff) > small)
85  {
86  reaction << "^" << rhs_[i].exponent;
87  }
88  }
89 }
90 
91 
92 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
93 
94 template<class ReactionThermo>
96 {
97  return nUnNamedReactions++;
98 }
99 
100 
101 template<class ReactionThermo>
103 (
104  OStringStream& reaction
105 ) const
106 {
107  reactionStrLeft(reaction);
108  reaction << " = ";
109  reactionStrRight(reaction);
110  return reaction.str();
111 }
112 
113 
114 template<class ReactionThermo>
116 (
117  const HashPtrTable<ReactionThermo>& thermoDatabase
118 )
119 {
120  typename ReactionThermo::thermoType rhsThermo
121  (
122  rhs_[0].stoichCoeff
123  *(*thermoDatabase[species_[rhs_[0].index]]).W()
124  *(*thermoDatabase[species_[rhs_[0].index]])
125  );
126 
127  for (label i=1; i<rhs_.size(); ++i)
128  {
129  rhsThermo +=
130  rhs_[i].stoichCoeff
131  *(*thermoDatabase[species_[rhs_[i].index]]).W()
132  *(*thermoDatabase[species_[rhs_[i].index]]);
133  }
134 
135  typename ReactionThermo::thermoType lhsThermo
136  (
137  lhs_[0].stoichCoeff
138  *(*thermoDatabase[species_[lhs_[0].index]]).W()
139  *(*thermoDatabase[species_[lhs_[0].index]])
140  );
141 
142  for (label i=1; i<lhs_.size(); ++i)
143  {
144  lhsThermo +=
145  lhs_[i].stoichCoeff
146  *(*thermoDatabase[species_[lhs_[i].index]]).W()
147  *(*thermoDatabase[species_[lhs_[i].index]]);
148  }
149 
150  ReactionThermo::thermoType::operator=(lhsThermo == rhsThermo);
151 }
152 
153 
154 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
155 
156 
157 template<class ReactionThermo>
159 (
160  const speciesTable& species,
161  const List<specieCoeffs>& lhs,
162  const List<specieCoeffs>& rhs,
163  const HashPtrTable<ReactionThermo>& thermoDatabase
164 )
165 :
166  ReactionThermo::thermoType(*thermoDatabase[species[0]]),
167  name_("un-named-reaction-" + Foam::name(getNewReactionID())),
168  species_(species),
169  Tlow_(TlowDefault),
170  Thigh_(ThighDefault),
171  lhs_(lhs),
172  rhs_(rhs)
173 {
174  setThermo(thermoDatabase);
175 }
176 
177 
178 template<class ReactionThermo>
180 (
181  const Reaction<ReactionThermo>& r,
182  const speciesTable& species
183 )
184 :
185  ReactionThermo::thermoType(r),
186  name_(r.name() + "Copy"),
187  species_(species),
188  Tlow_(r.Tlow()),
189  Thigh_(r.Thigh()),
190  lhs_(r.lhs_),
191  rhs_(r.rhs_)
192 {}
193 
194 
195 template<class ReactionThermo>
197 (
198  const speciesTable& species,
199  Istream& is
200 )
201 {
202  token t(is);
203  if (t.isNumber())
204  {
205  stoichCoeff = t.number();
206  is >> t;
207  }
208  else
209  {
210  stoichCoeff = 1;
211  }
212 
213  exponent = stoichCoeff;
214 
215  if (t.isWord())
216  {
217  word specieName = t.wordToken();
218 
219  size_t i = specieName.find('^');
220 
221  if (i != word::npos)
222  {
223  string exponentStr = specieName
224  (
225  i + 1,
226  specieName.size() - i - 1
227  );
228  exponent = atof(exponentStr.c_str());
229  specieName = specieName(0, i);
230  }
231 
232  if (species.contains(specieName))
233  {
234  index = species[specieName];
235  }
236  else
237  {
238  index = -1;
239  }
240  }
241  else
242  {
244  << "Expected a word but found " << t.info()
245  << exit(FatalIOError);
246  }
247 }
248 
249 
250 template<class ReactionThermo>
252 (
253  Istream& is,
254  const speciesTable& species,
255  List<specieCoeffs>& lhs,
256  List<specieCoeffs>& rhs
257 )
258 {
260 
261  while (is.good())
262  {
263  dlrhs.append(specieCoeffs(species, is));
264 
265  if (dlrhs.last().index != -1)
266  {
267  token t(is);
268  if (t.isPunctuation())
269  {
270  if (t == token::ADD)
271  {
272  }
273  else if (t == token::ASSIGN)
274  {
275  lhs = dlrhs.shrink();
276  dlrhs.clear();
277  }
278  else
279  {
280  rhs = dlrhs.shrink();
281  is.putBack(t);
282  return;
283  }
284  }
285  else
286  {
287  rhs = dlrhs.shrink();
288  is.putBack(t);
289  return;
290  }
291  }
292  else
293  {
294  dlrhs.remove();
295  if (is.good())
296  {
297  token t(is);
298  if (t.isPunctuation())
299  {
300  if (t == token::ADD)
301  {
302  }
303  else if (t == token::ASSIGN)
304  {
305  lhs = dlrhs.shrink();
306  dlrhs.clear();
307  }
308  else
309  {
310  rhs = dlrhs.shrink();
311  is.putBack(t);
312  return;
313  }
314  }
315  }
316  else
317  {
318  if (!dlrhs.empty())
319  {
320  rhs = dlrhs.shrink();
321  }
322  return;
323  }
324  }
325  }
326 
328  << "Cannot continue reading reaction data from stream"
329  << exit(FatalIOError);
330 }
331 
332 
333 template<class ReactionThermo>
335 (
336  const speciesTable& species,
337  const HashPtrTable<ReactionThermo>& thermoDatabase,
338  const dictionary& dict
339 )
340 :
341  ReactionThermo::thermoType(*thermoDatabase[species[0]]),
342  name_(dict.dictName()),
343  species_(species),
344  Tlow_(dict.lookupOrDefault<scalar>("Tlow", TlowDefault)),
345  Thigh_(dict.lookupOrDefault<scalar>("Thigh", ThighDefault))
346 {
347  setLRhs
348  (
349  IStringStream(dict.lookup("reaction"))(),
350  species_,
351  lhs_,
352  rhs_
353  );
354  setThermo(thermoDatabase);
355 }
356 
357 
358 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
359 
360 template<class ReactionThermo>
363 (
364  const speciesTable& species,
365  const HashPtrTable<ReactionThermo>& thermoDatabase,
366  const dictionary& dict
367 )
368 {
369  const word& reactionTypeName = dict.lookup("type");
370 
371  typename dictionaryConstructorTable::iterator cstrIter
372  = dictionaryConstructorTablePtr_->find(reactionTypeName);
373 
374  if (cstrIter == dictionaryConstructorTablePtr_->end())
375  {
377  << "Unknown reaction type "
378  << reactionTypeName << nl << nl
379  << "Valid reaction types are :" << nl
380  << dictionaryConstructorTablePtr_->sortedToc()
381  << exit(FatalError);
382  }
383 
385  (
386  cstrIter()(species, thermoDatabase, dict)
387  );
388 }
389 
390 
391 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
392 
393 template<class ReactionThermo>
395 {
397  os.writeKeyword("reaction") << reactionStr(reaction)
398  << token::END_STATEMENT << nl;
399 }
400 
401 
402 template<class ReactionThermo>
404 (
405  const scalar p,
406  const scalar T,
407  const scalarField& c,
408  scalarField& d
409 ) const
410 {
411 }
412 
413 
414 template<class ReactionThermo>
416 (
417  const scalar p,
418  const scalar T,
419  const scalarField& c,
420  scalarField& f
421 ) const
422 {
423 }
424 
425 
426 template<class ReactionThermo>
428 (
429  const scalar p,
430  const scalar T,
431  const scalarField& c,
432  scalarField& dcdt
433 ) const
434 {
435  scalar pf, cf, pr, cr;
436  label lRef, rRef;
437 
438  scalar omegaI = omega
439  (
440  p, T, c, pf, cf, lRef, pr, cr, rRef
441  );
442 
443  forAll(lhs_, i)
444  {
445  const label si = lhs_[i].index;
446  const scalar sl = lhs_[i].stoichCoeff;
447  dcdt[si] -= sl*omegaI;
448  }
449  forAll(rhs_, i)
450  {
451  const label si = rhs_[i].index;
452  const scalar sr = rhs_[i].stoichCoeff;
453  dcdt[si] += sr*omegaI;
454  }
455 }
456 
457 
458 template<class ReactionThermo>
460 (
461  const scalar p,
462  const scalar T,
463  const scalarField& c,
464  scalar& pf,
465  scalar& cf,
466  label& lRef,
467  scalar& pr,
468  scalar& cr,
469  label& rRef
470 ) const
471 {
472 
473  scalar clippedT = min(max(T, this->Tlow()), this->Thigh());
474 
475  const scalar kf = this->kf(p, clippedT, c);
476  const scalar kr = this->kr(kf, p, clippedT, c);
477 
478  pf = 1;
479  pr = 1;
480 
481  const label Nl = lhs_.size();
482  const label Nr = rhs_.size();
483 
484  label slRef = 0;
485  lRef = lhs_[slRef].index;
486 
487  pf = kf;
488  for (label s = 1; s < Nl; s++)
489  {
490  const label si = lhs_[s].index;
491 
492  if (c[si] < c[lRef])
493  {
494  const scalar exp = lhs_[slRef].exponent;
495  pf *= pow(max(c[lRef], 0), exp);
496  lRef = si;
497  slRef = s;
498  }
499  else
500  {
501  const scalar exp = lhs_[s].exponent;
502  pf *= pow(max(c[si], 0), exp);
503  }
504  }
505  cf = max(c[lRef], 0);
506 
507  {
508  const scalar exp = lhs_[slRef].exponent;
509  if (exp < 1)
510  {
511  if (cf > small)
512  {
513  pf *= pow(cf, exp - 1);
514  }
515  else
516  {
517  pf = 0;
518  }
519  }
520  else
521  {
522  pf *= pow(cf, exp - 1);
523  }
524  }
525 
526  label srRef = 0;
527  rRef = rhs_[srRef].index;
528 
529  // Find the matrix element and element position for the rhs
530  pr = kr;
531  for (label s = 1; s < Nr; s++)
532  {
533  const label si = rhs_[s].index;
534  if (c[si] < c[rRef])
535  {
536  const scalar exp = rhs_[srRef].exponent;
537  pr *= pow(max(c[rRef], 0), exp);
538  rRef = si;
539  srRef = s;
540  }
541  else
542  {
543  const scalar exp = rhs_[s].exponent;
544  pr *= pow(max(c[si], 0), exp);
545  }
546  }
547  cr = max(c[rRef], 0);
548 
549  {
550  const scalar exp = rhs_[srRef].exponent;
551  if (exp < 1)
552  {
553  if (cr > small)
554  {
555  pr *= pow(cr, exp - 1);
556  }
557  else
558  {
559  pr = 0;
560  }
561  }
562  else
563  {
564  pr *= pow(cr, exp - 1);
565  }
566  }
567 
568  return pf*cf - pr*cr;
569 }
570 
571 
572 template<class ReactionThermo>
574 (
575  const scalar p,
576  const scalar T,
577  const scalarField& c,
579  scalarField& dcdt,
580  scalar& omegaI,
581  scalar& kfwd,
582  scalar& kbwd,
583  const bool reduced,
584  const List<label>& c2s
585 ) const
586 {
587  scalar pf, cf, pr, cr;
588  label lRef, rRef;
589 
590  omegaI = omega(p, T, c, pf, cf, lRef, pr, cr, rRef);
591 
592  forAll(lhs_, i)
593  {
594  const label si = reduced ? c2s[lhs_[i].index] : lhs_[i].index;
595  const scalar sl = lhs_[i].stoichCoeff;
596  dcdt[si] -= sl*omegaI;
597  }
598  forAll(rhs_, i)
599  {
600  const label si = reduced ? c2s[rhs_[i].index] : rhs_[i].index;
601  const scalar sr = rhs_[i].stoichCoeff;
602  dcdt[si] += sr*omegaI;
603  }
604 
605  kfwd = this->kf(p, T, c);
606  kbwd = this->kr(kfwd, p, T, c);
607 
608  forAll(lhs_, j)
609  {
610  const label sj = reduced ? c2s[lhs_[j].index] : lhs_[j].index;
611  scalar kf = kfwd;
612  forAll(lhs_, i)
613  {
614  const label si = lhs_[i].index;
615  const scalar el = lhs_[i].exponent;
616  if (i == j)
617  {
618  if (el < 1)
619  {
620  if (c[si] > SMALL)
621  {
622  kf *= el*pow(c[si] + VSMALL, el - 1);
623  }
624  else
625  {
626  kf = 0;
627  }
628  }
629  else
630  {
631  kf *= el*pow(c[si], el - 1);
632  }
633  }
634  else
635  {
636  kf *= pow(c[si], el);
637  }
638  }
639 
640  forAll(lhs_, i)
641  {
642  const label si = reduced ? c2s[lhs_[i].index] : lhs_[i].index;
643  const scalar sl = lhs_[i].stoichCoeff;
644  J(si, sj) -= sl*kf;
645  }
646  forAll(rhs_, i)
647  {
648  const label si = reduced ? c2s[rhs_[i].index] : rhs_[i].index;
649  const scalar sr = rhs_[i].stoichCoeff;
650  J(si, sj) += sr*kf;
651  }
652  }
653 
654  forAll(rhs_, j)
655  {
656  const label sj = reduced ? c2s[rhs_[j].index] : rhs_[j].index;
657  scalar kr = kbwd;
658  forAll(rhs_, i)
659  {
660  const label si = rhs_[i].index;
661  const scalar er = rhs_[i].exponent;
662  if (i == j)
663  {
664  if (er < 1)
665  {
666  if (c[si] > SMALL)
667  {
668  kr *= er*pow(c[si] + VSMALL, er - 1);
669  }
670  else
671  {
672  kr = 0;
673  }
674  }
675  else
676  {
677  kr *= er*pow(c[si], er - 1);
678  }
679  }
680  else
681  {
682  kr *= pow(c[si], er);
683  }
684  }
685 
686  forAll(lhs_, i)
687  {
688  const label si = reduced ? c2s[lhs_[i].index] : lhs_[i].index;
689  const scalar sl = lhs_[i].stoichCoeff;
690  J(si, sj) += sl*kr;
691  }
692  forAll(rhs_, i)
693  {
694  const label si = reduced ? c2s[rhs_[i].index] : rhs_[i].index;
695  const scalar sr = rhs_[i].stoichCoeff;
696  J(si, sj) -= sr*kr;
697  }
698  }
699 
700  // When third-body species are involved, additional terms are added
701  // beta function returns an empty list when third-body are not involved
702  const List<Tuple2<label, scalar>>& beta = this->beta();
703  if (notNull(beta))
704  {
705  // This temporary array needs to be cached for efficiency
706  scalarField dcidc(beta.size());
707  this->dcidc(p, T, c, dcidc);
708 
709  forAll(beta, j)
710  {
711  label sj = beta[j].first();
712  sj = reduced ? c2s[sj] : sj;
713  if (sj != -1)
714  {
715  forAll(lhs_, i)
716  {
717  const label si =
718  reduced ? c2s[lhs_[i].index] : lhs_[i].index;
719  const scalar sl = lhs_[i].stoichCoeff;
720  J(si, sj) -= sl*dcidc[j]*omegaI;
721  }
722  forAll(rhs_, i)
723  {
724  const label si =
725  reduced ? c2s[rhs_[i].index] : rhs_[i].index;
726  const scalar sr = rhs_[i].stoichCoeff;
727  J(si, sj) += sr*dcidc[j]*omegaI;
728  }
729  }
730  }
731  }
732 }
733 
734 
735 template<class ReactionThermo>
737 (
738  const scalar p,
739  const scalar T,
740  const scalarField& c,
741  const scalar omegaI,
742  const scalar kfwd,
743  const scalar kbwd,
745  const bool reduced,
746  const List<label>& c2s,
747  const label indexT
748 ) const
749 {
750  scalar kf = kfwd;
751  scalar kr = kbwd;
752 
753  scalar dkfdT = this->dkfdT(p, T, c);
754  scalar dkrdT = this->dkrdT(p, T, c, dkfdT, kr);
755 
756  scalar sumExp = 0.0;
757  forAll(lhs_, i)
758  {
759  const label si = lhs_[i].index;
760  const scalar el = lhs_[i].exponent;
761  const scalar cExp = pow(c[si], el);
762  dkfdT *= cExp;
763  kf *= cExp;
764  sumExp += el;
765  }
766  kf *= -sumExp/T;
767 
768  sumExp = 0.0;
769  forAll(rhs_, i)
770  {
771  const label si = rhs_[i].index;
772  const scalar er = rhs_[i].exponent;
773  const scalar cExp = pow(c[si], er);
774  dkrdT *= cExp;
775  kr *= cExp;
776  sumExp += er;
777  }
778  kr *= -sumExp/T;
779 
780  // dqidT includes the third-body (or pressure dependent) effect
781  scalar dqidT = dkfdT - dkrdT + kf - kr;
782 
783  // For reactions including third-body efficiencies or pressure dependent
784  // reaction, an additional term is needed
785  scalar dcidT = this->dcidT(p, T, c);
786  dcidT *= omegaI;
787 
788  // J(i, indexT) = sum_reactions nu_i dqdT
789  forAll(lhs_, i)
790  {
791  const label si = reduced ? c2s[lhs_[i].index] : lhs_[i].index;
792  const scalar sl = lhs_[i].stoichCoeff;
793  J(si, indexT) -= sl*(dqidT + dcidT);
794  }
795  forAll(rhs_, i)
796  {
797  const label si = reduced ? c2s[rhs_[i].index] : rhs_[i].index;
798  const scalar sr = rhs_[i].stoichCoeff;
799  J(si, indexT) += sr*(dqidT + dcidT);
800  }
801 }
802 
803 
804 template<class ReactionThermo>
806 {
807  return species_;
808 }
809 
810 
811 // ************************************************************************* //
void ddot(const scalar p, const scalar T, const scalarField &c, scalarField &d) const
Forward reaction rate.
Definition: Reaction.C:404
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
bool isWord() const
Definition: tokenI.H:230
bool empty() const
Return true if the UList is empty (ie, size() is zero)
Definition: UListI.H:313
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const word & name() const
Return the name of the reaction.
Definition: ReactionI.H:36
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
void dwdT(const scalar p, const scalar T, const scalarField &c, const scalar omegaI, const scalar kfwd, const scalar kbwd, scalarSquareMatrix &J, const bool reduced, const List< label > &c2s, const label indexT) const
Derivative of the net reaction rate for each species involved.
Definition: Reaction.C:737
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:60
scalar number() const
Definition: tokenI.H:382
InfoProxy< token > info() const
Return info proxy.
Definition: token.H:380
const word & wordToken() const
Definition: tokenI.H:235
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
void fdot(const scalar p, const scalar T, const scalarField &c, scalarField &f) const
Backward reaction rate.
Definition: Reaction.C:416
A token holds items read from Istream.
Definition: token.H:69
virtual void write(Ostream &) const
Write.
Definition: Reaction.C:394
void putBack(const token &)
Put back token.
Definition: Istream.C:30
static const scalar SMALL
Definition: scalar.H:112
A HashTable specialization for hashing pointers.
Definition: HashPtrTable.H:50
void omega(const scalar p, const scalar T, const scalarField &c, scalarField &dcdt) const
Net reaction rate for individual species.
Definition: Reaction.C:428
T & first()
Return the first element of the list.
Definition: UListI.H:114
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:333
Class to hold the specie index and its coefficients in the.
Definition: Reaction.H:95
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Definition: Reaction.H:55
scalar Tlow() const
Return the lower temperature limit for the reaction.
Definition: ReactionI.H:43
static scalar TlowDefault
Default temperature limits of applicability of reaction rates.
Definition: Reaction.H:89
const word dictName() const
Return the local dictionary name (final part of scoped name)
Definition: dictionary.H:115
bool isNumber() const
Definition: tokenI.H:377
const speciesTable & species() const
Return the specie list.
Definition: Reaction.C:805
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 reactionStrLeft(OStringStream &reaction) const
Return string representation of the left of the reaction.
Definition: Reaction.C:44
dimensionedScalar exp(const dimensionedScalar &ds)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:292
CombustionModel< rhoReactionThermo > & reaction
void dwdc(const scalar p, const scalar T, const scalarField &c, scalarSquareMatrix &J, scalarField &dcdt, scalar &omegaI, scalar &kfwd, scalar &kbwd, const bool reduced, const List< label > &c2s) const
Derivative of the net reaction rate for each species involved.
Definition: Reaction.C:574
static scalar ThighDefault
Definition: Reaction.H:89
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
Definition: DynamicListI.H:240
static const char nl
Definition: Ostream.H:265
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const volScalarField & T
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
scalar Thigh() const
Return the upper temperature limit for the reaction.
Definition: ReactionI.H:50
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
Definition: nullObjectI.H:46
void reactionStrRight(OStringStream &reaction) const
Return string representation of the right of the reaction.
Definition: Reaction.C:69
T remove()
Remove and return the top element.
Definition: DynamicListI.H:347
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Reaction(const speciesTable &species, const List< specieCoeffs > &lhs, const List< specieCoeffs > &rhs, const HashPtrTable< ReactionThermo > &thermoDatabase)
Construct from components.
Definition: Reaction.C:159
void setLRhs(Istream &, const speciesTable &, List< specieCoeffs > &lhs, List< specieCoeffs > &rhs)
Construct the left- and right-hand-side reaction coefficients.
Definition: Reaction.C:252
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
static const scalar VSMALL
Definition: scalar.H:114
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:331
A wordList with hashed indices for faster lookup by name.
static autoPtr< Reaction< ReactionThermo > > New(const speciesTable &species, const HashPtrTable< ReactionThermo > &thermoDatabase, const dictionary &dict)
Return a pointer to new patchField created on freestore from dict.
Definition: Reaction.C:363
Input from memory buffer stream.
Definition: IStringStream.H:49
const scalarList W(::W(thermo))
string str() const
Return the string.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
bool contains(const word &) const
Does the list contain the specified name.
T & last()
Return the last element of the list.
Definition: UListI.H:128
void clear()
Clear the addressed list, i.e. set the size to zero.
Definition: DynamicListI.H:224
static label nUnNamedReactions
Number of un-named reactions.
Definition: Reaction.H:86
A class for handling character strings derived from std::string.
Definition: string.H:74
Output to memory buffer stream.
Definition: OStringStream.H:49
bool isPunctuation() const
Definition: tokenI.H:212
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576
IOerror FatalIOError