OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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