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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::thermophysicalProperties
29 
30 Description
31  Base-class for thermophysical properties of solids, liquids and gases
32  providing an interface compatible with the templated thermodynamics
33  packages.
34 
35 SourceFiles
36  thermophysicalPropertiesI.H
37  thermophysicalProperties.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef thermophysicalProperties_H
42 #define thermophysicalProperties_H
43 
44 #include "dictionary.H"
45 #include "runTimeSelectionTables.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class thermophysicalProperties Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58  // Private data
59 
60  //- Molecular weight [kg/kmol]
61  scalar W_;
62 
63 
64 public:
65 
66  TypeName("thermophysicalProperties");
67 
68 
69  // Declare run-time constructor selection tables
70 
72  (
73  autoPtr,
75  ,
76  (),
77  ()
78  );
79 
81  (
82  autoPtr,
84  dictionary,
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,
181  const thermophysicalProperties& l
182  );
183 };
184 
185 
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::thermophysicalProperties::psi
virtual scalar psi(scalar p, scalar T) const =0
Liquid compressibility rho/p [s^2/m^2].
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::thermophysicalProperties::limit
scalar limit(const scalar T) const
Limit temperature to be within the range.
Definition: thermophysicalPropertiesI.H:30
Foam::thermophysicalProperties::New
static autoPtr< thermophysicalProperties > New(const word &name)
Return a pointer to a new thermophysicalProperties created from name.
Definition: thermophysicalProperties.C:58
Foam::thermophysicalProperties::TypeName
TypeName("thermophysicalProperties")
Foam::thermophysicalProperties::Hc
virtual scalar Hc() const =0
Chemical enthalpy [J/kg].
Foam::thermophysicalProperties::CpMCv
virtual scalar CpMCv(scalar p, scalar T) const =0
Return (Cp - Cv) [J/(kg K].
Foam::thermophysicalProperties::kappa
virtual scalar kappa(scalar p, scalar T) const =0
Liquid thermal conductivity [W/(m K)].
Foam::thermophysicalProperties::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, thermophysicalProperties,,(),())
Foam::thermophysicalProperties::~thermophysicalProperties
virtual ~thermophysicalProperties()=default
Destructor.
Foam::thermophysicalProperties::W
scalar W() const
Molecular weight [kg/kmol].
Definition: thermophysicalPropertiesI.H:36
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::thermophysicalProperties
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
Definition: thermophysicalProperties.H:55
Foam::thermophysicalProperties::thermophysicalProperties
thermophysicalProperties(scalar W)
Construct from molecular weight.
Definition: thermophysicalProperties.C:42
Foam::thermophysicalProperties::alphah
virtual scalar alphah(const scalar p, const scalar T) const =0
Liquid thermal diffusivity of enthalpy [kg/ms].
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::thermophysicalProperties::Cp
virtual scalar Cp(const scalar p, const scalar T) const =0
Heat capacity at constant pressure [J/(kg K)].
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::thermophysicalProperties::writeData
virtual void writeData(Ostream &os) const =0
Write the function coefficients.
Definition: thermophysicalProperties.C:115
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::thermophysicalProperties::mu
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
thermophysicalPropertiesI.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::thermophysicalProperties::readIfPresent
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
Definition: thermophysicalProperties.C:109
Foam::thermophysicalProperties::Ha
virtual scalar Ha(const scalar p, const scalar T) const =0
Absolute Enthalpy [J/kg].
dictionary.H
Foam::thermophysicalProperties::rho
virtual scalar rho(scalar p, scalar T) const =0
Liquid density [kg/m^3].
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::thermophysicalProperties::Hs
virtual scalar Hs(const scalar p, const scalar T) const =0
Sensible enthalpy [J/kg].
Foam::thermophysicalProperties::S
virtual scalar S(const scalar p, const scalar T) const =0