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 
74  /// Calculate the temperature
75  virtual NekDouble GetTemperature(const NekDouble& rho, const NekDouble& e) = 0;
76 
77  virtual vec_t GetTemperature(const vec_t& rho, const vec_t& e) = 0;
78 
79  /// Calculate the pressure
80  virtual NekDouble GetPressure(const NekDouble& rho, const NekDouble& e) = 0;
81 
82  virtual vec_t GetPressure(const vec_t& rho, const vec_t& e) = 0;
83 
84  /// Calculate the sound speed
85  NekDouble GetSoundSpeed(const NekDouble &rho, const NekDouble &e);
86 
87  /// Calculate the entropy
88  NekDouble GetEntropy(const NekDouble &rho, const NekDouble &e);
89 
90  /// Calculate the partial derivative of P(rho,e) with respect to rho
91  NekDouble GetDPDrho_e(const NekDouble &rho, const NekDouble &e);
92 
93  /// Calculate the partial derivative of P(rho,e) with respect to e
94  NekDouble GetDPDe_rho(const NekDouble &rho, const NekDouble &e);
95 
96  /// Obtain the internal energy from rho and P
97  NekDouble GetEFromRhoP(const NekDouble &rho, const NekDouble &p);
98 
99  /// Obtain the density from P and T
100  NekDouble GetRhoFromPT(const NekDouble &p, const NekDouble &T);
101 
102 protected:
107 
108  /// Constructor
110 
111  /// Programmatic Constructor
112  EquationOfState(const NekDouble &gamma, const NekDouble &gasConstant);
113 
114  virtual NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e);
115 
116  virtual NekDouble v_GetEntropy(const NekDouble &rho,
117  const NekDouble &e) = 0;
118 
119  virtual NekDouble v_GetDPDrho_e(const NekDouble &rho,
120  const NekDouble &e) = 0;
121 
122  virtual NekDouble v_GetDPDe_rho(const NekDouble &rho,
123  const NekDouble &e) = 0;
124 
125  virtual NekDouble v_GetEFromRhoP(const NekDouble &rho,
126  const NekDouble &p) = 0;
127 
128  virtual NekDouble v_GetRhoFromPT(const NekDouble &rho,
129  const NekDouble &p) = 0;
130 
131 };
132 }
133 
134 #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)
virtual NekDouble v_GetEFromRhoP(const NekDouble &rho, const NekDouble &p)=0
virtual vec_t GetTemperature(const vec_t &rho, const vec_t &e)=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 GetTemperature(const NekDouble &rho, const NekDouble &e)=0
Calculate the temperature.
virtual NekDouble v_GetDPDrho_e(const NekDouble &rho, const NekDouble &e)=0
virtual vec_t GetPressure(const vec_t &rho, const vec_t &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.
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.
NekDouble GetEFromRhoP(const NekDouble &rho, const NekDouble &p)
Obtain the internal energy from rho and P.
virtual NekDouble GetPressure(const NekDouble &rho, const NekDouble &e)=0
Calculate the pressure.
virtual NekDouble v_GetEntropy(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:1
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 >::type simd
Definition: tinysimd.hpp:83