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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::foamChemistryReader
29
30Group
31 grpReactionThermophysicalChemistryReaders
32
33Description
34 Chemistry reader for OpenFOAM format
35
36SourceFiles
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
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class foamChemistry Declaration
57\*---------------------------------------------------------------------------*/
58
59template<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
104public:
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
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// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
A HashTable similar to std::unordered_map.
Definition: HashTable.H:123
List of templated reactions.
Definition: ReactionList.H:59
Abstract class for reading chemistry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
Chemistry reader for OpenFOAM format.
virtual ~foamChemistryReader()=default
Destructor.
const HashTable< label > & elementIndices() const
Element indices.
const wordList & elementNames() const
List of elements.
const speciesTable & species() const
Table of species.
const ReactionList< ThermoType > & reactions() const
List of the reactions.
const speciesCompositionTable & specieComposition() const
Table of species composition.
TypeName("foamChemistryReader")
Runtime type information.
const ReactionTable< ThermoType > & speciesThermo() const
Table of the thermodynamic data given in the foamChemistry file.
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
const dictionary & thermoDict
Definition: EEqn.H:16
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73