FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

ReversibleReaction.C

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Description
00025     
00026 \*---------------------------------------------------------------------------*/
00027 
00028 #include <specie/ReversibleReaction.H>
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00036 
00037 // Construct from components
00038 template<class ReactionThermo, class ReactionRate>
00039 ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
00040 (
00041     const Reaction<ReactionThermo>& reaction,
00042     const ReactionRate& k
00043 )
00044 :
00045     Reaction<ReactionThermo>(reaction),
00046     k_(k)
00047 {}
00048 
00049 
00050 // Construct from components
00051 template<class ReactionThermo, class ReactionRate>
00052 ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
00053 (
00054     const speciesTable& species,
00055     const HashPtrTable<ReactionThermo>& thermoDatabase,
00056     Istream& is
00057 )
00058 :
00059     Reaction<ReactionThermo>(species, thermoDatabase, is),
00060     k_(species, is)
00061 {}
00062 
00063 
00064 // Construct as copy given new speciesTable
00065 template<class ReactionThermo, class ReactionRate>
00066 ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
00067 (
00068     const ReversibleReaction<ReactionThermo, ReactionRate>& rr,
00069     const speciesTable& species
00070 )
00071 :
00072     Reaction<ReactionThermo>(rr, species),
00073     k_(rr.k_)
00074 {}
00075 
00076 
00077 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00078 
00079 template<class ReactionThermo, class ReactionRate>
00080 scalar ReversibleReaction<ReactionThermo, ReactionRate>::kf
00081 (
00082     const scalar T,
00083     const scalar p,
00084     const scalarField& c
00085 ) const
00086 {
00087     return k_(T, p, c);
00088 }
00089 
00090 
00091 template<class ReactionThermo, class ReactionRate>
00092 scalar ReversibleReaction<ReactionThermo, ReactionRate>::kr
00093 (
00094     const scalar kfwd,
00095     const scalar T,
00096     const scalar p,
00097     const scalarField& c
00098 ) const
00099 {
00100     return kfwd/this->Kc(T);
00101 }
00102 
00103 
00104 template<class ReactionThermo, class ReactionRate>
00105 scalar ReversibleReaction<ReactionThermo, ReactionRate>::kr
00106 (
00107     const scalar T,
00108     const scalar p,
00109     const scalarField& c
00110 ) const
00111 {
00112     return kr(kf(T, p, c), T, p, c);
00113 }
00114 
00115 
00116 template<class ReactionThermo, class ReactionRate>
00117 void ReversibleReaction<ReactionThermo, ReactionRate>::write
00118 (
00119     Ostream& os
00120 ) const
00121 {
00122     Reaction<ReactionThermo>::write(os);
00123     os  << token::SPACE << k_;
00124 }
00125 
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 } // End namespace Foam
00130 
00131 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines