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 
41 namespace Nektar
42 {
43 // Forward declaration
45 
46 /// A shared pointer to an equation of state object
47 typedef std::shared_ptr<EquationOfState> EquationOfStateSharedPtr;
48 
49 /// Declaration of the equation of state factory
50 typedef LibUtilities::NekFactory<std::string, EquationOfState,
53 
54 /// Declaration of the equation of state factory singleton
56 
57 /**
58  * @class EquationOfState
59  * @brief Encapsulates equations of state allowing us to obtain thermodynamic
60  * properties: most relations are in the form X(rho,e)
61  */
62 class EquationOfState
63 {
64 public:
65  virtual ~EquationOfState()
66  {
67  }
68 
69  /// Calculate the temperature
70  NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e);
71 
72  /// Calculate the pressure
73  NekDouble GetPressure(const NekDouble &rho, const NekDouble &e);
74 
75  /// Calculate the sound speed
76  NekDouble GetSoundSpeed(const NekDouble &rho, const NekDouble &e);
77 
78  /// Calculate the entropy
79  NekDouble GetEntropy(const NekDouble &rho, const NekDouble &e);
80 
81  /// Calculate the partial derivative of P(rho,e) with respect to rho
82  NekDouble GetDPDrho_e(const NekDouble &rho, const NekDouble &e);
83 
84  /// Calculate the partial derivative of P(rho,e) with respect to e
85  NekDouble GetDPDe_rho(const NekDouble &rho, const NekDouble &e);
86 
87  /// Obtain the internal energy from rho and P
88  NekDouble GetEFromRhoP(const NekDouble &rho, const NekDouble &p);
89 
90  /// Obtain the density from P and T
91  NekDouble GetRhoFromPT(const NekDouble &p, const NekDouble &T);
92 
93 protected:
96 
97  /// Constructor
99 
100  virtual NekDouble v_GetTemperature(const NekDouble &rho,
101  const NekDouble &e) = 0;
102 
103  virtual NekDouble v_GetPressure(const NekDouble &rho,
104  const NekDouble &e) = 0;
105 
106  virtual NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e);
107 
108  virtual NekDouble v_GetEntropy(const NekDouble &rho,
109  const NekDouble &e) = 0;
110 
111  virtual NekDouble v_GetDPDrho_e(const NekDouble &rho,
112  const NekDouble &e) = 0;
113 
114  virtual NekDouble v_GetDPDe_rho(const NekDouble &rho,
115  const NekDouble &e) = 0;
116 
117  virtual NekDouble v_GetEFromRhoP(const NekDouble &rho,
118  const NekDouble &p) = 0;
119 
120  virtual NekDouble v_GetRhoFromPT(const NekDouble &rho,
121  const NekDouble &p) = 0;
122 };
123 }
124 
125 #endif
NekDouble GetEntropy(const NekDouble &rho, const NekDouble &e)
Calculate the entropy.
LibUtilities::NekFactory< std::string, EquationOfState, const LibUtilities::SessionReaderSharedPtr & > EquationOfStateFactory
Declaration of the equation of state factory.
EquationOfState(const LibUtilities::SessionReaderSharedPtr &pSession)
Constructor.
virtual NekDouble v_GetRhoFromPT(const NekDouble &rho, const NekDouble &p)=0
virtual NekDouble v_GetDPDe_rho(const NekDouble &rho, const NekDouble &e)=0
NekDouble GetDPDe_rho(const NekDouble &rho, const NekDouble &e)
Calculate the partial derivative of P(rho,e) with respect to e.
virtual NekDouble v_GetSoundSpeed(const NekDouble &rho, const NekDouble &e)
Encapsulates equations of state allowing us to obtain thermodynamic properties: most relations are in...
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_GetDPDrho_e(const NekDouble &rho, const NekDouble &e)=0
virtual NekDouble v_GetTemperature(const NekDouble &rho, const NekDouble &e)=0
EquationOfStateFactory & GetEquationOfStateFactory()
Declaration of the equation of state factory singleton.
NekDouble GetEFromRhoP(const NekDouble &rho, const NekDouble &p)
Obtain the internal energy from rho and P.
double NekDouble
NekDouble GetRhoFromPT(const NekDouble &p, const NekDouble &T)
Obtain the density from P and T.
std::shared_ptr< EquationOfState > EquationOfStateSharedPtr
A shared pointer to an equation of state object.
NekDouble GetTemperature(const NekDouble &rho, const NekDouble &e)
Calculate the temperature.
NekDouble GetPressure(const NekDouble &rho, const NekDouble &e)
Calculate the pressure.
virtual NekDouble v_GetEntropy(const NekDouble &rho, const NekDouble &e)=0
virtual NekDouble v_GetEFromRhoP(const NekDouble &rho, const NekDouble &p)=0
virtual NekDouble v_GetPressure(const NekDouble &rho, const NekDouble &e)=0
std::shared_ptr< SessionReader > SessionReaderSharedPtr
Provides a generic Factory class.
Definition: NekFactory.hpp:103