13 namespace adiabaticIndex {
16#if defined(HYDRO_GAMMA_5_3)
18#define hydro_gamma 1.66666666666666667
19#define hydro_gamma_minus_one 0.66666666666666667
20#define hydro_gamma_plus_one 2.66666666666666667
21#define hydro_one_over_gamma_minus_one 1.5
22#define hydro_gamma_plus_one_over_two_gamma 0.8
23#define hydro_gamma_minus_one_over_two_gamma 0.2
24#define hydro_gamma_minus_one_over_gamma_plus_one 0.25
25#define hydro_two_over_gamma_plus_one 0.75
26#define hydro_two_over_gamma_minus_one 3.f
27#define hydro_gamma_minus_one_over_two 0.33333333333333333
28#define hydro_two_gamma_over_gamma_minus_one 5.
29#define hydro_one_over_gamma 0.6
31#elif defined(HYDRO_GAMMA_7_5)
33#define hydro_gamma 1.4
34#define hydro_gamma_minus_one 0.4
35#define hydro_gamma_plus_one 2.4
36#define hydro_one_over_gamma_minus_one 2.5
37#define hydro_gamma_plus_one_over_two_gamma 0.857142857
38#define hydro_gamma_minus_one_over_two_gamma 0.142857143
39#define hydro_gamma_minus_one_over_gamma_plus_one 0.166666667
40#define hydro_two_over_gamma_plus_one 0.83333333
41#define hydro_two_over_gamma_minus_one 5.
42#define hydro_gamma_minus_one_over_two 0.2
43#define hydro_two_gamma_over_gamma_minus_one 7.
44#define hydro_one_over_gamma 0.714285714
46#elif defined(HYDRO_GAMMA_4_3)
48#define hydro_gamma 1.33333333333333333
49#define hydro_gamma_minus_one 0.33333333333333333
50#define hydro_gamma_plus_one 2.33333333333333333
51#define hydro_one_over_gamma_minus_one 3.
52#define hydro_gamma_plus_one_over_two_gamma 0.875
53#define hydro_gamma_minus_one_over_two_gamma 0.125
54#define hydro_gamma_minus_one_over_gamma_plus_one 0.142857143
55#define hydro_two_over_gamma_plus_one 0.857142857
56#define hydro_two_over_gamma_minus_one 6.
57#define hydro_gamma_minus_one_over_two 0.166666666666666666
58#define hydro_two_gamma_over_gamma_minus_one 8.
59#define hydro_one_over_gamma 0.75
61#elif defined(HYDRO_GAMMA_2_1)
64#define hydro_gamma_minus_one 1.
65#define hydro_gamma_plus_one 3.
66#define hydro_one_over_gamma_minus_one 1.
67#define hydro_gamma_plus_one_over_two_gamma 0.75
68#define hydro_gamma_minus_one_over_two_gamma 0.25
69#define hydro_gamma_minus_one_over_gamma_plus_one 0.33333333333333333
70#define hydro_two_over_gamma_plus_one 0.66666666666666666
71#define hydro_two_over_gamma_minus_one 2.
72#define hydro_gamma_minus_one_over_two 0.5
73#define hydro_two_gamma_over_gamma_minus_one 4.
74#define hydro_one_over_gamma 0.5
78#error "An adiabatic index needs to be chosen!"
87 __attribute__((always_inline,
const)) inline static
double pow_gamma(
double x) {
89#if defined(HYDRO_GAMMA_5_3)
91 const double cbrt = std::cbrt(x);
92 return cbrt * cbrt * x;
94#elif defined(HYDRO_GAMMA_7_5)
96 return std::pow(x, 1.4);
98#elif defined(HYDRO_GAMMA_4_3)
100 return std::cbrt(x) * x;
102#elif defined(HYDRO_GAMMA_2_1)
108 error(
"The adiabatic index is not defined !");
120 __attribute__((always_inline,
const)) inline static
double pow_gamma_minus_one(
double x) {
122#if defined(HYDRO_GAMMA_5_3)
124 const double cbrt = std::cbrt(x);
127#elif defined(HYDRO_GAMMA_7_5)
129 return std::pow(x, 0.4);
131#elif defined(HYDRO_GAMMA_4_3)
135#elif defined(HYDRO_GAMMA_2_1)
141 error(
"The adiabatic index is not defined !");
153 __attribute__((always_inline,
const)) inline static
double pow_minus_gamma_minus_one(
double x) {
155#if defined(HYDRO_GAMMA_5_3)
157 const double cbrt_inv = 1. / std::cbrt(x);
158 return cbrt_inv * cbrt_inv;
160#elif defined(HYDRO_GAMMA_7_5)
162 return std::pow(x, -0.4);
164#elif defined(HYDRO_GAMMA_4_3)
166 return 1.f / std::cbrt(x);
168#elif defined(HYDRO_GAMMA_2_1)
174 error(
"The adiabatic index is not defined !");
189 __attribute__((always_inline,
const)) inline static
double pow_minus_gamma(
double x) {
191#if defined(HYDRO_GAMMA_5_3)
193 const double cbrt_inv = 1.f / std::cbrt(x);
194 const double cbrt_inv2 = cbrt_inv * cbrt_inv;
195 return cbrt_inv * cbrt_inv2 * cbrt_inv2;
197#elif defined(HYDRO_GAMMA_7_5)
199 return std::pow(x, -1.4);
201#elif defined(HYDRO_GAMMA_4_3)
203 const double cbrt_inv = 1.f / std::cbrt(x);
204 const double cbrt_inv2 = cbrt_inv * cbrt_inv;
205 return cbrt_inv2 * cbrt_inv2;
207#elif defined(HYDRO_GAMMA_2_1)
209 const double inv = 1.f / x;
214 error(
"The adiabatic index is not defined !");
229 __attribute__((always_inline,
const)) inline static
double pow_two_over_gamma_minus_one(
double x) {
231#if defined(HYDRO_GAMMA_5_3)
235#elif defined(HYDRO_GAMMA_7_5)
237 const double x2 = x * x;
238 const double x3 = x2 * x;
241#elif defined(HYDRO_GAMMA_4_3)
243 const double x3 = x * x * x;
246#elif defined(HYDRO_GAMMA_2_1)
252 error(
"The adiabatic index is not defined !");
268 __attribute__((always_inline,
const)) inline static
double pow_two_gamma_over_gamma_minus_one(
double x) {
270#if defined(HYDRO_GAMMA_5_3)
272 const double x2 =
x *
x;
273 const double x3 = x2 *
x;
276#elif defined(HYDRO_GAMMA_7_5)
278 const double x2 =
x *
x;
279 const double x4 = x2 * x2;
282#elif defined(HYDRO_GAMMA_4_3)
284 const double x2 =
x *
x;
285 const double x4 = x2 * x2;
288#elif defined(HYDRO_GAMMA_2_1)
290 const double x2 =
x *
x;
295 error(
"The adiabatic index is not defined !");
311 __attribute__((always_inline,
const)) inline static
double pow_gamma_minus_one_over_two_gamma(
double x) {
313#if defined(HYDRO_GAMMA_5_3)
315 return std::pow(x, 0.2);
317#elif defined(HYDRO_GAMMA_7_5)
319 return std::pow(x, hydro_gamma_minus_one_over_two_gamma);
321#elif defined(HYDRO_GAMMA_4_3)
323 return std::pow(x, 0.125);
325#elif defined(HYDRO_GAMMA_2_1)
327 return std::pow(x, 0.25);
331 error(
"The adiabatic index is not defined !");
347 __attribute__((always_inline,
const)) inline static
double pow_minus_gamma_plus_one_over_two_gamma(
double x) {
349#if defined(HYDRO_GAMMA_5_3)
351 return std::pow(x, -0.8);
353#elif defined(HYDRO_GAMMA_7_5)
355 return std::pow(x, -hydro_gamma_plus_one_over_two_gamma);
357#elif defined(HYDRO_GAMMA_4_3)
359 return std::pow(x, -0.875);
361#elif defined(HYDRO_GAMMA_2_1)
363 return std::pow(x, -0.75);
367 error(
"The adiabatic index is not defined !");
381 __attribute__((always_inline,
const)) inline static
double pow_one_over_gamma(
double x) {
383#if defined(HYDRO_GAMMA_5_3)
385 return std::pow(x, hydro_one_over_gamma);
387#elif defined(HYDRO_GAMMA_7_5)
389 return std::pow(x, hydro_one_over_gamma);
391#elif defined(HYDRO_GAMMA_4_3)
393 return std::pow(x, hydro_one_over_gamma);
395#elif defined(HYDRO_GAMMA_2_1)
401 error(
"The adiabatic index is not defined !");
414 __attribute__((always_inline,
const)) inline static
double pow_three_gamma_minus_two(
double x) {
416#if defined(HYDRO_GAMMA_5_3)
420#elif defined(HYDRO_GAMMA_7_5)
422 return std::pow(x, 2.2);
424#elif defined(HYDRO_GAMMA_4_3)
428#elif defined(HYDRO_GAMMA_2_1)
430 return x *
x *
x *
x;
434 error(
"The adiabatic index is not defined !");
448 __attribute__((always_inline,
const)) inline static
double pow_three_gamma_minus_five_over_two(
double x) {
450#if defined(HYDRO_GAMMA_5_3)
454#elif defined(HYDRO_GAMMA_7_5)
456 return std::pow(x, -0.4);
458#elif defined(HYDRO_GAMMA_4_3)
460 return 1.f / std::sqrt(x);
462#elif defined(HYDRO_GAMMA_2_1)
468 error(
"The adiabatic index is not defined !");
481 __attribute__((always_inline,
const)) inline static
double pow_three_gamma_minus_one(
double x) {
483#if defined(HYDRO_GAMMA_5_3)
487#elif defined(HYDRO_GAMMA_7_5)
489 return std::pow(x, 1.2);
491#elif defined(HYDRO_GAMMA_4_3)
495#elif defined(HYDRO_GAMMA_2_1)
501 error(
"The adiabatic index is not defined !");