NonEquilibriumReversibleReaction.C
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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template
34 <
35  template<class> class ReactionType,
36  class ReactionThermo,
37  class ReactionRate
38 >
40 <
41  ReactionType,
42  ReactionThermo,
43  ReactionRate
44 >::
45 NonEquilibriumReversibleReaction
46 (
47  const ReactionType<ReactionThermo>& reaction,
48  const ReactionRate& forwardReactionRate,
49  const ReactionRate& reverseReactionRate
50 )
51 :
52  ReactionType<ReactionThermo>(reaction),
53  fk_(forwardReactionRate),
54  rk_(reverseReactionRate)
55 {}
56 
57 
58 template
59 <
60  template<class> class ReactionType,
61  class ReactionThermo,
62  class ReactionRate
63 >
65 <
66  ReactionType,
67  ReactionThermo,
68  ReactionRate
69 >::
71 (
72  const speciesTable& species,
73  const ReactionTable<ReactionThermo>& thermoDatabase,
74  const dictionary& dict
75 )
76 :
77  ReactionType<ReactionThermo>(species, thermoDatabase, dict),
78  fk_(species, dict.subDict("forward")),
79  rk_(species, dict.subDict("reverse"))
80 {}
81 
82 
83 template
84 <
85  template<class> class ReactionType,
86  class ReactionThermo,
87  class ReactionRate
88 >
90 <
91  ReactionType,
92  ReactionThermo,
93  ReactionRate
94 >::
96 (
98  <
99  ReactionType,
100  ReactionThermo,
101  ReactionRate
102  >& nerr,
103  const speciesTable& species
104 )
105 :
106  ReactionType<ReactionThermo>(nerr, species),
107  fk_(nerr.fk_),
108  rk_(nerr.rk_)
109 {}
110 
111 
112 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
113 
114 template
115 <
116  template<class> class ReactionType,
117  class ReactionThermo,
118  class ReactionRate
119 >
120 Foam::scalar
122 <
123  ReactionType,
124  ReactionThermo,
125  ReactionRate
126 >::kf
127 (
128  const scalar p,
129  const scalar T,
130  const scalarField& c
131 ) const
132 {
133  return fk_(p, T, c);
134 }
135 
136 
137 template
138 <
139  template<class> class ReactionType,
140  class ReactionThermo,
141  class ReactionRate
142 >
143 Foam::scalar
145 <
146  ReactionType,
147  ReactionThermo,
148  ReactionRate
149 >::kr
150 (
151  const scalar,
152  const scalar p,
153  const scalar T,
154  const scalarField& c
155 ) const
156 {
157  return rk_(p, T, c);
158 }
159 
160 
161 template
162 <
163  template<class> class ReactionType,
164  class ReactionThermo,
165  class ReactionRate
166 >
167 Foam::scalar
169 <
170  ReactionType,
171  ReactionThermo,
172  ReactionRate
173 >::kr
174 (
175  const scalar p,
176  const scalar T,
177  const scalarField& c
178 ) const
179 {
180  return rk_(p, T, c);
181 }
182 
183 
184 template
185 <
186  template<class> class ReactionType,
187  class ReactionThermo,
188  class ReactionRate
189 >
191 <
192  ReactionType,
193  ReactionThermo,
194  ReactionRate
195 >::write
196 (
197  Ostream& os
198 ) const
199 {
201 
202  os.beginBlock("forward");
203  fk_.write(os);
204  os.endBlock();
205 
206  os.beginBlock("reverse");
207  rk_.write(os);
208  os.endBlock();
209 }
210 
211 
212 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::NonEquilibriumReversibleReaction
Simple extension of Reaction to handle reversible reactions using equilibrium thermodynamics.
Definition: NonEquilibriumReversibleReaction.H:61
Foam::Field< scalar >
Foam::hashedWordList
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
Definition: hashedWordList.H:54
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
os
OBJstream os(runTime.globalPath()/outputName)
T
const volScalarField & T
Definition: createFieldRefs.H:2
reaction
CombustionModel< rhoReactionThermo > & reaction
Definition: setRegionFluidFields.H:3
NonEquilibriumReversibleReaction.H
Foam::HashPtrTable< ThermoType >
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:36
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56