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