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  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::foamChemistryReader
29 
30 Group
31  grpReactionThermophysicalChemistryReaders
32 
33 Description
34  Chemistry reader for OpenFOAM format
35 
36 SourceFiles
37  foamChemistryReader.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef foamChemistryReader_H
42 #define foamChemistryReader_H
43 
44 #include "chemistryReader.H"
45 #include "fileName.H"
46 #include "labelList.H"
47 #include "speciesTable.H"
48 #include "atomicWeights.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class foamChemistry Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class ThermoType>
61 :
62  public chemistryReader<ThermoType>
63 {
64  //- Chemistry/reactions dictionary
65  dictionary chemDict_;
66 
67  //- Thermo properties dictionary
68  dictionary thermoDict_;
69 
70  //- List of elements
71  DynamicList<word> elementNames_;
72 
73  //- Element indices
74  HashTable<label> elementIndices_;
75 
76  //- Table of species
77  speciesTable& speciesTable_;
78 
79  //- Table of species composition
80  speciesCompositionTable speciesComposition_;
81 
82  //- Table of the thermodynamic data given in the foamChemistry file
83  ReactionTable<ThermoType> speciesThermo_;
84 
85  //- List of the reactions
86  ReactionList<ThermoType> reactions_;
87 
88 
89  // Private Member Functions
90 
91  //- Set the species list
92  speciesTable& setSpecies(const dictionary& dict, speciesTable& species);
93 
94  //- Read the species composition
95  void readSpeciesComposition();
96 
97  //- No copy construct
99 
100  //- No copy assignment
101  void operator=(const foamChemistryReader&) = delete;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("foamChemistryReader");
108 
109 
110  // Constructors
111 
112  //- Construct from foamChemistry and thermodynamics file names
114  (
115  const fileName& reactionsFileName,
117  const fileName& thermoFileName
118  );
119 
120  //- Construct by getting foamChemistry and thermodynamics file names
121  //- from dictionary
123  (
124  const dictionary& thermoDict,
126  );
127 
128 
129  //- Destructor
130  virtual ~foamChemistryReader() = default;
131 
132 
133  // Member Functions
134 
135  //- List of elements
136  const wordList& elementNames() const
137  {
138  return elementNames_;
139  }
140 
141  //- Element indices
142  const HashTable<label>& elementIndices() const
143  {
144  return elementIndices_;
145  }
146 
147  //- Table of species
148  const speciesTable& species() const
149  {
150  return speciesTable_;
151  }
152 
153  //- Table of species composition
155  {
156  return speciesComposition_;
157  }
158 
159  //- Table of the thermodynamic data given in the foamChemistry file
161  {
162  return speciesThermo_;
163  }
164 
165  //- List of the reactions
166  const ReactionList<ThermoType>& reactions() const
167  {
168  return reactions_;
169  }
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 // ************************************************************************* //
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:135
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::DynamicList< word >
atomicWeights.H
speciesTable.H
Foam::ReactionList
List of templated reactions.
Definition: ReactionList.H:56
labelList.H
Foam::foamChemistryReader::specieComposition
const speciesCompositionTable & specieComposition() const
Table of species composition.
Definition: foamChemistryReader.H:153
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:147
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:123
foamChemistryReader.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::HashTable< label >
Foam::foamChemistryReader::speciesThermo
const ReactionTable< ThermoType > & speciesThermo() const
Table of the thermodynamic data given in the foamChemistry file.
Definition: foamChemistryReader.H:159
thermoDict
const dictionary & thermoDict
Definition: EEqn.H:16
Foam::foamChemistryReader
Chemistry reader for OpenFOAM format.
Definition: foamChemistryReader.H:59
Foam::HashPtrTable< ThermoType >
Foam::foamChemistryReader::elementIndices
const HashTable< label > & elementIndices() const
Element indices.
Definition: foamChemistryReader.H:141
Foam::List< word >
Foam::foamChemistryReader::TypeName
TypeName("foamChemistryReader")
Runtime type information.
Foam::foamChemistryReader::reactions
const ReactionList< ThermoType > & reactions() const
List of the reactions.
Definition: foamChemistryReader.H:165
chemistryReader.H