thermophysicalPropertiesSelector.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-2020 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::thermophysicalPropertiesSelector
26 
27 Description
28  Wrapper class providing run-time selection of thermophysicalProperties
29  for the templated thermodynamics packages.
30 
31 SourceFiles
32  thermophysicalPropertiesSelectorI.H
33  thermophysicalPropertiesSelector.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef thermophysicalPropertiesSelector_H
38 #define thermophysicalPropertiesSelector_H
39 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class thermophysicalPropertiesSelector Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class ThermophysicalProperties>
53 {
54  // Private member data
55 
56  autoPtr<ThermophysicalProperties> propertiesPtr_;
57 
58 
59 public:
60 
61  // Constructors
62 
63  //- Construct from name
65 
66  //- Construct from dictionary
68 
69 
70  // Static data
71 
72  //- Is the equation of state is incompressible i.e. rho != f(p)
73  static const bool incompressible =
74  ThermophysicalProperties::incompressible;
75 
76  //- Is the equation of state is isochoric i.e. rho = const
77  static const bool isochoric =
78  ThermophysicalProperties::isochoric;
79 
80 
81  // Member Functions
82 
83  //- Return the instantiated type name
84  static word typeName()
85  {
86  return
87  "thermophysicalPropertiesSelector<"
88  + ThermophysicalProperties::typeName
89  + '>';
90  }
91 
92  //- Return reference to the selected physical properties class
93  inline const ThermophysicalProperties& properties() const;
94 
95 
96  // Physical constants which define the specie
97 
98  //- Molecular weight [kg/kmol]
99  inline scalar W() const;
100 
101  //- Limit the temperature to be in the range Tlow_ to Thigh_
102  inline scalar limit(const scalar T) const;
103 
104 
105  // Fundamental equation of state properties
106 
107  //- Liquid density [kg/m^3]
108  inline scalar rho(scalar p, scalar T) const;
109 
110  //- Liquid compressibility [s^2/m^2]
111  // Note: currently it is assumed the liquid is incompressible
112  inline scalar psi(scalar p, scalar T) const;
113 
114  //- Return (Cp - Cv) [J/kg/K]
115  // Note: currently it is assumed the liquid is incompressible
116  // so CpMCv 0
117  inline scalar CpMCv(scalar p, scalar T) const;
118 
119 
120  // Fundamental thermodynamic properties
121 
122  //- Heat capacity at constant pressure [J/kg/K]
123  inline scalar Cp(const scalar p, const scalar T) const;
124 
125  //- Sensible enthalpy [J/kg]
126  inline scalar Hs(const scalar p, const scalar T) const;
127 
128  //- Enthalpy of formation [J/kg]
129  inline scalar Hf() const;
130 
131  //- Absolute enthalpy [J/kg]
132  inline scalar Ha(const scalar p, const scalar T) const;
133 
134  //- Heat capacity at constant volume [J/kg/K]
135  inline scalar Cv(const scalar p, const scalar T) const;
136 
137  //- Sensible internal energy [J/kg]
138  inline scalar Es(const scalar p, const scalar T) const;
139 
140  //- Absolute internal energy [J/kg]
141  inline scalar Ea(const scalar p, const scalar T) const;
142 
143  // Entropy [J/kg/K]
144  inline scalar S(const scalar p, const scalar T) const;
145 
146 
147  // I-O
148 
149  //- Write to Ostream
150  void write(Ostream& os) const;
151 
152 
153  // Physical properties
154 
155  //- Liquid viscosity [Pa s]
156  inline scalar mu(scalar p, scalar T) const;
157 
158  //- Liquid thermal conductivity [W/m/K]
159  inline scalar kappa(scalar p, scalar T) const;
160 
161  //- Liquid thermal diffusivity of enthalpy [kg/m/s]
162  inline scalar alphah(const scalar p, const scalar T) const;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
173 
174 #ifdef NoRepository
176 #endif
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
dictionary dict
scalar kappa(scalar p, scalar T) const
Liquid thermal conductivity [W/m/K].
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/kg/K].
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
thermophysicalPropertiesSelector(const word &name)
Construct from name.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/kg/K].
scalar alphah(const scalar p, const scalar T) const
Liquid thermal diffusivity of enthalpy [kg/m/s].
scalar rho(scalar p, scalar T) const
Liquid density [kg/m^3].
scalar W() const
Molecular weight [kg/kmol].
A class for handling words, derived from string.
Definition: word.H:59
scalar Ha(const scalar p, const scalar T) const
Absolute enthalpy [J/kg].
scalar S(const scalar p, const scalar T) const
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static word typeName()
Return the instantiated type name.
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
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
scalar psi(scalar p, scalar T) const
Liquid compressibility [s^2/m^2].
scalar Hf() const
Enthalpy of formation [J/kg].
const ThermophysicalProperties & properties() const
Return reference to the selected physical properties class.
scalar mu(scalar p, scalar T) const
Liquid viscosity [Pa s].
void write(Ostream &os) const
Write to Ostream.
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/kg/K].
volScalarField & p
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
Namespace for OpenFOAM.
Wrapper class providing run-time selection of thermophysicalProperties for the templated thermodynami...