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 ThermophysicalProperties::typeName;
102  }
103 
104 
105  // Access
106 
107  //- Return the specie name
108  inline const word& name() const;
109 
110  //- Return the physical properties model
111  inline const ThermophysicalProperties& properties() const;
112 
113 
114  // Physical constants which define the specie
115 
116  //- Molecular weight [kg/kmol]
117  inline scalar W() const;
118 
119  //- Limit the temperature to be in the range Tlow_ to Thigh_
120  inline scalar limit(const scalar T) const;
121 
122 
123  // Fundamental equation of state properties
124 
125  //- Density [kg/m^3]
126  inline scalar rho(scalar p, scalar T) const;
127 
128  //- Compressibility [s^2/m^2]
129  inline scalar psi(scalar p, scalar T) const;
130 
131  //- Return (Cp - Cv) [J/kg/K]
132  inline scalar CpMCv(scalar p, scalar T) const;
133 
134 
135  // Fundamental thermodynamic properties
136 
137  //- Heat capacity at constant pressure [J/kg/K]
138  inline scalar Cp(const scalar p, const scalar T) const;
139 
140  //- Sensible enthalpy [J/kg]
141  inline scalar hs(const scalar p, const scalar T) const;
142 
143  //- Enthalpy of formation [J/kg]
144  inline scalar hf() const;
145 
146  //- Absolute enthalpy [J/kg]
147  inline scalar ha(const scalar p, const scalar T) const;
148 
149  //- Heat capacity at constant volume [J/kg/K]
150  inline scalar Cv(const scalar p, const scalar T) const;
151 
152  //- Sensible internal energy [J/kg]
153  inline scalar es(const scalar p, const scalar T) const;
154 
155  //- Absolute internal energy [J/kg]
156  inline scalar ea(const scalar p, const scalar T) const;
157 
158  // Entropy [J/kg/K]
159  inline scalar s(const scalar p, const scalar T) const;
160 
161 
162  // Physical properties
163 
164  //- Thermal conductivity [W/m/K]
165  inline scalar kappa(scalar p, scalar T) const;
166 
167 
168  // I-O
169 
170  //- Write to Ostream
171  void write(Ostream& os) const;
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
182 
183 #ifdef NoRepository
185 #endif
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
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:162
Wrapper class providing run-time selection of thermophysicalProperties for the templated thermodynami...
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
scalar psi(scalar p, scalar T) const
Compressibility [s^2/m^2].
scalar s(const scalar p, const scalar T) const
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].
scalar ea(const scalar p, const scalar T) const
Absolute internal energy [J/kg].
void write(Ostream &os) const
Write to Ostream.
scalar rho(scalar p, scalar T) const
Density [kg/m^3].
scalar kappa(scalar p, scalar T) const
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].
scalar ha(const scalar p, const scalar T) const
Absolute enthalpy [J/kg].
const ThermophysicalProperties & properties() const
Return the physical properties model.
scalar hf() const
Enthalpy of formation [J/kg].
scalar W() const
Molecular weight [kg/kmol].
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
scalar es(const scalar p, const scalar T) const
Sensible internal energy [J/kg].
thermophysicalPropertiesSelector(const word &name)
Construct from name.
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
const word & name() const
Return the specie name.
scalar hs(const scalar p, const scalar T) const
Sensible enthalpy [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