ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
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:
26
27 PolytropicGas(const std::string &subsection)
28 : EquationOfState("polytropic gas", subsection)
29 {
30 gamma_ = 7. / 5.;
31 this->add_parameter("gamma", gamma_, "The ratio of specific heats");
32
33 /*
34 * R is the specific gas constant with units [J / (Kg K)]. More details
35 * can be found at:
36 * https://en.wikipedia.org/wiki/Gas_constant#Specific_gas_constant
37 */
38 R_ = 287.052874;
39 this->add_parameter(
40 "gas constant R", R_, "The specific gas constant R");
41
42 cv_ = R_ / (gamma_ - 1.);
43 }
44
51 double pressure(double rho, double e) const final
52 {
53 return (gamma_ - 1.) * rho * e;
54 }
55
62 double specific_internal_energy(double rho, double p) const final
63 {
64 return p / (rho * (gamma_ - 1.));
65 }
66
73 double temperature(double /*rho*/, double e) const final
74 {
75 return e / cv_;
76 }
77
84 double speed_of_sound(double /*rho*/, double e) const final
85 {
86 return std::sqrt(gamma_ * (gamma_ - 1.) * e);
87 }
88
89 private:
90 double gamma_;
91 double R_;
92 double cv_;
93 };
94 } // namespace EquationOfStateLibrary
95} // namespace ryujin
virtual double specific_internal_energy(double rho, double p) const =0
virtual double pressure(double rho, double e) const =0
virtual double speed_of_sound(double rho, double e) const =0
virtual double temperature(double rho, double e) const =0
double specific_internal_energy(double rho, double p) const final