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 
43 namespace Nektar
44 {
45 // Forward declaration
46 class EquationOfState;
47 
48 /// A shared pointer to an equation of state object
49 typedef std::shared_ptr<EquationOfState> EquationOfStateSharedPtr;
50 
51 /// Declaration of the equation of state factory
52 typedef LibUtilities::NekFactory<std::string, EquationOfState,
55 
56 /// Declaration of the equation of state factory singleton
58 
60 
61 /**
62  * @class EquationOfState
63  * @brief Encapsulates equations of state allowing us to obtain thermodynamic
64  * properties: most relations are in the form X(rho,e)
65  */
67 {
68 public:
69  virtual ~EquationOfState()
70  {
71  }
72 
73  /// Calculate the temperature
74  NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e);
75 
76  vec_t GetTemperature(const vec_t &rho, const vec_t &e);
77 
78  /// Calculate the pressure
79  NekDouble GetPressure(const NekDouble &rho, const NekDouble &e);
80 
81  vec_t GetPressure(const vec_t &rho, const vec_t &e);
82 
83  /// Calculate the sound speed
84  NekDouble GetSoundSpeed(const NekDouble &rho, const NekDouble &e);
85 
86  /// Calculate the entropy
87  NekDouble GetEntropy(const NekDouble &rho, const NekDouble &e);
88 
89  /// Calculate the partial derivative of P(rho,e) with respect to rho
90  NekDouble GetDPDrho_e(const NekDouble &rho, const NekDouble &e);
91 
92  /// Calculate the partial derivative of P(rho,e) with respect to e
93  NekDouble GetDPDe_rho(const NekDouble &rho, const NekDouble &e);
94 
95  /// Obtain the internal energy from rho and P
96  NekDouble GetEFromRhoP(const NekDouble &rho, const NekDouble &p);
97 
98  /// Obtain the density from P and T
99  NekDouble GetRhoFromPT(const NekDouble &p, const NekDouble &T);
100 
101 protected:
106 
107  /// Constructor
109 
110  /// Programmatic Constructor
111  EquationOfState(const NekDouble &gamma, const NekDouble &gasConstant);
112 
114  const NekDouble &e) = 0;
115 
116  virtual vec_t v_GetTemperature(const vec_t &rho, const vec_t &e) = 0;
117 
118  virtual NekDouble v_GetPressure(const NekDouble &rho,
119  const NekDouble &e) = 0;
120 
121  virtual vec_t v_GetPressure(const vec_t &rho, const vec_t &e) = 0;
122 
123  virtual NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e);
124 
125  virtual NekDouble v_GetEntropy(const NekDouble &rho,
126  const NekDouble &e) = 0;
127 
128  virtual NekDouble v_GetDPDrho_e(const NekDouble &rho,
129  const NekDouble &e) = 0;
130 
131  virtual NekDouble v_GetDPDe_rho(const NekDouble &rho,
132  const NekDouble &e) = 0;
133 
134  virtual NekDouble v_GetEFromRhoP(const NekDouble &rho,
135  const NekDouble &p) = 0;
136 
137  virtual NekDouble v_GetRhoFromPT(const NekDouble &rho,
138  const NekDouble &p) = 0;
139 };
140 } // namespace Nektar
141 
142 #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.
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.
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.
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.
Definition: NekFactory.hpp:105
std::shared_ptr< SessionReader > SessionReaderSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
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