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-2019 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
51 <
52  template<class> class ReactionType,
53  class ReactionThermo,
54  class ReactionRate
55 >
57 :
58  public ReactionType<ReactionThermo>
59 {
60  // Private Data
61 
62  ReactionRate k_;
63 
64 
65 public:
66 
67  //- Runtime type information
68  TypeName("reversible");
69 
70 
71  // Constructors
72 
73  //- Construct from components
75  (
76  const ReactionType<ReactionThermo>& reaction,
77  const ReactionRate& k
78  );
79 
80  //- Construct as copy given new speciesTable
82  (
83  const ReversibleReaction
84  <
85  ReactionType,
86  ReactionThermo,
87  ReactionRate
88  >&,
89  const speciesTable& species
90  );
91 
92  //- Construct from dictionary
94  (
95  const speciesTable& species,
96  const HashPtrTable<ReactionThermo>& thermoDatabase,
97  const dictionary& dict
98  );
99 
100  //- Construct and return a clone
102  {
104  (
106  <
107  ReactionType,
108  ReactionThermo,
109  ReactionRate
110  >(*this)
111  );
112  }
113 
114  //- Construct and return a clone with new speciesTable
116  (
117  const speciesTable& species
118  ) const
119  {
121  (
123  <ReactionType, ReactionThermo, ReactionRate>
124  (
125  *this,
126  species
127  )
128  );
129  }
130 
131 
132  //- Destructor
133  virtual ~ReversibleReaction()
134  {}
135 
136 
137  // Member Functions
138 
139  // ReversibleReaction rate coefficients
140 
141  //- Forward rate constant
142  virtual scalar kf
143  (
144  const scalar p,
145  const scalar T,
146  const scalarField& c
147  ) const;
148 
149  //- Reverse rate constant from the given formard rate constant
150  virtual scalar kr
151  (
152  const scalar kfwd,
153  const scalar p,
154  const scalar T,
155  const scalarField& c
156  ) const;
157 
158  //- Reverse rate constant.
159  // Note this evaluates the forward rate constant and divides by
160  // the equilibrium constant
161  virtual scalar kr
162  (
163  const scalar p,
164  const scalar T,
165  const scalarField& c
166  ) const;
167 
168 
169  // ReversibleReaction Jacobian functions
170 
171  //- Temperature derivative of forward rate
172  virtual scalar dkfdT
173  (
174  const scalar p,
175  const scalar T,
176  const scalarField& c
177  ) const;
178 
179  //- Temperature derivative of backward rate
180  virtual scalar dkrdT
181  (
182  const scalar p,
183  const scalar T,
184  const scalarField& c,
185  const scalar dkfdT,
186  const scalar kr
187  ) const;
188 
189  //- Third-body efficiencies (beta = 1-alpha)
190  // non-empty only for third-body reactions
191  // with enhanced molecularity (alpha != 1)
192  virtual const List<Tuple2<label, scalar>>& beta() const;
193 
194  //- Species concentration derivative of the pressure dependent term
195  // By default this value is 1 as it multiplies the third-body term
196  virtual void dcidc
197  (
198  const scalar p,
199  const scalar T,
200  const scalarField& c,
202  ) const;
203 
204  //- Temperature derivative of the pressure dependent term
205  // By default this value is 0 since ddT of molecularity is approx.0
206  virtual scalar dcidT
207  (
208  const scalar p,
209  const scalar T,
210  const scalarField& c
211  ) const;
212 
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 
217 
218  // Member Operators
219 
220  //- Disallow default bitwise assignment
221  void operator=
222  (
223  const ReversibleReaction
224  <
225  ReactionType,
226  ReactionThermo,
227  ReactionRate
228  >&
229  ) = delete;
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #ifdef NoRepository
240  #include "ReversibleReaction.C"
241 #endif
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #endif
246 
247 // ************************************************************************* //
dictionary dict
virtual scalar kr(const scalar kfwd, const scalar p, const scalar T, const scalarField &c) const
Reverse rate constant from the given formard rate constant.
virtual const List< Tuple2< label, scalar > > & beta() const
Third-body efficiencies (beta = 1-alpha)
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
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< ReactionType< ReactionThermo > > clone() const
Construct and return a clone.
ReversibleReaction(const ReactionType< ReactionThermo > &reaction, const ReactionRate &k)
Construct from components.
virtual scalar dcidT(const scalar p, const scalar T, const scalarField &c) const
Temperature derivative of the pressure dependent term.
virtual scalar dkrdT(const scalar p, const scalar T, const scalarField &c, const scalar dkfdT, const scalar kr) const
Temperature derivative of backward rate.
label k
Boltzmann constant.
A HashTable specialization for hashing pointers.
Definition: HashPtrTable.H:50
virtual ~ReversibleReaction()
Destructor.
virtual void write(Ostream &) const
Write.
CombustionModel< rhoReactionThermo > & reaction
virtual scalar dkfdT(const scalar p, const scalar T, const scalarField &c) const
Temperature derivative of forward rate.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
Forward rate constant.
A wordList with hashed indices for faster lookup by name.
const dimensionedScalar c
Speed of light in a vacuum.
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
virtual void dcidc(const scalar p, const scalar T, const scalarField &c, scalarField &dcidc) const
Species concentration derivative of the pressure dependent term.
Namespace for OpenFOAM.
Simple extension of Reaction to handle reversible reactions using equilibrium thermodynamics.