Nektar++
IdealGasEoS.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: IdealGasEoS.cpp
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: Ideal gas equation of state
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <boost/core/ignore_unused.hpp>
36 
37 #include "IdealGasEoS.h"
38 
39 using namespace std;
40 
41 namespace Nektar
42 {
43 
44 std::string IdealGasEoS::className = GetEquationOfStateFactory().
45  RegisterCreatorFunction("IdealGas",
46  IdealGasEoS::create,
47  "Ideal gas equation of state.");
48 
49 IdealGasEoS::IdealGasEoS(const LibUtilities::SessionReaderSharedPtr& pSession)
50  : EquationOfState(pSession)
51 {
52 
53 }
54 
56  const NekDouble &rho, const NekDouble &e)
57 {
58  boost::ignore_unused(rho);
59  return GetTemperatureKernel(e);
60 }
61 
63  const vec_t &rho, const vec_t &e)
64 {
65  boost::ignore_unused(rho);
66  return GetTemperatureKernel(e);
67 }
68 
70  const NekDouble &rho, const NekDouble &e)
71 {
72  return GetPressureKernel(rho, e);
73 }
74 
76  const vec_t &rho, const vec_t &e)
77 {
78  return GetPressureKernel(rho, e);
79 }
80 
82  const NekDouble &rho, const NekDouble &e)
83 {
84  NekDouble T = GetTemperature(rho,e);
85  return sqrt(m_gamma * m_gasConstant * T);
86 }
87 
89  const NekDouble &rho, const NekDouble &e)
90 {
91  NekDouble T = GetTemperature(rho,e);
92  return m_gasConstant/(m_gamma-1) * log(T) - m_gasConstant * log(rho);
93 }
94 
96  const NekDouble &rho, const NekDouble &e)
97 {
98  boost::ignore_unused(rho);
99  return e*(m_gamma-1);
100 }
101 
103  const NekDouble &rho, const NekDouble &e)
104 {
105  boost::ignore_unused(e);
106  return rho*(m_gamma-1);
107 }
108 
110  const NekDouble &rho, const NekDouble &p)
111 {
112  return p / (rho * (m_gamma-1));
113 }
114 
116  const NekDouble &p, const NekDouble &T)
117 {
118  return p/(m_gasConstant*T);
119 }
120 
121 }
Encapsulates equations of state allowing us to obtain thermodynamic properties: most relations are in...
NekDouble GetPressure(const NekDouble &rho, const NekDouble &e) final
Calculate the pressure.
Definition: IdealGasEoS.cpp:69
NekDouble v_GetEFromRhoP(const NekDouble &rho, const NekDouble &p) final
NekDouble v_GetRhoFromPT(const NekDouble &rho, const NekDouble &p) final
NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:81
NekDouble v_GetDPDe_rho(const NekDouble &rho, const NekDouble &e) final
T GetPressureKernel(const T &rho, const T &e)
Definition: IdealGasEoS.h:112
NekDouble v_GetDPDrho_e(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:95
NekDouble v_GetEntropy(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:88
T GetTemperatureKernel(const T &e)
Definition: IdealGasEoS.h:101
NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e) final
Calculate the temperature.
Definition: IdealGasEoS.cpp:55
std::shared_ptr< SessionReader > SessionReaderSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
EquationOfStateFactory & GetEquationOfStateFactory()
Declaration of the equation of state factory singleton.
tinysimd::simd< NekDouble > vec_t
double NekDouble
scalarT< T > log(scalarT< T > in)
Definition: scalar.hpp:278
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:267