ArrheniusReactionRateI.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) 2011-2012 OpenFOAM Foundation
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 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
29 (
30  const scalar A,
31  const scalar beta,
32  const scalar Ta
33 )
34 :
35  A_(A),
36  beta_(beta),
37  Ta_(Ta)
38 {}
39 
40 
42 (
43  const speciesTable&,
44  Istream& is
45 )
46 :
47  A_(readScalar(is.readBegin("ArrheniusReactionRate(Istream&)"))),
48  beta_(readScalar(is)),
49  Ta_(readScalar(is))
50 {
51  is.readEnd("ArrheniusReactionRate(Istream&)");
52 }
53 
54 
56 (
57  const speciesTable&,
58  const dictionary& dict
59 )
60 :
61  A_(readScalar(dict.lookup("A"))),
62  beta_(readScalar(dict.lookup("beta"))),
63  Ta_(readScalar(dict.lookup("Ta")))
64 {}
65 
66 
67 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 
69 inline Foam::scalar Foam::ArrheniusReactionRate::operator()
70 (
71  const scalar p,
72  const scalar T,
73  const scalarField&
74 ) const
75 {
76  scalar ak = A_;
77 
78  if (mag(beta_) > VSMALL)
79  {
80  ak *= pow(T, beta_);
81  }
82 
83  if (mag(Ta_) > VSMALL)
84  {
85  ak *= exp(-Ta_/T);
86  }
87 
88  return ak;
89 }
90 
91 
93 {
94  os.writeKeyword("A") << A_ << token::END_STATEMENT << nl;
95  os.writeKeyword("beta") << beta_ << token::END_STATEMENT << nl;
96  os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl;
97 }
98 
99 
100 inline Foam::Ostream& Foam::operator<<
101 (
102  Ostream& os,
103  const ArrheniusReactionRate& arr
104 )
105 {
106  os << token::BEGIN_LIST
107  << arr.A_ << token::SPACE << arr.beta_ << token::SPACE << arr.Ta_
108  << token::END_LIST;
109  return os;
110 }
111 
112 
113 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
Istream & readBegin(const char *funcName)
Definition: Istream.C:86
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
ArrheniusReactionRate(const scalar A, const scalar beta, const scalar Ta)
Construct from components.
Istream & readEnd(const char *funcName)
Definition: Istream.C:103
dimensionedScalar exp(const dimensionedScalar &ds)
void write(Ostream &os) const
Write to stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
static const char nl
Definition: Ostream.H:262
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
const volScalarField & T
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
A wordList with hashed indices for faster lookup by name.
Arrhenius reaction rate given by:
dimensioned< scalar > mag(const dimensioned< Type > &)
volScalarField & p
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451