initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / specie / reaction / Reactions / ReversibleReaction / ReversibleReaction.H
blob5f3f7175497d886ba1dcb1549ed49e5c23acbea0
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::ReversibleReaction
28 Description
29     Simple extension of Reaction to handle reversible reactions using
30     equilibrium thermodynamics.
32 SourceFiles
33     ReversibleReaction.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef ReversibleReaction_H
38 #define ReversibleReaction_H
40 #include "Reaction.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class ReversibleReaction Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class ReactionThermo, class ReactionRate>
52 class ReversibleReaction
54     public Reaction<ReactionThermo>
56     // Private data
58         ReactionRate k_;
61     // Private Member Functions
63         //- Disallow default bitwise assignment
64         void operator=(const ReversibleReaction<ReactionThermo, ReactionRate>&);
67 public:
69     //- Runtime type information
70     TypeName("reversible");
73     // Constructors
75         //- Construct from components
76         ReversibleReaction
77         (
78             const Reaction<ReactionThermo>& reaction,
79             const ReactionRate& k
80         );
82         //- Construct as copy given new speciesTable
83         ReversibleReaction
84         (
85             const ReversibleReaction<ReactionThermo, ReactionRate>&,
86             const speciesTable& species
87         );
89         //- Construct from Istream
90         ReversibleReaction
91         (
92             const speciesTable& species,
93             const HashPtrTable<ReactionThermo>& thermoDatabase,
94             Istream& is
95         );
97         //- Construct and return a clone
98         virtual autoPtr<Reaction<ReactionThermo> > clone() const
99         {
100             return autoPtr<Reaction<ReactionThermo> >
101             (
102                 new ReversibleReaction<ReactionThermo, ReactionRate>(*this)
103             );
104         }
106         //- Construct and return a clone with new speciesTable
107         virtual autoPtr<Reaction<ReactionThermo> > clone
108         (
109             const speciesTable& species
110         ) const
111         {
112             return autoPtr<Reaction<ReactionThermo> >
113             (
114                 new ReversibleReaction<ReactionThermo, ReactionRate>
115                 (
116                     *this,
117                     species
118                 )
119             );
120         }
123     // Destructor
125         virtual ~ReversibleReaction()
126         {}
129     // Member Functions
131         // ReversibleReaction rate coefficients
133             //- Forward rate constant
134             virtual scalar kf
135             (
136                 const scalar T,
137                 const scalar p,
138                 const scalarField& c
139             ) const;
141             //- Reverse rate constant from the given formard rate constant
142             virtual scalar kr
143             (
144                 const scalar kfwd,
145                 const scalar T,
146                 const scalar p,
147                 const scalarField& c
148             ) const;
150             //- Reverse rate constant.
151             //  Note this evaluates the forward rate constant and divides by the
152             //  equilibrium constant
153             virtual scalar kr
154             (
155                 const scalar T,
156                 const scalar p,
157                 const scalarField& c
158             ) const;
161         //- Write
162         virtual void write(Ostream&) const;
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 } // End namespace Foam
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 #ifdef NoRepository
173 #   include "ReversibleReaction.C"
174 #endif
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 #endif
180 // ************************************************************************* //