Nektar++
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Friends | List of all members
Nektar::IdealGasEoS Class Reference

Ideal gas equation of state: p = rho * R * T. More...

#include <IdealGasEoS.h>

Inheritance diagram for Nektar::IdealGasEoS:
[legend]

Static Public Member Functions

static EquationOfStateSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of the class. More...
 

Protected Member Functions

NekDouble v_GetTemperature (const NekDouble &rho, const NekDouble &e) final
 
vec_t v_GetTemperature (const vec_t &rho, const vec_t &e) final
 
NekDouble v_GetPressure (const NekDouble &rho, const NekDouble &e) final
 
vec_t v_GetPressure (const vec_t &rho, const vec_t &e) final
 
NekDouble v_GetSoundSpeed (const NekDouble &rho, const NekDouble &e) final
 
NekDouble v_GetEntropy (const NekDouble &rho, const NekDouble &e) final
 
NekDouble v_GetDPDrho_e (const NekDouble &rho, const NekDouble &e) final
 
NekDouble v_GetDPDe_rho (const NekDouble &rho, const NekDouble &e) final
 
NekDouble v_GetEFromRhoP (const NekDouble &rho, const NekDouble &p) final
 
NekDouble v_GetRhoFromPT (const NekDouble &rho, const NekDouble &p) final
 
- Protected Member Functions inherited from Nektar::EquationOfState
 EquationOfState (const LibUtilities::SessionReaderSharedPtr &pSession)
 Constructor. More...
 
 EquationOfState (const NekDouble &gamma, const NekDouble &gasConstant)
 Programmatic Constructor. More...
 
virtual NekDouble v_GetTemperature (const NekDouble &rho, const NekDouble &e)=0
 
virtual vec_t v_GetTemperature (const vec_t &rho, const vec_t &e)=0
 
virtual NekDouble v_GetPressure (const NekDouble &rho, const NekDouble &e)=0
 
virtual vec_t v_GetPressure (const vec_t &rho, const vec_t &e)=0
 
virtual NekDouble v_GetSoundSpeed (const NekDouble &rho, const NekDouble &e)
 
virtual NekDouble v_GetEntropy (const NekDouble &rho, const NekDouble &e)=0
 
virtual NekDouble v_GetDPDrho_e (const NekDouble &rho, const NekDouble &e)=0
 
virtual NekDouble v_GetDPDe_rho (const NekDouble &rho, const NekDouble &e)=0
 
virtual NekDouble v_GetEFromRhoP (const NekDouble &rho, const NekDouble &p)=0
 
virtual NekDouble v_GetRhoFromPT (const NekDouble &rho, const NekDouble &p)=0
 

Private Member Functions

 IdealGasEoS (const LibUtilities::SessionReaderSharedPtr &pSession)
 
 ~IdealGasEoS (void) override
 
template<class T , typename = typename std::enable_if< std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value>::type>
GetTemperatureKernel (const T &e)
 
template<class T , typename = typename std::enable_if< std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value>::type>
GetPressureKernel (const T &rho, const T &e)
 

Friends

class MemoryManager< IdealGasEoS >
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::EquationOfState
virtual ~EquationOfState ()
 
NekDouble GetTemperature (const NekDouble &rho, const NekDouble &e)
 Calculate the temperature. More...
 
vec_t GetTemperature (const vec_t &rho, const vec_t &e)
 
NekDouble GetPressure (const NekDouble &rho, const NekDouble &e)
 Calculate the pressure. More...
 
vec_t GetPressure (const vec_t &rho, const vec_t &e)
 
NekDouble GetSoundSpeed (const NekDouble &rho, const NekDouble &e)
 Calculate the sound speed. More...
 
NekDouble GetEntropy (const NekDouble &rho, const NekDouble &e)
 Calculate the entropy. More...
 
NekDouble GetDPDrho_e (const NekDouble &rho, const NekDouble &e)
 Calculate the partial derivative of P(rho,e) with respect to rho. More...
 
NekDouble GetDPDe_rho (const NekDouble &rho, const NekDouble &e)
 Calculate the partial derivative of P(rho,e) with respect to e. More...
 
NekDouble GetEFromRhoP (const NekDouble &rho, const NekDouble &p)
 Obtain the internal energy from rho and P. More...
 
NekDouble GetRhoFromPT (const NekDouble &p, const NekDouble &T)
 Obtain the density from P and T. More...
 
- Protected Attributes inherited from Nektar::EquationOfState
NekDouble m_gamma
 
NekDouble m_gasConstant
 
NekDouble m_gammaMone
 
NekDouble m_gammaMoneOgasConst
 

Detailed Description

Ideal gas equation of state: p = rho * R * T.

Definition at line 47 of file IdealGasEoS.h.

Constructor & Destructor Documentation

◆ IdealGasEoS()

Nektar::IdealGasEoS::IdealGasEoS ( const LibUtilities::SessionReaderSharedPtr pSession)
private

Definition at line 46 of file IdealGasEoS.cpp.

47 : EquationOfState(pSession)
48{
49}
EquationOfState(const LibUtilities::SessionReaderSharedPtr &pSession)
Constructor.

◆ ~IdealGasEoS()

Nektar::IdealGasEoS::~IdealGasEoS ( void  )
inlineoverrideprivate

Definition at line 88 of file IdealGasEoS.h.

88{};

Member Function Documentation

◆ create()

static EquationOfStateSharedPtr Nektar::IdealGasEoS::create ( const LibUtilities::SessionReaderSharedPtr pSession)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file IdealGasEoS.h.

