FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 
28 // Construct from components
30 (
31  const scalar alpha,
32  const scalar Tsss,
33  const scalar Ts,
34  const scalar Tss
35 )
36 :
37  alpha_(alpha),
38  Tsss_(Tsss),
39  Ts_(Ts),
40  Tss_(Tss)
41 {}
42 
43 
44 // Construct from Istream
46 :
47  alpha_(readScalar(is.readBegin("TroeFallOffFunction(Istream&)"))),
48  Tsss_(readScalar(is)),
49  Ts_(readScalar(is)),
50  Tss_(readScalar(is))
51 {
52  is.readEnd("TroeFallOffFunction(Istream&)");
53 }
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
58 inline Foam::scalar Foam::TroeFallOffFunction::operator()
59 (
60  const scalar T,
61  const scalar Pr
62 ) const
63 {
64  scalar logFcent = log10
65  (
66  max
67  (
68  (1 - alpha_)*exp(-T/Tsss_) + alpha_*exp(-T/Ts_) + exp(-Tss_/T),
69  SMALL
70  )
71  );
72 
73  scalar c = -0.4 - 0.67*logFcent;
74  static const scalar d = 0.14;
75  scalar n = 0.75 - 1.27*logFcent;
76 
77  scalar logPr = log10(max(Pr, SMALL));
78  return pow(10.0, logFcent/(1.0 + sqr((logPr + c)/(n - d*(logPr + c)))));
79 }
80 
81 
82 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
83 
84 inline Foam::Ostream& Foam::operator<<
85 (
86  Foam::Ostream& os,
87  const Foam::TroeFallOffFunction& tfof
88 )
89 {
90  os << token::BEGIN_LIST
91  << tfof.alpha_
92  << token::SPACE << tfof.Tsss_
93  << token::SPACE << tfof.Ts_
94  << token::SPACE << tfof.Tss_
95  << token::END_LIST;
96 
97  return os;
98 }
99 
100 
101 // ************************ vim: set sw=4 sts=4 et: ************************ //