Go to the documentation of this file.
34 template<
class ReactionThermo>
40 template<
class ReactionThermo>
46 for (label i = 0; i < lhs_.size(); ++i)
52 if (
mag(lhs_[i].stoichCoeff - 1) > SMALL)
57 if (
mag(lhs_[i].exponent - lhs_[i].stoichCoeff) > SMALL)
65 template<
class ReactionThermo>
71 for (label i = 0; i < rhs_.size(); ++i)
77 if (
mag(rhs_[i].stoichCoeff - 1) > SMALL)
82 if (
mag(rhs_[i].exponent - rhs_[i].stoichCoeff) > SMALL)
92 template<
class ReactionThermo>
95 return nUnNamedReactions++;
99 template<
class ReactionThermo>
112 template<
class ReactionThermo>
115 const ReactionTable<ReactionThermo>& thermoDatabase
119 typename ReactionThermo::thermoType rhsThermo
122 *(*thermoDatabase[species_[rhs_[0].index]]).W()
123 *(*thermoDatabase[species_[rhs_[0].index]])
126 for (label i=1; i<rhs_.size(); ++i)
130 *(*thermoDatabase[species_[rhs_[i].index]]).W()
131 *(*thermoDatabase[species_[rhs_[i].index]]);
134 typename ReactionThermo::thermoType lhsThermo
137 *(*thermoDatabase[species_[lhs_[0].index]]).W()
138 *(*thermoDatabase[species_[lhs_[0].index]])
141 for (label i=1; i<lhs_.size(); ++i)
145 *(*thermoDatabase[species_[lhs_[i].index]]).W()
146 *(*thermoDatabase[species_[lhs_[i].index]]);
149 ReactionThermo::thermoType::operator=(lhsThermo == rhsThermo);
156 template<
class ReactionThermo>
163 bool initReactionThermo
166 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
167 name_(
"un-named-reaction-" +
Foam::name(getNewReactionID())),
172 if (initReactionThermo)
174 setThermo(thermoDatabase);
179 template<
class ReactionThermo>
186 ReactionThermo::thermoType(r),
187 name_(r.
name() +
"Copy"),
194 template<
class ReactionThermo>
212 exponent = stoichCoeff;
218 const size_t i = specieName.find(
'^');
222 exponent = atof(specieName.substr(i + 1).c_str());
223 specieName.resize(i);
227 index = species[specieName];
232 <<
"Expected a word but found " << t.
info()
238 template<
class ReactionThermo>
253 if (dlrhs.last().index != -1)
261 else if (t == token::ASSIGN)
291 else if (t == token::ASSIGN)
316 <<
"Cannot continue reading reaction data from stream"
321 template<
class ReactionThermo>
327 bool initReactionThermo
330 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
331 name_(
dict.dictName()),
342 if (initReactionThermo)
344 setThermo(thermoDatabase);
351 template<
class ReactionThermo>
362 auto* ctorPtr = dictionaryConstructorTable(reactionTypeName);
371 *dictionaryConstructorTablePtr_
377 ctorPtr(species, thermoDatabase,
dict)
384 template<
class ReactionThermo>
388 os.writeEntry(
"reaction", reactionStr(
reaction));
392 template<
class ReactionThermo>
404 template<
class ReactionThermo>
417 template<
class ReactionThermo>
429 template<
class ReactionThermo>
433 return NullObjectRef<speciesTable>();
437 template<
class ReactionThermo>
442 return NullObjectRef<List<specieCoeffs>>();
446 template<
class ReactionThermo>
451 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.
void reactionStrLeft(OStringStream &reaction) const
Return string representation of the left of the reaction.
const word & name() const noexcept
Name of reaction.
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.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
virtual const speciesTable & gasSpecies() const
Access to gas specie list.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
virtual const List< specieCoeffs > & glhs() const
bool good() const noexcept
True if next operation might succeed.
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.
#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)....
virtual void write(Ostream &os) const
Write.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
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 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. Always UNCOMPRESSED.
void putBack(const token &tok)
Put back a token. Only a single put back is permitted.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
T remove()
Remove and return the last element. Fatal on an empty list.
const dimensionedScalar c
Speed of light in a vacuum.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual const List< specieCoeffs > & grhs() const
Access to gas components of the reaction.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Reaction(const speciesTable &species, const List< specieCoeffs > &lhs, const List< specieCoeffs > &rhs, const ReactionTable< ReactionThermo > &thermoDatabase, bool initReactionThermo=true)
Construct from components.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
static autoPtr< Reaction< ReactionThermo > > New(const speciesTable &species, const ReactionTable< ReactionThermo > &thermoDatabase, const dictionary &dict)
Return a pointer to new patchField created on freestore from dict.