55 {
58 return p;
59 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< EquationOfState > EquationOfStateSharedPtr
A shared pointer to an equation of state object.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.

◆ GetPressureKernel()

template<class T , typename = typename std::enable_if< std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value>::type>
T Nektar::IdealGasEoS::GetPressureKernel ( const T &  rho,
const T &  e 
)
inlineprivate

Definition at line 102 of file IdealGasEoS.h.

103 {
104 return rho * e * m_gammaMone;
105 }

References Nektar::EquationOfState::m_gammaMone.

Referenced by v_GetPressure().

◆ GetTemperatureKernel()

template<class T , typename = typename std::enable_if< std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value>::type>
T Nektar::IdealGasEoS::GetTemperatureKernel ( const T &  e)
inlineprivate

Definition at line 94 of file IdealGasEoS.h.

95 {
96 return e * m_gammaMoneOgasConst;
97 }

References Nektar::EquationOfState::m_gammaMoneOgasConst.

Referenced by v_GetTemperature().

◆ v_GetDPDe_rho()

NekDouble Nektar::IdealGasEoS::v_GetDPDe_rho ( const NekDouble rho,
const NekDouble e 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 91 of file IdealGasEoS.cpp.

93{
94 return rho * (m_gamma - 1);
95}

References Nektar::EquationOfState::m_gamma.

◆ v_GetDPDrho_e()

NekDouble Nektar::IdealGasEoS::v_GetDPDrho_e ( const NekDouble rho,
const NekDouble e 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 85 of file IdealGasEoS.cpp.

87{
88 return e * (m_gamma - 1);
89}

References Nektar::EquationOfState::m_gamma.

◆ v_GetEFromRhoP()

NekDouble Nektar::IdealGasEoS::v_GetEFromRhoP ( const NekDouble rho,
const NekDouble p 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 97 of file IdealGasEoS.cpp.

98{
99 return p / (rho * (m_gamma - 1));
100}

References Nektar::EquationOfState::m_gamma, and CellMLToNektar.cellml_metadata::p.

◆ v_GetEntropy()

NekDouble Nektar::IdealGasEoS::v_GetEntropy ( const NekDouble rho,
const NekDouble e 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 79 of file IdealGasEoS.cpp.

80{
81 NekDouble T = GetTemperature(rho, e);
82 return m_gasConstant / (m_gamma - 1) * log(T) - m_gasConstant * log(rho);
83}
NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e)
Calculate the temperature.
double NekDouble
scalarT< T > log(scalarT< T > in)
Definition: scalar.hpp:303

References Nektar::EquationOfState::GetTemperature(), tinysimd::log(), Nektar::EquationOfState::m_gamma, and Nektar::EquationOfState::m_gasConstant.

◆ v_GetPressure() [1/2]

NekDouble Nektar::IdealGasEoS::v_GetPressure ( const NekDouble rho,
const NekDouble e 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 63 of file IdealGasEoS.cpp.

64{
65 return GetPressureKernel(rho, e);
66}
T GetPressureKernel(const T &rho, const T &e)
Definition: IdealGasEoS.h:102

References GetPressureKernel().

◆ v_GetPressure() [2/2]

vec_t Nektar::IdealGasEoS::v_GetPressure ( const vec_t rho,
const vec_t e 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 68 of file IdealGasEoS.cpp.

69{
70 return GetPressureKernel(rho, e);
71}

References GetPressureKernel().

◆ v_GetRhoFromPT()

NekDouble Nektar::IdealGasEoS::v_GetRhoFromPT ( const NekDouble rho,
const NekDouble p 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 102 of file IdealGasEoS.cpp.

103{
104 return p / (m_gasConstant * T);
105}

References Nektar::EquationOfState::m_gasConstant, and CellMLToNektar.cellml_metadata::p.

◆ v_GetSoundSpeed()

NekDouble Nektar::IdealGasEoS::v_GetSoundSpeed ( const NekDouble rho,
const NekDouble e 
)
finalprotectedvirtual

Reimplemented from Nektar::EquationOfState.

Definition at line 73 of file IdealGasEoS.cpp.

74{
75 NekDouble T = GetTemperature(rho, e);
76 return sqrt(m_gamma * m_gasConstant * T);
77}
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294

References Nektar::EquationOfState::GetTemperature(), Nektar::EquationOfState::m_gamma, Nektar::EquationOfState::m_gasConstant, and tinysimd::sqrt().

◆ v_GetTemperature() [1/2]

NekDouble Nektar::IdealGasEoS::v_GetTemperature ( const NekDouble rho,
const NekDouble e 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 51 of file IdealGasEoS.cpp.

53{
54 return GetTemperatureKernel(e);
55}
T GetTemperatureKernel(const T &e)
Definition: IdealGasEoS.h:94

References GetTemperatureKernel().

◆ v_GetTemperature() [2/2]

vec_t Nektar::IdealGasEoS::v_GetTemperature ( const vec_t rho,
const vec_t e 
)
finalprotectedvirtual

Implements Nektar::EquationOfState.

Definition at line 57 of file IdealGasEoS.cpp.

59{
60 return GetTemperatureKernel(e);
61}

References GetTemperatureKernel().

Friends And Related Function Documentation

◆ MemoryManager< IdealGasEoS >

friend class MemoryManager< IdealGasEoS >
friend

Definition at line 1 of file IdealGasEoS.h.

Member Data Documentation

◆ className

std::string Nektar::IdealGasEoS::className
static
Initial value:
=
"IdealGas", IdealGasEoS::create, "Ideal gas equation of state.")
static EquationOfStateSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Creates an instance of this class.
Definition: IdealGasEoS.h:53
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
EquationOfStateFactory & GetEquationOfStateFactory()
Declaration of the equation of state factory singleton.

Name of the class.

Definition at line 62 of file IdealGasEoS.h.