35template<
class ThermoType>
48template<
class ThermoType>
49void Foam::foamChemistryReader<ThermoType>::readSpeciesComposition()
53 if (!chemDict_.readIfPresent(
"elements", elems))
55 Info<<
" elements not defined in " << chemDict_.name() <<
endl;
59 DynamicList<word> elementNames_;
60 HashTable<label> elementIndices_;
62 for (
const word& elemName : elems)
64 if (elementIndices_.insert(elemName, elementNames_.size()))
66 elementNames_.append(elemName);
71 <<
"element " << elemName <<
" already in table." <<
endl;
76 for (
const word& specieName : speciesTable_)
79 thermoDict_.subDict(specieName).findDict(
"elements");
84 <<
"Specie " << specieName
85 <<
" does not contain \"elements\" description."
86 <<
exit(FatalIOError);
89 wordList elemNames(elemsDict->toc());
90 List<specieElement> currentComposition(elemNames.size());
94 currentComposition[eni].name() = elemNames[eni];
96 currentComposition[eni].nAtoms() =
97 elemsDict->getOrDefault<label>
106 speciesComposition_.erase(specieName);
107 speciesComposition_.
set(specieName, currentComposition);
114template<
class ThermoType>
115Foam::foamChemistryReader<ThermoType>::foamChemistryReader
117 const fileName& reactionsFileName,
118 speciesTable& species,
119 const fileName& thermoFileName
122 chemistryReader<ThermoType>(),
127 fileName(reactionsFileName).expand()
134 fileName(thermoFileName).expand()
137 speciesTable_(setSpecies(chemDict_, species)),
138 speciesThermo_(thermoDict_),
139 reactions_(speciesTable_, speciesThermo_, chemDict_)
141 readSpeciesComposition();
145template<
class ThermoType>
146Foam::foamChemistryReader<ThermoType>::foamChemistryReader
167 speciesTable_(setSpecies(chemDict_,
species)),
168 speciesThermo_(thermoDict_),
169 reactions_(speciesTable_, speciesThermo_, chemDict_)
171 readSpeciesComposition();
Macros for easy insertion into run-time selection tables.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
Abstract class for reading chemistry.
chemistryReader()
Default construct.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
const speciesTable & species() const
Table of species.
const dictionary & thermoDict
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere).
hashedWordList speciesTable
A table of species as a hashedWordList.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.