ryujin 2.1.1 revision fa044d3939298da517bf6a5839b34e00b155547d
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 <compile_time_options.h>
9
10#include "equation_of_state.h"
11
12namespace ryujin
13{
14 namespace EquationOfStateLibrary
15 {
22 {
23 public:
28
29 NobleAbelStiffenedGas(const std::string &subsection)
30 : EquationOfState("noble abel stiffened 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 b_ = 0.;
47 this->add_parameter(
48 "covolume b", b_, "The maximum compressibility constant");
49
50 q_ = 0.;
51 this->add_parameter("reference specific internal energy",
52 q_,
53 "The reference specific internal energy");
54
55 pinf_ = 0.;
56 this->add_parameter(
57 "reference pressure", pinf_, "The reference pressure p infinity");
58
59 /* Update the EOS interpolation parameters on parameter read in: */
60 ParameterAcceptor::parse_parameters_call_back.connect([this] {
61 this->interpolation_b_ = b_;
62 this->interpolation_pinfty_ = pinf_;
63 this->interpolation_q_ = q_;
64 });
65 }
66
73 double pressure(double rho, double e) const final
74 {
75 return (gamma_ - 1.) * rho * (e - q_) / (1. - b_ * rho) -
76 gamma_ * pinf_;
77 }
78
79
86 double specific_internal_energy(double rho, double p) const final
87 {
88 const auto numerator = (p + gamma_ * pinf_) * (1. - b_ * rho);
89 const auto denominator = rho * (gamma_ - 1.);
90 return q_ + numerator / denominator;
91 }
92
99 double temperature(double rho, double e) const final
100 {
101 return (e - q_ - pinf_ * (1. / rho - b_)) / cv_;
102 }
103
111 double speed_of_sound(double rho, double e) const final
112 {
113 const auto covolume = 1. - b_ * rho;
114 auto radicand =
115 (rho * (e - q_) - pinf_ * covolume) / (covolume * covolume * rho);
116 radicand *= gamma_ * (gamma_ - 1.);
117 return std::sqrt(radicand);
118 }
119
120 private:
121 double gamma_;
122 double R_;
123 double cv_;
124 double b_;
125 double q_;
126 double pinf_;
127 };
128 } // namespace EquationOfStateLibrary
129} /* 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