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-2023 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  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 ThermoType, class ReactionRate>
51 :
52  public Reaction<ThermoType>
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 PtrList<ThermoType>& speciesThermo,
86  const dictionary& dict
87  );
88 
89  //- Construct from objectRegistry and dictionary
91  (
92  const speciesTable& species,
93  const PtrList<ThermoType>& speciesThermo,
94  const objectRegistry& ob,
95  const dictionary& dict
96  );
97 
98  //- Construct and return a clone
99  virtual autoPtr<Reaction<ThermoType>> clone() const
100  {
102  (
104  (
105  *this
106  )
107  );
108  }
109 
110  //- Construct and return a clone with new speciesTable
112  (
113  const speciesTable& species
114  ) const
115  {
117  (
119  (
120  *this,
121  species
122  )
123  );
124  }
125 
126 
127  //- Destructor
128  virtual ~IrreversibleReaction()
129  {}
130 
131 
132  // Member Functions
133 
134  // Hooks
135 
136  //- Pre-evaluation hook
137  virtual void preEvaluate() const;
138 
139  //- Post-evaluation hook
140  virtual void postEvaluate() const;
141 
142 
143  // IrreversibleReaction rate coefficients
144 
145  //- Forward rate constant
146  virtual scalar kf
147  (
148  const scalar p,
149  const scalar T,
150  const scalarField& c,
151  const label li
152  ) const;
153 
154  //- Reverse rate constant from the given forward rate constant
155  // Returns 0
156  virtual scalar kr
157  (
158  const scalar kfwd,
159  const scalar p,
160  const scalar T,
161  const scalarField& c,
162  const label li
163  ) const;
164 
165  //- Reverse rate constant
166  // Returns 0
167  virtual scalar kr
168  (
169  const scalar p,
170  const scalar T,
171  const scalarField& c,
172  const label li
173  ) const;
174 
175 
176  // IrreversibleReaction Jacobian functions
177 
178  //- Temperature derivative of forward rate
179  virtual scalar dkfdT
180  (
181  const scalar p,
182  const scalar T,
183  const scalarField& c,
184  const label li
185  ) const;
186 
187  //- Temperature derivative of reverse rate. Returns zero.
188  virtual scalar dkrdT
189  (
190  const scalar p,
191  const scalar T,
192  const scalarField& c,
193  const label li,
194  const scalar dkfdT,
195  const scalar kr
196  ) const;
197 
198  //- Does this reaction have concentration-dependent rate constants?
199  virtual bool hasDkdc() const;
200 
201  //- Concentration derivative of forward rate
202  void dkfdc
203  (
204  const scalar p,
205  const scalar T,
206  const scalarField& c,
207  const label li,
209  ) const;
210 
211  //- Concentration derivative of reverse rate. Returns zero.
212  void dkrdc
213  (
214  const scalar p,
215  const scalar T,
216  const scalarField& c,
217  const label li,
218  const scalarField& dkfdc,
219  const scalar kr,
221  ) const;
222 
223 
224  //- Write
225  virtual void write(Ostream&) const;
226 
227 
228  // Member Operators
229 
230  //- Disallow default bitwise assignment
231  void operator=
232  (
234  ) = delete;
235 };
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #ifdef NoRepository
245  #include "IrreversibleReaction.C"
246 #endif
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
Extension of Reaction to handle irreversible reactions.
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.
virtual scalar dkfdT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of forward rate.
virtual void write(Ostream &) const
Write.
virtual void preEvaluate() const
Pre-evaluation hook.
TypeName("irreversible")
Runtime type information.
virtual void postEvaluate() const
Post-evaluation hook.
IrreversibleReaction(const Reaction< ThermoType > &reaction, const ReactionRate &reactionRate)
Construct from components.
virtual autoPtr< Reaction< ThermoType > > clone() const
Construct and return a clone.
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.
void dkfdc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dkfdc) const
Concentration derivative of forward rate.
virtual ~IrreversibleReaction()
Destructor.
virtual bool hasDkdc() const
Does this reaction have concentration-dependent rate constants?
virtual scalar kf(const scalar p, const scalar T, const scalarField &c, const label li) const
Forward rate constant.
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Simple extension of ThermoType to handle reaction kinetics in addition to the equilibrium thermodynam...
Definition: Reaction.H:72
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A wordList with hashed indices for faster lookup by name.
Registry of regIOobjects.
Reaction base-class holding the specie names and coefficients.
Definition: reaction.H:57
const speciesTable & species() const
Return the specie list.
Definition: reactionI.H:48
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
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
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p