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-2021 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 (
82 );
83 
84 
85 /*---------------------------------------------------------------------------*\
86  Class icoTabulated Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 template<class Specie>
90 class icoTabulated
91 :
92  public Specie
93 {
95 
96 
97  // Private Data
98 
99  //- Density table [kg/m^3]
100  nonUniformTable rho_;
101 
102 
103 public:
104 
105  // Constructors
106 
107  //- Construct from components
108  inline icoTabulated
109  (
110  const Specie& sp,
111  const nonUniformTable& rho
112  );
113 
114  //- Construct from dictionary
115  icoTabulated(const dictionary& dict);
116 
117  //- Construct as named copy
118  inline icoTabulated(const word& name, const icoTabulated&);
119 
120  //- Construct and return a clone
121  inline autoPtr<icoTabulated> clone() const;
122 
123  // Selector from dictionary
124  inline static autoPtr<icoTabulated> New(const dictionary& dict);
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 
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 // ************************************************************************* //
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:144
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:135
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:80
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
scalar alphav(const scalar p, const scalar T) const
Return volumetric coefficient of thermal expansion [1/T].
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:147
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.