icoTabulated.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::icoTabulated
28 
29 Description
30  Incompressible of equation of state using non-uniform tabulated
31  density vs temperature.
32 
33 Usage
34  \table
35  Property | Description
36  rho | Density vs temperature table
37  \endtable
38 
39  Example of the specification of the equation of state:
40  \verbatim
41  equationOfState
42  {
43  rho
44  (
45  (200 1010)
46  (350 1000)
47  (400 980)
48  );
49  }
50  \endverbatim
51 
52 SourceFiles
53  icoTabulatedI.H
54  icoTabulated.C
55 
56 See also
57  Foam::thermophysicalFunctions::nonUniformTable
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef icoTabulated_H
62 #define icoTabulated_H
63 
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 // Forward Declarations
72 
73 template<class Specie> class icoTabulated;
74 
75 template<class Specie>
76 Ostream& operator<<(Ostream& os, const icoTabulated<Specie>&);
77 
78 
79 /*---------------------------------------------------------------------------*\
80  Class icoTabulated Declaration
81 \*---------------------------------------------------------------------------*/
82 
83 template<class Specie>
84 class icoTabulated
85 :
86  public Specie
87 {
88  // Private Data
89 
90  //- Density table [kg/m^3]
91  nonUniformTable rho_;
92 
93 
94 public:
95 
96  // Constructors
97 
98  //- Construct from components
99  inline icoTabulated
100  (
101  const Specie& sp,
102  const nonUniformTable& rho
103  );
104 
105  //- Construct from dictionary
106  explicit icoTabulated(const dictionary& dict);
107 
108  //- Construct as named copy
109  inline icoTabulated(const word& name, const icoTabulated&);
110 
111  //- Construct and return a clone
112  inline autoPtr<icoTabulated> clone() const;
113 
114  //- Selector from dictionary
115  inline static autoPtr<icoTabulated> New(const dictionary& dict);
116 
117 
118  // Member Functions
119 
120  //- The instantiated type name
121  static word typeName()
122  {
123  return "icoTabulated<" + word(Specie::typeName_()) + '>';
124  }
125 
126 
127  // Fundamental Properties
128 
129  //- Is the equation of state is incompressible i.e. rho != f(p)
130  static const bool incompressible = true;
131 
132  //- Is the equation of state is isochoric i.e. rho = const
133  static const bool isochoric = false;
134 
135  //- Return density [kg/m^3]
136  inline scalar rho(scalar p, scalar T) const;
137 
138  //- Return enthalpy departure [J/kg]
139  inline scalar H(const scalar p, const scalar T) const;
140 
141  //- Return Cp departure [J/(kg K]
142  inline scalar Cp(scalar p, scalar T) const;
143 
144  //- Return internal energy departure [J/kg]
145  inline scalar E(const scalar p, const scalar T) const;
146 
147  //- Return Cv departure [J/(kg K]
148  inline scalar Cv(scalar p, scalar T) const;
149 
150  //- Return entropy departure to the integral of Cp/T [J/kg/K]
151  inline scalar S(const scalar p, const scalar T) const;
152 
153  //- Return compressibility [s^2/m^2]
154  inline scalar psi(scalar p, scalar T) const;
155 
156  //- Return compression factor []
157  inline scalar Z(scalar p, scalar T) const;
158 
159  //- Return (Cp - Cv) [J/(kg K]
160  inline scalar CpMCv(scalar p, scalar T) const;
161 
162 
163  // IO
164 
165  //- Write to Ostream
166  void write(Ostream& os) const;
167 
168 
169  // Ostream Operator
170 
171  friend Ostream& operator<< <Specie>
172  (
173  Ostream&,
174  const icoTabulated&
175  );
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #include "icoTabulatedI.H"
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #ifdef NoRepository
190  #include "icoTabulated.C"
191 #endif
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
Foam::icoTabulated::CpMCv
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
Definition: icoTabulatedI.H:167
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
icoTabulatedI.H
Foam::icoTabulated::rho
scalar rho(scalar p, scalar T) const
Return density [kg/m^3].
Definition: icoTabulatedI.H:79
Foam::icoTabulated::typeName
static word typeName()
The instantiated type name.
Definition: icoTabulated.H:126
Foam::icoTabulated::Z
scalar Z(scalar p, scalar T) const
Return compression factor [].
Definition: icoTabulatedI.H:156
Foam::icoTabulated::icoTabulated
icoTabulated(const Specie &sp, const nonUniformTable &rho)
Construct from components.
Definition: icoTabulatedI.H:35
Foam::icoTabulated::clone
autoPtr< icoTabulated > clone() const
Construct and return a clone.
Definition: icoTabulatedI.H:61
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::icoTabulated::New
static autoPtr< icoTabulated > New(const dictionary &dict)
Selector from dictionary.
Definition: icoTabulatedI.H:69
Foam::icoTabulated::H
scalar H(const scalar p, const scalar T) const
Return enthalpy departure [J/kg].
Definition: icoTabulatedI.H:90
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::icoTabulated::isochoric
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
Definition: icoTabulated.H:138
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::icoTabulated
Incompressible of equation of state using non-uniform tabulated density vs temperature.
Definition: icoTabulated.H:78
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::icoTabulated::Cp
scalar Cp(scalar p, scalar T) const
Return Cp departure [J/(kg K].
Definition: icoTabulatedI.H:101
Foam::icoTabulated::E
scalar E(const scalar p, const scalar T) const
Return internal energy departure [J/kg].
Definition: icoTabulatedI.H:112
nonUniformTableThermophysicalFunction.H
Foam::icoTabulated::incompressible
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
Definition: icoTabulated.H:135
Foam::icoTabulated::psi
scalar psi(scalar p, scalar T) const
Return compressibility [s^2/m^2].
Definition: icoTabulatedI.H:145
Foam::icoTabulated::write
void write(Ostream &os) const
Write to Ostream.
Definition: icoTabulated.C:45
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::icoTabulated::Cv
scalar Cv(scalar p, scalar T) const
Return Cv departure [J/(kg K].
Definition: icoTabulatedI.H:123
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::icoTabulated::S
scalar S(const scalar p, const scalar T) const
Return entropy departure to the integral of Cp/T [J/kg/K].
Definition: icoTabulatedI.H:134
icoTabulated.C