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-2023 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 #define defineReaction(nullArg, ThermoPhysics) \
46  \
47  typedef Reaction<ThermoPhysics> Reaction##ThermoPhysics; \
48  \
49  defineTemplateTypeNameAndDebug(Reaction##ThermoPhysics, 0); \
50  \
51  defineTemplateRunTimeSelectionTable(Reaction##ThermoPhysics, dictionary) \
52  defineTemplateRunTimeSelectionTable \
53  ( \
54  Reaction##ThermoPhysics, \
55  objectRegistry \
56  )
57 
58 
59 #define makeReaction(ReactionType, ReactionRate, ThermoPhysics) \
60  \
61  typedef Reaction<ThermoPhysics> Reaction##ThermoPhysics; \
62  typedef ReactionType<ThermoPhysics, ReactionRate> \
63  ReactionType##ThermoPhysics##ReactionRate; \
64  \
65  template<> \
66  const word ReactionType##ThermoPhysics##ReactionRate::typeName \
67  ( \
68  ReactionType::typeName_() \
69  + ReactionRate::type().capitalise() \
70  ); \
71  \
72  addToRunTimeSelectionTable \
73  ( \
74  Reaction##ThermoPhysics, \
75  ReactionType##ThermoPhysics##ReactionRate, \
76  dictionary \
77  )
78 
79 
80 #define makeGeneralReaction(ReactionType, ReactionRate, ThermoPhysics) \
81  \
82  typedef Reaction<ThermoPhysics> Reaction##ThermoPhysics; \
83  typedef ReactionType<ThermoPhysics, ReactionRate> \
84  ReactionType##ThermoPhysics##ReactionRate; \
85  \
86  template<> \
87  const word ReactionType##ThermoPhysics##ReactionRate::typeName \
88  ( \
89  ReactionType::typeName_() \
90  + ReactionRate::type().capitalise() \
91  ); \
92  \
93  addToRunTimeSelectionTable \
94  ( \
95  Reaction##ThermoPhysics, \
96  ReactionType##ThermoPhysics##ReactionRate, \
97  objectRegistry \
98  )
99 
100 
101 #define makeIReactions(ReactionRate, ThermoPhysics) \
102  \
103  makeReaction(IrreversibleReaction, ReactionRate, ThermoPhysics)
104 
105 
106 #define makeIRReactions(ReactionRate, ThermoPhysics) \
107  \
108  makeIReactions(ReactionRate, ThermoPhysics); \
109  makeReaction(ReversibleReaction, ReactionRate, ThermoPhysics)
110 
111 
112 #define makeIRNReactions(ReactionRate, ThermoPhysics) \
113  \
114  makeIRReactions(ReactionRate, ThermoPhysics); \
115  makeReaction(NonEquilibriumReversibleReaction, ReactionRate, ThermoPhysics)
116 
117 
118 #define makeITemplate1Reactions(ReactionRate, Param, ThermoPhysics) \
119  \
120  typedef ReactionRate<Param> ReactionRate##Param; \
121  \
122  makeReaction \
123  ( \
124  IrreversibleReaction, \
125  ReactionRate##Param, \
126  ThermoPhysics \
127  )
128 
129 
130 #define makeIRTemplate1Reactions(ReactionRate, Param, ThermoPhysics) \
131  \
132  makeITemplate1Reactions(ReactionRate, Param, ThermoPhysics); \
133  \
134  makeReaction \
135  ( \
136  ReversibleReaction, \
137  ReactionRate##Param, \
138  ThermoPhysics \
139  )
140 
141 
142 #define makeITemplate2Reactions(ReactionRate, Param1, Param2, ThermoPhysics) \
143  \
144  typedef ReactionRate<Param1, Param2> ReactionRate##Param1##Param2; \
145  \
146  makeReaction \
147  ( \
148  IrreversibleReaction, \
149  ReactionRate##Param1##Param2, \
150  ThermoPhysics \
151  )
152 
153 
154 #define makeIRTemplate2Reactions(ReactionRate, Param1, Param2, ThermoPhysics) \
155  \
156  makeITemplate2Reactions(ReactionRate, Param1, Param2, ThermoPhysics); \
157  \
158  makeReaction \
159  ( \
160  ReversibleReaction, \
161  ReactionRate##Param1##Param2, \
162  ThermoPhysics \
163  )
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.