foamChemistryReader.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "foamChemistryReader.H"
27 #include "IFstream.H"
29 
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 
32 template<class ThermoType>
34 (
35  const dictionary& dict,
36  speciesTable& species
37 )
38 {
39  wordList s(dict.lookup("species"));
40  species.transfer(s);
41  return species;
42 }
43 
44 
45 // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
46 
47 template<class ThermoType>
49 (
50  const fileName& reactionsFileName,
51  speciesTable& species,
52  const fileName& thermoFileName
53 )
54 :
56  chemDict_
57  (
58  IFstream
59  (
60  fileName(reactionsFileName).expand()
61  )()
62  ),
63  thermoDict_
64  (
65  IFstream
66  (
67  fileName(thermoFileName).expand()
68  )()
69  ),
70  speciesTable_(setSpecies(chemDict_, species)),
71  speciesThermo_(thermoDict_),
72  reactions_(speciesTable_, speciesThermo_, chemDict_)
73 {}
74 
75 
76 template<class ThermoType>
78 (
79  const dictionary& thermoDict,
80  speciesTable& species
81 )
82 :
84  chemDict_
85  (
86  IFstream
87  (
88  fileName(thermoDict.lookup("foamChemistryFile")).expand()
89  )()
90  ),
91  thermoDict_
92  (
93  IFstream
94  (
95  fileName(thermoDict.lookup("foamChemistryThermoFile")).expand()
96  )()
97  ),
98  speciesThermo_(thermoDict_),
99  speciesTable_(setSpecies(chemDict_, species)),
100  reactions_(speciesTable_, speciesThermo_, chemDict_)
101 {}
102 
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::chemistryReader
Abstract class for reading chemistry.
Definition: chemistryReader.H:52
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::IFstream
Input from file stream.
Definition: IFstream.H:81
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
foamChemistryReader.H
Foam::hashedWordList
A wordList with hashed indices for faster lookup by name.
Definition: hashedWordList.H:57
Foam::hashedWordList::transfer
void transfer(List< word > &)
Transfer the contents of the argument List into this list.
Definition: hashedWordList.C:134
IFstream.H
Foam::foamChemistryReader::foamChemistryReader
foamChemistryReader(const foamChemistryReader &)
Disallow default bitwise copy construct.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::string::expand
string & expand(const bool allowEmpty=false)
Expand initial tildes and all occurences of environment variables.
Definition: string.C:98
Foam::stringOps::expand
string expand(const string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Expand occurences of variables according to the mapping.
Definition: stringOps.C:74
Foam::foamChemistryReader::setSpecies
speciesTable & setSpecies(const dictionary &dict, speciesTable &species)
Set the species list.
Definition: foamChemistryReader.C:34