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-2024 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 "ArrheniusReactionRate.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 (
33  const scalar A,
34  const scalar beta,
35  const scalar Ta
36 )
37 :
38  beta_(beta),
39  A_(A),
40  Ta_(Ta)
41 {}
42 
43 
45 (
46  const speciesTable&,
47  const dimensionSet& dims,
48  const dictionary& dict
49 )
50 :
51  beta_(dict.lookup<scalar>("beta", dimless)),
52  A_(dict.lookup<scalar>("A", dims/pow(dimTemperature, beta_))),
53  Ta_
54  (
55  dict.found("Ta") || !dict.found("Ea")
56  ? dict.lookup<scalar>("Ta", dimTemperature)
57  : dict.lookup<scalar>("Ea", dimEnergy/dimMoles)
58  /constant::physicoChemical::RR.value()
59  )
60 {}
61 
62 
63 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64 
66 {}
67 
68 
70 {}
71 
72 
73 inline Foam::scalar Foam::ArrheniusReactionRate::operator()
74 (
75  const scalar p,
76  const scalar T,
77  const scalarField&,
78  const label
79 ) const
80 {
81  scalar ak = A_;
82 
83  if (mag(beta_) > vSmall)
84  {
85  ak *= pow(T, beta_);
86  }
87 
88  if (mag(Ta_) > vSmall)
89  {
90  ak *= exp(-Ta_/T);
91  }
92 
93  return ak;
94 }
95 
96 
98 (
99  const scalar p,
100  const scalar T,
101  const scalarField&,
102  const label
103 ) const
104 {
105  scalar ak = A_;
106 
107  if (mag(beta_) > vSmall)
108  {
109  ak *= pow(T, beta_);
110  }
111 
112  if (mag(Ta_) > vSmall)
113  {
114  ak *= exp(-Ta_/T);
115  }
116 
117  return ak*(beta_+Ta_/T)/T;
118 }
119 
120 
122 {
123  return false;
124 }
125 
126 
128 (
129  const scalar p,
130  const scalar T,
131  const scalarField& c,
132  const label li,
133  scalarField& ddc
134 ) const
135 {
136  ddc = 0;
137 }
138 
139 
141 {
142  writeEntry(os, "A", A_);
143  writeEntry(os, "beta", beta_);
144  writeEntry(os, "Ta", Ta_);
145 }
146 
147 
148 inline Foam::Ostream& Foam::operator<<
149 (
150  Ostream& os,
151  const ArrheniusReactionRate& arr
152 )
153 {
154  arr.write(os);
155  return os;
156 }
157 
158 
159 // ************************************************************************* //
static const Foam::dimensionedScalar A("A", Foam::dimPressure, 611.21)
bool found
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:162
Dimension set for the base types.
Definition: dimensionSet.H:125
A wordList with hashed indices for faster lookup by name.
const dimensionedScalar RR
Universal gas constant: default SI units: [J/kmol/K].
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
const dimensionSet dimEnergy
const dimensionSet dimless
const dimensionSet dimTemperature
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 > &)
const dimensionSet dimMoles
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p