Go to the documentation of this file.
31 template<
class ReactionThermo>
36 template<
class ReactionThermo>
42 for (
label i = 0; i < lhs_.size(); ++i)
48 if (
mag(lhs_[i].stoichCoeff - 1) > SMALL)
53 if (
mag(lhs_[i].exponent - lhs_[i].stoichCoeff) > SMALL)
61 template<
class ReactionThermo>
67 for (
label i = 0; i < rhs_.size(); ++i)
73 if (
mag(rhs_[i].stoichCoeff - 1) > SMALL)
78 if (
mag(rhs_[i].exponent - rhs_[i].stoichCoeff) > SMALL)
88 template<
class ReactionThermo>
91 return nUnNamedReactions++;
95 template<
class ReactionThermo>
108 template<
class ReactionThermo>
116 ReactionThermo::thermoType::operator=
118 rhs_[0].stoichCoeff*(*thermoDatabase[species_[rhs_[0].index]])
121 for (
label i=1; i<rhs_.size(); ++i)
125 rhs_[i].stoichCoeff*(*thermoDatabase[species_[rhs_[i].index]])
134 lhs_[i].stoichCoeff*(*thermoDatabase[species_[lhs_[i].index]])
143 template<
class ReactionThermo>
152 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
153 name_(
"un-named-reaction-" +
Foam::name(getNewReactionID())),
158 setThermo(thermoDatabase);
162 template<
class ReactionThermo>
169 ReactionThermo::thermoType(r),
170 name_(r.
name() +
"Copy"),
177 template<
class ReactionThermo>
195 exponent = stoichCoeff;
201 size_t i = specieName.find(
'^');
205 string exponentStr = specieName
208 specieName.size() - i - 1
210 exponent = atof(exponentStr.c_str());
211 specieName = specieName(0, i);
216 index = species[specieName];
226 <<
"Expected a word but found " << t.
info()
232 template<
class ReactionThermo>
247 if (dlrhs.last().index != -1)
310 <<
"Cannot continue reading reaction data from stream"
315 template<
class ReactionThermo>
323 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
324 name_(
"un-named-reaction" +
Foam::name(getNewReactionID())),
327 setLRhs(is, species, lhs_, rhs_);
328 setThermo(thermoDatabase);
332 template<
class ReactionThermo>
340 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
351 setThermo(thermoDatabase);
357 template<
class ReactionThermo>
371 ) <<
"Reaction type not specified" <<
nl <<
nl
372 <<
"Valid Reaction types are :" <<
nl
373 << IstreamConstructorTablePtr_->sortedToc()
377 const word reactionTypeName(is);
379 typename IstreamConstructorTable::iterator cstrIter
380 = IstreamConstructorTablePtr_->find(reactionTypeName);
382 if (cstrIter == IstreamConstructorTablePtr_->end())
387 ) <<
"Unknown reaction type "
388 << reactionTypeName <<
nl <<
nl
389 <<
"Valid reaction types are :" <<
nl
390 << IstreamConstructorTablePtr_->sortedToc()
396 cstrIter()(species, thermoDatabase, is)
401 template<
class ReactionThermo>
412 typename dictionaryConstructorTable::iterator cstrIter
413 = dictionaryConstructorTablePtr_->find(reactionTypeName);
415 if (cstrIter == dictionaryConstructorTablePtr_->end())
418 <<
"Unknown reaction type "
419 << reactionTypeName <<
nl <<
nl
420 <<
"Valid reaction types are :" <<
nl
421 << dictionaryConstructorTablePtr_->sortedToc()
427 cstrIter()(species, thermoDatabase,
dict)
434 template<
class ReactionThermo>
443 template<
class ReactionThermo>
455 template<
class ReactionThermo>
468 template<
class ReactionThermo>
480 template<
class ReactionThermo>
487 template<
class ReactionThermo>
491 return NullObjectRef<speciesTable>();
495 template<
class ReactionThermo>
500 return NullObjectRef<List<specieCoeffs> >();
504 template<
class ReactionThermo>
509 return NullObjectRef<List<specieCoeffs> >();
const word dictName() const
Return the local dictionary name (final part of scoped name)
A class for handling words, derived from string.
Reaction(const speciesTable &species, const List< specieCoeffs > &lhs, const List< specieCoeffs > &rhs, const HashPtrTable< ReactionThermo > &thermoDatabase)
Construct from components.
void setLRhs(Istream &, const speciesTable &, List< specieCoeffs > &lhs, List< specieCoeffs > &rhs)
Construct the left- and right-hand-side reaction coefficients.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
const speciesTable & species() const
bool eof() const
Return true if end of input seen.
void reactionStrLeft(OStringStream &reaction) const
Return string representation of the left of the reaction.
void setThermo(const HashPtrTable< ReactionThermo > &thermoDatabase)
Construct reaction thermo.
Class to hold the specie index and its coefficients in the.
const word & wordToken() const
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
label getNewReactionID()
Return new reaction ID for un-named reactions.
string reactionStr(OStringStream &reaction) const
Return string representation of reaction.
A token holds items read from Istream.
A class for handling character strings derived from std::string.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual const speciesTable & gasSpecies() const
static autoPtr< Reaction< ReactionThermo > > New(const speciesTable &species, const HashPtrTable< ReactionThermo > &thermoDatabase, Istream &is)
Return a pointer to new patchField created on freestore from input.
virtual const List< specieCoeffs > & glhs() const
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
Forward rate constant.
void reactionStrRight(OStringStream &reaction) const
Return string representation of the right of the reaction.
virtual scalar kr(const scalar kfwd, const scalar p, const scalar T, const scalarField &c) const
Reverse rate constant from the given forward rate constant.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
InfoProxy< token > info() const
Return info proxy.
A wordList with hashed indices for faster lookup by name.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual void write(Ostream &) const
Write.
void clear()
Clear the addressed list, i.e. set the size to zero.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Input from memory buffer stream.
Info<< "Creating reaction model\n"<< endl;autoPtr< combustionModels::psiCombustionModel > reaction(combustionModels::psiCombustionModel::New(mesh))
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void putBack(const token &)
Put back token.
Output to memory buffer stream.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
T remove()
Remove and return the top element.
const dimensionedScalar c
Speed of light in a vacuum.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual const List< specieCoeffs > & grhs() const
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool good() const
Return true if next operation might succeed.
bool isPunctuation() const
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
word name(const complex &)
Return a string representation of a complex.
bool contains(const word &) const
Does the list contain the specified name.