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-2018 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 /*---------------------------------------------------------------------------*\
50  Class thermophysicalProperties Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 {
55  // Private data
56 
57  //- Molecular weight [kg/kmol]
58  scalar W_;
59 
60 
61 public:
62 
63  TypeName("thermophysicalProperties");
64 
65 
66  // Declare run-time constructor selection tables
67 
69  (
70  autoPtr,
72  ,
73  (),
74  ()
75  );
76 
78  (
79  autoPtr,
81  dictionary,
82  (const dictionary& dict),
83  (dict)
84  );
85 
86 
87  // Constructors
88 
89  //- Construct from molecular weight
91 
92  //- Construct from dictionary
94 
95 
96  // Selectors
97 
98  //- Return a pointer to a new thermophysicalProperties created from name
100 
101  //- Return a pointer to a new thermophysicalProperties
102  // created from dictionary
104 
105 
106  //- Destructor
107  virtual ~thermophysicalProperties()
108  {}
109 
110 
111  // Member Functions
112 
113  // Physical constants which define the specie
114 
115  //- Molecular weight [kg/kmol]
116  inline scalar W() const;
117 
118  //- Limit the temperature to be in the range Tlow_ to Thigh_
119  inline scalar limit(const scalar T) const;
120 
121 
122  // Fundamental equation of state properties
123 
124  //- Liquid density [kg/m^3]
125  virtual scalar rho(scalar p, scalar T) const = 0;
126 
127  //- Liquid compressibility rho/p [s^2/m^2]
128  // Note: currently it is assumed the liquid is incompressible
129  virtual scalar psi(scalar p, scalar T) const = 0;
130 
131  //- Return (Cp - Cv) [J/(kg K]
132  // Note: currently it is assumed the liquid is incompressible
133  // so CpMCv 0
134  virtual scalar CpMCv(scalar p, scalar T) const = 0;
135 
136 
137  // Fundamental thermodynamic properties
138 
139  //- Heat capacity at constant pressure [J/(kg K)]
140  virtual scalar Cp(const scalar p, const scalar T) const = 0;
141 
142  //- Absolute Enthalpy [J/kg]
143  virtual scalar Ha(const scalar p, const scalar T) const = 0;
144 
145  //- Sensible enthalpy [J/kg]
146  virtual scalar Hs(const scalar p, const scalar T) const = 0;
147 
148  //- Chemical enthalpy [J/kg]
149  virtual scalar Hc() const = 0;
150 
151  // Entropy [J/(kg K)]
152  virtual scalar S(const scalar p, const scalar T) const = 0;
153 
154 
155  // Physical properties
156 
157  //- Liquid viscosity [Pa s]
158  virtual scalar mu(scalar p, scalar T) const = 0;
159 
160  //- Liquid thermal conductivity [W/(m K)]
161  virtual scalar kappa(scalar p, scalar T) const = 0;
162 
163  //- Liquid thermal diffusivity of enthalpy [kg/ms]
164  virtual scalar alphah(const scalar p, const scalar T) const = 0;
165 
166 
167  // I-O
168 
169  //- Read and set the properties present it the given dictionary
170  void readIfPresent(const dictionary& dict);
171 
172  //- Write the function coefficients
173  virtual void writeData(Ostream& os) const = 0;
174 
175  //- Write dictionary to Ostream
176  void write(Ostream& os) const;
177 
178  //- Ostream Operator
179  friend Ostream& operator<<
180  (
181  Ostream& os,
182  const thermophysicalProperties& l
183  );
184 };
185 
186 
188 
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 } // End namespace Foam
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #endif
201 
202 // ************************************************************************* //
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:137
void write(Ostream &os) const
Write dictionary to Ostream.
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 rho/p [s^2/m^2].
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
friend Ostream & operator<<(Ostream &os, const thermophysicalProperties &l)
Ostream Operator.
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/ms].
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:53
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 writeData(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
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].
virtual scalar Hc() const =0
Chemical enthalpy [J/kg].
declareRunTimeSelectionTable(autoPtr, thermophysicalProperties,,(),())
thermophysicalProperties(scalar W)
Construct from molecular weight.
Namespace for OpenFOAM.