LangmuirHinshelwoodReactionRateI.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-2017 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 #include "FixedList.H"
27 #include "Tuple2.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 (
33  const scalar A[],
34  const scalar Ta[],
35  const label co,
36  const label c3h6,
37  const label no
38 )
39 :
40  co_(co),
41  c3h6_(c3h6),
42  no_(no)
43 {
44  for (int i=0; i<n_; i++)
45  {
46  A_[i] = A[i];
47  Ta_[i] = Ta[i];
48  }
49 }
50 
51 
53 (
54  const speciesTable& st,
55  const dictionary& dict
56 )
57 :
58  co_(st["CO"]),
59  c3h6_(st["C3H6"]),
60  no_(st["NO"])
61 {
62  // read (A, Ta) pairs
63  FixedList<Tuple2<scalar, scalar>, n_> coeffs(dict.lookup("coeffs"));
64 
65  forAll(coeffs, i)
66  {
67  A_[i] = coeffs[i].first();
68  Ta_[i] = coeffs[i].second();
69  }
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
75 inline Foam::scalar Foam::LangmuirHinshelwoodReactionRate::operator()
76 (
77  const scalar p,
78  const scalar T,
79  const scalarField& c
80 ) const
81 {
82  return A_[0]*exp(-Ta_[0]/T)/
83  (
84  T
85  *sqr(1 + A_[1]*exp(-Ta_[1]/T)*c[co_] + A_[2]*exp(-Ta_[2]/T)*c[c3h6_])
86  *(1 + A_[3]*exp(-Ta_[3]/T)*sqr(c[co_])*sqr(c[c3h6_]))
87  *(1 + A_[4]*exp(-Ta_[4]/T)*pow(c[no_], 0.7))
88  );
89 }
90 
91 
93 {
95 
96  forAll(coeffs, i)
97  {
98  coeffs[i].first() = A_[i];
99  coeffs[i].second() = Ta_[i];
100  }
101 
102  os.writeKeyword("coeffs") << coeffs << nl;
103 }
104 
105 
106 inline Foam::Ostream& Foam::operator<<
107 (
108  Ostream& os,
110 )
111 {
112  lhrr.write(os);
113  return os;
114 }
115 
116 
117 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:54
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar exp(const dimensionedScalar &ds)
T & first()
Return the first element of the list.
Definition: FixedListI.H:227
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
void write(Ostream &os) const
Write to stream.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
A wordList with hashed indices for faster lookup by name.
const dimensionedScalar c
Speed of light in a vacuum.
virtual Ostream & write(const token &)=0
Write next token to stream.
volScalarField & p
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576
LangmuirHinshelwoodReactionRate(const scalar A[], const scalar Ta[], const label co, const label c3h6, const label no)
Construct from components.