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 : : std::size_t,
81 : : const std::array< std::array< tk::real, 3 >, 3 >& ) const
82 : : // *************************************************************************
83 : : //! \brief Calculate the Cauchy stress tensor from the material
84 : : //! inverse deformation gradient tensor
85 : : //! \return Material Cauchy stress tensor (alpha_k * sigma_k)
86 : : // *************************************************************************
87 : : {
88 : 0 : std::array< std::array< tk::real, 3 >, 3 > asig{{{0,0,0}, {0,0,0}, {0,0,0}}};
89 : :
90 : : // No elastic contribution
91 : :
92 : 0 : return asig;
93 : : }
94 : :
95 : : [[noreturn]] tk::real
96 : 0 : ThermallyPerfectGas::soundspeed(
97 : : tk::real ,
98 : : tk::real ,
99 : : tk::real,
100 : : std::size_t,
101 : : const std::array< std::array< tk::real, 3 >, 3 >&,
102 : : const std::array< tk::real, 3 >& ) const
103 : : // *************************************************************************
104 : : //! Calculate speed of sound from the material density and material pressure
105 : : //! \param[in] rho density
106 : : //! \param[in] pr pressure
107 : : //! \return Material speed of sound using the ideal gas EoS
108 : : // *************************************************************************
109 : : {
110 [ - - ][ - - ]: 0 : Throw("Direct call to TPG soundspeed should not occur. Use Mixture class.");
[ - - ]
111 : : }
112 : :
113 : : [[noreturn]] tk::real
114 : 0 : ThermallyPerfectGas::totalenergy(
115 : : tk::real ,
116 : : tk::real ,
117 : : tk::real ,
118 : : tk::real ,
119 : : tk::real ,
120 : : tk::real ,
121 : : const std::array< std::array< tk::real, 3 >, 3 >& ) const
122 : : // *************************************************************************
123 : : //! \brief Calculate material specific total energy from the material
124 : : //! density, momentum and material pressure
125 : : // //! \param[in] rho density
126 : : // //! \param[in] u X-velocity
127 : : // //! \param[in] v Y-velocity
128 : : // //! \param[in] w Z-velocity
129 : : // //! \param[in] pr pressure
130 : : // //! \param[in] alpha volume fraction
131 : : //! \return specific total energy using the thermally perfect gas EoS
132 : : // *************************************************************************
133 : : {
134 [ - - ][ - - ]: 0 : Throw("Direct call to TPG totalenergy should not occur. Use Mixture class.");
[ - - ]
135 : : }
136 : :
137 : : [[noreturn]] tk::real
138 : 0 : ThermallyPerfectGas::temperature(
139 : : tk::real ,
140 : : tk::real ,
141 : : tk::real ,
142 : : tk::real ,
143 : : tk::real ,
144 : : tk::real,
145 : : const std::array< std::array< tk::real, 3 >, 3 >& ) const
146 : : // *************************************************************************
147 : : //! \brief Calculate material temperature from the material density
148 : : //! \param[in] rho density
149 : : //! \param[in] u X-velocity
150 : : //! \param[in] v Y-velocity
151 : : //! \param[in] w Z-velocity
152 : : //! \param[in] rhoE total energy
153 : : //! \return Material temperature using the thermally perfect gas EoS
154 : : // *************************************************************************
155 : : {
156 [ - - ][ - - ]: 0 : Throw("Direct call to TPG temperature should not occur. Use Mixture class.");
[ - - ]
157 : : }
158 : :
159 : : tk::real
160 : 8415522 : ThermallyPerfectGas::internalenergy(tk::real temp) const
161 : : // *************************************************************************
162 : : //! \brief Calculate species internal energy
163 : : //! \param[in] temp Temperature
164 : : //! \return Species internal energy using the thermally perfect gas EoS
165 : : // *************************************************************************
166 : : {
167 : 8415522 : auto R = m_R;
168 : 8415522 : tk::real h = calc_h(temp) * R * temp + m_dH_ref;
169 : 8415522 : return h - R * temp;
170 : : }
171 : :
172 : : tk::real
173 : 8192106 : ThermallyPerfectGas::cv(tk::real temp) const
174 : : // *************************************************************************
175 : : //! \brief Calculate species specific heat (constant volume)
176 : : //! \param[in] temp Temperature
177 : : //! \return Species specific heat using the thermally perfect gas EoS
178 : : // *************************************************************************
179 : : {
180 : 8192106 : auto R = m_R;
181 : 8192106 : tk::real cp = calc_cp(temp) * R;
182 : 8192106 : return cp - R;
183 : : }
|