Nektar++
VanDerWaalsEoS.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: VanDerWaalsEoS.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: Van der Waals equation of state
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_MISC_VANDERWAALSEOS
36 #define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_MISC_VANDERWAALSEOS
37 
38 #include "EquationOfState.h"
39 
40 namespace Nektar
41 {
42 
43 /**
44 * @brief van der Waals equation of state:
45  * p = RT/(1/rho - b) - a * rho^2
46  * with a = 27/64 * (R*Tc)^2 / Pc
47  * b = 1/8 * (R*Tc) / Pc
48 */
50 {
51 public:
52  friend class MemoryManager<VanDerWaalsEoS>;
53 
54  /// Creates an instance of this class
57  {
60  return p;
61  }
62 
63  /// Name of the class
64  static std::string className;
65 
66 protected:
69 
70  NekDouble GetTemperature(const NekDouble& rho, const NekDouble& e) final;
71 
72  vec_t GetTemperature(const vec_t& rho, const vec_t& e) final;
73 
74  NekDouble GetPressure(const NekDouble& rho, const NekDouble& e) final;
75 
76  vec_t GetPressure(const vec_t& rho, const vec_t& e) final;
77 
78  NekDouble v_GetEntropy(const NekDouble &rho, const NekDouble &e) final;
79 
80  NekDouble v_GetDPDrho_e(const NekDouble &rho, const NekDouble &e) final;
81 
82  NekDouble v_GetDPDe_rho(const NekDouble &rho, const NekDouble &e) final;
83 
84  NekDouble v_GetEFromRhoP(const NekDouble &rho, const NekDouble &p) final;
85 
86  NekDouble v_GetRhoFromPT(const NekDouble &rho, const NekDouble &p) final;
87 
88 private:
90 
91  ~VanDerWaalsEoS(void){};
92 
93 
94  template <class T, typename = typename std::enable_if
95  <
96  std::is_floating_point<T>::value ||
98  >::type
99  >
100  inline T GetTemperatureKernel(const T& rho, const T& e)
101  {
102  return (e + m_a * rho) * (m_gamma - 1) / m_gasConstant;
103  }
104 
105  template <class T, typename = typename std::enable_if
106  <
107  std::is_floating_point<T>::value ||
109  >::type
110  >
111  inline T GetPressureKernel(const T& rho, const T& e)
112  {
113  return (e + m_a * rho) * (m_gamma - 1) / (1.0 / rho - m_b) -
114  m_a * rho * rho;
115  }
116 
117 };
118 }
119 
120 #endif
Encapsulates equations of state allowing us to obtain thermodynamic properties: most relations are in...
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
van der Waals equation of state: p = RT/(1/rho - b) - a * rho^2 with a = 27/64 * (R*Tc)^2 / Pc b = 1/...
T GetTemperatureKernel(const T &rho, const T &e)
static EquationOfStateSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Creates an instance of this class.
NekDouble v_GetEntropy(const NekDouble &rho, const NekDouble &e) final
T GetPressureKernel(const T &rho, const T &e)
NekDouble v_GetEFromRhoP(const NekDouble &rho, const NekDouble &p) final
VanDerWaalsEoS(const LibUtilities::SessionReaderSharedPtr &pSession)
NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e) final
Calculate the temperature.
NekDouble v_GetDPDe_rho(const NekDouble &rho, const NekDouble &e) final
NekDouble v_GetRhoFromPT(const NekDouble &rho, const NekDouble &p) final
NekDouble v_GetDPDrho_e(const NekDouble &rho, const NekDouble &e) final
NekDouble GetPressure(const NekDouble &rho, const NekDouble &e) final
Calculate the pressure.
static std::string className
Name of the class.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< EquationOfState > EquationOfStateSharedPtr
A shared pointer to an equation of state object.
tinysimd::simd< NekDouble > vec_t
double NekDouble