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-2016 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 Istream
108  (
109  const speciesTable& species,
110  const HashPtrTable<ReactionThermo>& thermoDatabase,
111  Istream& is
112  );
113 
114  //- Construct from dictionary
116  (
117  const speciesTable& species,
118  const HashPtrTable<ReactionThermo>& thermoDatabase,
119  const dictionary& dict
120  );
121 
122  //- Construct and return a clone
124  {
126  (
128  <
129  ReactionType,
130  ReactionThermo,
131  ReactionRate
132  >(*this)
133  );
134  }
135 
136  //- Construct and return a clone with new speciesTable
138  (
139  const speciesTable& species
140  ) const
141  {
143  (
145  <ReactionType, ReactionThermo, ReactionRate>
146  (
147  *this,
148  species
149  )
150  );
151  }
152 
153 
154  //- Destructor
155  virtual ~ReversibleReaction()
156  {}
157 
158 
159  // Member Functions
160 
161  // ReversibleReaction rate coefficients
162 
163  //- Forward rate constant
164  virtual scalar kf
165  (
166  const scalar p,
167  const scalar T,
168  const scalarField& c
169  ) const;
170 
171  //- Reverse rate constant from the given formard rate constant
172  virtual scalar kr
173  (
174  const scalar kfwd,
175  const scalar p,
176  const scalar T,
177  const scalarField& c
178  ) const;
179 
180  //- Reverse rate constant.
181  // Note this evaluates the forward rate constant and divides by
182  // the equilibrium constant
183  virtual scalar kr
184  (
185  const scalar p,
186  const scalar T,
187  const scalarField& c
188  ) const;
189 
190 
191  //- Write
192  virtual void write(Ostream&) const;
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #ifdef NoRepository
203  #include "ReversibleReaction.C"
204 #endif
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
ReversibleReaction(const ReactionType< ReactionThermo > &reaction, const ReactionRate &k)
Construct from components.
label k
Boltzmann constant.
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 kr(const scalar kfwd, const scalar p, const scalar T, const scalarField &c) const
Reverse rate constant from the given formard rate constant.
A wordList with hashed indices for faster lookup by name.
Info<< "Creating reaction model\n"<< endl;autoPtr< combustionModels::psiCombustionModel > reaction(combustionModels::psiCombustionModel::New(mesh))
virtual autoPtr< ReactionType< ReactionThermo > > clone() const
Construct and return a clone.
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:53
TypeName("reversible")
Runtime type information.
volScalarField & p
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
Forward rate constant.
Namespace for OpenFOAM.
Simple extension of Reaction to handle reversible reactions using equilibrium thermodynamics.