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