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 forward 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  //- Does this reaction have concentration-dependent rate constants?
211  virtual bool hasDkdc() const;
212 
213  //- Concentration derivative of forward rate
214  void dkfdc
215  (
216  const scalar p,
217  const scalar T,
218  const scalarField& c,
219  const label li,
221  ) const;
222 
223  //- Concentration derivative of reverse rate
224  void dkrdc
225  (
226  const scalar p,
227  const scalar T,
228  const scalarField& c,
229  const label li,
230  const scalarField& dkfdc,
231  const scalar kr,
233  ) const;
234 
235 
236  //- Write
237  virtual void write(Ostream&) const;
238 
239 
240  // Member Operators
241 
242  //- Disallow default bitwise assignment
243  void operator=
244  (
246  <
247  ReactionThermo,
248  ReactionRate
249  >&
250  ) = delete;
251 };
252 
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 } // End namespace Foam
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #ifdef NoRepository
262 #endif
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #endif
267 
268 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual autoPtr< Reaction< ReactionThermo > > clone() const
Construct and return a clone.
virtual void postEvaluate() const
Post-evaluation hook.
void dkfdc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dkfdc) const
Concentration derivative of forward rate.
TypeName("nonEquilibriumReversible")
Runtime type information.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:50
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 dkrdc(const scalar p, const scalar T, const scalarField &c, const label li, const scalarField &dkfdc, const scalar kr, scalarField &dkrdc) const
Concentration derivative of reverse rate.
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 forward 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.
virtual bool hasDkdc() const
Does this reaction have concentration-dependent rate constants?
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.
Namespace for OpenFOAM.