absoluteInternalEnergy.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::absoluteInternalEnergy
28 
29 Group
30  grpSpecieThermo
31 
32 Description
33  Thermodynamics mapping class to expose the absolute internal energy
34  functions.
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef absoluteInternalEnergy_H
39 #define absoluteInternalEnergy_H
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class absoluteInternalEnergy Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class Thermo>
52 {
53 
54 public:
55 
56  // Constructors
57 
58  //- Construct
60  {}
61 
62 
63  // Member Functions
64 
65  //- Return the instantiated type name
66  static word typeName()
67  {
68  return "absoluteInternalEnergy";
69  }
70 
71  // Fundamental properties
72 
73  static word energyName()
74  {
75  return "ea";
76  }
77 
78  // Heat capacity at constant volume [J/(kg K)]
79  scalar Cpv
80  (
81  const Thermo& thermo,
82  const scalar p,
83  const scalar T
84  ) const
85  {
86  #ifdef __clang__
87  // Using volatile to prevent compiler optimisations leading to
88  // a sigfpe
89  volatile const scalar cv = thermo.Cv(p, T);
90  return cv;
91  #else
92  return thermo.Cv(p, T);
93  #endif
94  }
95 
96  //- Cp/Cv []
97  scalar CpByCpv
98  (
99  const Thermo& thermo,
100  const scalar p,
101  const scalar T
102  ) const
103  {
104  #ifdef __clang__
105  // Using volatile to prevent compiler optimisations leading to
106  // a sigfpe
107  volatile const scalar gamma = thermo.gamma(p, T);
108  return gamma;
109  #else
110  return thermo.gamma(p, T);
111  #endif
112  }
113 
114  // Absolute internal energy [J/kg]
115  scalar HE
116  (
117  const Thermo& thermo,
118  const scalar p,
119  const scalar T
120  ) const
121  {
122  #ifdef __clang__
123  // Using volatile to prevent compiler optimisations leading to
124  // a sigfpe
125  volatile const scalar ea = thermo.Ea(p, T);
126  return ea;
127  #else
128  return thermo.Ea(p, T);
129  #endif
130  }
131 
132  //- Temperature from absolute internal energy
133  // given an initial temperature T0
134  scalar THE
135  (
136  const Thermo& thermo,
137  const scalar e,
138  const scalar p,
139  const scalar T0
140  ) const
141  {
142  #ifdef __clang__
143  // Using volatile to prevent compiler optimisations leading to
144  // a sigfpe
145  volatile const scalar tea = thermo.TEa(e, p, T0);
146  return tea;
147  #else
148  return thermo.TEa(e, p, T0);
149  #endif
150  }
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::absoluteInternalEnergy::absoluteInternalEnergy
absoluteInternalEnergy()
Construct.
Definition: absoluteInternalEnergy.H:58
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::absoluteInternalEnergy::CpByCpv
scalar CpByCpv(const Thermo &thermo, const scalar p, const scalar T) const
Cp/Cv [].
Definition: absoluteInternalEnergy.H:97
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::absoluteInternalEnergy::energyName
static word energyName()
Definition: absoluteInternalEnergy.H:72
Foam::absoluteInternalEnergy::Cpv
scalar Cpv(const Thermo &thermo, const scalar p, const scalar T) const
Definition: absoluteInternalEnergy.H:79
Foam::absoluteInternalEnergy::HE
scalar HE(const Thermo &thermo, const scalar p, const scalar T) const
Definition: absoluteInternalEnergy.H:115
Foam::absoluteInternalEnergy
Thermodynamics mapping class to expose the absolute internal energy functions.
Definition: absoluteInternalEnergy.H:50
Foam::absoluteInternalEnergy::typeName
static word typeName()
Return the instantiated type name.
Definition: absoluteInternalEnergy.H:65
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::absoluteInternalEnergy::THE
scalar THE(const Thermo &thermo, const scalar e, const scalar p, const scalar T0) const
Temperature from absolute internal energy.
Definition: absoluteInternalEnergy.H:134
gamma
const scalar gamma
Definition: EEqn.H:9
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
T0
scalar T0
Definition: createFields.H:22