absoluteEnthalpy.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) 2012-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::absoluteEnthalpy
28
29Group
30 grpSpecieThermo
31
32Description
33 Thermodynamics mapping class to expose the absolute enthalpy functions.
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef absoluteEnthalpy_H
38#define absoluteEnthalpy_H
39
40// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41
42namespace Foam
43{
44
45/*---------------------------------------------------------------------------*\
46 Class absoluteEnthalpy Declaration
47\*---------------------------------------------------------------------------*/
48
49template<class Thermo>
51{
52
53public:
54
55 // Constructors
56
57 //- Construct
59 {}
60
61
62 // Member Functions
63
64 //- Return the instantiated type name
65 static word typeName()
66 {
67 return "absoluteEnthalpy";
68 }
69
70 // Fundamental properties
72 static word energyName()
73 {
74 return "ha";
75 }
76
77 // Heat capacity at constant pressure [J/(kg K)]
78 scalar Cpv
79 (
80 const Thermo& thermo,
81 const scalar p,
82 const scalar T
83 ) const
84 {
85 #ifdef __clang__
86 // Using volatile to prevent compiler optimisations leading to
87 // a sigfpe
88 volatile const scalar cp = thermo.Cp(p, T);
89 return cp;
90 #else
91 return thermo.Cp(p, T);
92 #endif
93 }
94
95 //- Cp/Cp []
96 scalar CpByCpv
97 (
98 const Thermo& thermo,
99 const scalar p,
100 const scalar T
101 ) const
102 {
103 return 1;
104 }
105
106 // Absolute enthalpy [J/kg]
107 scalar HE
108 (
109 const Thermo& thermo,
110 const scalar p,
111 const scalar T
112 ) const
113 {
114 #ifdef __clang__
115 // Using volatile to prevent compiler optimisations leading to
116 // a sigfpe
117 volatile const scalar ha = thermo.Ha(p, T);
118 return ha;
119 #else
120 return thermo.Ha(p, T);
121 #endif
122 }
123
124 //- Temperature from absolute enthalpy
125 // given an initial temperature T0
126 scalar THE
127 (
128 const Thermo& thermo,
129 const scalar h,
130 const scalar p,
131 const scalar T0
132 ) const
133 {
134 #ifdef __clang__
135 // Using volatile to prevent compiler optimisations leading to
136 // a sigfpe
137 volatile const scalar tha = thermo.THa(h, p, T0);
138 return tha;
139 #else
140 return thermo.THa(h, p, T0);
141 #endif
142 }
143};
144
145
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148} // End namespace Foam
149
150// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151
152#endif
153
154// ************************************************************************* //
Thermodynamics mapping class to expose the absolute enthalpy functions.
scalar HE(const Thermo &thermo, const scalar p, const scalar T) const
scalar THE(const Thermo &thermo, const scalar h, const scalar p, const scalar T0) const
Temperature from absolute enthalpy.
static word typeName()
Return the instantiated type name.
scalar Cpv(const Thermo &thermo, const scalar p, const scalar T) const
scalar CpByCpv(const Thermo &thermo, const scalar p, const scalar T) const
Cp/Cp [].
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
const volScalarField & T
Namespace for OpenFOAM.
volScalarField & h
const volScalarField & cp
scalar T0
Definition: createFields.H:22