Peano
Loading...
Searching...
No Matches
equation_of_state.h
Go to the documentation of this file.
1#pragma once
2
3#include "cmath"
4
5#include "adiabatic_index.h"
6
7
15namespace exaparty {
16 namespace kernels {
17 namespace legacy {
18 namespace eos {
19
20 // @todo we need to make this modular. This is only valid for ideal gases. It needs to be exchangeable.
21
30 __attribute__((always_inline, const)) inline static double gas_internal_energy_from_entropy(
31 double density, double entropy
32 ) {
33
34 return entropy * adiabaticIndex::pow_gamma_minus_one(density) * hydro_one_over_gamma_minus_one;
35 }
36
45 __attribute__((always_inline, const)) inline static double gas_pressure_from_entropy(
46 double density, double entropy
47 ) {
48
49 return entropy * adiabaticIndex::pow_gamma(density);
50 }
51
61 __attribute__((always_inline, const)) inline static double gas_entropy_from_pressure(
62 double density, double pressure
63 ) {
64
65 return pressure * adiabaticIndex::pow_minus_gamma(density);
66 }
67
76 __attribute__((always_inline, const)) inline static double gas_soundspeed_from_entropy(
77 double density, double entropy
78 ) {
79
80 return std::sqrt(hydro_gamma * adiabaticIndex::pow_gamma_minus_one(density) * entropy);
81 }
82
91 __attribute__((always_inline, const)) inline static double gas_entropy_from_internal_energy(
92 double density, double u
93 ) {
94
95 return hydro_gamma_minus_one * u * adiabaticIndex::pow_minus_gamma_minus_one(density);
96 }
97
106 __attribute__((always_inline, const)) inline static double gas_pressure_from_internal_energy(
107 double density, double u
108 ) {
109
110 return hydro_gamma_minus_one * u * density;
111 }
112
122 __attribute__((always_inline, const)) inline static double gas_internal_energy_from_pressure(
123 double density, double pressure
124 ) {
125
126 return hydro_one_over_gamma_minus_one * pressure / density;
127 }
128
136 __attribute__((always_inline, const)) inline static double gas_soundspeed_from_internal_energy(double u) {
137
138 return std::sqrt(u * hydro_gamma * hydro_gamma_minus_one);
139 }
140
149 __attribute__((always_inline, const)) inline static double gas_soundspeed_from_pressure(
150 double density, double P
151 ) {
152
153 return std::sqrt(hydro_gamma * P / density);
154 }
155
156 } // namespace eos
157 } // namespace legacy
158 }
159} // namespace exaparty
contains functions and definitions related to the adiabatic index of the gas.
__attribute__((always_inline, const)) inline static double gas_internal_energy_from_entropy(double density
Returns the internal energy given density and entropy.
This file is part of the ExaParty project.
Definition __init__.py:1