OpenFOAM logo
Open Source CFD Toolkit

ReversibleReaction.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     ReversibleReaction
00027 
00028 Description
00029     Simple extension of Reaction to handle reversible reactions using
00030     equilibrium thermodynamics.
00031 
00032 SourceFiles
00033     ReversibleReaction.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef ReversibleReaction_H
00038 #define ReversibleReaction_H
00039 
00040 #include "Reaction.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class ReversibleReaction Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<class ReactionThermo, class ReactionRate>
00052 class ReversibleReaction
00053 :
00054     public Reaction<ReactionThermo>
00055 {
00056     // Private data
00057 
00058         ReactionRate k_;
00059 
00060 
00061     // Private Member Functions
00062 
00063         //- Disallow default bitwise assignment
00064         void operator=(const ReversibleReaction<ReactionThermo, ReactionRate>&);
00065 
00066 
00067 public:
00068 
00069     //- Runtime type information
00070     TypeName("reversible");
00071 
00072 
00073     // Constructors
00074 
00075         //- Construct from components
00076         ReversibleReaction
00077         (
00078             const Reaction<ReactionThermo>& reaction,
00079             const ReactionRate& k
00080         );
00081 
00082         //- Construct as copy given new speciesTable
00083         ReversibleReaction
00084         (
00085             const ReversibleReaction<ReactionThermo, ReactionRate>&,
00086             const speciesTable& species
00087         );
00088 
00089         //- Construct from Istream
00090         ReversibleReaction
00091         (
00092             const speciesTable& species,
00093             const HashPtrTable<ReactionThermo>& thermoDatabase,
00094             Istream& is
00095         );
00096 
00097         //- Construct and return a clone
00098         virtual autoPtr<Reaction<ReactionThermo> > clone() const
00099         {
00100             return autoPtr<Reaction<ReactionThermo> >
00101             (
00102                 new ReversibleReaction<ReactionThermo, ReactionRate>(*this)
00103             );
00104         }
00105 
00106         //- Construct and return a clone with new speciesTable
00107         virtual autoPtr<Reaction<ReactionThermo> > clone
00108         (
00109             const speciesTable& species
00110         ) const
00111         {
00112             return autoPtr<Reaction<ReactionThermo> >
00113             (
00114                 new ReversibleReaction<ReactionThermo, ReactionRate>
00115                 (
00116                     *this,
00117                     species
00118                 )
00119             );
00120         }
00121 
00122 
00123     // Destructor
00124 
00125         virtual ~ReversibleReaction()
00126         {}
00127 
00128 
00129     // Member Functions
00130 
00131         // ReversibleReaction rate coefficients
00132 
00133             //- Forward rate constant
00134             virtual scalar kf
00135             (
00136                 const scalar T,
00137                 const scalar p,
00138                 const scalarField& c
00139             ) const;
00140 
00141             //- Reverse rate constant from the given formard rate constant
00142             virtual scalar kr
00143             (
00144                 const scalar kfwd,
00145                 const scalar T,
00146                 const scalar p,
00147                 const scalarField& c
00148             ) const;
00149 
00150             //- Reverse rate constant.
00151             //  Note this evaluates the forward rate constant and divides by the
00152             //  equilibrium constant
00153             virtual scalar kr
00154             (
00155                 const scalar T,
00156                 const scalar p,
00157                 const scalarField& c
00158             ) const;
00159 
00160 
00161         //- Write
00162         virtual void write(Ostream&) const;
00163 };
00164 
00165 
00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00167 
00168 } // End namespace Foam
00169 
00170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00171 
00172 #ifdef NoRepository
00173 #   include "ReversibleReaction.C"
00174 #endif
00175 
00176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00177 
00178 #endif
00179 
00180 // ************************************************************************* //
For further information go to www.openfoam.org