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-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::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 CompType, class ThermoType>
51 class TDACChemistryModel;
52 
53 /*---------------------------------------------------------------------------*\
54  Class chemistryTabulationMethod Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class CompType, 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 bool variableTimeStep()
134  {
135  return chemistry_.variableTimeStep();
136  }
138  inline scalar tolerance() const
139  {
140  return tolerance_;
141  }
142 
143  virtual label size() = 0;
144 
145  virtual void writePerformance() = 0;
146 
147  // Retrieve function: (only virtual here)
148  // Try to retrieve a stored point close enough (according to tolerance)
149  // to a stored point. If successful, it returns true and store the
150  // results in RphiQ, i.e. the result of the integration of phiQ
151  virtual bool retrieve
152  (
153  const scalarField& phiQ,
154  scalarField& RphiQ
155  ) = 0;
156 
157  // Add function: (only virtual here)
158  // Add information to the tabulation algorithm. Give the reference for
159  // future retrieve (phiQ) and the corresponding result (RphiQ).
160  virtual label add
161  (
162  const scalarField& phiQ,
163  const scalarField& RphiQ,
164  const label li,
165  const scalar rho,
166  const scalar deltaT
167  ) = 0;
168 
169  // Update function: (only virtual here)
170  // The underlying structure of the tabulation is updated/cleaned
171  // to increase the performance of the retrieve
172  virtual bool update() = 0;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
183  #include "chemistryTabulationMethod.C"
185 #endif
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
Switch active_
Is tabulation active?
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
chemistryTabulationMethod(const dictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry)
Construct from components.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
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
BasicChemistryModel< rhoReactionThermo > & chemistry
TypeName("chemistryTabulationMethod")
Runtime type information.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
virtual bool retrieve(const scalarField &phiQ, scalarField &RphiQ)=0
TDACChemistryModel< CompType, ThermoType > & chemistry_
declareRunTimeSelectionTable(autoPtr, chemistryTabulationMethod, dictionary,(const dictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry),(dict, chemistry))
bool variableTimeStep() const
Return true if the time-step is variable and/or non-uniform.
An abstract class for chemistry tabulation.
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.
static autoPtr< chemistryTabulationMethod > New(const IOdictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry)
virtual ~chemistryTabulationMethod()
Destructor.
Namespace for OpenFOAM.