IrreversibleReaction.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-2021 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::IrreversibleReaction
26 
27 Description
28  Simple extension of Reaction to handle irreversible reactions
29 
30 SourceFiles
31  IrreversibleReaction.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef IrreversibleReaction_H
36 #define IrreversibleReaction_H
37 
38 #include "Reaction.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class IrreversibleReaction Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class ReactionThermo, class ReactionRate>
51 :
52  public Reaction<ReactionThermo>
53 {
54  // Private Data
55 
56  ReactionRate k_;
57 
58 
59 public:
60 
61  //- Runtime type information
62  TypeName("irreversible");
63 
64 
65  // Constructors
66 
67  //- Construct from components
69  (
71  const ReactionRate& reactionRate
72  );
73 
74  //- Construct as copy given new speciesTable
76  (
78  const speciesTable& species
79  );
80 
81  //- Construct from dictionary
83  (
84  const speciesTable& species,
85  const HashPtrTable<ReactionThermo>& thermoDatabase,
86  const dictionary& dict
87  );
88 
89  //- Construct from objectRegistry and dictionary
91  (
92  const speciesTable& species,
93  const HashPtrTable<ReactionThermo>& thermoDatabase,
94  const objectRegistry& ob,
95  const dictionary& dict
96  );
97 
98  //- Construct and return a clone
100  {
102  (
104  );
105  }
106 
107  //- Construct and return a clone with new speciesTable
109  (
110  const speciesTable& species
111  ) const
112  {
114  (
116  (
117  *this,
118  species
119  )
120  );
121  }
122 
123 
124  //- Destructor
125  virtual ~IrreversibleReaction()
126  {}
127 
128 
129  // Member Functions
130 
131  // Hooks
132 
133  //- Pre-evaluation hook
134  virtual void preEvaluate() const;
135 
136  //- Post-evaluation hook
137  virtual void postEvaluate() const;
138 
139 
140  // IrreversibleReaction rate coefficients
141 
142  //- Forward rate constant
143  virtual scalar kf
144  (
145  const scalar p,
146  const scalar T,
147  const scalarField& c,
148  const label li
149  ) const;
150 
151  //- Reverse rate constant from the given forward rate constant
152  // Returns 0
153  virtual scalar kr
154  (
155  const scalar kfwd,
156  const scalar p,
157  const scalar T,
158  const scalarField& c,
159  const label li
160  ) const;
161 
162  //- Reverse rate constant
163  // Returns 0
164  virtual scalar kr
165  (
166  const scalar p,
167  const scalar T,
168  const scalarField& c,
169  const label li
170  ) const;
171 
172 
173  // IrreversibleReaction Jacobian functions
174 
175  //- Temperature derivative of forward rate
176  virtual scalar dkfdT
177  (
178  const scalar p,
179  const scalar T,
180  const scalarField& c,
181  const label li
182  ) const;
183 
184  //- Temperature derivative of reverse rate. Returns zero.
185  virtual scalar dkrdT
186  (
187  const scalar p,
188  const scalar T,
189  const scalarField& c,
190  const label li,
191  const scalar dkfdT,
192  const scalar kr
193  ) const;
194 
195  //- Does this reaction have concentration-dependent rate constants?
196  virtual bool hasDkdc() const;
197 
198  //- Concentration derivative of forward rate
199  void dkfdc
200  (
201  const scalar p,
202  const scalar T,
203  const scalarField& c,
204  const label li,
206  ) const;
207 
208  //- Concentration derivative of reverse rate. Returns zero.
209  void dkrdc
210  (
211  const scalar p,
212  const scalar T,
213  const scalarField& c,
214  const label li,
215  const scalarField& dkfdc,
216  const scalar kr,
218  ) const;
219 
220 
221  //- Write
222  virtual void write(Ostream&) const;
223 
224 
225  // Member Operators
226 
227  //- Disallow default bitwise assignment
228  void operator=
229  (
231  ) = delete;
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #ifdef NoRepository
242  #include "IrreversibleReaction.C"
243 #endif
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
dictionary dict
virtual void write(Ostream &) const
Write.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void postEvaluate() const
Post-evaluation hook.
virtual ~IrreversibleReaction()
Destructor.
TypeName("irreversible")
Runtime type information.
virtual scalar dkfdT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of forward rate.
void dkfdc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dkfdc) const
Concentration derivative of forward rate.
virtual autoPtr< Reaction< ReactionThermo > > clone() const
Construct and return a clone.
A HashTable specialisation for hashing pointers.
Definition: HashPtrTable.H:50
const dimensionedScalar c
Speed of light in a vacuum.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Definition: Reaction.H:55
Reaction base-class holding the specie names and coefficients.
Definition: reaction.H:56
const speciesTable & species() const
Return the specie list.
Definition: reactionI.H:48
void dkrdc(const scalar p, const scalar T, const scalarField &c, const label li, const scalarField &dkfdc, const scalar kr, scalarField &dkrdc) const
Concentration derivative of reverse rate. Returns zero.
virtual bool hasDkdc() const
Does this reaction have concentration-dependent rate constants?
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 kf(const scalar p, const scalar T, const scalarField &c, const label li) const
Forward rate constant.
virtual void preEvaluate() const
Pre-evaluation hook.
IrreversibleReaction(const Reaction< ReactionThermo > &reaction, const ReactionRate &reactionRate)
Construct from components.
A wordList with hashed indices for faster lookup by name.
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 reverse rate. Returns zero.
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 forward rate constant.
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.
Simple extension of Reaction to handle irreversible reactions.
Namespace for OpenFOAM.