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) 2011-2013 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  const FixedList<scalar, nCoeff_> coeffs
34 )
35 :
36  A_(A),
37  beta_(beta),
38  Ta_(Ta),
39  coeffs_(coeffs)
40 {}
41 
42 
44 (
45  const speciesTable&,
46  Istream& is
47 )
48 :
49  A_(readScalar(is.readBegin("powerSeriesReactionRate(Istream&)"))),
50  beta_(readScalar(is)),
51  Ta_(readScalar(is)),
52  coeffs_(is)
53 {
54  is.readEnd("powerSeriesReactionRate(Istream&)");
55 }
56 
57 
59 (
60  const speciesTable&,
61  const dictionary& dict
62 )
63 :
64  A_(readScalar(dict.lookup("A"))),
65  beta_(readScalar(dict.lookup("beta"))),
66  Ta_(readScalar(dict.lookup("Ta"))),
67  coeffs_(dict.lookup("coeffs"))
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
73 inline Foam::scalar Foam::powerSeriesReactionRate::operator()
74 (
75  const scalar p,
76  const scalar T,
77  const scalarField&
78 ) const
79 {
80  scalar lta = A_;
81 
82  if (mag(beta_) > VSMALL)
83  {
84  lta *= pow(T, beta_);
85  }
86 
87  scalar expArg = 0.0;
88 
89  forAll(coeffs_, n)
90  {
91  expArg += coeffs_[n]/pow(T, n + 1);
92  }
93 
94  lta *= exp(expArg);
95 
96  return lta;
97 }
98 
99 
101 {
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;
106 }
107 
108 
109 inline Foam::Ostream& Foam::operator<<
110 (
111  Ostream& os,
112  const powerSeriesReactionRate& psrr
113 )
114 {
115  os << token::BEGIN_LIST
116  << psrr.A_ << token::SPACE << psrr.beta_ << token::SPACE << psrr.Ta_;
117 
118  for (int n=0; n<powerSeriesReactionRate::nCoeff_; n++)
119  {
120  os << token::SPACE << psrr.coeffs_[n];
121  }
122 
123  os << token::END_LIST;
124 
125  return os;
126 }
127 
128 
129 // ************************************************************************* //
beta
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
Foam::token::END_STATEMENT
@ END_STATEMENT
Definition: token.H:99
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
p
p
Definition: pEqn.H:62
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::powerSeriesReactionRate::nCoeff_
static const label nCoeff_
Definition: powerSeriesReactionRate.H:58
Foam::powerSeriesReactionRate::A_
scalar A_
Definition: powerSeriesReactionRate.H:54
Foam::powerSeriesReactionRate::coeffs_
FixedList< scalar, nCoeff_ > coeffs_
Definition: powerSeriesReactionRate.H:59
Foam::powerSeriesReactionRate::write
void write(Ostream &os) const
Write to stream.
Definition: powerSeriesReactionRateI.H:100
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:252
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::powerSeriesReactionRate::beta_
scalar beta_
Definition: powerSeriesReactionRate.H:55
A
simpleMatrix< scalar > A(Nc)
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::hashedWordList
A wordList with hashed indices for faster lookup by name.
Definition: hashedWordList.H:57
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
Foam::powerSeriesReactionRate::powerSeriesReactionRate
powerSeriesReactionRate(const scalar A, const scalar beta, const scalar Ta, const FixedList< scalar, nCoeff_ > coeffs)
Construct from components.
Definition: powerSeriesReactionRateI.H:29
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
readScalar
#define readScalar
Definition: doubleScalar.C:38
T
const volScalarField & T
Definition: createFields.H:25
Foam::powerSeriesReactionRate::Ta_
scalar Ta_
Definition: powerSeriesReactionRate.H:56
Foam::token::BEGIN_LIST
@ BEGIN_LIST
Definition: token.H:100
Foam::powerSeriesReactionRate
Power series reaction rate.
Definition: powerSeriesReactionRate.H:50
Foam::FixedList< scalar, nCoeff_ >
Foam::Ostream::writeKeyword
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::Istream::readBegin
Istream & readBegin(const char *funcName)
Definition: Istream.C:88
Foam::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95