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-2018 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  // Private Member Functions
66 
67  //- Disallow default bitwise assignment
68  void operator=
69  (
70  const ReversibleReaction
71  <
72  ReactionType,
73  ReactionThermo,
74  ReactionRate
75  >&
76  );
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("reversible");
83 
84 
85  // Constructors
86 
87  //- Construct from components
89  (
90  const ReactionType<ReactionThermo>& reaction,
91  const ReactionRate& k
92  );
93 
94  //- Construct as copy given new speciesTable
96  (
97  const ReversibleReaction
98  <
99  ReactionType,
100  ReactionThermo,
101  ReactionRate
102  >&,
103  const speciesTable& species
104  );
105 
106  //- Construct from dictionary
108  (
109  const speciesTable& species,
110  const HashPtrTable<ReactionThermo>& thermoDatabase,
111  const dictionary& dict
112  );
113 
114  //- Construct and return a clone
116  {
118  (
120  <
121  ReactionType,
122  ReactionThermo,
123  ReactionRate
124  >(*this)
125  );
126  }
127 
128  //- Construct and return a clone with new speciesTable
130  (
131  const speciesTable& species
132  ) const
133  {
135  (
137  <ReactionType, ReactionThermo, ReactionRate>
138  (
139  *this,
140  species
141  )
142  );
143  }
144 
145 
146  //- Destructor
147  virtual ~ReversibleReaction()
148  {}
149 
150 
151  // Member Functions
152 
153  // ReversibleReaction rate coefficients
154 
155  //- Forward rate constant
156  virtual scalar kf
157  (
158  const scalar p,
159  const scalar T,
160  const scalarField& c
161  ) const;
162 
163  //- Reverse rate constant from the given formard rate constant
164  virtual scalar kr
165  (
166  const scalar kfwd,
167  const scalar p,
168  const scalar T,
169  const scalarField& c
170  ) const;
171 
172  //- Reverse rate constant.
173  // Note this evaluates the forward rate constant and divides by
174  // the equilibrium constant
175  virtual scalar kr
176  (
177  const scalar p,
178  const scalar T,
179  const scalarField& c
180  ) const;
181 
182 
183  // ReversibleReaction Jacobian functions
184 
185  //- Temperature derivative of forward rate
186  virtual scalar dkfdT
187  (
188  const scalar p,
189  const scalar T,
190  const scalarField& c
191  ) const;
192 
193  //- Temperature derivative of backward rate
194  virtual scalar dkrdT
195  (
196  const scalar p,
197  const scalar T,
198  const scalarField& c,
199  const scalar dkfdT,
200  const scalar kr
201  ) const;
202 
203  //- Third-body efficiencies (beta = 1-alpha)
204  // non-empty only for third-body reactions
205  // with enhanced molecularity (alpha != 1)
206  virtual const List<Tuple2<label, scalar>>& beta() const;
207 
208  //- Species concentration derivative of the pressure dependent term
209  // By default this value is 1 as it multiplies the third-body term
210  virtual void dcidc
211  (
212  const scalar p,
213  const scalar T,
214  const scalarField& c,
216  ) const;
217 
218  //- Temperature derivative of the pressure dependent term
219  // By default this value is 0 since ddT of molecularity is approx.0
220  virtual scalar dcidT
221  (
222  const scalar p,
223  const scalar T,
224  const scalarField& c
225  ) const;
226 
227 
228  //- Write
229  virtual void write(Ostream&) const;
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:137
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:60
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.