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-------------------------------------------------------------------------------
11License
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
33template
34<
35 template<class> class ReactionType,
36 class ReactionThermo,
37 class ReactionRate
38>
40<
41 ReactionType,
42 ReactionThermo,
43 ReactionRate
44>::
45NonEquilibriumReversibleReaction
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
58template
59<
60 template<class> class ReactionType,
61 class ReactionThermo,
62 class ReactionRate
63>
65<
66 ReactionType,
67 ReactionThermo,
68 ReactionRate
69>::
70NonEquilibriumReversibleReaction
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
83template
84<
85 template<class> class ReactionType,
86 class ReactionThermo,
87 class ReactionRate
88>
90<
91 ReactionType,
92 ReactionThermo,
93 ReactionRate
94>::
95NonEquilibriumReversibleReaction
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
114template
115<
116 template<class> class ReactionType,
117 class ReactionThermo,
118 class ReactionRate
119>
120Foam::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
137template
138<
139 template<class> class ReactionType,
140 class ReactionThermo,
141 class ReactionRate
142>
143Foam::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
161template
162<
163 template<class> class ReactionType,
164 class ReactionThermo,
165 class ReactionRate
166>
167Foam::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
184template
185<
186 template<class> class ReactionType,
187 class ReactionThermo,
188 class ReactionRate
189>
191<
192 ReactionType,
193 ReactionThermo,
194 ReactionRate
196(
197 Ostream& os
198) const
199{
200 ReactionType<ReactionThermo>::write(os);
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// ************************************************************************* //
Simple extension of Reaction to handle reversible reactions using equilibrium thermodynamics.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:105
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:87
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
volScalarField & p
const volScalarField & T
OBJstream os(runTime.globalPath()/outputName)
CombustionModel< rhoReactionThermo > & reaction
runTime write()
dictionary dict