chemistryTabulationMethod.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) 2016-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::chemistryTabulationMethod
28 
29 Description
30  An abstract class for chemistry tabulation.
31 
32 SourceFiles
33  chemistryTabulationMethod.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef chemistryTabulationMethod_H
38 #define chemistryTabulationMethod_H
39 
40 #include "IOdictionary.H"
41 #include "scalarField.H"
42 #include "Switch.H"
43 #include "runTimeSelectionTables.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 template<class CompType, class ThermoType>
53 class TDACChemistryModel;
54 
55 /*---------------------------------------------------------------------------*\
56  Class chemistryTabulationMethod Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class CompType, class ThermoType>
61 {
62 
63 protected:
64 
65  const dictionary& dict_;
66 
67  const dictionary coeffsDict_;
68 
69  //- Is tabulation active?
71 
72  //- Switch to select performance logging
73  Switch log_;
74 
76 
77  scalar tolerance_;
78 
79 
80 public:
81 
82  //- Runtime type information
83  TypeName("chemistryTabulationMethod");
84 
85 
86  // Declare runtime constructor selection table
88  (
89  autoPtr,
91  dictionary,
92  (
93  const dictionary& dict,
95  ),
96  (dict, chemistry)
97  );
98 
99 
100  // Constructors
101 
102  //- Construct from components
104  (
105  const dictionary& dict,
107  );
108 
109 
110  // Selectors
111 
113  (
114  const IOdictionary& dict,
116  );
117 
118 
119  //- Destructor
120  virtual ~chemistryTabulationMethod();
121 
122 
123  // Member Functions
124 
125  inline bool active()
126  {
127  return active_;
128  }
129 
130  inline bool log()
131  {
132  return active_ && log_;
133  }
134 
135  inline bool variableTimeStep()
136  {
137  return chemistry_.variableTimeStep();
138  }
139 
140  inline scalar tolerance() const
141  {
142  return tolerance_;
143  }
144 
145  virtual label size() = 0;
146 
147  virtual void writePerformance() = 0;
148 
149  // Retrieve function: (only virtual here)
150  // Try to retrieve a stored point close enough (according to tolerance)
151  // to a stored point. If successful, it returns true and store the
152  // results in RphiQ, i.e. the result of the integration of phiQ
153  virtual bool retrieve
154  (
155  const scalarField& phiQ,
156  scalarField& RphiQ
157  ) = 0;
158 
159  // Add function: (only virtual here)
160  // Add information to the tabulation algorithm. Give the reference for
161  // future retrieve (phiQ) and the corresponding result (RphiQ).
162  virtual label add
163  (
164  const scalarField& phiQ,
165  const scalarField& RphiQ,
166  const scalar rho,
167  const scalar deltaT
168  ) = 0;
169 
170  // Update function: (only virtual here)
171  // The underlying structure of the tabulation is updated/cleaned
172  // to increase the performance of the retrieve
173  virtual bool update() = 0;
174 };
175 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #ifdef NoRepository
184  #include "chemistryTabulationMethod.C"
186 #endif
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::chemistryTabulationMethod::coeffsDict_
const dictionary coeffsDict_
Definition: chemistryTabulationMethod.H:66
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::chemistryTabulationMethod::dict_
const dictionary & dict_
Definition: chemistryTabulationMethod.H:64
scalarField.H
Foam::chemistryTabulationMethod::variableTimeStep
bool variableTimeStep()
Definition: chemistryTabulationMethod.H:134
chemistry
BasicChemistryModel< psiReactionThermo > & chemistry
Definition: createFieldRefs.H:1
Foam::chemistryTabulationMethod::chemistry_
TDACChemistryModel< CompType, ThermoType > & chemistry_
Definition: chemistryTabulationMethod.H:74
Foam::chemistryTabulationMethod::active_
Switch active_
Is tabulation active?
Definition: chemistryTabulationMethod.H:69
Foam::chemistryTabulationMethod::update
virtual bool update()=0
rho
rho
Definition: readInitialConditions.H:88
Foam::chemistryTabulationMethod::tolerance
scalar tolerance() const
Definition: chemistryTabulationMethod.H:139
Foam::chemistryTabulationMethod::log
bool log()
Definition: chemistryTabulationMethod.H:129
chemistryTabulationMethod.C
Foam::chemistryTabulationMethod::add
virtual label add(const scalarField &phiQ, const scalarField &RphiQ, const scalar rho, const scalar deltaT)=0
Foam::Field< scalar >
Foam::chemistryTabulationMethod::tolerance_
scalar tolerance_
Definition: chemistryTabulationMethod.H:76
Foam::chemistryTabulationMethod::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, chemistryTabulationMethod, dictionary,(const dictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry),(dict, chemistry))
Switch.H
Foam::chemistryTabulationMethod::writePerformance
virtual void writePerformance()=0
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
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::TDACChemistryModel::variableTimeStep
bool variableTimeStep() const
Return true if the time-step is variable and/or non-uniform.
Definition: TDACChemistryModelI.H:32
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::chemistryTabulationMethod::~chemistryTabulationMethod
virtual ~chemistryTabulationMethod()
Destructor.
Definition: chemistryTabulationMethod.C:54
Foam::chemistryTabulationMethod::size
virtual label size()=0
Foam::chemistryTabulationMethod::retrieve
virtual bool retrieve(const scalarField &phiQ, scalarField &RphiQ)=0
chemistryTabulationMethodNew.C
Foam::chemistryTabulationMethod::chemistryTabulationMethod
chemistryTabulationMethod(const dictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry)
Construct from components.
Definition: chemistryTabulationMethod.C:36
Foam::TDACChemistryModel< CompType, ThermoType >
Foam::chemistryTabulationMethod::TypeName
TypeName("chemistryTabulationMethod")
Runtime type information.
Foam::chemistryTabulationMethod::New
static autoPtr< chemistryTabulationMethod > New(const IOdictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry)
Definition: chemistryTabulationMethodNew.C:37
Foam::chemistryTabulationMethod::active
bool active()
Definition: chemistryTabulationMethod.H:124
Foam::chemistryTabulationMethod::log_
Switch log_
Switch to select performance logging.
Definition: chemistryTabulationMethod.H:72
Foam::chemistryTabulationMethod
An abstract class for chemistry tabulation.
Definition: chemistryTabulationMethod.H:59