FreeFOAM The Cross-Platform CFD Toolkit
SRIFallOffFunctionI.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 a,
32  const scalar b,
33  const scalar c,
34  const scalar d,
35  const scalar e
36 )
37 :
38  a_(a),
39  b_(b),
40  c_(c),
41  d_(d),
42  e_(e)
43 {}
44 
45 
46 // Construct from Istream
48 :
49  a_(readScalar(is.readBegin("SRIFallOffFunction(Istream&)"))),
50  b_(readScalar(is)),
51  c_(readScalar(is)),
52  d_(readScalar(is)),
53  e_(readScalar(is))
54 {
55  is.readEnd("SRIFallOffFunction(Istream&)");
56 }
57 
58 
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
60 
61 inline Foam::scalar Foam::SRIFallOffFunction::operator()
62 (
63  const scalar T,
64  const scalar Pr
65 ) const
66 {
67  scalar X = 1.0/(1.0 + sqr(log10(max(Pr, SMALL))));
68  return d_*pow(a_*exp(-b_/T) + exp(-T/c_), X)*pow(T, e_);
69 }
70 
71 
72 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
73 
74 inline Foam::Ostream& Foam::operator<<
75 (
76  Foam::Ostream& os,
77  const Foam::SRIFallOffFunction& srifof
78 )
79 {
80  os << token::BEGIN_LIST
81  << srifof.a_
82  << token::SPACE << srifof.b_
83  << token::SPACE << srifof.c_
84  << token::SPACE << srifof.d_
85  << token::SPACE << srifof.e_
86  << token::END_LIST;
87 
88  return os;
89 }
90 
91 
92 // ************************ vim: set sw=4 sts=4 et: ************************ //