rhoTabulated.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::rhoTabulated
26 
27 Description
28  Incompressible of equation of state using uniform tabulated
29  density vs pressure and temperature.
30 
31  Thermodynamic contributions derived from tabulated density data are not
32  sufficiently accurate and hence the H, Cp, E, Cv, Sp, Sv and CpMCv are not
33  implemented. Thus this equation of state should be used in conjunction with
34  hTabulated or eTabulated thermodynamics in which both the energy and heat
35  capacity are tabulated w.r.t. pressure and temperature avoiding the need
36  for equation of state contributions.
37 
38 Usage
39  \table
40  Property | Description
41  rho | Density vs pressure and temperature table
42  \endtable
43 
44  Example of the specification of the equation of state:
45  \verbatim
46  equationOfState
47  {
48  rho
49  {
50  pLow 1e4;
51  pHigh 5e5;
52 
53  Tlow 200;
54  Thigh 1500;
55 
56  values
57  <m> <n>
58  (
59  (..........)
60  .
61  .
62  .
63  (..........)
64  );
65  }
66  }
67  \endverbatim
68 
69 SourceFiles
70  rhoTabulatedI.H
71  rhoTabulated.C
72 
73 See also
74  Foam::Function1s::NonUniformTable
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef rhoTabulated_H
79 #define rhoTabulated_H
80 
81 #include "UniformTable2.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 // Forward declaration of friend functions and operators
89 
90 template<class Specie>
91 class rhoTabulated;
92 
93 template<class Specie>
94 inline rhoTabulated<Specie> operator+
95 (
96  const rhoTabulated<Specie>&,
97  const rhoTabulated<Specie>&
98 );
99 
100 template<class Specie>
101 inline rhoTabulated<Specie> operator*
102 (
103  const scalar,
104  const rhoTabulated<Specie>&
105 );
106 
107 template<class Specie>
108 inline rhoTabulated<Specie> operator==
109 (
110  const rhoTabulated<Specie>&,
111  const rhoTabulated<Specie>&
112 );
113 
114 template<class Specie>
115 Ostream& operator<<
116 (
117  Ostream&,
118  const rhoTabulated<Specie>&
119 );
120 
121 
122 /*---------------------------------------------------------------------------*\
123  Class rhoTabulated Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 template<class Specie>
127 class rhoTabulated
128 :
129  public Specie
130 {
131  // Private Typedefs
132 
133  //- Table type
135 
136 
137  // Private Data
138 
139  //- Density table [kg/m^3]
140  table2D rho_;
141 
142 
143 public:
144 
145  // Constructors
146 
147  //- Construct from components
148  inline rhoTabulated
149  (
150  const Specie& sp,
151  const table2D& rho
152  );
153 
154  //- Construct from name and dictionary
155  rhoTabulated(const word& name, const dictionary& dict);
156 
157  //- Construct as named copy
158  inline rhoTabulated(const word& name, const rhoTabulated&);
159 
160  //- Construct and return a clone
161  inline autoPtr<rhoTabulated> clone() const;
162 
163 
164  // Member Functions
165 
166  //- Return the instantiated type name
167  static word typeName()
168  {
169  return "rhoTabulated<" + word(Specie::typeName_()) + '>';
170  }
171 
172 
173  // Fundamental properties
174 
175  //- Is the equation of state is incompressible i.e. rho != f(p)
176  static const bool incompressible = false;
177 
178  //- Is the equation of state is isochoric i.e. rho = const
179  static const bool isochoric = false;
180 
181  //- Return density [kg/m^3]
182  inline scalar rho(scalar p, scalar T) const;
183 
184  //- Return enthalpy contribution [J/kg]
185  // Not implemented
186  inline scalar H(const scalar p, const scalar T) const;
187 
188  //- Return Cp contribution [J/(kg K]
189  // Not implemented
190  inline scalar Cp(scalar p, scalar T) const;
191 
192  //- Return internal energy contribution [J/kg]
193  // Not implemented
194  inline scalar E(const scalar p, const scalar T) const;
195 
196  //- Return Cv contribution [J/(kg K]
197  // Not implemented
198  inline scalar Cv(scalar p, scalar T) const;
199 
200  //- Return entropy contribution to the integral of Cp/T [J/kg/K]
201  // Not implemented
202  inline scalar Sp(const scalar p, const scalar T) const;
203 
204  //- Return entropy contribution to the integral of Cv/T [J/kg/K]
205  // Not implemented
206  inline scalar Sv(const scalar p, const scalar T) const;
207 
208  //- Return compressibility [s^2/m^2]
209  inline scalar psi(scalar p, scalar T) const;
210 
211  //- Return compression factor []
212  inline scalar Z(scalar p, scalar T) const;
213 
214  //- Return (Cp - Cv) [J/(kg K]
215  // Not implemented
216  inline scalar CpMCv(scalar p, scalar T) const;
217 
218  //- Return volumetric coefficient of thermal expansion [1/T]
219  inline scalar alphav(const scalar p, const scalar T) const;
220 
221 
222  // IO
223 
224  //- Write to Ostream
225  void write(Ostream& os) const;
226 
227 
228  // Member Operators
229 
230  inline void operator+=(const rhoTabulated&);
231  inline void operator*=(const scalar);
232 
233 
234  // Friend operators
235 
236  friend rhoTabulated operator+ <Specie>
237  (
238  const rhoTabulated&,
239  const rhoTabulated&
240  );
241 
242  friend rhoTabulated operator* <Specie>
243  (
244  const scalar s,
245  const rhoTabulated&
246  );
247 
248  friend rhoTabulated operator== <Specie>
249  (
250  const rhoTabulated&,
251  const rhoTabulated&
252  );
253 
254 
255  // Ostream Operator
256 
257  friend Ostream& operator<< <Specie>
258  (
259  Ostream&,
260  const rhoTabulated&
261  );
262 };
263 
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 } // End namespace Foam
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 #include "rhoTabulatedI.H"
272 
273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 
275 #ifdef NoRepository
276  #include "rhoTabulated.C"
277 #endif
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 #endif
282 
283 // ************************************************************************* //
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 uniform tabulated density vs pressure and temperature.
Definition: rhoTabulated.H:135
scalar Cv(scalar p, scalar T) const
Return Cv contribution [J/(kg K].
void operator+=(const rhoTabulated &)
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].
rhoTabulated(const Specie &sp, const table2D &rho)
Construct from components.
Definition: rhoTabulatedI.H:32
scalar H(const scalar p, const scalar T) const
Return enthalpy contribution [J/kg].
Definition: rhoTabulatedI.H:80
scalar alphav(const scalar p, const scalar T) const
Return volumetric coefficient of thermal expansion [1/T].
static word typeName()
Return the instantiated type name.
Definition: rhoTabulated.H:172
void write(Ostream &os) const
Write to Ostream.
Definition: rhoTabulated.C:46
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: rhoTabulatedI.H:69
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
autoPtr< rhoTabulated > clone() const
Construct and return a clone.
Definition: rhoTabulatedI.H:56
scalar Cp(scalar p, scalar T) const
Return Cp contribution [J/(kg K].
Definition: rhoTabulatedI.H:92
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: rhoTabulated.H:184
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: rhoTabulated.H:181
scalar Z(scalar p, scalar T) const
Return compression factor [].
void operator*=(const scalar)
A class for handling words, derived from string.
Definition: word.H:62
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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