ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
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 - 2025 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 s0_ = 0.;
60 this->add_parameter("reference specific entropy",
61 s0_,
62 "The reference specific entropy");
63
64 /* Update the EOS interpolation parameters on parameter read in
65 * and specific heat at constant volume:
66 */
67 ParameterAcceptor::parse_parameters_call_back.connect([this] {
68 this->covolume_constant_ = b_;
69 this->interpolation_pinfty_ = pinf_;
70 this->interpolation_q_ = q_;
71 cv_ = R_ / (gamma_ - 1.);
72 });
73 }
74
81 double pressure(double rho, double e) const final
82 {
83 return (gamma_ - 1.) * rho * (e - q_) / (1. - b_ * rho) -
84 gamma_ * pinf_;
85 }
86
87
94 double specific_internal_energy(double rho, double p) const final
95 {
96 const auto numerator = (p + gamma_ * pinf_) * (1. - b_ * rho);
97 const auto denominator = rho * (gamma_ - 1.);
98 return q_ + numerator / denominator;
99 }
100
107 double temperature(double rho, double e) const final
108 {
109 return (e - q_ - pinf_ * (1. / rho - b_)) / cv_;
110 }
111
118 double cold_curve_bound(double rho) const final
119 {
120 return q_ + pinf_ * (1. / rho - b_);
121 }
122
134 double specific_entropy(double rho, double e) const final
135 {
136 const auto covolume_term = 1. / rho - b_;
137 const auto p_plus_pinf =
138 (gamma_ - 1.) * ((e - q_) - pinf_ * covolume_term) / covolume_term;
139 const auto first_term = cv_ * std::log(p_plus_pinf);
140 const auto second_term =
141 cv_ * gamma_ * std::log((gamma_ - 1.) * cv_ / covolume_term);
142 return first_term - second_term + s0_;
143 }
144
152 double speed_of_sound(double rho, double e) const final
153 {
154 const auto covolume = 1. - b_ * rho;
155 auto radicand =
156 (rho * (e - q_) - pinf_ * covolume) / (covolume * covolume * rho);
157 radicand *= gamma_ * (gamma_ - 1.);
158 return std::sqrt(radicand);
159 }
160
161 private:
162 double gamma_;
163 double R_;
164 double cv_;
165 double b_;
166 double q_;
167 double pinf_;
168 double s0_;
169 };
170 } // namespace EquationOfStateLibrary
171} /* 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, double) const
virtual double temperature(double, double) const