initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / specie / reaction / reactionRate / powerSeries / powerSeriesReactionRateI.H
blob5d49c6f5d500f180522ddd06e7bd4742859feb0c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 namespace Foam
32 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
34 // Construct from components
35 inline powerSeriesReactionRate::powerSeriesReactionRate
37     const scalar A,
38     const scalar beta,
39     const scalar Ta,
40     const scalar b[]
43     A_(A),
44     beta_(beta),
45     Ta_(Ta)
47     for (int n=0; n<nb_; n++)
48     {
49         b_[n] = b[n];
50     }
54 //- Construct from Istream
55 inline powerSeriesReactionRate::powerSeriesReactionRate
57     const speciesTable&,
58     Istream& is
61     A_(readScalar(is.readBegin("powerSeriesReactionRate(Istream&)"))),
62     beta_(readScalar(is)),
63     Ta_(readScalar(is))
65     for (int n=0; n<nb_; n++)
66     {
67         is >> b_[n];
68     }
70     is.readEnd("powerSeriesReactionRate(Istream&)");
74 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
76 inline scalar powerSeriesReactionRate::operator()
78     const scalar T,
79     const scalar,
80     const scalarField&
81 ) const
83     scalar lta = A_;
85     if (mag(beta_) > VSMALL)
86     {
87         lta *= pow(T, beta_);
88     }
90     scalar expArg = 0.0;
92     for (int n=0; n<nb_; n++)
93     {
94         expArg += b_[n]/pow(T, n);
95     }
97     lta *= exp(expArg);
99     return lta;
103 inline Ostream& operator<<(Ostream& os, const powerSeriesReactionRate& psrr)
105     os  << token::BEGIN_LIST
106         << psrr.A_ << token::SPACE << psrr.beta_ << token::SPACE << psrr.Ta_;
108     for (int n=0; n<powerSeriesReactionRate::nb_; n++)
109     {
110         os  << token::SPACE << psrr.b_[n];
111     }
113     os << token::END_LIST;
115     return os;
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 } // End namespace Foam
123 // ************************************************************************* //