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 "IdealGasEoS.h"
36
37using namespace std;
38
39namespace Nektar
40{
41
42std::string IdealGasEoS::className =
44 "IdealGas", IdealGasEoS::create, "Ideal gas equation of state.");
45
47 : EquationOfState(pSession)
48{
49}
50
52 const NekDouble &e)
53{
54 return GetTemperatureKernel(e);
55}
56
57vec_t IdealGasEoS::v_GetTemperature([[maybe_unused]] const vec_t &rho,
58 const vec_t &e)
59{
60 return GetTemperatureKernel(e);
61}
62
64{
65 return GetPressureKernel(rho, e);
66}
67
69{
70 return GetPressureKernel(rho, e);
71}
72
74{
75 NekDouble T = GetTemperature(rho, e);
76 return sqrt(m_gamma * m_gasConstant * T);
77}
78
80{
81 NekDouble T = GetTemperature(rho, e);
82 return m_gasConstant / (m_gamma - 1) * log(T) - m_gasConstant * log(rho);
83}
84
86 const NekDouble &e)
87{
88 return e * (m_gamma - 1);
89}
90
92 [[maybe_unused]] const NekDouble &e)
93{
94 return rho * (m_gamma - 1);
95}
96
98{
99 return p / (rho * (m_gamma - 1));
100}
101
103{
104 return p / (m_gasConstant * T);
105}
106
107} // namespace Nektar
Encapsulates equations of state allowing us to obtain thermodynamic properties: most relations are in...
NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e)
Calculate the temperature.
static EquationOfStateSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Creates an instance of this class.
Definition: IdealGasEoS.h:53
static std::string className
Name of the class.
Definition: IdealGasEoS.h:62
NekDouble v_GetEFromRhoP(const NekDouble &rho, const NekDouble &p) final
Definition: IdealGasEoS.cpp:97
NekDouble v_GetRhoFromPT(const NekDouble &rho, const NekDouble &p) final
NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:73
NekDouble v_GetDPDe_rho(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:91
IdealGasEoS(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: IdealGasEoS.cpp:46
T GetPressureKernel(const T &rho, const T &e)
Definition: IdealGasEoS.h:102
NekDouble v_GetDPDrho_e(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:85
NekDouble v_GetPressure(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:63
NekDouble v_GetEntropy(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:79
NekDouble v_GetTemperature(const NekDouble &rho, const NekDouble &e) final
Definition: IdealGasEoS.cpp:51
T GetTemperatureKernel(const T &e)
Definition: IdealGasEoS.h:94
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:197
std::shared_ptr< SessionReader > SessionReaderSharedPtr
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:303
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294