ReversibleReaction.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2017 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  //- Write
184  virtual void write(Ostream&) const;
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #ifdef NoRepository
195  #include "ReversibleReaction.C"
196 #endif
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #endif
201 
202 // ************************************************************************* //
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual autoPtr< ReactionType< ReactionThermo > > clone() const
Construct and return a clone.
ReversibleReaction(const ReactionType< ReactionThermo > &reaction, const ReactionRate &k)
Construct from components.
label k
Boltzmann constant.
A HashTable specialization for hashing pointers.
Definition: HashPtrTable.H:50
virtual ~ReversibleReaction()
Destructor.
virtual void write(Ostream &) const
Write.
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.
Info<< "Creating reaction model\"<< endl;autoPtr< combustionModels::psiCombustionModel > reaction(combustionModels::psiCombustionModel::New(mesh))
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
Namespace for OpenFOAM.
Simple extension of Reaction to handle reversible reactions using equilibrium thermodynamics.