ryujin 2.1.1 revision 336b16a72e829721302c626ec7071b92032b8248
equation_of_state_polytropic_gas.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2023 by the ryujin authors
4//
5
6#pragma once
7
8#include "equation_of_state.h"
9
10namespace ryujin
11{
12 namespace EquationOfStateLibrary
13 {
20 {
21 public:
22 PolytropicGas(const std::string &subsection)
23 : EquationOfState("polytropic gas", subsection)
24 {
25 gamma_ = 7. / 5.;
26 this->add_parameter("gamma", gamma_, "The ratio of specific heats");
27
28 /*
29 * R is the specific gas constant with units [J / (Kg K)]. More details
30 * can be found at:
31 * https://en.wikipedia.org/wiki/Gas_constant#Specific_gas_constant
32 */
33 R_ = 287.052874;
34 this->add_parameter(
35 "gas constant R", R_, "The specific gas constant R");
36
37 cv_ = R_ / (gamma_ - 1.);
38 }
39
46 double pressure(double rho, double e) const final
47 {
48 return (gamma_ - 1.) * rho * e;
49 }
50
57 double specific_internal_energy(double rho, double p) const final
58 {
59 return p / (rho * (gamma_ - 1.));
60 }
61
68 double temperature(double /*rho*/, double e) const final
69 {
70 return e / cv_;
71 }
72
79 double speed_of_sound(double /*rho*/, double e) const final
80 {
81 return std::sqrt(gamma_ * (gamma_ - 1.) * e);
82 }
83
84 private:
85 double gamma_;
86 double R_;
87 double cv_;
88 };
89 } // namespace EquationOfStateLibrary
90} // namespace ryujin
double specific_internal_energy(double rho, double p) const final