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-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::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  // NonEquilibriumReversibleReaction rate coefficients
147 
148  //- Forward rate constant
149  virtual scalar kf
150  (
151  const scalar p,
152  const scalar T,
153  const scalarField& c,
154  const label li
155  ) const;
156 
157  //- Reverse rate constant from the given formard rate constant
158  virtual scalar kr
159  (
160  const scalar kfwd,
161  const scalar p,
162  const scalar T,
163  const scalarField& c,
164  const label li
165  ) const;
166 
167  //- Reverse rate constant.
168  // Note this evaluates the forward rate constant and divides by the
169  // equilibrium constant
170  virtual scalar kr
171  (
172  const scalar p,
173  const scalar T,
174  const scalarField& c,
175  const label li
176  ) const;
177 
178 
179  // ReversibleReaction Jacobian functions
180 
181  //- Temperature derivative of forward rate
182  virtual scalar dkfdT
183  (
184  const scalar p,
185  const scalar T,
186  const scalarField& c,
187  const label li
188  ) const;
189 
190  //- Temperature derivative of backward rate
191  virtual scalar dkrdT
192  (
193  const scalar p,
194  const scalar T,
195  const scalarField& c,
196  const label li,
197  const scalar dkfdT,
198  const scalar kr
199  ) const;
200 
201  //- Third-body efficiencies (beta = 1-alpha)
202  // non-empty only for third-body reactions
203  // with enhanced molecularity (alpha != 1)
204  virtual const List<Tuple2<label, scalar>>& beta() const;
205 
206  //- Species concentration derivative of the pressure dependent term
207  // By default this value is 1 as it multiplies the third-body term
208  virtual void dcidc
209  (
210  const scalar p,
211  const scalar T,
212  const scalarField& c,
213  const label li,
215  ) const;
216 
217  //- Temperature derivative of the pressure dependent term
218  // By default this value is 0 since ddT of molecularity is approx.0
219  virtual scalar dcidT
220  (
221  const scalar p,
222  const scalar T,
223  const scalarField& c,
224  const label li
225  ) const;
226 
227 
228  //- Write
229  virtual void write(Ostream&) const;
230 
231 
232  // Member Operators
233 
234  //- Disallow default bitwise assignment
235  void operator=
236  (
238  <
239  ReactionThermo,
240  ReactionRate
241  >&
242  ) = delete;
243 };
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace Foam
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #ifdef NoRepository
254 #endif
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #endif
259 
260 // ************************************************************************* //
dictionary dict
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
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< Reaction< ReactionThermo > > clone() const
Construct and return a clone.
virtual const List< Tuple2< label, scalar > > & beta() const
Third-body efficiencies (beta = 1-alpha)
TypeName("nonEquilibriumReversible")
Runtime type information.
A HashTable specialization for hashing pointers.
Definition: HashPtrTable.H:50
const dimensionedScalar & c
Speed of light in a vacuum.
virtual void dcidc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dcidc) const
Species concentration derivative of the pressure dependent term.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Definition: Reaction.H:56
virtual scalar dkfdT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of forward rate.
const speciesTable & species() const
Return the specie list.
Definition: Reaction.C:715
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.
CombustionModel< rhoReactionThermo > & reaction
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)
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 formard 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.
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 scalar dcidT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of the pressure dependent term.
Namespace for OpenFOAM.