ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
equation_of_state_noble_abel_stiffened_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 NobleAbelStiffenedGas(const std::string &subsection)
28 : EquationOfState("noble abel stiffened 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 b_ = 0.;
45 this->add_parameter(
46 "covolume b", b_, "The maximum compressibility constant");
47
48 q_ = 0.;
49 this->add_parameter("reference specific internal energy",
50 q_,
51 "The reference specific internal energy");
52
53 pinf_ = 0.;
54 this->add_parameter(
55 "reference pressure", pinf_, "The reference pressure p infinity");
56
57 /* Update the EOS interpolation parameters on parameter read in: */
58 ParameterAcceptor::parse_parameters_call_back.connect([this] {
59 this->interpolation_b_ = b_;
60 this->interpolation_pinfty_ = pinf_;
61 this->interpolation_q_ = q_;
62 });
63 }
64
71 double pressure(double rho, double e) const final
72 {
73 return (gamma_ - 1.) * rho * (e - q_) / (1. - b_ * rho) -
74 gamma_ * pinf_;
75 }
76
77
84 double specific_internal_energy(double rho, double p) const final
85 {
86 const auto numerator = (p + gamma_ * pinf_) * (1. - b_ * rho);
87 const auto denominator = rho * (gamma_ - 1.);
88 return q_ + numerator / denominator;
89 }
90
97 double temperature(double rho, double e) const final
98 {
99 return (e - q_ - pinf_ * (1. / rho - b_)) / cv_;
100 }
101
109 double speed_of_sound(double rho, double e) const final
110 {
111 const auto covolume = 1. - b_ * rho;
112 auto radicand =
113 (rho * (e - q_) - pinf_ * covolume) / (covolume * covolume * rho);
114 radicand *= gamma_ * (gamma_ - 1.);
115 return std::sqrt(radicand);
116 }
117
118 private:
119 double gamma_;
120 double R_;
121 double cv_;
122 double b_;
123 double q_;
124 double pinf_;
125 };
126 } // namespace EquationOfStateLibrary
127} /* 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