makeReaction.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) 2011-2020 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 InClass
25  Foam::makeReaction
26 
27 Description
28  Macros for instantiating reactions on given thermo packages
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef makeReaction_H
33 #define makeReaction_H
34 
35 #include "Reaction.H"
36 
37 #include "IrreversibleReaction.H"
38 #include "ReversibleReaction.H"
40 
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 #define defineReaction(nullArg, ThermoPhysics) \
51  \
52  typedef Reaction<ThermoPhysics> Reaction##ThermoPhysics; \
53  \
54  defineTemplateTypeNameAndDebug(Reaction##ThermoPhysics, 0); \
55  \
56  defineTemplateRunTimeSelectionTable(Reaction##ThermoPhysics, dictionary) \
57  defineTemplateRunTimeSelectionTable \
58  ( \
59  Reaction##ThermoPhysics, \
60  objectRegistry \
61  )
62 
63 
64 #define makeReaction(ReactionType, ReactionRate, ThermoPhysics) \
65  \
66  typedef ReactionType<ThermoPhysics, ReactionRate> \
67  ReactionType##ThermoPhysics##ReactionRate; \
68  typedef Reaction<ThermoPhysics> \
69  ReactionType##ThermoPhysics##ReactionRate##Base; \
70  \
71  template<> \
72  const word ReactionType##ThermoPhysics##ReactionRate::typeName \
73  ( \
74  ReactionType::typeName_() \
75  + ReactionRate::type().capitalise() \
76  ); \
77  \
78  addToRunTimeSelectionTable \
79  ( \
80  ReactionType##ThermoPhysics##ReactionRate##Base, \
81  ReactionType##ThermoPhysics##ReactionRate, \
82  dictionary \
83  )
84 
85 
86 #define makeGeneralReaction(ReactionType, ReactionRate, ThermoPhysics) \
87  \
88  typedef ReactionType<ThermoPhysics, ReactionRate> \
89  ReactionType##ThermoPhysics##ReactionRate; \
90  typedef Reaction<ThermoPhysics> \
91  ReactionType##ThermoPhysics##ReactionRate##Base; \
92  \
93  template<> \
94  const word ReactionType##ThermoPhysics##ReactionRate::typeName \
95  ( \
96  ReactionType::typeName_() \
97  + ReactionRate::type().capitalise() \
98  ); \
99  \
100  addToRunTimeSelectionTable \
101  ( \
102  ReactionType##ThermoPhysics##ReactionRate##Base, \
103  ReactionType##ThermoPhysics##ReactionRate, \
104  objectRegistry \
105  );
106 
107 
108 #define makePressureDependentReaction\
109 ( \
110  ReactionType, \
111  PressureDependentReactionRate, \
112  ReactionRate, \
113  FallOffFunction, \
114  ThermoPhysics \
115 ) \
116  \
117  typedef PressureDependentReactionRate<ReactionRate, FallOffFunction> \
118  PressureDependentReactionRate##ReactionRate##FallOffFunction; \
119  \
120  makeReaction \
121  ( \
122  ReactionType, \
123  PressureDependentReactionRate##ReactionRate##FallOffFunction, \
124  ThermoPhysics \
125  )
126 
127 
128 #define makeIReactions(ReactionRate, ThermoPhysics) \
129  \
130  makeReaction(IrreversibleReaction, ReactionRate, ThermoPhysics)
131 
132 
133 #define makeIRReactions(ReactionRate, ThermoPhysics) \
134  \
135  makeIReactions(ReactionRate, ThermoPhysics); \
136  makeReaction(ReversibleReaction, ReactionRate, ThermoPhysics)
137 
138 
139 #define makeIRNReactions(ReactionRate, ThermoPhysics) \
140  \
141  makeIRReactions(ReactionRate, ThermoPhysics); \
142  makeReaction(NonEquilibriumReversibleReaction, ReactionRate, ThermoPhysics)
143 
144 
145 #define makeIRRPressureDependentReactions\
146 ( \
147  PressureDependentReactionRate, \
148  ReactionRate, \
149  FallOffFunction, \
150  ThermoPhysics \
151 ) \
152  \
153  makePressureDependentReaction \
154  ( \
155  IrreversibleReaction, \
156  PressureDependentReactionRate, \
157  ReactionRate, \
158  FallOffFunction, \
159  ThermoPhysics \
160  ); \
161  makePressureDependentReaction \
162  ( \
163  ReversibleReaction, \
164  PressureDependentReactionRate, \
165  ReactionRate, \
166  FallOffFunction, \
167  ThermoPhysics \
168  )
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Namespace for OpenFOAM.