FreeFOAM The Cross-Platform CFD Toolkit
ReversibleReaction.C
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) 1991-2010 OpenCFD Ltd.
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 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
37 // Construct from components
38 template<class ReactionThermo, class ReactionRate>
40 (
41  const Reaction<ReactionThermo>& reaction,
42  const ReactionRate& k
43 )
44 :
45  Reaction<ReactionThermo>(reaction),
46  k_(k)
47 {}
48 
49 
50 // Construct from components
51 template<class ReactionThermo, class ReactionRate>
53 (
54  const speciesTable& species,
55  const HashPtrTable<ReactionThermo>& thermoDatabase,
56  Istream& is
57 )
58 :
59  Reaction<ReactionThermo>(species, thermoDatabase, is),
60  k_(species, is)
61 {}
62 
63 
64 // Construct as copy given new speciesTable
65 template<class ReactionThermo, class ReactionRate>
67 (
69  const speciesTable& species
70 )
71 :
72  Reaction<ReactionThermo>(rr, species),
73  k_(rr.k_)
74 {}
75 
76 
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 
79 template<class ReactionThermo, class ReactionRate>
81 (
82  const scalar T,
83  const scalar p,
84  const scalarField& c
85 ) const
86 {
87  return k_(T, p, c);
88 }
89 
90 
91 template<class ReactionThermo, class ReactionRate>
93 (
94  const scalar kfwd,
95  const scalar T,
96  const scalar p,
97  const scalarField& c
98 ) const
99 {
100  return kfwd/this->Kc(T);
101 }
102 
103 
104 template<class ReactionThermo, class ReactionRate>
106 (
107  const scalar T,
108  const scalar p,
109  const scalarField& c
110 ) const
111 {
112  return kr(kf(T, p, c), T, p, c);
113 }
114 
115 
116 template<class ReactionThermo, class ReactionRate>
118 (
119  Ostream& os
120 ) const
121 {
123  os << token::SPACE << k_;
124 }
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // ************************ vim: set sw=4 sts=4 et: ************************ //