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-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::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  //- Return the name of the liquid
118  virtual const word& name() const = 0;
119 
120 
121  // Physical constants which define the specie
122 
123  //- Molecular weight [kg/kmol]
124  inline scalar W() const;
125 
126  //- Limit the temperature to be in the range Tlow_ to Thigh_
127  inline scalar limit(const scalar T) const;
128 
129 
130  // Fundamental equation of state properties
131 
132  //- Liquid density [kg/m^3]
133  virtual scalar rho(scalar p, scalar T) const = 0;
134 
135  //- Liquid compressibility [s^2/m^2]
136  // Note: currently it is assumed the liquid is incompressible
137  virtual scalar psi(scalar p, scalar T) const = 0;
138 
139  //- Return (Cp - Cv) [J/(kg K]
140  // Note: currently it is assumed the liquid is incompressible
141  // so CpMCv 0
142  virtual scalar CpMCv(scalar p, scalar T) const = 0;
143 
144 
145  // Fundamental thermodynamic properties
146 
147  //- Heat capacity at constant pressure [J/kg/K]
148  virtual scalar Cp(const scalar p, const scalar T) const = 0;
149 
150  //- Sensible enthalpy [J/kg]
151  virtual scalar Hs(const scalar p, const scalar T) const = 0;
152 
153  //- Enthalpy of formation [J/kg]
154  virtual scalar Hf() const = 0;
155 
156  //- Absolute enthalpy [J/kg]
157  virtual scalar Ha(const scalar p, const scalar T) const = 0;
158 
159  // Entropy [J/kg/K]
160  virtual scalar S(const scalar p, const scalar T) const = 0;
161 
162 
163  // Physical properties
164 
165  //- Liquid viscosity [Pa s]
166  virtual scalar mu(scalar p, scalar T) const = 0;
167 
168  //- Liquid thermal conductivity [W/m/K]
169  virtual scalar kappa(scalar p, scalar T) const = 0;
170 
171 
172  // I-O
173 
174  //- Read and set the properties present it the given dictionary
175  void readIfPresent(const dictionary& dict);
176 
177  //- Write the function coefficients
178  virtual void write(Ostream& os) const = 0;
179 
180  //- Ostream Operator
181  friend Ostream& operator<<
182  (
183  Ostream& os,
184  const thermophysicalProperties& l
185  );
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
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
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
virtual const word & name() const =0
Return the name of the liquid.
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
virtual scalar Ha(const scalar p, const scalar T) const =0
Absolute enthalpy [J/kg].
virtual scalar CpMCv(scalar p, scalar T) const =0
Return (Cp - Cv) [J/(kg K].
virtual void write(Ostream &os) const =0
Write the function coefficients.
TypeName("thermophysicalProperties")
virtual scalar Hs(const scalar p, const scalar T) const =0
Sensible enthalpy [J/kg].
virtual ~thermophysicalProperties()
Destructor.
virtual scalar Hf() const =0
Enthalpy of formation [J/kg].
virtual scalar psi(scalar p, scalar T) const =0
Liquid compressibility [s^2/m^2].
thermophysicalProperties(scalar W)
Construct from molecular weight.
virtual scalar S(const scalar p, const scalar T) const =0
scalar W() const
Molecular weight [kg/kmol].
virtual scalar rho(scalar p, scalar T) const =0
Liquid density [kg/m^3].
static autoPtr< thermophysicalProperties > New(const word &name)
Return a pointer to a new thermophysicalProperties created from name.
declareRunTimeSelectionTable(autoPtr, thermophysicalProperties,,(),())
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
virtual scalar kappa(scalar p, scalar T) const =0
Liquid thermal conductivity [W/m/K].
virtual scalar Cp(const scalar p, const scalar T) const =0
Heat capacity at constant pressure [J/kg/K].
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const ensightPart &)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Macros to ease declaration of run-time selection tables.
dictionary dict
volScalarField & p