icoTabulated.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) 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::icoTabulated
26 
27 Description
28  Incompressible of equation of state using non-uniform tabulated
29  density vs temperature.
30 
31 Usage
32  \table
33  Property | Description
34  rho | Density vs temperature table
35  \endtable
36 
37  Example of the specification of the equation of state:
38  \verbatim
39  equationOfState
40  {
41  rho
42  (
43  (200 1010)
44  (350 1000)
45  (400 980)
46  );
47  }
48  \endverbatim
49 
50 SourceFiles
51  icoTabulatedI.H
52  icoTabulated.C
53 
54 See also
55  Foam::Function1s::NonUniformTable
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef icoTabulated_H
60 #define icoTabulated_H
61 
62 #include "NonUniformTable1.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 
69 // Forward declaration of friend functions and operators
70 
71 template<class Specie>
72 class icoTabulated;
73 
74 template<class Specie>
75 Ostream& operator<<
76 (
79 );
80 
81 
82 /*---------------------------------------------------------------------------*\
83  Class icoTabulated Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 template<class Specie>
87 class icoTabulated
88 :
89  public Specie
90 {
92 
93 
94  // Private Data
95 
96  //- Density table [kg/m^3]
97  nonUniformTable rho_;
98 
99 
100 public:
101 
102  // Constructors
103 
104  //- Construct from components
105  inline icoTabulated
106  (
107  const Specie& sp,
108  const nonUniformTable& rho
109  );
110 
111  //- Construct from dictionary
112  icoTabulated(const dictionary& dict);
113 
114  //- Construct as named copy
115  inline icoTabulated(const word& name, const icoTabulated&);
116 
117  //- Construct and return a clone
118  inline autoPtr<icoTabulated> clone() const;
119 
120  // Selector from dictionary
121  inline static autoPtr<icoTabulated> New(const dictionary& dict);
122 
123 
124  // Member Functions
125 
126  //- Return the instantiated type name
127  static word typeName()
128  {
129  return "icoTabulated<" + word(Specie::typeName_()) + '>';
130  }
131 
133  // Fundamental properties
134 
135  //- Is the equation of state is incompressible i.e. rho != f(p)
136  static const bool incompressible = true;
137 
138  //- Is the equation of state is isochoric i.e. rho = const
139  static const bool isochoric = false;
140 
141  //- Return density [kg/m^3]
142  inline scalar rho(scalar p, scalar T) const;
143 
144  //- Return enthalpy contribution [J/kg]
145  inline scalar H(const scalar p, const scalar T) const;
146 
147  //- Return Cp contribution [J/(kg K]
148  inline scalar Cp(scalar p, scalar T) const;
149 
150  //- Return internal energy contribution [J/kg]
151  inline scalar E(const scalar p, const scalar T) const;
152 
153  //- Return Cv contribution [J/(kg K]
154  inline scalar Cv(scalar p, scalar T) const;
155 
156  //- Return entropy contribution to the integral of Cp/T [J/kg/K]
157  inline scalar Sp(const scalar p, const scalar T) const;
158 
159  //- Return entropy contribution to the integral of Cv/T [J/kg/K]
160  inline scalar Sv(const scalar p, const scalar T) const;
161 
162  //- Return compressibility [s^2/m^2]
163  inline scalar psi(scalar p, scalar T) const;
164 
165  //- Return compression factor []
166  inline scalar Z(scalar p, scalar T) const;
167 
168  //- Return (Cp - Cv) [J/(kg K]
169  inline scalar CpMCv(scalar p, scalar T) const;
170 
171 
172  // IO
173 
174  //- Write to Ostream
175  void write(Ostream& os) const;
176 
177 
178  // Ostream Operator
179 
180  friend Ostream& operator<< <Specie>
181  (
182  Ostream&,
183  const icoTabulated&
184  );
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #include "icoTabulatedI.H"
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #ifdef NoRepository
199  #include "icoTabulated.C"
200 #endif
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
scalar Sp(const scalar p, const scalar T) const
Return entropy contribution to the integral of Cp/T [J/kg/K].
dictionary dict
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: icoTabulated.H:141
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
scalar Cp(scalar p, scalar T) const
Return Cp contribution [J/(kg K].
static word typeName()
Return the instantiated type name.
Definition: icoTabulated.H:132
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
scalar psi(scalar p, scalar T) const
Return compressibility [s^2/m^2].
Incompressible of equation of state using non-uniform tabulated density vs temperature.
Definition: icoTabulated.H:77
scalar Cv(scalar p, scalar T) const
Return Cv contribution [J/(kg K].
void write(Ostream &os) const
Write to Ostream.
Definition: icoTabulated.C:42
scalar Sv(const scalar p, const scalar T) const
Return entropy contribution to the integral of Cv/T [J/kg/K].
A class for handling words, derived from string.
Definition: word.H:59
autoPtr< icoTabulated > clone() const
Construct and return a clone.
Definition: icoTabulatedI.H:58
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static autoPtr< icoTabulated > New(const dictionary &dict)
Definition: icoTabulatedI.H:69
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: icoTabulated.H:144
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: icoTabulatedI.H:82
icoTabulated(const Specie &sp, const nonUniformTable &rho)
Construct from components.
Definition: icoTabulatedI.H:32
scalar Z(scalar p, scalar T) const
Return compression factor [].
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
scalar H(const scalar p, const scalar T) const
Return enthalpy contribution [J/kg].
Definition: icoTabulatedI.H:93
scalar E(const scalar p, const scalar T) const
Return internal energy contribution [J/kg].
Namespace for OpenFOAM.