Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / specie / reaction / reactionRate / powerSeries / powerSeriesReactionRateI.H
blob0821afd18a1e8741d99a8cf385b90e8de788d748
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
28 inline Foam::powerSeriesReactionRate::powerSeriesReactionRate
30     const scalar A,
31     const scalar beta,
32     const scalar Ta,
33     const FixedList<scalar, nCoeff_> coeffs
36     A_(A),
37     beta_(beta),
38     Ta_(Ta),
39     coeffs_(coeffs)
43 inline Foam::powerSeriesReactionRate::powerSeriesReactionRate
45     const speciesTable&,
46     Istream& is
49     A_(readScalar(is.readBegin("powerSeriesReactionRate(Istream&)"))),
50     beta_(readScalar(is)),
51     Ta_(readScalar(is)),
52     coeffs_(is)
54     is.readEnd("powerSeriesReactionRate(Istream&)");
58 inline Foam::powerSeriesReactionRate::powerSeriesReactionRate
60     const speciesTable&,
61     const dictionary& dict
64     A_(readScalar(dict.lookup("A"))),
65     beta_(readScalar(dict.lookup("beta"))),
66     Ta_(readScalar(dict.lookup("Ta"))),
67     coeffs_(dict.lookup("coeffs"))
71 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
73 inline Foam::scalar Foam::powerSeriesReactionRate::operator()
75     const scalar T,
76     const scalar,
77     const scalarField&
78 ) const
80     scalar lta = A_;
82     if (mag(beta_) > VSMALL)
83     {
84         lta *= pow(T, beta_);
85     }
87     scalar expArg = 0.0;
89     forAll(coeffs_, n)
90     {
91         expArg += coeffs_[n]/pow(T, n);
92     }
94     lta *= exp(expArg);
96     return lta;
100 inline void Foam::powerSeriesReactionRate::write(Ostream& os) const
102     os.writeKeyword("A") << A_ << token::END_STATEMENT << nl;
103     os.writeKeyword("beta") << beta_ << token::END_STATEMENT << nl;
104     os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl;
105     os.writeKeyword("coeffs") << coeffs_ << token::END_STATEMENT << nl;
109 inline Foam::Ostream& Foam::operator<<
111     Ostream& os,
112     const powerSeriesReactionRate& psrr
115     os  << token::BEGIN_LIST
116         << psrr.A_ << token::SPACE << psrr.beta_ << token::SPACE << psrr.Ta_;
118     for (int n=0; n<powerSeriesReactionRate::nCoeff_; n++)
119     {
120         os  << token::SPACE << psrr.coeffs_[n];
121     }
123     os << token::END_LIST;
125     return os;
129 // ************************************************************************* //