ArrheniusReactionRateI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 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  const dictionary& dict
45 )
46 :
47  A_(dict.lookup<scalar>("A")),
48  beta_(dict.lookup<scalar>("beta")),
49  Ta_(dict.lookup<scalar>("Ta"))
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 
56 {}
57 
58 
60 {}
61 
62 
63 inline Foam::scalar Foam::ArrheniusReactionRate::operator()
64 (
65  const scalar p,
66  const scalar T,
67  const scalarField&,
68  const label
69 ) const
70 {
71  scalar ak = A_;
72 
73  if (mag(beta_) > vSmall)
74  {
75  ak *= pow(T, beta_);
76  }
77 
78  if (mag(Ta_) > vSmall)
79  {
80  ak *= exp(-Ta_/T);
81  }
82 
83  return ak;
84 }
85 
86 
88 (
89  const scalar p,
90  const scalar T,
91  const scalarField&,
92  const label
93 ) const
94 {
95  scalar ak = A_;
96 
97  if (mag(beta_) > vSmall)
98  {
99  ak *= pow(T, beta_);
100  }
101 
102  if (mag(Ta_) > vSmall)
103  {
104  ak *= exp(-Ta_/T);
105  }
106 
107  return ak*(beta_+Ta_/T)/T;
108 }
109 
110 
112 {
113  return false;
114 }
115 
116 
118 (
119  const scalar p,
120  const scalar T,
121  const scalarField& c,
122  const label li,
123  scalarField& ddc
124 ) const
125 {
126  ddc = 0;
127 }
128 
129 
131 {
132  writeEntry(os, "A", A_);
133  writeEntry(os, "beta", beta_);
134  writeEntry(os, "Ta", Ta_);
135 }
136 
137 
138 inline Foam::Ostream& Foam::operator<<
139 (
140  Ostream& os,
141  const ArrheniusReactionRate& arr
142 )
143 {
144  arr.write(os);
145  return os;
146 }
147 
148 
149 // ************************************************************************* //
static const Foam::dimensionedScalar A("A", Foam::dimPressure, 611.21)
Arrhenius reaction rate given by:
void preEvaluate() const
Pre-evaluation hook.
ArrheniusReactionRate(const scalar A, const scalar beta, const scalar Ta)
Construct from components.
void postEvaluate() const
Post-evaluation hook.
void write(Ostream &os) const
Write to stream.
void ddc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &ddc) const
The derivative of the rate w.r.t. concentration.
scalar ddT(const scalar p, const scalar T, const scalarField &c, const label li) const
The derivative of the rate w.r.t. temperature.
bool hasDdc() const
Is the rate a function of concentration?
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
virtual Ostream & write(const char)=0
Write character.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A wordList with hashed indices for faster lookup by name.
const dimensionedScalar c
Speed of light in a vacuum.
dimensionedScalar exp(const dimensionedScalar &ds)
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
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensioned< scalar > mag(const dimensioned< Type > &)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p