thermophysicalProperties.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) 2017-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::thermophysicalProperties
26 
27 Description
28  Base-class for thermophysical properties of solids, liquids and gases
29  providing an interface compatible with the templated thermodynamics
30  packages.
31 
32 SourceFiles
33  thermophysicalPropertiesI.H
34  thermophysicalProperties.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef thermophysicalProperties_H
39 #define thermophysicalProperties_H
40 
41 #include "dictionary.H"
42 #include "runTimeSelectionTables.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of friend functions and operators
50 class thermophysicalProperties;
51 Ostream& operator<<(Ostream& os, const thermophysicalProperties& l);
52 
53 /*---------------------------------------------------------------------------*\
54  Class thermophysicalProperties Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 {
59  // Private Data
60 
61  //- Molecular weight [kg/kmol]
62  scalar W_;
63 
64 
65 public:
66 
67  TypeName("thermophysicalProperties");
68 
69 
70  // Declare run-time constructor selection tables
71 
73  (
74  autoPtr,
76  ,
77  (),
78  ()
79  );
80 
82  (
83  autoPtr,
85  dictionary,
86  (const dictionary& dict),
87  (dict)
88  );
89 
90 
91  // Constructors
92 
93  //- Construct from molecular weight
95 
96  //- Construct from dictionary
98 
99 
100  // Selectors
101 
102  //- Return a pointer to a new thermophysicalProperties created from name
104 
105  //- Return a pointer to a new thermophysicalProperties
106  // created from dictionary
108 
109 
110  //- Destructor
111  virtual ~thermophysicalProperties()
112  {}
113 
114 
115  // Member Functions
116 
117  // Physical constants which define the specie
118 
119  //- Molecular weight [kg/kmol]
120  inline scalar W() const;
121 
122  //- Limit the temperature to be in the range Tlow_ to Thigh_
123  inline scalar limit(const scalar T) const;
124 
125 
126  // Fundamental equation of state properties
127 
128  //- Liquid density [kg/m^3]
129  virtual scalar rho(scalar p, scalar T) const = 0;
130 
131  //- Liquid compressibility [s^2/m^2]
132  // Note: currently it is assumed the liquid is incompressible
133  virtual scalar psi(scalar p, scalar T) const = 0;
134 
135  //- Return (Cp - Cv) [J/(kg K]
136  // Note: currently it is assumed the liquid is incompressible
137  // so CpMCv 0
138  virtual scalar CpMCv(scalar p, scalar T) const = 0;
139 
140 
141  // Fundamental thermodynamic properties
142 
143  //- Heat capacity at constant pressure [J/kg/K]
144  virtual scalar Cp(const scalar p, const scalar T) const = 0;
145 
146  //- Sensible enthalpy [J/kg]
147  virtual scalar Hs(const scalar p, const scalar T) const = 0;
148 
149  //- Enthalpy of formation [J/kg]
150  virtual scalar Hf() const = 0;
151 
152  //- Absolute enthalpy [J/kg]
153  virtual scalar Ha(const scalar p, const scalar T) const = 0;
154 
155  // Entropy [J/kg/K]
156  virtual scalar S(const scalar p, const scalar T) const = 0;
157 
158 
159  // Physical properties
160 
161  //- Liquid viscosity [Pa s]
162  virtual scalar mu(scalar p, scalar T) const = 0;
163 
164  //- Liquid thermal conductivity [W/m/K]
165  virtual scalar kappa(scalar p, scalar T) const = 0;
166 
167  //- Liquid thermal diffusivity of enthalpy [kg/m/s]
168  virtual scalar alphah(const scalar p, const scalar T) const = 0;
169 
170 
171  // I-O
172 
173  //- Read and set the properties present it the given dictionary
174  void readIfPresent(const dictionary& dict);
175 
176  //- Write the function coefficients
177  virtual void write(Ostream& os) const = 0;
178 
179  //- Ostream Operator
180  friend Ostream& operator<<
181  (
182  Ostream& os,
183  const thermophysicalProperties& l
184  );
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
virtual scalar Hf() const =0
Enthalpy of formation [J/kg].
TypeName("thermophysicalProperties")
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
dictionary dict
virtual scalar rho(scalar p, scalar T) const =0
Liquid density [kg/m^3].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual scalar CpMCv(scalar p, scalar T) const =0
Return (Cp - Cv) [J/(kg K].
virtual scalar kappa(scalar p, scalar T) const =0
Liquid thermal conductivity [W/m/K].
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
virtual scalar psi(scalar p, scalar T) const =0
Liquid compressibility [s^2/m^2].
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
static autoPtr< thermophysicalProperties > New(const word &name)
Return a pointer to a new thermophysicalProperties created from name.
A class for handling words, derived from string.
Definition: word.H:59
scalar W() const
Molecular weight [kg/kmol].
virtual scalar alphah(const scalar p, const scalar T) const =0
Liquid thermal diffusivity of enthalpy [kg/m/s].
virtual scalar Cp(const scalar p, const scalar T) const =0
Heat capacity at constant pressure [J/kg/K].
virtual ~thermophysicalProperties()
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual scalar Ha(const scalar p, const scalar T) const =0
Absolute enthalpy [J/kg].
virtual scalar S(const scalar p, const scalar T) const =0
virtual void write(Ostream &os) const =0
Write the function coefficients.
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
Ostream & operator<<(Ostream &, const ensightPart &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
volScalarField & p
virtual scalar Hs(const scalar p, const scalar T) const =0
Sensible enthalpy [J/kg].
declareRunTimeSelectionTable(autoPtr, thermophysicalProperties,,(),())
thermophysicalProperties(scalar W)
Construct from molecular weight.
Namespace for OpenFOAM.