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>
160 const List<specieCoeffs>& lhs,
161 const List<specieCoeffs>& rhs,
162 const ReactionTable<ReactionThermo>& thermoDatabase,
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>
182 const Reaction<ReactionThermo>& r,
186 ReactionThermo::thermoType(r),
187 name_(r.
name() +
"Copy"),
194 template<
class ReactionThermo>
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[specieName];
232 <<
"Expected a word but found " << t.info()
238 template<
class ReactionThermo>
243 List<specieCoeffs>& lhs,
244 List<specieCoeffs>& rhs
247 DynamicList<specieCoeffs> dlrhs;
251 dlrhs.append(specieCoeffs(species, is));
253 if (dlrhs.last().index != -1)
256 if (t.isPunctuation())
263 lhs = dlrhs.shrink();
268 rhs = dlrhs.shrink();
275 rhs = dlrhs.shrink();
286 if (t.isPunctuation())
293 lhs = dlrhs.shrink();
298 rhs = dlrhs.shrink();
308 rhs = dlrhs.shrink();
316 <<
"Cannot continue reading reaction data from stream"
321 template<
class ReactionThermo>
325 const ReactionTable<ReactionThermo>& thermoDatabase,
326 const dictionary&
dict,
327 bool initReactionThermo
330 ReactionThermo::thermoType(*thermoDatabase[species[0]]),
336 IStringStream(
dict.getString(
"reaction"))(),
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>
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>>();
@ ASSIGN
Assignment/equals [isseparator].
A class for handling words, derived from Foam::string.
void setLRhs(Istream &, const speciesTable &, List< specieCoeffs > &lhs, List< specieCoeffs > &rhs)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void reactionStrLeft(OStringStream &reaction) const
const word dictName("faMeshDefinition")
A token holds an item read from Istream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
A class for handling character strings derived from std::string.
DynamicList< T, SizeMin > & shrink()
virtual const speciesTable & gasSpecies() const
bool isWord() const noexcept
virtual const List< specieCoeffs > & glhs() const
bool good() const noexcept
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
void reactionStrRight(OStringStream &reaction) const
bool isNumber() const noexcept
virtual scalar kr(const scalar kfwd, const scalar p, const scalar T, const scalarField &c) const
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Generic templated field type.
InfoProxy< token > info() const
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)....
hashedWordList speciesTable
A table of species as a hashedWordList.
virtual void write(Ostream &os) const
DynamicList< T, SizeMin > & append(const T &val)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
bool isPunctuation() const noexcept
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
const word & wordToken() const
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...
void putBack(const token &tok)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Ostream & writeEntry(const keyType &key, const T &value)
const dimensionedScalar c
word name(const expressions::valueTypeCode typeCode)
#define FatalIOErrorInFunction(ios)
virtual const List< specieCoeffs > & grhs() const
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)
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)
@ ADD
Addition [isseparator].