foamChemistryReader.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::foamChemistryReader
28 
29 Group
30  grpReactionThermophysicalChemistryReaders
31 
32 Description
33  Chemistry reader for OpenFOAM format
34 
35 SourceFiles
36  foamChemistryReader.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef foamChemistryReader_H
41 #define foamChemistryReader_H
42 
43 #include "chemistryReader.H"
44 #include "fileName.H"
45 #include "typeInfo.H"
46 #include "HashPtrTable.H"
47 #include "labelList.H"
48 #include "speciesTable.H"
49 #include "atomicWeights.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class foamChemistry Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class ThermoType>
62 :
63  public chemistryReader<ThermoType>
64 {
65  //- Chemistry/reactions dictionary
66  dictionary chemDict_;
67 
68  //- Thermo properties dictionary
69  dictionary thermoDict_;
70 
71  //- List of elements
72  DynamicList<word> elementNames_;
73 
74  //- Element indices
75  HashTable<label> elementIndices_;
76 
77  //- Table of species
78  speciesTable& speciesTable_;
79 
80  //- Table of species composition
81  speciesCompositionTable speciesComposition_;
82 
83  //- Table of the thermodynamic data given in the foamChemistry file
84  HashPtrTable<ThermoType> speciesThermo_;
85 
86  //- List of the reactions
87  ReactionList<ThermoType> reactions_;
88 
89 
90  // Private Member Functions
91 
92  //- Set the species list
93  speciesTable& setSpecies(const dictionary& dict, speciesTable& species);
94 
95  //- Read the species composition
96  void readSpeciesComposition();
97 
98  //- No copy construct
100 
101  //- No copy assignment
102  void operator=(const foamChemistryReader&) = delete;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("foamChemistryReader");
109 
110 
111  // Constructors
112 
113  //- Construct from foamChemistry and thermodynamics file names
115  (
116  const fileName& reactionsFileName,
118  const fileName& thermoFileName
119  );
120 
121  //- Construct by getting the foamChemistry and thermodynamics file names
122  // from dictionary
124  (
125  const dictionary& thermoDict,
127  );
128 
129 
130  //- Destructor
131  virtual ~foamChemistryReader() = default;
132 
133 
134  // Member functions
135 
136  //- List of elements
137  const wordList& elementNames() const
138  {
139  return elementNames_;
140  }
141 
142  //- Element indices
143  const HashTable<label>& elementIndices() const
144  {
145  return elementIndices_;
146  }
147 
148  //- Table of species
149  const speciesTable& species() const
150  {
151  return speciesTable_;
152  }
153 
154  //- Table of species composition
156  {
157  return speciesComposition_;
158  }
159 
160  //- Table of the thermodynamic data given in the foamChemistry file
162  {
163  return speciesThermo_;
164  }
165 
166  //- List of the reactions
167  const ReactionList<ThermoType>& reactions() const
168  {
169  return reactions_;
170  }
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #ifdef NoRepository
181  #include "foamChemistryReader.C"
182 #endif
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
Foam::foamChemistryReader::~foamChemistryReader
virtual ~foamChemistryReader()=default
Destructor.
Foam::chemistryReader
Abstract class for reading chemistry.
Definition: chemistryReader.H:61
Foam::foamChemistryReader::elementNames
const wordList & elementNames() const
List of elements.
Definition: foamChemistryReader.H:136
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
typeInfo.H
Foam::DynamicList< word >
atomicWeights.H
speciesTable.H
Foam::foamChemistryReader::speciesThermo
const HashPtrTable< ThermoType > & speciesThermo() const
Table of the thermodynamic data given in the foamChemistry file.
Definition: foamChemistryReader.H:160
Foam::ReactionList
List of templated reactions.
Definition: ReactionList.H:57
labelList.H
Foam::foamChemistryReader::specieComposition
const speciesCompositionTable & specieComposition() const
Table of species composition.
Definition: foamChemistryReader.H:154
Foam::hashedWordList
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
Definition: hashedWordList.H:54
fileName.H
Foam::foamChemistryReader::species
const speciesTable & species() const
Table of species.
Definition: foamChemistryReader.H:148
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
foamChemistryReader.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::HashTable< label >
thermoDict
const dictionary & thermoDict
Definition: EEqn.H:16
Foam::foamChemistryReader
Chemistry reader for OpenFOAM format.
Definition: foamChemistryReader.H:60
Foam::HashPtrTable< ThermoType >
Foam::foamChemistryReader::elementIndices
const HashTable< label > & elementIndices() const
Element indices.
Definition: foamChemistryReader.H:142
Foam::List< word >
Foam::foamChemistryReader::TypeName
TypeName("foamChemistryReader")
Runtime type information.
HashPtrTable.H
Foam::foamChemistryReader::reactions
const ReactionList< ThermoType > & reactions() const
List of the reactions.
Definition: foamChemistryReader.H:166
chemistryReader.H