34 template<
class ReactionThermo>
40 template<
class ReactionThermo>
48 for (label i = 0; i < reactCoeffs.
size(); ++i)
69 template<
class ReactionThermo>
75 reactionStr(
reaction, species_, lhs_);
79 template<
class ReactionThermo>
85 reactionStr(
reaction, species_, rhs_);
91 template<
class ReactionThermo>
94 return nUnNamedReactions++;
98 template<
class ReactionThermo>
111 template<
class ReactionThermo>
114 const ReactionTable<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>
181 const Reaction<ReactionThermo>& r,
185 ReactionThermo::thermoType(r),
186 name_(r.
name() +
"Copy"),
193 template<
class ReactionThermo>
198 bool failUnknownSpecie
204 stoichCoeff = t.number();
212 exponent = stoichCoeff;
216 word specieName = t.wordToken();
218 const size_t i = specieName.find(
'^');
222 exponent = atof(specieName.substr(i + 1).c_str());
223 specieName.resize(i);
227 index = species.
find(specieName);
229 if (failUnknownSpecie && index < 0)
232 <<
"Unknown specie " << specieName <<
nl 240 <<
"Expected a word but found " << t.info()
246 template<
class ReactionThermo>
251 List<specieCoeffs>& lhs,
252 List<specieCoeffs>& rhs,
253 bool failUnknownSpecie
256 DynamicList<specieCoeffs> dlrhs;
258 bool parsingRight =
false;
262 dlrhs.push_back(specieCoeffs(species, is, failUnknownSpecie));
264 if (dlrhs.back().index < 0)
272 if (t.isPunctuation())
282 <<
"Multiple '=' in reaction equation" <<
endl 293 <<
"Unknown punctuation token '" << t
294 <<
"' in reaction equation" <<
endl 305 else if (parsingRight)
316 <<
"Cannot continue reading reaction data from stream" 321 template<
class ReactionThermo>
327 bool initReactionThermo,
328 bool failUnknownSpecie
331 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
344 if (initReactionThermo)
346 setThermo(thermoDatabase);
353 template<
class ReactionThermo>
364 auto* ctorPtr = dictionaryConstructorTable(reactionTypeName);
373 *dictionaryConstructorTablePtr_
379 ctorPtr(species, thermoDatabase,
dict)
386 template<
class ReactionThermo>
394 template<
class ReactionThermo>
406 template<
class ReactionThermo>
419 template<
class ReactionThermo>
431 template<
class ReactionThermo>
435 return NullObjectRef<speciesTable>();
439 template<
class ReactionThermo>
444 return NullObjectRef<List<specieCoeffs>>();
448 template<
class ReactionThermo>
453 return NullObjectRef<List<specieCoeffs>>();
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.
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
Forward rate constant.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual const List< specieCoeffs > & grhs() const
Access to gas components of the reaction.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#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...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
A token holds an item read from Istream.
const word dictName("faMeshDefinition")
virtual void write(Ostream &os) const
Write.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Assignment/equals [isseparator].
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
hashedWordList speciesTable
A table of species as a hashedWordList.
Hold specie index and its coefficients in the reaction rate expression.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
void reactionStrLeft(OStringStream &reaction) const
Add string representation of the left of the reaction.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
Reaction(const speciesTable &species, const List< specieCoeffs > &lhs, const List< specieCoeffs > &rhs, const ReactionTable< ReactionThermo > &thermoDatabase, bool initReactionThermo=true)
Construct from components.
virtual const List< specieCoeffs > & glhs() const
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual const speciesTable & gasSpecies() const
Access to gas specie list.
void reactionStrRight(OStringStream &reaction) const
Add string representation of the right of the reaction.
void setLRhs(Istream &, const speciesTable &, List< specieCoeffs > &lhs, List< specieCoeffs > &rhs, bool failUnknownSpecie=true)
Construct the left- and right-hand-side reaction coefficients.
CombustionModel< rhoReactionThermo > & reaction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
const dimensionedScalar c
Speed of light in a vacuum.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
label find(const word &val) const
Find index of the value (searches the hash).
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
A class for handling character strings derived from std::string.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...