FreeFOAM The Cross-Platform CFD Toolkit
chemistrySolver.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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::chemistrySolver
26 
27 Description
28  An abstract base class for solving chemistry
29 
30 SourceFiles
31  chemistrySolver.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef chemistrySolver_H
36 #define chemistrySolver_H
37 
39 #include <OpenFOAM/IOdictionary.H>
40 #include <OpenFOAM/scalarField.H>
41 #include <OpenFOAM/autoPtr.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 template<class CompType, class ThermoType>
51 class chemistrySolver;
52 
53 /*---------------------------------------------------------------------------*\
54  Class chemistrySolver Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class CompType, class ThermoType>
59 {
60 protected:
61 
62  // Protected data
63 
64  //- Reference to the chemistry model
66 
67  //- Name of the chemistry solver
68  const word name_;
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("chemistrySolver");
75 
76 
77  // Declare runtime constructor selection table
79  (
80  autoPtr,
82  dictionary,
83  (
85  const word& modelName
86  ),
87  (model, modelName)
88  );
89 
90 
91  // Constructors
92 
93  //- Construct from components
95  (
97  const word& modelName
98  );
99 
100 
101  //- Selector
103  (
105  const word& compTypeName,
106  const word& thermoTypeName
107  );
108 
109 
110  //- Destructor
111  virtual ~chemistrySolver();
112 
113 
114  // Member Functions
115 
116  //- Update the concentrations and return the chemical time
117  virtual scalar solve
118  (
119  scalarField &c,
120  const scalar T,
121  const scalar p,
122  const scalar t0,
123  const scalar dt
124  ) const = 0;
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #define makeChemistrySolver(Comp, Thermo) \
135  \
136  typedef chemistrySolver<Comp, Thermo> \
137  chemistrySolver##Comp##Thermo; \
138  \
139  defineTemplateTypeNameAndDebugWithName \
140  ( \
141  chemistrySolver##Comp##Thermo, \
142  "chemistryModel<"#Comp","#Thermo">", \
143  0 \
144  ); \
145  \
146  defineTemplateRunTimeSelectionTable \
147  ( \
148  chemistrySolver##Comp##Thermo, \
149  dictionary \
150  );
151 
152 
153 #define makeChemistrySolverType(SS, Comp, Thermo) \
154  \
155  typedef SS<Comp, Thermo> SS##Comp##Thermo; \
156  \
157  defineTemplateTypeNameAndDebugWithName \
158  ( \
159  SS##Comp##Thermo, \
160  #SS"<"#Comp","#Thermo">", \
161  0 \
162  ); \
163  \
164  chemistrySolver<Comp, Thermo>:: \
165  adddictionaryConstructorToTable<SS<Comp, Thermo> > \
166  add##SS##Comp##Thermo##ConstructorToTable_;
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #ifdef NoRepository
172 # include "chemistrySolver.C"
173 # include "newChemistrySolver.C"
174 #endif
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************ vim: set sw=4 sts=4 et: ************************ //