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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ReversibleReaction
29 
30 Group
31  grpSpecieReactions
32 
33 Description
34  Simple extension of Reaction to handle reversible reactions using
35  equilibrium thermodynamics.
36 
37 SourceFiles
38  ReversibleReaction.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef ReversibleReaction_H
43 #define ReversibleReaction_H
44 
45 #include "Reaction.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class ReversibleReaction Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template
57 <
58  template<class> class ReactionType,
59  class ReactionThermo,
60  class ReactionRate
61 >
63 :
64  public ReactionType<ReactionThermo>
65 {
66  // Private Data
67 
68  ReactionRate k_;
69 
70 
71  // Private Member Functions
72 
73  //- No copy assignment
74  void operator=
75  (
76  const ReversibleReaction
77  <
78  ReactionType,
79  ReactionThermo,
80  ReactionRate
81  >&
82  ) = delete;
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("reversible");
89 
90 
91  // Constructors
92 
93  //- Construct from components
95  (
96  const ReactionType<ReactionThermo>& reaction,
97  const ReactionRate& k
98  );
99 
100  //- Construct as copy given new speciesTable
102  (
103  const ReversibleReaction
104  <
105  ReactionType,
106  ReactionThermo,
107  ReactionRate
108  >&,
109  const speciesTable& species
110  );
111 
112  //- Construct from dictionary
114  (
115  const speciesTable& species,
116  const ReactionTable<ReactionThermo>& thermoDatabase,
117  const dictionary& dict
118  );
119 
120  //- Construct and return a clone
122  {
124  (
126  <
127  ReactionType,
128  ReactionThermo,
129  ReactionRate
130  >(*this)
131  );
132  }
133 
134  //- Construct and return a clone with new speciesTable
136  (
137  const speciesTable& species
138  ) const
139  {
141  (
143  <ReactionType, ReactionThermo, ReactionRate>
144  (
145  *this,
146  species
147  )
148  );
149  }
150 
151 
152  //- Destructor
153  virtual ~ReversibleReaction() = default;
154 
155 
156  // Member Functions
157 
158  // ReversibleReaction rate coefficients
159 
160  //- Forward rate constant
161  virtual scalar kf
162  (
163  const scalar p,
164  const scalar T,
165  const scalarField& c
166  ) const;
167 
168  //- Reverse rate constant from the given formard rate constant
169  virtual scalar kr
170  (
171  const scalar kfwd,
172  const scalar p,
173  const scalar T,
174  const scalarField& c
175  ) const;
176 
177  //- Reverse rate constant.
178  // Note this evaluates the forward rate constant and divides by
179  // the equilibrium constant
180  virtual scalar kr
181  (
182  const scalar p,
183  const scalar T,
184  const scalarField& c
185  ) const;
186 
187 
188  //- Write
189  virtual void write(Ostream&) const;
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #ifdef NoRepository
200  #include "ReversibleReaction.C"
201 #endif
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::ReversibleReaction::~ReversibleReaction
virtual ~ReversibleReaction()=default
Destructor.
ReversibleReaction.C
Foam::ReversibleReaction::clone
virtual autoPtr< ReactionType< ReactionThermo > > clone() const
Construct and return a clone.
Definition: ReversibleReaction.H:120
Foam::ReversibleReaction
Simple extension of Reaction to handle reversible reactions using equilibrium thermodynamics.
Definition: ReversibleReaction.H:61
Foam::Field< scalar >
Foam::hashedWordList
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
Definition: hashedWordList.H:54
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::ReversibleReaction::kf
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
Forward rate constant.
Definition: ReversibleReaction.C:102
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Reaction.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ReversibleReaction::write
virtual void write(Ostream &) const
Write.
Definition: ReversibleReaction.C:169
reaction
CombustionModel< rhoReactionThermo > & reaction
Definition: setRegionFluidFields.H:3
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::HashPtrTable< ThermoType >
Foam::ReversibleReaction::ReversibleReaction
ReversibleReaction(const ReactionType< ReactionThermo > &reaction, const ReactionRate &k)
Construct from components.
Definition: ReversibleReaction.C:41
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::ReversibleReaction::TypeName
TypeName("reversible")
Runtime type information.
Foam::ReversibleReaction::kr
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.
Definition: ReversibleReaction.C:124