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-2024 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  Extension of Reaction to handle non-equilibrium reversible reactions
29 
30 SourceFiles
31  NonEquilibriumReversibleReaction.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef NonEquilibriumReversibleReaction_H
36 #define NonEquilibriumReversibleReaction_H
37 
38 #include "Reaction.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class NonEquilibriumReversibleReaction Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class ThermoType, class ReactionRate>
51 :
52  public Reaction<ThermoType>
53 {
54  // Private Data
55 
56  ReactionRate kf_;
57  ReactionRate kr_;
58 
59 
60 public:
61 
62  //- Runtime type information
63  TypeName("nonEquilibriumReversible");
64 
65 
66  // Constructors
67 
68  //- Construct from components
70  (
72  const ReactionRate& forwardReactionRate,
73  const ReactionRate& reverseReactionRate
74  );
75 
76  //- Construct as copy given new speciesTable
78  (
80  <
81  ThermoType,
82  ReactionRate
83  >&,
84  const speciesTable& species
85  );
86 
87  //- Construct from dictionary
89  (
90  const speciesTable& species,
91  const PtrList<ThermoType>& speciesThermo,
92  const dictionary& dict
93  );
94 
95  //- Construct from objectRegistry and dictionary
97  (
98  const speciesTable& species,
99  const PtrList<ThermoType>& speciesThermo,
100  const objectRegistry& ob,
101  const dictionary& dict
102  );
103 
104  //- Construct and return a clone
105  virtual autoPtr<Reaction<ThermoType>> clone() const
106  {
108  (
110  <
111  ThermoType,
112  ReactionRate
113  >(*this)
114  );
115  }
116 
117  //- Construct and return a clone with new speciesTable
119  (
120  const speciesTable& species
121  ) const
122  {
124  (
126  <
127  ThermoType,
128  ReactionRate
129  >
130  (
131  *this,
132  species
133  )
134  );
135  }
136 
137 
138  //- Destructor
140  {}
141 
142 
143  // Member Functions
144 
145  // Hooks
146 
147  //- Pre-evaluation hook
148  virtual void preEvaluate() const;
149 
150  //- Post-evaluation hook
151  virtual void postEvaluate() const;
152 
153 
154  // NonEquilibriumReversibleReaction rate coefficients
155 
156  //- Forward rate constant
157  virtual scalar kf
158  (
159  const scalar p,
160  const scalar T,
161  const scalarField& c,
162  const label li
163  ) const;
164 
165  //- Reverse rate constant from the given forward rate constant
166  virtual scalar kr
167  (
168  const scalar kfwd,
169  const scalar p,
170  const scalar T,
171  const scalarField& c,
172  const label li
173  ) const;
174 
175  //- Reverse rate constant.
176  // Note this evaluates the forward rate constant and divides by the
177  // equilibrium constant
178  virtual scalar kr
179  (
180  const scalar p,
181  const scalar T,
182  const scalarField& c,
183  const label li
184  ) const;
185 
186 
187  // ReversibleReaction Jacobian functions
188 
189  //- Temperature derivative of forward rate
190  virtual scalar dkfdT
191  (
192  const scalar p,
193  const scalar T,
194  const scalarField& c,
195  const label li
196  ) const;
197 
198  //- Temperature derivative of backward rate
199  virtual scalar dkrdT
200  (
201  const scalar p,
202  const scalar T,
203  const scalarField& c,
204  const label li,
205  const scalar dkfdT,
206  const scalar kr
207  ) const;
208 
209  //- Does this reaction have concentration-dependent rate constants?
210  virtual bool hasDkdc() const;
211 
212  //- Concentration derivative of forward rate
213  void dkfdc
214  (
215  const scalar p,
216  const scalar T,
217  const scalarField& c,
218  const label li,
220  ) const;
221 
222  //- Concentration derivative of reverse rate
223  void dkrdc
224  (
225  const scalar p,
226  const scalar T,
227  const scalarField& c,
228  const label li,
229  const scalarField& dkfdc,
230  const scalar kr,
232  ) const;
233 
234 
235  //- Write
236  virtual void write(Ostream&) const;
237 
238 
239  // Member Operators
240 
241  //- Disallow default bitwise assignment
242  void operator=
243  (
245  <
246  ThermoType,
247  ReactionRate
248  >&
249  ) = delete;
250 };
251 
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 } // End namespace Foam
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 #ifdef NoRepository
261 #endif
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #endif
266 
267 // ************************************************************************* //
Extension of Reaction to handle non-equilibrium reversible reactions.
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 dkfdT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of forward rate.
virtual void preEvaluate() const
Pre-evaluation hook.
TypeName("nonEquilibriumReversible")
Runtime type information.
virtual void postEvaluate() const
Post-evaluation hook.
virtual autoPtr< Reaction< ThermoType > > clone() const
Construct and return a clone.
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.
void dkfdc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dkfdc) const
Concentration derivative of forward rate.
virtual bool hasDkdc() const
Does this reaction have concentration-dependent rate constants?
NonEquilibriumReversibleReaction(const Reaction< ThermoType > &reaction, const ReactionRate &forwardReactionRate, const ReactionRate &reverseReactionRate)
Construct from components.
virtual scalar kf(const scalar p, const scalar T, const scalarField &c, const label li) const
Forward rate constant.
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Simple extension of ThermoType to handle reaction kinetics in addition to the equilibrium thermodynam...
Definition: Reaction.H:72
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A wordList with hashed indices for faster lookup by name.
Registry of regIOobjects.
Reaction base-class holding the specie names and coefficients.
Definition: reaction.H:57
const speciesTable & species() const
Return the specie list.
Definition: reactionI.H:48
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
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
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p