ChemicallyActivatedReactionRateI.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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 template<class ReactionRate, class ChemicallyActivationFunction>
30 <
31  ReactionRate,
32  ChemicallyActivationFunction
33 >::ChemicallyActivatedReactionRate
34 (
35  const ReactionRate& k0,
36  const ReactionRate& kInf,
37  const ChemicallyActivationFunction& F,
38  const thirdBodyEfficiencies& tbes
39 )
40 :
41  k0_(k0),
42  kInf_(kInf),
43  F_(F),
44  thirdBodyEfficiencies_(tbes)
45 {}
46 
47 
48 template<class ReactionRate, class ChemicallyActivationFunction>
50 <
51  ReactionRate,
52  ChemicallyActivationFunction
54 (
55  const speciesTable& species,
56  Istream& is
57 )
58 :
59  k0_(species, is.readBegin("ChemicallyActivatedReactionRate(Istream&)")),
60  kInf_(species, is),
61  F_(is),
62  thirdBodyEfficiencies_(species, is)
63 {
64  is.readEnd("ChemicallyActivatedReactionRate(Istream&)");
65 }
66 
67 
68 template<class ReactionRate, class ChemicallyActivationFunction>
70 <
71  ReactionRate,
72  ChemicallyActivationFunction
74 (
75  const speciesTable& species,
76  const dictionary& dict
77 )
78 :
79  k0_(species, dict),
80  kInf_(species, dict),
81  F_(dict),
82  thirdBodyEfficiencies_(species, dict)
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
88 template<class ReactionRate, class ChemicallyActivationFunction>
89 inline Foam::scalar Foam::ChemicallyActivatedReactionRate
90 <
91  ReactionRate,
92  ChemicallyActivationFunction
93 >::operator()
94 (
95  const scalar p,
96  const scalar T,
97  const scalarField& c
98 ) const
99 {
100  scalar k0 = k0_(p, T, c);
101  scalar kInf = kInf_(p, T, c);
102 
103  scalar Pr = k0*thirdBodyEfficiencies_.M(c)/kInf;
104 
105  return k0*(1/(1 + Pr))*F_(T, Pr);
106 }
107 
108 
109 template<class ReactionRate, class ChemicallyActivationFunction>
111 <
112  ReactionRate,
113  ChemicallyActivationFunction
114 >::write(Ostream& os) const
115 {
116  k0_.write(os);
117  kInf_.write(os);
118  F_.write(os);
119  thirdBodyEfficiencies_.write(os);
120 }
121 
122 
123 template<class ReactionRate, class ChemicallyActivationFunction>
124 inline Foam::Ostream& Foam::operator<<
125 (
126  Ostream& os,
128  <ReactionRate, ChemicallyActivationFunction>& carr
129 )
130 {
131  os << token::BEGIN_LIST
132  << carr.k0_ << token::SPACE << carr.kInf_ << token::SPACE << carr.F_
133  << token::END_LIST;
134  return os;
135 }
136 
137 
138 // ************************************************************************* //
Istream & readBegin(const char *funcName)
Definition: Istream.C:86
dimensionedScalar Pr("Pr", dimless, laminarTransport)
dictionary dict
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
General class for handling chemically-activated bimolecular reactions.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const volScalarField & T
A wordList with hashed indices for faster lookup by name.
const dimensionedScalar c
Speed of light in a vacuum.
volScalarField & p
Third body efficiencies.
runTime write()