All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tableThermophysicalFunction.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) 2019-2020 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 Class
25  Foam::thermophysicalFunctions::table
26 
27 Description
28  Tabulated property function that linearly interpolates between
29  the table values.
30 
31 Usage
32  \table
33  Property | Description
34  Tlow | Lower temperature limit of the table
35  Thigh | Upper temperature limit of the table
36  values | Property values, assumed uniformly distributed
37  \endtable
38 
39  Example for the density of water between 280 and 350K
40  \verbatim
41  rho
42  {
43  type table;
44 
45  Tlow 280;
46  Thigh 350;
47 
48  values
49  (
50  999.87
51  991.53
52  973.7
53  );
54  }
55  \endverbatim
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef tableThermophysicalFunction_H
60 #define tableThermophysicalFunction_H
61 
62 #include "thermophysicalFunction.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 namespace thermophysicalFunctions
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class table Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class table
76 :
77  public thermophysicalFunction
78 {
79  // Private member data
80 
81  //- Name of dictionary from which this function is instantiated
82  fileName dictName_;
83 
84  //- Lowest temperature in the table
85  scalar Tlow_;
86 
87  //- Highest temperature in the table
88  scalar Thigh_;
89 
90  //- Table values
91  List<scalar> values_;
92 
93  //- Temperature increment derived from Tlow_, Thigh_ and values_.size()
94  scalar deltaT_;
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("table");
101 
102 
103  // Constructors
104 
105  //- Construct from dictionary
106  table(const dictionary& dict);
107 
108 
109  // Member Functions
110 
111  //- Evaluate the function and return the result
112  scalar f(scalar p, scalar T) const;
113 
114  //- Write the function coefficients
115  void write(Ostream& os) const;
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace thermophysicalFunctions
122 } // End namespace Foam
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
table(const dictionary &dict)
Construct from dictionary.
void write(Ostream &os) const
Write the function coefficients.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
TypeName("table")
Runtime type information.
volScalarField & p
scalar f(scalar p, scalar T) const
Evaluate the function and return the result.
Namespace for OpenFOAM.