ryujin 2.1.1 revision 46bf70e400e423a8ffffe8300887eeb35b8dfb2c
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 <compile_time_options.h>
9
10#include "equation_of_state.h"
11
12namespace ryujin
13{
14 namespace EquationOfStateLibrary
15 {
22 {
23 public:
28
29 PolytropicGas(const std::string &subsection)
30 : EquationOfState("polytropic gas", subsection)
31 {
32 gamma_ = 7. / 5.;
33 this->add_parameter("gamma", gamma_, "The ratio of specific heats");
34
35 /*
36 * R is the specific gas constant with units [J / (Kg K)]. More details
37 * can be found at:
38 * https://en.wikipedia.org/wiki/Gas_constant#Specific_gas_constant
39 */
40 R_ = 287.052874;
41 this->add_parameter(
42 "gas constant R", R_, "The specific gas constant R");
43
44 cv_ = R_ / (gamma_ - 1.);
45 }
46
53 double pressure(double rho, double e) const final
54 {
55 return (gamma_ - 1.) * rho * e;
56 }
57
64 double specific_internal_energy(double rho, double p) const final
65 {
66 return p / (rho * (gamma_ - 1.));
67 }
68
75 double temperature(double /*rho*/, double e) const final
76 {
77 return e / cv_;
78 }
79
86 double speed_of_sound(double /*rho*/, double e) const final
87 {
88 return std::sqrt(gamma_ * (gamma_ - 1.) * e);
89 }
90
91 private:
92 double gamma_;
93 double R_;
94 double cv_;
95 };
96 } // namespace EquationOfStateLibrary
97} // 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