FreeFOAM The Cross-Platform CFD Toolkit
JanevReactionRateI.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("JanevReactionRate(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("JanevReactionRate(Istream&)");
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
75 inline scalar JanevReactionRate::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  if (mag(Ta_) > VSMALL)
92  {
93  expArg -= Ta_/T;
94  }
95 
96  scalar lnT = log(T);
97 
98  for (int n=0; n<nb_; n++)
99  {
100  expArg += b_[n]*pow(lnT, n);
101  }
102 
103  lta *= exp(expArg);
104 
105  return lta;
106 }
107 
108 
109 inline Ostream& operator<<(Ostream& os, const JanevReactionRate& jrr)
110 {
111  os << token::BEGIN_LIST
112  << jrr.A_ << token::SPACE << jrr.beta_ << token::SPACE << jrr.Ta_;
113 
114  for (int n=0; n<JanevReactionRate::nb_; n++)
115  {
116  os << token::SPACE << jrr.b_[n];
117  }
118 
119  os << token::END_LIST;
120 
121  return os;
122 }
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace Foam
128 
129 // ************************ vim: set sw=4 sts=4 et: ************************ //