NonEquilibriumReversibleReaction.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-2021 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 Class
25  Foam::NonEquilibriumReversibleReaction
26 
27 Description
28  Simple extension of Reaction to handle reversible reactions using
29  equilibrium thermodynamics.
30 
31 SourceFiles
32  NonEquilibriumReversibleReaction.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef NonEquilibriumReversibleReaction_H
37 #define NonEquilibriumReversibleReaction_H
38 
39 #include "Reaction.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class NonEquilibriumReversibleReaction Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class ReactionThermo, class ReactionRate>
52 :
53  public Reaction<ReactionThermo>
54 {
55  // Private Data
56 
57  ReactionRate fk_;
58  ReactionRate rk_;
59 
60 
61 public:
62 
63  //- Runtime type information
64  TypeName("nonEquilibriumReversible");
65 
66 
67  // Constructors
68 
69  //- Construct from components
71  (
73  const ReactionRate& forwardReactionRate,
74  const ReactionRate& reverseReactionRate
75  );
76 
77  //- Construct as copy given new speciesTable
79  (
81  <
82  ReactionThermo,
83  ReactionRate
84  >&,
85  const speciesTable& species
86  );
87 
88  //- Construct from dictionary
90  (
91  const speciesTable& species,
92  const HashPtrTable<ReactionThermo>& thermoDatabase,
93  const dictionary& dict
94  );
95 
96  //- Construct from objectRegistry and dictionary
98  (
99  const speciesTable& species,
100  const HashPtrTable<ReactionThermo>& thermoDatabase,
101  const objectRegistry& ob,
102  const dictionary& dict
103  );
104 
105  //- Construct and return a clone
106  virtual autoPtr<Reaction<ReactionThermo>> clone() const
107  {
109  (
111  <
112  ReactionThermo,
113  ReactionRate
114  >(*this)
115  );
116  }
117 
118  //- Construct and return a clone with new speciesTable
120  (
121  const speciesTable& species
122  ) const
123  {
125  (
127  <
128  ReactionThermo,
129  ReactionRate
130  >
131  (
132  *this,
133  species
134  )
135  );
136  }
137 
138 
139  //- Destructor
141  {}
142 
143 
144  // Member Functions
145 
146  // Hooks
147 
148  //- Pre-evaluation hook
149  virtual void preEvaluate() const;
150 
151  //- Post-evaluation hook
152  virtual void postEvaluate() const;
153 
154 
155  // NonEquilibriumReversibleReaction rate coefficients
156 
157  //- Forward rate constant
158  virtual scalar kf
159  (
160  const scalar p,
161  const scalar T,
162  const scalarField& c,
163  const label li
164  ) const;
165 
166  //- Reverse rate constant from the given formard rate constant
167  virtual scalar kr
168  (
169  const scalar kfwd,
170  const scalar p,
171  const scalar T,
172  const scalarField& c,
173  const label li
174  ) const;
175 
176  //- Reverse rate constant.
177  // Note this evaluates the forward rate constant and divides by the
178  // equilibrium constant
179  virtual scalar kr
180  (
181  const scalar p,
182  const scalar T,
183  const scalarField& c,
184  const label li
185  ) const;
186 
187 
188  // ReversibleReaction Jacobian functions
189 
190  //- Temperature derivative of forward rate
191  virtual scalar dkfdT
192  (
193  const scalar p,
194  const scalar T,
195  const scalarField& c,
196  const label li
197  ) const;
198 
199  //- Temperature derivative of backward rate
200  virtual scalar dkrdT
201  (
202  const scalar p,
203  const scalar T,
204  const scalarField& c,
205  const label li,
206  const scalar dkfdT,
207  const scalar kr
208  ) const;
209 
210  //- Third-body efficiencies (beta = 1-alpha)
211  // non-empty only for third-body reactions
212  // with enhanced molecularity (alpha != 1)
213  virtual const List<Tuple2<label, scalar>>& beta() const;
214 
215  //- Species concentration derivative of the pressure dependent term
216  // By default this value is 1 as it multiplies the third-body term
217  virtual void dcidc
218  (
219  const scalar p,
220  const scalar T,
221  const scalarField& c,
222  const label li,
224  ) const;
225 
226  //- Temperature derivative of the pressure dependent term
227  // By default this value is 0 since ddT of molecularity is approx.0
228  virtual scalar dcidT
229  (
230  const scalar p,
231  const scalar T,
232  const scalarField& c,
233  const label li
234  ) const;
235 
236 
237  //- Write
238  virtual void write(Ostream&) const;
239 
240 
241  // Member Operators
242 
243  //- Disallow default bitwise assignment
244  void operator=
245  (
247  <
248  ReactionThermo,
249  ReactionRate
250  >&
251  ) = delete;
252 };
253 
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 } // End namespace Foam
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #ifdef NoRepository
263 #endif
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 #endif
268 
269 // ************************************************************************* //
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
virtual autoPtr< Reaction< ReactionThermo > > clone() const
Construct and return a clone.
virtual void postEvaluate() const
Post-evaluation hook.
virtual const List< Tuple2< label, scalar > > & beta() const
Third-body efficiencies (beta = 1-alpha)
TypeName("nonEquilibriumReversible")
Runtime type information.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:50
virtual void dcidc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dcidc) const
Species concentration derivative of the pressure dependent term.
const dimensionedScalar c
Speed of light in a vacuum.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Definition: Reaction.H:55
Reaction base-class holding the specie names and coefficients.
Definition: reaction.H:56
const speciesTable & species() const
Return the specie list.
Definition: reactionI.H:48
virtual scalar dkfdT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of forward rate.
virtual scalar kf(const scalar p, const scalar T, const scalarField &c, const label li) const
Forward rate constant.
NonEquilibriumReversibleReaction(const Reaction< ReactionThermo > &reaction, const ReactionRate &forwardReactionRate, const ReactionRate &reverseReactionRate)
Construct from components.
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:54
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual scalar kr(const scalar kfwd, const scalar p, const scalar T, const scalarField &c, const label li) const
Reverse rate constant from the given formard rate constant.
virtual scalar dkrdT(const scalar p, const scalar T, const scalarField &c, const label li, const scalar dkfdT, const scalar kr) const
Temperature derivative of backward rate.
A wordList with hashed indices for faster lookup by name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
Registry of regIOobjects.
virtual void preEvaluate() const
Pre-evaluation hook.
virtual scalar dcidT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of the pressure dependent term.
Namespace for OpenFOAM.