Go to the documentation of this file.
34 template<
class ReactionThermo>
39 template<
class ReactionThermo>
45 for (label i = 0; i < lhs_.size(); ++i)
51 if (
mag(lhs_[i].stoichCoeff - 1) > SMALL)
56 if (
mag(lhs_[i].exponent - lhs_[i].stoichCoeff) > SMALL)
64 template<
class ReactionThermo>
70 for (label i = 0; i < rhs_.size(); ++i)
76 if (
mag(rhs_[i].stoichCoeff - 1) > SMALL)
81 if (
mag(rhs_[i].exponent - rhs_[i].stoichCoeff) > SMALL)
91 template<
class ReactionThermo>
94 return nUnNamedReactions++;
98 template<
class ReactionThermo>
111 template<
class ReactionThermo>
114 const HashPtrTable<ReactionThermo>& thermoDatabase
118 typename ReactionThermo::thermoType rhsThermo
121 *(*thermoDatabase[species_[rhs_[0].index]]).W()
122 *(*thermoDatabase[species_[rhs_[0].index]])
125 for (label i=1; i<rhs_.size(); ++i)
129 *(*thermoDatabase[species_[rhs_[i].index]]).W()
130 *(*thermoDatabase[species_[rhs_[i].index]]);
133 typename ReactionThermo::thermoType lhsThermo
136 *(*thermoDatabase[species_[lhs_[0].index]]).W()
137 *(*thermoDatabase[species_[lhs_[0].index]])
140 for (label i=1; i<lhs_.size(); ++i)
144 *(*thermoDatabase[species_[lhs_[i].index]]).W()
145 *(*thermoDatabase[species_[lhs_[i].index]]);
148 ReactionThermo::thermoType::operator=(lhsThermo == rhsThermo);
155 template<
class ReactionThermo>
162 bool initReactionThermo
165 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
166 name_(
"un-named-reaction-" +
Foam::name(getNewReactionID())),
171 if (initReactionThermo)
173 setThermo(thermoDatabase);
178 template<
class ReactionThermo>
185 ReactionThermo::thermoType(r),
186 name_(r.
name() +
"Copy"),
193 template<
class ReactionThermo>
211 exponent = stoichCoeff;
217 const size_t i = specieName.find(
'^');
221 exponent = atof(specieName.substr(i + 1).c_str());
222 specieName.resize(i);
226 index = species[specieName];
231 <<
"Expected a word but found " << t.
info()
237 template<
class ReactionThermo>
252 if (dlrhs.last().index != -1)
260 else if (t == token::ASSIGN)
290 else if (t == token::ASSIGN)
315 <<
"Cannot continue reading reaction data from stream"
320 template<
class ReactionThermo>
326 bool initReactionThermo
329 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
330 name_(
dict.dictName()),
341 if (initReactionThermo)
343 setThermo(thermoDatabase);
350 template<
class ReactionThermo>
361 auto cstrIter = dictionaryConstructorTablePtr_->cfind(reactionTypeName);
363 if (!cstrIter.found())
370 *dictionaryConstructorTablePtr_
376 cstrIter()(species, thermoDatabase,
dict)
383 template<
class ReactionThermo>
391 template<
class ReactionThermo>
403 template<
class ReactionThermo>
416 template<
class ReactionThermo>
428 template<
class ReactionThermo>
435 template<
class ReactionThermo>
439 return NullObjectRef<speciesTable>();
443 template<
class ReactionThermo>
448 return NullObjectRef<List<specieCoeffs>>();
452 template<
class ReactionThermo>
457 return NullObjectRef<List<specieCoeffs>>();
A class for handling words, derived from Foam::string.
void setLRhs(Istream &, const speciesTable &, List< specieCoeffs > &lhs, List< specieCoeffs > &rhs)
Construct the left- and right-hand-side reaction coefficients.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
const speciesTable & species() const
Access to specie list.
void reactionStrLeft(OStringStream &reaction) const
Return string representation of the left of the reaction.
Class to hold the specie index and its coefficients in the.
A token holds an item read from Istream.
A class for handling character strings derived from std::string.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
virtual const speciesTable & gasSpecies() const
Access to gas specie list.
bool isWord() const noexcept
Token is WORD or DIRECTIVE word.
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.
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
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.
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.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
scalar number() const
Return label, float or double value.
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
word name(const complex &c)
Return string representation of complex.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
virtual void write(Ostream &) const
Write.
void clear()
Clear the addressed list, i.e. set the size to zero.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Input from string buffer, using a ISstream.
const word & wordToken() const
Return const reference to the word contents.
errorManipArg< error, int > exit(error &err, const int errNo=1)
CombustionModel< rhoReactionThermo > & reaction
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to string buffer, using a OSstream.
void putBack(const token &tok)
Put back token.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
T remove()
Remove and return the last element. Fatal on an empty list.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
const dimensionedScalar c
Speed of light in a vacuum.
const word & name() const
#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.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Reaction(const speciesTable &species, const List< specieCoeffs > &lhs, const List< specieCoeffs > &rhs, const HashPtrTable< ReactionThermo > &thermoDatabase, bool initReactionThermo=true)
Construct from components.