Nektar++
EquationOfState.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: EquationOfState.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Abstract base class for equations of state.
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_MISC_EQUATIONOFSTATE
36#define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_MISC_EQUATIONOFSTATE
37
40
42
43namespace Nektar
44{
45
46// Forward declaration
47class EquationOfState;
48
49/// A shared pointer to an equation of state object
50typedef std::shared_ptr<EquationOfState> EquationOfStateSharedPtr;
51
52/// Declaration of the equation of state factory
53typedef LibUtilities::NekFactory<std::string, EquationOfState,
56
57/// Declaration of the equation of state factory singleton
59
61
62/**
63 * @class EquationOfState
64 * @brief Encapsulates equations of state allowing us to obtain thermodynamic
65 * properties: most relations are in the form X(rho,e)
66 */
68{
69public:
70 virtual ~EquationOfState() = default;
71
72 /// Calculate the temperature
74 {
75 return v_GetTemperature(rho, e);
76 }
77
78 vec_t GetTemperature(const vec_t &rho, const vec_t &e)
79 {
80 return v_GetTemperature(rho, e);
81 }
82
83 /// Calculate the pressure
85 {
86 return v_GetPressure(rho, e);
87 }
88
89 vec_t GetPressure(const vec_t &rho, const vec_t &e)
90 {
91 return v_GetPressure(rho, e);
92 }
93
94 /// Calculate the sound speed
96 {
97 return v_GetSoundSpeed(rho, e);
98 }
99
100 /// Calculate the entropy
102 {
103 return v_GetEntropy(rho, e);
104 }
105
106 /// Calculate the partial derivative of P(rho,e) with respect to rho
108 {
109 return v_GetDPDrho_e(rho, e);
110 }
111
112 /// Calculate the partial derivative of P(rho,e) with respect to e
114 {
115 return v_GetDPDe_rho(rho, e);
116 }
117
118 /// Obtain the internal energy from rho and P
120 {
121 return v_GetEFromRhoP(rho, p);
122 }
123
124 /// Obtain the density from P and T
126 {
127 return v_GetRhoFromPT(p, T);
128 }
129
130protected:
135
136 /// Constructor
138
139 /// Programmatic Constructor
140 EquationOfState(const NekDouble &gamma, const NekDouble &gasConstant);
141
143 const NekDouble &e) = 0;
144
145 virtual vec_t v_GetTemperature(const vec_t &rho, const vec_t &e) = 0;
146
148 const NekDouble &e) = 0;
149
150 virtual vec_t v_GetPressure(const vec_t &rho, const vec_t &e) = 0;
151
152 virtual NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e);
153
154 virtual NekDouble v_GetEntropy(const NekDouble &rho,
155 const NekDouble &e) = 0;
156
158 const NekDouble &e) = 0;
159
161 const NekDouble &e) = 0;
162
164 const NekDouble &p) = 0;
165
167 const NekDouble &p) = 0;
168};
169} // namespace Nektar
170
171#endif
Encapsulates equations of state allowing us to obtain thermodynamic properties: most relations are in...
NekDouble GetEntropy(const NekDouble &rho, const NekDouble &e)
Calculate the entropy.
virtual NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e)
NekDouble GetPressure(const NekDouble &rho, const NekDouble &e)
Calculate the pressure.
vec_t GetPressure(const vec_t &rho, const vec_t &e)
virtual NekDouble v_GetEFromRhoP(const NekDouble &rho, const NekDouble &p)=0
virtual NekDouble v_GetDPDe_rho(const NekDouble &rho, const NekDouble &e)=0
NekDouble GetRhoFromPT(const NekDouble &p, const NekDouble &T)
Obtain the density from P and T.
vec_t GetTemperature(const vec_t &rho, const vec_t &e)
EquationOfState(const LibUtilities::SessionReaderSharedPtr &pSession)
Constructor.
virtual NekDouble v_GetDPDrho_e(const NekDouble &rho, const NekDouble &e)=0
NekDouble GetDPDrho_e(const NekDouble &rho, const NekDouble &e)
Calculate the partial derivative of P(rho,e) with respect to rho.
virtual ~EquationOfState()=default
NekDouble GetSoundSpeed(const NekDouble &rho, const NekDouble &e)
Calculate the sound speed.
NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e)
Calculate the temperature.
virtual vec_t v_GetTemperature(const vec_t &rho, const vec_t &e)=0
virtual NekDouble v_GetRhoFromPT(const NekDouble &rho, const NekDouble &p)=0
NekDouble GetDPDe_rho(const NekDouble &rho, const NekDouble &e)
Calculate the partial derivative of P(rho,e) with respect to e.
virtual vec_t v_GetPressure(const vec_t &rho, const vec_t &e)=0
NekDouble GetEFromRhoP(const NekDouble &rho, const NekDouble &p)
Obtain the internal energy from rho and P.
virtual NekDouble v_GetTemperature(const NekDouble &rho, const NekDouble &e)=0
virtual NekDouble v_GetEntropy(const NekDouble &rho, const NekDouble &e)=0
virtual NekDouble v_GetPressure(const NekDouble &rho, const NekDouble &e)=0
Provides a generic Factory class.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
EquationOfStateFactory & GetEquationOfStateFactory()
Declaration of the equation of state factory singleton.
LibUtilities::NekFactory< std::string, EquationOfState, const LibUtilities::SessionReaderSharedPtr & > EquationOfStateFactory
Declaration of the equation of state factory.
std::shared_ptr< EquationOfState > EquationOfStateSharedPtr
A shared pointer to an equation of state object.
tinysimd::simd< NekDouble > vec_t
double NekDouble
typename abi< ScalarType, width >::type simd
Definition: tinysimd.hpp:80