LandauTellerReactionRateI.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  const scalar B,
34  const scalar C
35 )
36 :
37  A_(A),
38  beta_(beta),
39  Ta_(Ta),
40  B_(B),
41  C_(C)
42 {}
43 
44 
46 (
47  const speciesTable&,
48  Istream& is
49 )
50 :
51  A_(readScalar(is.readBegin("LandauTellerReactionRate(Istream&)"))),
52  beta_(readScalar(is)),
53  Ta_(readScalar(is)),
54  B_(readScalar(is)),
55  C_(readScalar(is))
56 {
57  is.readEnd("LandauTellerReactionRate(Istream&)");
58 }
59 
60 
62 (
63  const speciesTable&,
64  const dictionary& dict
65 )
66 :
67  A_(readScalar(dict.lookup("A"))),
68  beta_(readScalar(dict.lookup("beta"))),
69  Ta_(readScalar(dict.lookup("Ta"))),
70  B_(readScalar(dict.lookup("B"))),
71  C_(readScalar(dict.lookup("C")))
72 {}
73 
74 
75 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 
77 inline Foam::scalar Foam::LandauTellerReactionRate::operator()
78 (
79  const scalar p,
80  const scalar T,
81  const scalarField&
82 ) const
83 {
84  scalar lta = A_;
85 
86  if (mag(beta_) > VSMALL)
87  {
88  lta *= pow(T, beta_);
89  }
90 
91  scalar expArg = 0.0;
92 
93  if (mag(Ta_) > VSMALL)
94  {
95  expArg -= Ta_/T;
96  }
97 
98  if (mag(B_) > VSMALL)
99  {
100  expArg += B_/cbrt(T);
101  }
102 
103  if (mag(C_) > VSMALL)
104  {
105  expArg += C_/pow(T, 2.0/3.0);
106  }
107 
108  if (mag(expArg) > VSMALL)
109  {
110  lta *= exp(expArg);
111  }
112 
113  return lta;
114 }
115 
116 
118 {
119  os.writeKeyword("A") << A_ << token::END_STATEMENT << nl;
120  os.writeKeyword("beta") << beta_ << token::END_STATEMENT << nl;
121  os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl;
122  os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
123  os.writeKeyword("C") << C_ << token::END_STATEMENT << nl;
124 }
125 
126 
127 inline Foam::Ostream& Foam::operator<<
128 (
129  Ostream& os,
130  const LandauTellerReactionRate& arr
131 )
132 {
133  os << token::BEGIN_LIST
134  << arr.A_ << token::SPACE << arr.beta_ << token::SPACE << arr.Ta_
135  << token::SPACE << arr.B_ << token::SPACE << arr.C_
136  << token::END_LIST;
137  return os;
138 }
139 
140 
141 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
Istream & readBegin(const char *funcName)
Definition: Istream.C:86
LandauTellerReactionRate(const scalar A, const scalar beta, const scalar Ta, const scalar B, const scalar C)
Construct from components.
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
Istream & readEnd(const char *funcName)
Definition: Istream.C:103
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar cbrt(const dimensionedScalar &ds)
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)
Landau-Teller reaction rate.
A wordList with hashed indices for faster lookup by name.
dimensioned< scalar > mag(const dimensioned< Type > &)
volScalarField & p
void write(Ostream &os) const
Write to stream.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451