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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
A class for handling file names.
Definition: fileName.H:69
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
hashedWordList speciesTable
A table of species as a hashedWordList.
Definition: speciesTable.H:41
Macros for easy insertion into run-time selection tables.
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))
Chemistry reader for OpenFOAM format.
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:75
Input from file stream.
Definition: IFstream.H:81
List< word > wordList
A List of words.
Definition: fileName.H:54
A wordList with hashed indices for faster lookup by name.
Abstract class for reading chemistry.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451