foamChemistryReader.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 Class
25  Foam::foamChemistryReader
26 
27 Description
28  Chemistry reader for OpenFOAM format
29 
30 SourceFiles
31  foamChemistryReader.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef foamChemistryReader_H
36 #define foamChemistryReader_H
37 
38 #include "chemistryReader.H"
39 #include "fileName.H"
40 #include "typeInfo.H"
41 #include "HashPtrTable.H"
42 #include "labelList.H"
43 #include "speciesTable.H"
44 #include "atomicWeights.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class foamChemistry Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 template<class ThermoType>
57 :
58  public chemistryReader<ThermoType>
59 {
60  //- Chemistry/reactions dictionary
61  dictionary chemDict_;
62 
63  //- Thermo properties dictionary
64  dictionary thermoDict_;
65 
66  //- List of elements
67  DynamicList<word> elementNames_;
68 
69  //- Element indices
70  HashTable<label> elementIndices_;
71 
72  //- Table of species
73  speciesTable& speciesTable_;
74 
75  //- Table of species composition
76  speciesCompositionTable speciesComposition_;
77 
78  //- Table of the thermodynamic data given in the foamChemistry file
79  HashPtrTable<ThermoType> speciesThermo_;
80 
81  //- List of the reactions
82  ReactionList<ThermoType> reactions_;
83 
84 
85  // Private Member Functions
86 
87  //- Set the species list
88  speciesTable& setSpecies(const dictionary& dict, speciesTable& species);
89 
90  //- Read the species composition
91  void readSpeciesComposition();
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("foamChemistryReader");
98 
99 
100  // Constructors
101 
102  //- Construct from foamChemistry and thermodynamics file names
104  (
105  const fileName& reactionsFileName,
106  speciesTable& species,
107  const fileName& thermoFileName
108  );
109 
110  //- Construct by getting the foamChemistry and thermodynamics file names
111  // from dictionary
113  (
114  const dictionary& thermoDict,
115  speciesTable& species
116  );
117 
118  //- Disallow default bitwise copy construction
119  foamChemistryReader(const foamChemistryReader&) = delete;
120 
121 
122  //- Destructor
123  virtual ~foamChemistryReader()
124  {}
125 
126 
127  // Member Functions
128 
129  //- List of elements
130  const wordList& elementNames() const
131  {
132  return elementNames_;
133  }
134 
135  //- Element indices
136  const HashTable<label>& elementIndices() const
137  {
138  return elementIndices_;
139  }
140 
141  //- Table of species
142  const speciesTable& species() const
143  {
144  return speciesTable_;
145  }
146 
147  //- Table of species composition
149  {
150  return speciesComposition_;
151  }
152 
153  //- Table of the thermodynamic data given in the foamChemistry file
155  {
156  return speciesThermo_;
157  }
158 
159  //- List of the reactions
160  const ReactionList<ThermoType>& reactions() const
161  {
162  return reactions_;
163  }
164 
165 
166  // Member Operators
167 
168  //- Disallow default bitwise assignment
169  void operator=(const foamChemistryReader&) = delete;
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #ifdef NoRepository
180  #include "foamChemistryReader.C"
181 #endif
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
const speciesCompositionTable & specieComposition() const
Table of species composition.
dictionary dict
A class for handling file names.
Definition: fileName.H:79
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const HashPtrTable< ThermoType > & speciesThermo() const
Table of the thermodynamic data given in the foamChemistry file.
const wordList & elementNames() const
List of elements.
void operator=(const foamChemistryReader &)=delete
Disallow default bitwise assignment.
const HashTable< label > & elementIndices() const
Element indices.
Chemistry reader for OpenFOAM format.
virtual ~foamChemistryReader()
Destructor.
foamChemistryReader(const fileName &reactionsFileName, speciesTable &species, const fileName &thermoFileName)
Construct from foamChemistry and thermodynamics file names.
TypeName("foamChemistryReader")
Runtime type information.
const ReactionList< ThermoType > & reactions() const
List of the reactions.
List of templated reactions.
Definition: ReactionList.H:54
A wordList with hashed indices for faster lookup by name.
const speciesTable & species() const
Table of species.
Abstract class for reading chemistry.
Namespace for OpenFOAM.