FreeFOAM The Cross-Platform CFD Toolkit
powerSeriesReactionRateI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 namespace Foam
29 {
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 // Construct from components
35 (
36  const scalar A,
37  const scalar beta,
38  const scalar Ta,
39  const scalar b[]
40 )
41 :
42  A_(A),
43  beta_(beta),
44  Ta_(Ta)
45 {
46  for (int n=0; n<nb_; n++)
47  {
48  b_[n] = b[n];
49  }
50 }
51 
52 
53 //- Construct from Istream
55 (
56  const speciesTable&,
57  Istream& is
58 )
59 :
60  A_(readScalar(is.readBegin("powerSeriesReactionRate(Istream&)"))),
61  beta_(readScalar(is)),
62  Ta_(readScalar(is))
63 {
64  for (int n=0; n<nb_; n++)
65  {
66  is >> b_[n];
67  }
68 
69  is.readEnd("powerSeriesReactionRate(Istream&)");
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
75 inline scalar powerSeriesReactionRate::operator()
76 (
77  const scalar T,
78  const scalar,
79  const scalarField&
80 ) const
81 {
82  scalar lta = A_;
83 
84  if (mag(beta_) > VSMALL)
85  {
86  lta *= pow(T, beta_);
87  }
88 
89  scalar expArg = 0.0;
90 
91  for (int n=0; n<nb_; n++)
92  {
93  expArg += b_[n]/pow(T, n);
94  }
95 
96  lta *= exp(expArg);
97 
98  return lta;
99 }
100 
101 
103 {
104  os << token::BEGIN_LIST
105  << psrr.A_ << token::SPACE << psrr.beta_ << token::SPACE << psrr.Ta_;
106 
107  for (int n=0; n<powerSeriesReactionRate::nb_; n++)
108  {
109  os << token::SPACE << psrr.b_[n];
110  }
111 
112  os << token::END_LIST;
113 
114  return os;
115 }
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // ************************ vim: set sw=4 sts=4 et: ************************ //