ReversibleReaction.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::ReversibleReaction
26 
27 Description
28  Simple extension of Reaction to handle reversible reactions using
29  equilibrium thermodynamics.
30 
31 SourceFiles
32  ReversibleReaction.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef ReversibleReaction_H
37 #define ReversibleReaction_H
38 
39 #include "Reaction.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class ReversibleReaction Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class ReactionThermo, class ReactionRate>
52 :
53  public Reaction<ReactionThermo>
54 {
55  // Private Data
56 
57  ReactionRate k_;
58 
59 
60 public:
61 
62  //- Runtime type information
63  TypeName("reversible");
64 
65 
66  // Constructors
67 
68  //- Construct from components
70  (
72  const ReactionRate& k
73  );
74 
75  //- Construct as copy given new speciesTable
77  (
79  const speciesTable& species
80  );
81 
82  //- Construct from dictionary
84  (
85  const speciesTable& species,
86  const HashPtrTable<ReactionThermo>& thermoDatabase,
87  const dictionary& dict
88  );
89 
90  //- Construct from objectRegistry and dictionary
92  (
93  const speciesTable& species,
94  const HashPtrTable<ReactionThermo>& thermoDatabase,
95  const objectRegistry& ob,
96  const dictionary& dict
97  );
98 
99  //- Construct and return a clone
100  virtual autoPtr<Reaction<ReactionThermo>> clone() const
101  {
103  (
105  );
106  }
107 
108  //- Construct and return a clone with new speciesTable
110  (
111  const speciesTable& species
112  ) const
113  {
115  (
117  (
118  *this,
119  species
120  )
121  );
122  }
123 
124 
125  //- Destructor
126  virtual ~ReversibleReaction()
127  {}
128 
129 
130  // Member Functions
131 
132  // Hooks
133 
134  //- Pre-evaluation hook
135  virtual void preEvaluate() const;
136 
137  //- Post-evaluation hook
138  virtual void postEvaluate() const;
139 
140 
141  // ReversibleReaction rate coefficients
142 
143  //- Forward rate constant
144  virtual scalar kf
145  (
146  const scalar p,
147  const scalar T,
148  const scalarField& c,
149  const label li
150  ) const;
151 
152  //- Reverse rate constant from the given forward rate constant
153  virtual scalar kr
154  (
155  const scalar kfwd,
156  const scalar p,
157  const scalar T,
158  const scalarField& c,
159  const label li
160  ) const;
161 
162  //- Reverse rate constant.
163  // Note this evaluates the forward rate constant and divides by
164  // the equilibrium constant
165  virtual scalar kr
166  (
167  const scalar p,
168  const scalar T,
169  const scalarField& c,
170  const label li
171  ) const;
172 
173 
174  // ReversibleReaction Jacobian functions
175 
176  //- Temperature derivative of forward rate
177  virtual scalar dkfdT
178  (
179  const scalar p,
180  const scalar T,
181  const scalarField& c,
182  const label li
183  ) const;
184 
185  //- Temperature derivative of backward rate
186  virtual scalar dkrdT
187  (
188  const scalar p,
189  const scalar T,
190  const scalarField& c,
191  const label li,
192  const scalar dkfdT,
193  const scalar kr
194  ) const;
195 
196  //- Does this reaction have concentration-dependent rate constants?
197  virtual bool hasDkdc() const;
198 
199  //- Concentration derivative of forward rate
200  void dkfdc
201  (
202  const scalar p,
203  const scalar T,
204  const scalarField& c,
205  const label li,
207  ) const;
208 
209  //- Concentration derivative of reverse rate
210  void dkrdc
211  (
212  const scalar p,
213  const scalar T,
214  const scalarField& c,
215  const label li,
216  const scalarField& dkfdc,
217  const scalar kr,
219  ) const;
220 
221 
222  //- Write
223  virtual void write(Ostream&) const;
224 
225 
226  // Member Operators
227 
228  //- Disallow default bitwise assignment
229  void operator=
230  (
232  ) = delete;
233 };
234 
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 } // End namespace Foam
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 #ifdef NoRepository
243  #include "ReversibleReaction.C"
244 #endif
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
virtual bool hasDkdc() const
Does this reaction have concentration-dependent rate constants?
dictionary dict
void dkfdc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dkfdc) const
Concentration derivative of forward rate.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
label k
Boltzmann constant.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:50
virtual ~ReversibleReaction()
Destructor.
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 void preEvaluate() const
Pre-evaluation hook.
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 void write(Ostream &) const
Write.
virtual void postEvaluate() const
Post-evaluation hook.
virtual scalar kf(const scalar p, const scalar T, const scalarField &c, const label li) const
Forward rate constant.
virtual scalar dkfdT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of forward rate.
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)
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.
virtual autoPtr< Reaction< ReactionThermo > > clone() const
Construct and return a clone.
A wordList with hashed indices for faster lookup by name.
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.
ReversibleReaction(const Reaction< ReactionThermo > &reaction, const ReactionRate &k)
Construct from components.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
TypeName("reversible")
Runtime type information.
volScalarField & p
Registry of regIOobjects.
Namespace for OpenFOAM.
Simple extension of Reaction to handle reversible reactions using equilibrium thermodynamics.