thermophysicalProperties.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) 2017 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::thermophysicalProperties
29
30Description
31 Base-class for thermophysical properties of solids, liquids and gases
32 providing an interface compatible with the templated thermodynamics
33 packages.
34
35SourceFiles
36 thermophysicalPropertiesI.H
37 thermophysicalProperties.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef thermophysicalProperties_H
42#define thermophysicalProperties_H
43
44#include "dictionary.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52/*---------------------------------------------------------------------------*\
53 Class thermophysicalProperties Declaration
54\*---------------------------------------------------------------------------*/
57{
58 // Private data
59
60 //- Molecular weight [kg/kmol]
61 scalar W_;
62
63
64public:
66 TypeName("thermophysicalProperties");
67
68
69 // Declare run-time constructor selection tables
72 (
73 autoPtr,
75 ,
76 (),
77 ()
78 );
81 (
82 autoPtr,
85 (const dictionary& dict),
86 (dict)
87 );
88
89
90 // Constructors
91
92 //- Construct from molecular weight
94
95 //- Construct from dictionary
97
98
99 // Selectors
100
101 //- Return a pointer to a new thermophysicalProperties created from name
103
104 //- Return a pointer to a new thermophysicalProperties
105 // created from dictionary
107
108
109 //- Destructor
110 virtual ~thermophysicalProperties() = default;
111
112
113 // Member Functions
114
115 // Physical constants which define the specie
116
117 //- Molecular weight [kg/kmol]
118 inline scalar W() const;
119
120 //- Limit temperature to be within the range
121 inline scalar limit(const scalar T) const;
122
123
124 // Fundamental equation of state properties
125
126 //- Liquid density [kg/m^3]
127 virtual scalar rho(scalar p, scalar T) const = 0;
128
129 //- Liquid compressibility rho/p [s^2/m^2]
130 // Note: currently it is assumed the liquid is incompressible
131 virtual scalar psi(scalar p, scalar T) const = 0;
132
133 //- Return (Cp - Cv) [J/(kg K]
134 // Note: currently it is assumed the liquid is incompressible
135 // so CpMCv 0
136 virtual scalar CpMCv(scalar p, scalar T) const = 0;
137
138
139 // Fundamental thermodynamic properties
140
141 //- Heat capacity at constant pressure [J/(kg K)]
142 virtual scalar Cp(const scalar p, const scalar T) const = 0;
143
144 //- Sensible enthalpy [J/kg]
145 virtual scalar Hs(const scalar p, const scalar T) const = 0;
146
147 //- Chemical enthalpy [J/kg]
148 virtual scalar Hc() const = 0;
149
150 //- Absolute Enthalpy [J/kg]
151 virtual scalar Ha(const scalar p, const scalar T) const = 0;
152
153 // Entropy [J/(kg K)]
154 virtual scalar S(const scalar p, const scalar T) const = 0;
155
156
157 // Physical properties
158
159 //- Liquid viscosity [Pa s]
160 virtual scalar mu(scalar p, scalar T) const = 0;
161
162 //- Liquid thermal conductivity [W/(m K)]
163 virtual scalar kappa(scalar p, scalar T) const = 0;
164
165 //- Liquid thermal diffusivity of enthalpy [kg/ms]
166 virtual scalar alphah(const scalar p, const 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 writeData(Ostream& os) const = 0;
176
177 //- Ostream Operator
178 friend Ostream& operator<<
179 (
180 Ostream& os,
182 );
183};
184
185
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:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
scalar limit(const scalar T) const
Limit temperature to be within the range.
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 scalar alphah(const scalar p, const scalar T) const =0
Liquid thermal diffusivity of enthalpy [kg/ms].
TypeName("thermophysicalProperties")
virtual scalar Hc() const =0
Chemical enthalpy [J/kg].
virtual scalar Hs(const scalar p, const scalar T) const =0
Sensible enthalpy [J/kg].
declareRunTimeSelectionTable(autoPtr, thermophysicalProperties, dictionary,(const dictionary &dict),(dict))
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.
virtual void writeData(Ostream &os) const =0
Write the function coefficients.
virtual ~thermophysicalProperties()=default
Destructor.
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 Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & psi
const volScalarField & T
const volScalarField & mu
const volScalarField & Cp
Definition: EEqn.H:7
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73