All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-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::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 substance
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  //- Density [kg/m^3]
133  virtual scalar rho(scalar p, scalar T) const = 0;
134 
135  //- Compressibility [s^2/m^2]
136  virtual scalar psi(scalar p, scalar T) const = 0;
137 
138  //- Return (Cp - Cv) [J/(kg K]
139  virtual scalar CpMCv(scalar p, scalar T) const = 0;
140 
141 
142  // Fundamental thermodynamic properties
143 
144  //- Heat capacity at constant pressure [J/kg/K]
145  virtual scalar Cp(const scalar p, const scalar T) const = 0;
146 
147  //- Sensible enthalpy [J/kg]
148  virtual scalar hs(const scalar p, const scalar T) const = 0;
149 
150  //- Enthalpy of formation [J/kg]
151  virtual scalar hf() const = 0;
152 
153  //- Absolute enthalpy [J/kg]
154  virtual scalar ha(const scalar p, const scalar T) const = 0;
155 
156  // Entropy [J/kg/K]
157  virtual scalar s(const scalar p, const scalar T) const = 0;
158 
159 
160  // Physical properties
161 
162  //- Viscosity [Pa s]
163  virtual scalar mu(scalar p, scalar T) const = 0;
164 
165  //- Thermal conductivity [W/m/K]
166  virtual scalar kappa(scalar p, scalar T) const = 0;
167 
168 
169  // I-O
170 
171  //- Read and set the properties present it the given dictionary
172  void readIfPresent(const dictionary& dict);
173 
174  //- Write the function coefficients
175  virtual void write(Ostream& os) const = 0;
176 
177  //- Ostream Operator
178  friend Ostream& operator<<
179  (
180  Ostream& os,
181  const thermophysicalProperties& l
182  );
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
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:162
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 substance.
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
Viscosity [Pa s].
virtual scalar CpMCv(scalar p, scalar T) const =0
Return (Cp - Cv) [J/(kg K].
virtual scalar hf() const =0
Enthalpy of formation [J/kg].
virtual void write(Ostream &os) const =0
Write the function coefficients.
virtual scalar s(const scalar p, const scalar T) const =0
TypeName("thermophysicalProperties")
virtual ~thermophysicalProperties()
Destructor.
virtual scalar psi(scalar p, scalar T) const =0
Compressibility [s^2/m^2].
thermophysicalProperties(scalar W)
Construct from molecular weight.
virtual scalar hs(const scalar p, const scalar T) const =0
Sensible enthalpy [J/kg].
scalar W() const
Molecular weight [kg/kmol].
virtual scalar rho(scalar p, scalar T) const =0
Density [kg/m^3].
static autoPtr< thermophysicalProperties > New(const word &name)
Return a pointer to a new thermophysicalProperties created from name.
declareRunTimeSelectionTable(autoPtr, thermophysicalProperties,,(),())
virtual scalar ha(const scalar p, const scalar T) const =0
Absolute enthalpy [J/kg].
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
virtual scalar kappa(scalar p, scalar T) const =0
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 &os, const fvConstraints &constraints)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Macros to ease declaration of run-time selection tables.
dictionary dict
volScalarField & p