powerSeriesReactionRateI.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-2019 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 FixedList<scalar, nCoeff_> coeffs
34 )
35 :
36  A_(A),
37  beta_(beta),
38  Ta_(Ta),
39  coeffs_(coeffs)
40 {}
41 
42 
44 (
45  const speciesTable&,
46  const dictionary& dict
47 )
48 :
49  A_(dict.lookup<scalar>("A")),
50  beta_(dict.lookup<scalar>("beta")),
51  Ta_(dict.lookup<scalar>("Ta")),
52  coeffs_(dict.lookup("coeffs"))
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
58 inline Foam::scalar Foam::powerSeriesReactionRate::operator()
59 (
60  const scalar p,
61  const scalar T,
62  const scalarField&,
63  const label
64 ) const
65 {
66  scalar lta = A_;
67 
68  if (mag(beta_) > vSmall)
69  {
70  lta *= pow(T, beta_);
71  }
72 
73  scalar expArg = 0;
74 
75  forAll(coeffs_, n)
76  {
77  expArg += coeffs_[n]/pow(T, n + 1);
78  }
79 
80  lta *= exp(expArg);
81 
82  return lta;
83 }
84 
85 
86 inline Foam::scalar Foam::powerSeriesReactionRate::ddT
87 (
88  const scalar p,
89  const scalar T,
90  const scalarField&,
91  const label
92 ) const
93 {
94  scalar lta = A_;
95 
96  if (mag(beta_) > vSmall)
97  {
98  lta *= pow(T, beta_);
99  }
100 
101  scalar expArg = 0;
102  scalar deriv = 0;
103 
104  forAll(coeffs_, n)
105  {
106  scalar cT = coeffs_[n]/pow(T, n + 1);
107  expArg += cT;
108  deriv -= (n + 1)*cT;
109  }
110 
111  lta *= exp(expArg);
112 
113  return lta*(beta_+deriv)/T;
114 }
115 
116 
119 {
120  return NullObjectRef<List<Tuple2<label, scalar>>>();
121 }
122 
123 
125 (
126  const scalar p,
127  const scalar T,
128  const scalarField& c,
129  const label li,
130  scalarField& dcidc
131 ) const
132 {}
133 
134 
135 inline Foam::scalar Foam::powerSeriesReactionRate::dcidT
136 (
137  const scalar p,
138  const scalar T,
139  const scalarField& c,
140  const label li
141 ) const
142 {
143  return 0;
144 }
145 
146 
148 {
149  writeEntry(os, "A", A_);
150  writeEntry(os, "beta", beta_);
151  writeEntry(os, "Ta", Ta_);
152  writeEntry(os, "coeffs", coeffs_);
153 }
154 
155 
156 inline Foam::Ostream& Foam::operator<<
157 (
158  Ostream& os,
159  const powerSeriesReactionRate& psrr
160 )
161 {
162  psrr.write(os);
163  return os;
164 }
165 
166 
167 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
const List< Tuple2< label, scalar > > & beta() const
Third-body efficiencies (beta = 1-alpha)
virtual Ostream & write(const char)=0
Write character.
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
void write(Ostream &os) const
Write to stream.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
scalar ddT(const scalar p, const scalar T, const scalarField &c, const label li) const
dimensionedScalar exp(const dimensionedScalar &ds)
powerSeriesReactionRate(const scalar A, const scalar beta, const scalar Ta, const FixedList< scalar, nCoeff_ > coeffs)
Construct from components.
Power series reaction rate.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
const volScalarField & T
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
A wordList with hashed indices for faster lookup by name.
dimensioned< scalar > mag(const dimensioned< Type > &)
label n
volScalarField & p
scalar dcidT(const scalar p, const scalar T, const scalarField &c, const label li) const
Temperature derivative of the pressure dependent term.
void dcidc(const scalar p, const scalar T, const scalarField &c, const label li, scalarField &dcidc) const
Species concentration derivative of the pressure dependent term.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:812