Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/PDE/EoS/ThermallyPerfectGas.cpp
4 : : \copyright 2012-2015 J. Bakosi,
5 : : 2016-2018 Los Alamos National Security, LLC.,
6 : : 2019-2021 Triad National Security, LLC.
7 : : All rights reserved. See the LICENSE file for details.
8 : : \brief Thermally perfect gas equation of state
9 : : \details This file defines functions for the thermally perfect gas equation
10 : : of state for the compressible flow equations.
11 : : */
12 : : // *****************************************************************************
13 : :
14 : : #include <cmath>
15 : : #include <iostream>
16 : : #include "EoS/ThermallyPerfectGas.hpp"
17 : :
18 : : using inciter::ThermallyPerfectGas;
19 : :
20 : 36 : ThermallyPerfectGas::ThermallyPerfectGas(
21 : : tk::real R,
22 : : std::vector< std::vector< tk::real > > cp_coeff,
23 : : std::vector< tk::real > t_range,
24 : 36 : tk::real dH_ref) :
25 : : m_R(R),
26 : : m_cp_coeff(cp_coeff),
27 : : m_t_range(t_range),
28 [ + - ]: 36 : m_dH_ref(dH_ref)
29 : : // *************************************************************************
30 : : // Constructor
31 : : //! \param[in] R gas constant
32 : : //! \param[in] cp_coeff NASA Glenn polynomials coefficients for cp fit
33 : : //! \param[in] t_range temperature range where polynomial coeffs are valid
34 : : //! \param[in] dH_ref reference enthalpy, h(t = 298.15 K) - h(t = 0 K)
35 : : // *************************************************************************
36 : 36 : { }
37 : :
38 : : [[noreturn]] tk::real
39 : 0 : ThermallyPerfectGas::density(
40 : : tk::real ,
41 : : tk::real ) const
42 : : // *************************************************************************
43 : : //! \brief Calculate density from the material pressure and temperature
44 : : //! using the stiffened-gas equation of state
45 : : //! \param[in] pr Material pressure
46 : : //! \param[in] temp Material temperature
47 : : //! \return Material density calculated using the stiffened-gas EoS
48 : : // *************************************************************************
49 : : {
50 [ - - ][ - - ]: 0 : Throw("Direct call to TPG density should not occur. Use Mixture class.");
[ - - ][ - - ]
[ - - ][ - - ]
51 : : }
52 : :
53 : : [[noreturn]] tk::real
54 : 0 : ThermallyPerfectGas::pressure(
55 : : tk::real ,
56 : : tk::real ,
57 : : tk::real ,
58 : : tk::real ,
59 : : tk::real ,
60 : : tk::real,
61 : : std::size_t,
62 : : const std::array< std::array< tk::real, 3 >, 3 >& ) const
63 : : // *************************************************************************
64 : : //! \brief Calculate pressure from the material density, momentum and total
65 : : //! energy using the thermally perfect gas equation of state
66 : : //! \param[in] rho density
67 : : //! \param[in] u X-velocity
68 : : //! \param[in] v Y-velocity
69 : : //! \param[in] w Z-velocity
70 : : //! \param[in] rhoE total energy
71 : : //! \return Pressure calculated using the thermally perfect gas EOS
72 : : // *************************************************************************
73 : : {
74 [ - - ][ - - ]: 0 : Throw("Direct call to TPG pressure should not occur. Use Mixture class.");
[ - - ][ - - ]
[ - - ][ - - ]
75 : : }
76 : :
77 : : std::array< std::array< tk::real, 3 >, 3 >
78 : 0 : ThermallyPerfectGas::CauchyStress(
79 : : tk::real,
80 : : tk::real,
81 : : tk::real,
82 : : tk::real,
83 : : tk::real,
84 : : tk::real,
85 : : std::size_t,
86 : : const std::array< std::array< tk::real, 3 >, 3 >& ) const
87 : : // *************************************************************************
88 : : //! \brief Calculate the Cauchy stress tensor from the material density,
89 : : //! momentum, and total energy
90 : : //! \return Material Cauchy stress tensor (alpha_k * sigma_k)
91 : : // *************************************************************************
92 : : {
93 : 0 : std::array< std::array< tk::real, 3 >, 3 > asig{{{0,0,0}, {0,0,0}, {0,0,0}}};
94 : :
95 : : // No elastic contribution
96 : :
97 : 0 : return asig;
98 : : }
99 : :
100 : : [[noreturn]] tk::real
101 : 0 : ThermallyPerfectGas::soundspeed(
102 : : tk::real ,
103 : : tk::real ,
104 : : tk::real,
105 : : std::size_t,
106 : : const std::array< std::array< tk::real, 3 >, 3 >&,
107 : : const std::array< tk::real, 3 >& ) const
108 : : // *************************************************************************
109 : : //! Calculate speed of sound from the material density and material pressure
110 : : //! \param[in] rho density
111 : : //! \param[in] pr pressure
112 : : //! \return Material speed of sound using the ideal gas EoS
113 : : // *************************************************************************
114 : : {
115 [ - - ][ - - ]: 0 : Throw("Direct call to TPG soundspeed should not occur. Use Mixture class.");
[ - - ][ - - ]
[ - - ][ - - ]
116 : : }
117 : :
118 : : [[noreturn]] tk::real
119 : 0 : ThermallyPerfectGas::totalenergy(
120 : : tk::real ,
121 : : tk::real ,
122 : : tk::real ,
123 : : tk::real ,
124 : : tk::real ,
125 : : const std::array< std::array< tk::real, 3 >, 3 >& ) const
126 : : // *************************************************************************
127 : : //! \brief Calculate material specific total energy from the material
128 : : //! density, momentum and material pressure
129 : : //! \param[in] rho density
130 : : //! \param[in] u X-velocity
131 : : //! \param[in] v Y-velocity
132 : : //! \param[in] w Z-velocity
133 : : //! \param[in] pr pressure
134 : : //! \return specific total energy using the thermally perfect gas EoS
135 : : // *************************************************************************
136 : : {
137 [ - - ][ - - ]: 0 : Throw("Direct call to TPG totalenergy should not occur. Use Mixture class.");
[ - - ][ - - ]
[ - - ][ - - ]
138 : : }
139 : :
140 : : [[noreturn]] tk::real
141 : 0 : ThermallyPerfectGas::temperature(
142 : : tk::real ,
143 : : tk::real ,
144 : : tk::real ,
145 : : tk::real ,
146 : : tk::real ,
147 : : tk::real,
148 : : const std::array< std::array< tk::real, 3 >, 3 >& ) const
149 : : // *************************************************************************
150 : : //! \brief Calculate material temperature from the material density
151 : : //! \param[in] rho density
152 : : //! \param[in] u X-velocity
153 : : //! \param[in] v Y-velocity
154 : : //! \param[in] w Z-velocity
155 : : //! \param[in] rhoE total energy
156 : : //! \return Material temperature using the thermally perfect gas EoS
157 : : // *************************************************************************
158 : : {
159 [ - - ][ - - ]: 0 : Throw("Direct call to TPG temperature should not occur. Use Mixture class.");
[ - - ][ - - ]
[ - - ][ - - ]
160 : : }
161 : :
162 : : tk::real
163 : 15240329 : ThermallyPerfectGas::internalenergy(tk::real temp) const
164 : : // *************************************************************************
165 : : //! \brief Calculate species internal energy
166 : : //! \param[in] temp Temperature
167 : : //! \return Species internal energy using the thermally perfect gas EoS
168 : : // *************************************************************************
169 : : {
170 : 15240329 : auto R = m_R;
171 : 15240329 : tk::real h = calc_h(temp) * R * temp + m_dH_ref;
172 : 15240329 : return h - R * temp;
173 : : }
174 : :
175 : : tk::real
176 : 20133413 : ThermallyPerfectGas::cv(tk::real temp) const
177 : : // *************************************************************************
178 : : //! \brief Calculate species specific heat (constant volume)
179 : : //! \param[in] temp Temperature
180 : : //! \return Species specific heat using the thermally perfect gas EoS
181 : : // *************************************************************************
182 : : {
183 : 20133413 : auto R = m_R;
184 : 20133413 : tk::real cp = calc_cp(temp) * R;
185 : 20133413 : return cp - R;
186 : : }
|