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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::absoluteEnthalpy
28 
29 Group
30  grpSpecieThermo
31 
32 Description
33  Thermodynamics mapping class to expose the absolute enthalpy functions.
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef absoluteEnthalpy_H
38 #define absoluteEnthalpy_H
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class absoluteEnthalpy Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class Thermo>
50 class absoluteEnthalpy
51 {
52 
53 public:
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
71 
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 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::absoluteEnthalpy
Thermodynamics mapping class to expose the absolute enthalpy functions.
Definition: absoluteEnthalpy.H:49
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::absoluteEnthalpy::typeName
static word typeName()
Return the instantiated type name.
Definition: absoluteEnthalpy.H:64
Foam::constant::universal::h
const dimensionedScalar h
Planck constant.
Definition: setRegionSolidFields.H:33
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::absoluteEnthalpy::energyName
static word energyName()
Definition: absoluteEnthalpy.H:71
Foam::absoluteEnthalpy::Cpv
scalar Cpv(const Thermo &thermo, const scalar p, const scalar T) const
Definition: absoluteEnthalpy.H:78
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cp
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition: MSwindows.C:802
Foam::absoluteEnthalpy::absoluteEnthalpy
absoluteEnthalpy()
Construct.
Definition: absoluteEnthalpy.H:57
Foam::absoluteEnthalpy::CpByCpv
scalar CpByCpv(const Thermo &thermo, const scalar p, const scalar T) const
Cp/Cp [].
Definition: absoluteEnthalpy.H:96
T0
scalar T0
Definition: createFields.H:22
Foam::absoluteEnthalpy::THE
scalar THE(const Thermo &thermo, const scalar h, const scalar p, const scalar T0) const
Temperature from absolute enthalpy.
Definition: absoluteEnthalpy.H:126
Foam::absoluteEnthalpy::HE
scalar HE(const Thermo &thermo, const scalar p, const scalar T) const
Definition: absoluteEnthalpy.H:107