34template<
class ReactionThermo>
40template<
class ReactionThermo>
41void Foam::Reaction<ReactionThermo>::reactionStr
48 for (label i = 0; i < reactCoeffs.
size(); ++i)
69template<
class ReactionThermo>
75 reactionStr(
reaction, species_, lhs_);
79template<
class ReactionThermo>
85 reactionStr(
reaction, species_, rhs_);
91template<
class ReactionThermo>
92Foam::label Foam::Reaction<ReactionThermo>::getNewReactionID()
94 return nUnNamedReactions++;
98template<
class ReactionThermo>
111template<
class ReactionThermo>
112void Foam::Reaction<ReactionThermo>::setThermo
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);
155template<
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);
178template<
class ReactionThermo>
181 const Reaction<ReactionThermo>& r,
185 ReactionThermo::thermoType(r),
186 name_(r.
name() +
"Copy"),
193template<
class ReactionThermo>
198 bool failUnknownSpecie
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.find(specieName);
229 if (failUnknownSpecie && index < 0)
232 <<
"Unknown specie " << specieName <<
nl
240 <<
"Expected a word but found " << t.
info()
246template<
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)
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"
321template<
class ReactionThermo>
327 bool initReactionThermo,
328 bool failUnknownSpecie
331 ReactionThermo::thermoType(*thermoDatabase[
species[0]]),
346 if (initReactionThermo)
348 setThermo(thermoDatabase);
355template<
class ReactionThermo>
366 auto* ctorPtr = dictionaryConstructorTable(reactionTypeName);
375 *dictionaryConstructorTablePtr_
388template<
class ReactionThermo>
396template<
class ReactionThermo>
408template<
class ReactionThermo>
421template<
class ReactionThermo>
433template<
class ReactionThermo>
441template<
class ReactionThermo>
450template<
class ReactionThermo>
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void pop_back(label n=1)
Reduce size by 1 or more elements. Can be called on an empty list.
void push_back(const T &val)
Copy append an element to the end of this list.
An ISstream with internal List storage. Always UNCOMPRESSED.
bool good() const noexcept
True if next operation might succeed.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void putBack(const token &tok)
Put back a token (copy). Only a single put back is permitted.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static const List< T > & null() noexcept
Return a null List (reference to a nullObject). Behaves like an empty List.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
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.
void setLRhs(Istream &, const speciesTable &, List< specieCoeffs > &lhs, List< specieCoeffs > &rhs, bool failUnknownSpecie=true)
Construct the left- and right-hand-side reaction coefficients.
static label nUnNamedReactions
Number of un-named reactions.
virtual const List< specieCoeffs > & glhs() const
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.
Reaction(const speciesTable &species, const List< specieCoeffs > &lhs, const List< specieCoeffs > &rhs, const ReactionTable< ReactionThermo > &thermoDatabase, bool initReactionThermo=true)
Construct from components.
virtual void write(Ostream &os) const
Write.
const word & name() const noexcept
Name of reaction.
const List< specieCoeffs > & lhs() const noexcept
Specie info for the left-hand-side of the reaction.
void reactionStrLeft(OStringStream &reaction) const
Add string representation of the left of the reaction.
const speciesTable & species() const noexcept
Access to specie list.
virtual const List< specieCoeffs > & grhs() const
Access to gas components of the reaction.
const List< specieCoeffs > & rhs() const noexcept
Specie info for the right-hand-side of the reaction.
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
Forward rate constant.
void reactionStrRight(OStringStream &reaction) const
Add string representation of the right of the reaction.
virtual const speciesTable & gasSpecies() const
Access to gas specie list.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
T & back()
Access last element of the list, position [size()-1].
void size(const label n)
Older name for setAddressableSize.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling character strings derived from std::string.
A token holds an item read from Istream.
bool isNumber() const noexcept
Token is (signed/unsigned) integer type, FLOAT or DOUBLE.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
@ ASSIGN
Assignment/equals [isseparator].
@ ADD
Addition [isseparator].
const word & wordToken() const
Return const reference to the word contents.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE).
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
scalar number() const
Return label, float or double value.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const word dictName("faMeshDefinition")
CombustionModel< rhoReactionThermo > & reaction
const T & NullObjectRef() noexcept
Const reference (of type T) to the nullObject.
hashedWordList speciesTable
A table of species as a hashedWordList.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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 ...
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
HashPtrTable< ThermoType > ReactionTable
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
Hold specie index and its coefficients in the reaction rate expression.