ryujin 2.1.1 revision 336b16a72e829721302c626ec7071b92032b8248
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:
22 NobleAbelStiffenedGas(const std::string &subsection)
23 : EquationOfState("noble abel stiffened 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 b_ = 0.;
40 this->add_parameter(
41 "covolume b", b_, "The maximum compressibility constant");
42
43 q_ = 0.;
44 this->add_parameter("reference specific internal energy",
45 q_,
46 "The reference specific internal energy");
47
48 pinf_ = 0.;
49 this->add_parameter(
50 "reference pressure", pinf_, "The reference pressure p infinity");
51
52 /* Update the interpolation_b_ parameter on parameter read in: */
53 ParameterAcceptor::parse_parameters_call_back.connect(
54 [this] { this->interpolation_b_ = b_; });
55 this->interpolation_b_ = b_;
56 }
57
64 double pressure(double rho, double e) const final
65 {
66 return (gamma_ - 1.) * rho * (e - q_) / (1. - b_ * rho) -
67 gamma_ * pinf_;
68 }
69
70
77 double specific_internal_energy(double rho, double p) const final
78 {
79 const auto numerator = (p + gamma_ * pinf_) * (1. - b_ * rho);
80 const auto denominator = rho * (gamma_ - 1.);
81 return q_ + numerator / denominator;
82 }
83
90 double temperature(double rho, double e) const final
91 {
92 return (e - q_ - pinf_ * (1. / rho - b_)) / cv_;
93 }
94
102 double speed_of_sound(double rho, double e) const final
103 {
104 const auto covolume = 1. - b_ * rho;
105 auto numerator = (rho * (e - q_) - pinf_ * covolume) / rho;
106 numerator *= gamma_ * (gamma_ - 1.);
107 return std::sqrt(numerator) / covolume;
108 }
109
110 private:
111 double gamma_;
112 double R_;
113 double cv_;
114 double b_;
115 double q_;
116 double pinf_;
117 };
118 } // namespace EquationOfStateLibrary
119} /* namespace ryujin */