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-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::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  //- Specie name
57  word name_;
58 
59  //- Properties model
60  autoPtr<ThermophysicalProperties> propertiesPtr_;
61 
62 
63 public:
64 
65  // Constructors
66 
67  //- Construct from name
69 
70  //- Construct from name and dictionary
72  (
73  const word& name,
74  const dictionary& dict
75  );
76 
77  //- Construct as named copy
79  (
80  const word& name,
82  );
83 
84 
85  // Static data
86 
87  //- Is the equation of state is incompressible i.e. rho != f(p)
88  static const bool incompressible =
89  ThermophysicalProperties::incompressible;
90 
91  //- Is the equation of state is isochoric i.e. rho = const
92  static const bool isochoric =
93  ThermophysicalProperties::isochoric;
94 
95 
96  // Member Functions
97 
98  //- Return the instantiated type name
99  static word typeName()
100  {
101  return
102  "thermophysicalPropertiesSelector<"
103  + ThermophysicalProperties::typeName
104  + '>';
105  }
106 
107 
108  // Access
109 
110  //- Return the specie name
111  inline const word& name() const;
112 
113  //- Return the physical properties model
114  inline const ThermophysicalProperties& properties() const;
115 
116 
117  // Physical constants which define the specie
118 
119  //- Molecular weight [kg/kmol]
120  inline scalar W() const;
121 
122  //- Limit the temperature to be in the range Tlow_ to Thigh_
123  inline scalar limit(const scalar T) const;
124 
125 
126  // Fundamental equation of state properties
127 
128  //- Liquid density [kg/m^3]
129  inline scalar rho(scalar p, scalar T) const;
130 
131  //- Liquid compressibility [s^2/m^2]
132  // Note: currently it is assumed the liquid is incompressible
133  inline scalar psi(scalar p, scalar T) const;
134 
135  //- Return (Cp - Cv) [J/kg/K]
136  // Note: currently it is assumed the liquid is incompressible
137  // so CpMCv 0
138  inline scalar CpMCv(scalar p, scalar T) const;
139 
140 
141  // Fundamental thermodynamic properties
142 
143  //- Heat capacity at constant pressure [J/kg/K]
144  inline scalar Cp(const scalar p, const scalar T) const;
145 
146  //- Sensible enthalpy [J/kg]
147  inline scalar Hs(const scalar p, const scalar T) const;
148 
149  //- Enthalpy of formation [J/kg]
150  inline scalar Hf() const;
151 
152  //- Absolute enthalpy [J/kg]
153  inline scalar Ha(const scalar p, const scalar T) const;
154 
155  //- Heat capacity at constant volume [J/kg/K]
156  inline scalar Cv(const scalar p, const scalar T) const;
157 
158  //- Sensible internal energy [J/kg]
159  inline scalar Es(const scalar p, const scalar T) const;
160 
161  //- Absolute internal energy [J/kg]
162  inline scalar Ea(const scalar p, const scalar T) const;
163 
164  // Entropy [J/kg/K]
165  inline scalar S(const scalar p, const scalar T) const;
166 
167 
168  // I-O
169 
170  //- Write to Ostream
171  void write(Ostream& os) const;
172 
173 
174  // Physical properties
175 
176  //- Liquid viscosity [Pa s]
177  inline scalar mu(scalar p, scalar T) const;
178 
179  //- Liquid thermal conductivity [W/m/K]
180  inline scalar kappa(scalar p, scalar T) const;
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
191 
192 #ifdef NoRepository
194 #endif
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Wrapper class providing run-time selection of thermophysicalProperties for the templated thermodynami...
scalar Hf() const
Enthalpy of formation [J/kg].
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
scalar psi(scalar p, scalar T) const
Liquid compressibility [s^2/m^2].
scalar mu(scalar p, scalar T) const
Liquid viscosity [Pa s].
static word typeName()
Return the instantiated type name.
scalar Cp(const scalar p, const scalar T) const
Heat capacity at constant pressure [J/kg/K].
void write(Ostream &os) const
Write to Ostream.
scalar rho(scalar p, scalar T) const
Liquid density [kg/m^3].
scalar S(const scalar p, const scalar T) const
scalar Ha(const scalar p, const scalar T) const
Absolute enthalpy [J/kg].
scalar kappa(scalar p, scalar T) const
Liquid thermal conductivity [W/m/K].
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/kg/K].
scalar Cv(const scalar p, const scalar T) const
Heat capacity at constant volume [J/kg/K].
const ThermophysicalProperties & properties() const
Return the physical properties model.
scalar W() const
Molecular weight [kg/kmol].
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
thermophysicalPropertiesSelector(const word &name)
Construct from name.
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
scalar Es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
const word & name() const
Return the specie name.
scalar Ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & p