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

JanevReactionRateI.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 JanevReactionRate::JanevReactionRate
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 JanevReactionRate::JanevReactionRate
00056 (
00057     const speciesTable&,
00058     Istream& is
00059 )
00060 :
00061     A_(readScalar(is.readBegin("JanevReactionRate(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("JanevReactionRate(Istream&)");
00071 }
00072 
00073 
00074 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00075 
00076 inline scalar JanevReactionRate::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     if (mag(Ta_) > VSMALL)
00093     {
00094         expArg -= Ta_/T;
00095     }
00096 
00097     scalar lnT = log(T);
00098 
00099     for (int n=0; n<nb_; n++)
00100     {
00101         expArg += b_[n]*pow(lnT, n);
00102     }
00103 
00104     lta *= exp(expArg);
00105 
00106     return lta;
00107 }
00108 
00109 
00110 inline Ostream& operator<<(Ostream& os, const JanevReactionRate& jrr)
00111 {
00112     os  << token::BEGIN_LIST
00113         << jrr.A_ << token::SPACE << jrr.beta_ << token::SPACE << jrr.Ta_;
00114 
00115     for (int n=0; n<JanevReactionRate::nb_; n++)
00116     {
00117         os  << token::SPACE << jrr.b_[n];
00118     }
00119 
00120     os << token::END_LIST;
00121 
00122     return os;
00123 }
00124 
00125 
00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00127 
00128 } // End namespace Foam
00129 
00130 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd