TroeFallOffFunctionI.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 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
29 (
30  const scalar alpha,
31  const scalar Tsss,
32  const scalar Ts,
33  const scalar Tss
34 )
35 :
36  alpha_(alpha),
37  Tsss_(Tsss),
38  Ts_(Ts),
39  Tss_(Tss)
40 {}
41 
42 
44 :
45  alpha_(readScalar(dict.lookup("alpha"))),
46  Tsss_(readScalar(dict.lookup("Tsss"))),
47  Ts_(readScalar(dict.lookup("Ts"))),
48  Tss_(readScalar(dict.lookup("Tss")))
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
53 
54 inline Foam::scalar Foam::TroeFallOffFunction::operator()
55 (
56  const scalar T,
57  const scalar Pr
58 ) const
59 {
60  scalar logFcent = log10
61  (
62  max
63  (
64  (1 - alpha_)*exp(-T/Tsss_) + alpha_*exp(-T/Ts_) + exp(-Tss_/T),
65  SMALL
66  )
67  );
68 
69  scalar c = -0.4 - 0.67*logFcent;
70  static const scalar d = 0.14;
71  scalar n = 0.75 - 1.27*logFcent;
72 
73  scalar logPr = log10(max(Pr, SMALL));
74  return pow(10.0, logFcent/(1.0 + sqr((logPr + c)/(n - d*(logPr + c)))));
75 }
76 
77 
79 {
80  os.writeKeyword("alpha") << alpha_ << token::END_STATEMENT << nl;
81  os.writeKeyword("Tsss") << Tsss_ << token::END_STATEMENT << nl;
82  os.writeKeyword("Ts") << Ts_ << token::END_STATEMENT << nl;
83  os.writeKeyword("Tss") << Tss_ << token::END_STATEMENT << nl;
84 }
85 
86 
87 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
88 
89 inline Foam::Ostream& Foam::operator<<
90 (
91  Foam::Ostream& os,
92  const Foam::TroeFallOffFunction& tfof
93 )
94 {
95  tfof.write(os);
96  return os;
97 }
98 
99 
100 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
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
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
The Troe fall-off function.
void write(Ostream &os) const
Write to stream.
stressControl lookup("compactNormalStress") >> compactNormalStress
dimensionedScalar exp(const dimensionedScalar &ds)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
TroeFallOffFunction(const scalar alpha, const scalar Tsss, const scalar Ts, const scalar Tss)
Construct from components.
static const char nl
Definition: Ostream.H:262
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
const dimensionedScalar c
Speed of light in a vacuum.
label n
virtual Ostream & write(const token &)=0
Write next token to stream.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
dimensionedScalar log10(const dimensionedScalar &ds)