OpenFOAM logo
Open Source CFD Toolkit

powerSeriesReactionRateI.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 Description
00026     
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00036 
00037 // Construct from components
00038 inline powerSeriesReactionRate::powerSeriesReactionRate
00039 (
00040     const scalar A,
00041     const scalar beta,
00042     const scalar Ta,
00043     const scalar b[]
00044 )
00045 :
00046     A_(A),
00047     beta_(beta),
00048     Ta_(Ta)
00049 {
00050     for (int n=0; n<nb_; n++)
00051     {
00052         b_[n] = b[n];
00053     }
00054 }
00055 
00056 
00057 //- Construct from Istream
00058 inline powerSeriesReactionRate::powerSeriesReactionRate
00059 (
00060     const speciesTable&,
00061     Istream& is
00062 )
00063 :
00064     A_(readScalar(is.readBegin("powerSeriesReactionRate(Istream&)"))),
00065     beta_(readScalar(is)),
00066     Ta_(readScalar(is))
00067 {
00068     for (int n=0; n<nb_; n++)
00069     {
00070         is >> b_[n];
00071     }
00072 
00073     is.readEnd("powerSeriesReactionRate(Istream&)");
00074 }
00075 
00076 
00077 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00078 
00079 inline scalar powerSeriesReactionRate::operator()
00080 (
00081     const scalar T,
00082     const scalar,
00083     const scalarField&
00084 ) const
00085 {
00086     scalar lta = A_;
00087 
00088     if (mag(beta_) > VSMALL)
00089     {
00090         lta *= pow(T, beta_);
00091     }
00092 
00093     scalar expArg = 0.0;
00094 
00095     for (int n=0; n<nb_; n++)
00096     {
00097         expArg += b_[n]/pow(T, n);
00098     }
00099 
00100     lta *= exp(expArg);
00101 
00102     return lta;
00103 }
00104 
00105 
00106 inline Ostream& operator<<(Ostream& os, const powerSeriesReactionRate& psrr)
00107 {
00108     os  << token::BEGIN_LIST
00109         << psrr.A_ << token::SPACE << psrr.beta_ << token::SPACE << psrr.Ta_;
00110 
00111     for (int n=0; n<powerSeriesReactionRate::nb_; n++)
00112     {
00113         os  << token::SPACE << psrr.b_[n];
00114     }
00115 
00116     os << token::END_LIST;
00117 
00118     return os;
00119 }
00120 
00121 
00122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00123 
00124 } // End namespace Foam
00125 
00126 // ************************************************************************* //
For further information go to www.openfoam.org