chemistryTabulationMethod.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) 2016-2021 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::chemistryTabulationMethod
26 
27 Description
28  An abstract class for chemistry tabulation.
29 
30 SourceFiles
31  chemistryTabulationMethod.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef chemistryTabulationMethod_H
36 #define chemistryTabulationMethod_H
37 
38 #include "IOdictionary.H"
39 #include "scalarField.H"
40 #include "Switch.H"
41 #include "runTimeSelectionTables.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 template<class ThermoType>
51 class TDACChemistryModel;
52 
53 /*---------------------------------------------------------------------------*\
54  Class chemistryTabulationMethod Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class ThermoType>
59 {
60 
61 protected:
62 
63  const dictionary& dict_;
64 
65  const dictionary coeffsDict_;
66 
67  //- Is tabulation active?
69 
70  //- Switch to select performance logging
71  Switch log_;
72 
74 
75  scalar tolerance_;
76 
77 
78 public:
79 
80  //- Runtime type information
81  TypeName("chemistryTabulationMethod");
82 
83 
84  // Declare runtime constructor selection table
86  (
87  autoPtr,
89  dictionary,
90  (
91  const dictionary& dict,
93  ),
94  (dict, chemistry)
95  );
96 
97 
98  // Constructors
99 
100  //- Construct from components
102  (
103  const dictionary& dict,
105  );
106 
107 
108  // Selectors
109 
111  (
112  const IOdictionary& dict,
114  );
115 
116 
117  //- Destructor
118  virtual ~chemistryTabulationMethod();
119 
120 
121  // Member Functions
123  inline bool active()
124  {
125  return active_;
126  }
128  inline bool log()
129  {
130  return active_ && log_;
131  }
133  inline scalar tolerance() const
134  {
135  return tolerance_;
136  }
137 
138  virtual label size() = 0;
139 
140  virtual void writePerformance() = 0;
141 
142  // Retrieve function: (only virtual here)
143  // Try to retrieve a stored point close enough (according to tolerance)
144  // to a stored point. If successful, it returns true and store the
145  // results in RphiQ, i.e. the result of the integration of phiQ
146  virtual bool retrieve
147  (
148  const scalarField& phiQ,
149  scalarField& RphiQ
150  ) = 0;
151 
152  // Add function: (only virtual here)
153  // Add information to the tabulation algorithm. Give the reference for
154  // future retrieve (phiQ) and the corresponding result (RphiQ).
155  virtual label add
156  (
157  const scalarField& phiQ,
158  const scalarField& RphiQ,
159  const label li,
160  const scalar rho,
161  const scalar deltaT
162  ) = 0;
163 
164  // Update function: (only virtual here)
165  // The underlying structure of the tabulation is updated/cleaned
166  // to increase the performance of the retrieve
167  virtual bool update() = 0;
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #ifdef NoRepository
178  #include "chemistryTabulationMethod.C"
180 #endif
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
Switch active_
Is tabulation active?
Extends standardChemistryModel by adding the TDAC method.
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
declareRunTimeSelectionTable(autoPtr, chemistryTabulationMethod, dictionary,(const dictionary &dict, TDACChemistryModel< ThermoType > &chemistry),(dict, chemistry))
virtual label add(const scalarField &phiQ, const scalarField &RphiQ, const label li, const scalar rho, const scalar deltaT)=0
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
virtual void writePerformance()=0
TypeName("chemistryTabulationMethod")
Runtime type information.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
virtual bool retrieve(const scalarField &phiQ, scalarField &RphiQ)=0
basicChemistryModel & chemistry
chemistryTabulationMethod(const dictionary &dict, TDACChemistryModel< ThermoType > &chemistry)
Construct from components.
An abstract class for chemistry tabulation.
static autoPtr< chemistryTabulationMethod > New(const IOdictionary &dict, TDACChemistryModel< ThermoType > &chemistry)
Switch log_
Switch to select performance logging.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
TDACChemistryModel< ThermoType > & chemistry_
virtual ~chemistryTabulationMethod()
Destructor.
Namespace for OpenFOAM.