ryujin 2.5.0 revision c64172211cf21344cb9b9b0f3a1266aa6400d392
Loading...
Searching...
No Matches
equation_of_state_hayes.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2026 by the ryujin authors
4//
5
6#pragma once
7
9
10#include <cmath>
11
12namespace ryujin
13{
14 namespace EquationsOfState
15 {
21 class Hayes : public EquationOfState
22 {
23 public:
28
29 Hayes(const std::string &subsection)
30 : EquationOfState("hayes", subsection)
31 {
32
33 rho0_ = 1.844; // [g/cc]
34 this->add_parameter("rho_0", rho0_, "The reference density");
35
36 T0_ = 298.15; // [K]
37 this->add_parameter("T_0", T0_, "The reference temperature");
38
39 gm0_ = 1.0715848; // [unitless]
40 this->add_parameter("gamma_0", gm0_, "The Gruneisen parameter");
41
42 cv_ = 1.11e-3; // [kJ/ (g * K)]
43 this->add_parameter(
44 "c_v", cv_, "The specific heat capacity at constant volume");
45
46 k0_ = 12.6; // [Gpa]
47 this->add_parameter("k_0", k0_, "The bulk modulus");
48
49 // Derivative of bulk modulus w.r.t pressure
50 N_ = 5.6; // [unitless]
51 this->add_parameter("N", N_, "The exponent N");
52
53 e0_ = 0.; // [kJ / g]
54 this->add_parameter(
55 "e_0", e0_, "The reference specific internal energy");
56
57 p0_ = 0.; // [Gpa]
58 this->add_parameter("p_0", p0_, "The reference pressure");
59
60 s0_ = 0.; // [kJ / (g * K)]
61 this->add_parameter("s_0", s0_, "The reference specific entropy");
62
63
64 const auto update_values = [this]() { v0_ = 1. / rho0_; };
65
66 this->parse_parameters_call_back.connect(update_values);
67 update_values();
68 }
69
70
88 double pressure(double rho, double e) const final
89 {
90 const auto v = 1. / rho;
91 const auto ratio = v / v0_;
92 const auto f_c = repulsion_of_ions(v);
93 const auto delta_T =
94 (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_ + gm0_ * T0_ * (1. - ratio);
95 const auto first_term = k0_ / N_ * std::pow(ratio, -N_);
96 const auto second_term = cv_ * gm0_ / v0_ * delta_T;
97
98 return first_term + second_term - k0_ / N_ + p0_;
99 }
100
113 double specific_internal_energy(double rho, double p) const final
114 {
115 const auto v = 1. / rho;
116 const auto ratio = v / v0_;
117 const auto f_c = repulsion_of_ions(v);
118 auto scaled_delta_p =
119 p - p0_ - k0_ / N_ * std::pow(ratio, -N_) + k0_ / N_;
120 scaled_delta_p *= v0_ / gm0_;
121 const auto composite_constant = p0_ * v0_ - gm0_ * T0_ * cv_;
122
123 return scaled_delta_p + composite_constant * (1. - ratio) + f_c + e0_;
124 }
125
138 double temperature(double rho, double e) const final
139 {
140 const auto v = 1. / rho;
141 const auto f_c = repulsion_of_ions(v);
142 const auto first_term = (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_;
143 const auto second_term = gm0_ * T0_ * (v0_ - v) / v0_;
144 return first_term + second_term + T0_;
145 }
146
158 double cold_curve_bound(double rho) const final
159 {
160 const auto v = 1. / rho;
161 const auto f_c = repulsion_of_ions(v);
162 return p0_ * (v0_ - v) + f_c + e0_;
163 }
164
175 double specific_entropy(double rho, double e) const final
176 {
177 const auto v = 1. / rho;
178 const auto f_c = repulsion_of_ions(v);
179 const auto T = (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_ +
180 gm0_ * T0_ * (v0_ - v) / v0_ + T0_;
181 auto s = std::log(T / T0_) + gm0_ * (v - v0_) / v0_;
182 s *= cv_;
183 return s + s0_;
184 }
185
202 double speed_of_sound(double rho, double e) const final
203 {
204 const auto v = 1. / rho;
205 const auto ratio = v / v0_;
206 const auto f_c = repulsion_of_ions(v);
207 const auto T = (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_ +
208 gm0_ * T0_ * (v0_ - v) / v0_ + T0_;
209 const auto radicand = v0_ * k0_ * std::pow(ratio, 1. - N_) +
210 cv_ * gm0_ * gm0_ * v * v * T / (v0_ * v0_);
211 return std::sqrt(radicand);
212 }
213
214 private:
215 double e0_;
216 double k0_;
217 double p0_;
218 double rho0_;
219 double s0_;
220 double T0_;
221 double gm0_;
222 double cv_;
223 double N_;
224 double v0_;
225
233 double repulsion_of_ions(const double v) const
234 {
235 const double ratio = v / v0_;
236 double f_c = std::pow(ratio, 1. - N_) - (N_ - 1.) * (1. - ratio) - 1.;
237 f_c *= k0_ * v0_ / (N_ * (N_ - 1.));
238 return f_c;
239 }
240 };
241 } // namespace EquationsOfState
242} // namespace ryujin
virtual double pressure(double rho, double e) const =0
virtual double temperature(double, double) const
virtual double speed_of_sound(double, double) const
virtual double specific_internal_energy(double rho, double p) const =0
double specific_entropy(double rho, double e) const final
double specific_internal_energy(double rho, double p) const final
double pressure(double rho, double e) const final
double cold_curve_bound(double rho) const final
double temperature(double rho, double e) const final
double speed_of_sound(double rho, double e) const final
Hayes(const std::string &subsection)