ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
equation_of_state_hayes.h
Go to the documentation of this file.
1#pragma once
2
3#include "equation_of_state.h"
4#include <cmath>
5
6namespace ryujin
7{
8 namespace EquationOfStateLibrary
9 {
15 class Hayes : public EquationOfState
16 {
17 public:
22
23 Hayes(const std::string &subsection)
24 : EquationOfState("hayes", subsection)
25 {
26
27 rho0_ = 1.844; // [g/cc]
28 this->add_parameter("rho_0", rho0_, "The reference density");
29
30 T0_ = 298.15; // [K]
31 this->add_parameter("T_0", T0_, "The reference temperature");
32
33 gm0_ = 1.0715848; // [unitless]
34 this->add_parameter("gamma_0", gm0_, "The Gruneisen parameter");
35
36 cv_ = 1.11e-3; // [kJ/ (g * K)]
37 this->add_parameter(
38 "c_v", cv_, "The specific heat capacity at constant volume");
39
40 k0_ = 12.6; // [Gpa]
41 this->add_parameter("k_0", k0_, "The bulk modulus");
42
43 // Derivative of bulk modulus w.r.t pressure
44 N_ = 5.6; // [unitless]
45 this->add_parameter("N", N_, "The exponent N");
46
47 e0_ = 0.; // [kJ / g]
48 this->add_parameter(
49 "e_0", e0_, "The reference specific internal energy");
50
51 p0_ = 0.; // [Gpa]
52 this->add_parameter("p_0", p0_, "The reference pressure");
53
54 s0_ = 0.; // [kJ / (g * K)]
55 this->add_parameter("s_0", s0_, "The reference specific entropy");
56
57
58 const auto update_values = [this]() { v0_ = 1. / rho0_; };
59
60 this->parse_parameters_call_back.connect(update_values);
61 update_values();
62 }
63
64
82 double pressure(double rho, double e) const final
83 {
84 const auto v = 1. / rho;
85 const auto ratio = v / v0_;
86 const auto f_c = repulsion_of_ions(v);
87 const auto delta_T =
88 (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_ + gm0_ * T0_ * (1. - ratio);
89 const auto first_term = k0_ / N_ * std::pow(ratio, -N_);
90 const auto second_term = cv_ * gm0_ / v0_ * delta_T;
91
92 return first_term + second_term - k0_ / N_ + p0_;
93 }
94
107 double specific_internal_energy(double rho, double p) const final
108 {
109 const auto v = 1. / rho;
110 const auto ratio = v / v0_;
111 const auto f_c = repulsion_of_ions(v);
112 auto scaled_delta_p =
113 p - p0_ - k0_ / N_ * std::pow(ratio, -N_) + k0_ / N_;
114 scaled_delta_p *= v0_ / gm0_;
115 const auto composite_constant = p0_ * v0_ - gm0_ * T0_ * cv_;
116
117 return scaled_delta_p + composite_constant * (1. - ratio) + f_c + e0_;
118 }
119
132 double temperature(double rho, double e) const final
133 {
134 const auto v = 1. / rho;
135 const auto f_c = repulsion_of_ions(v);
136 const auto first_term = (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_;
137 const auto second_term = gm0_ * T0_ * (v0_ - v) / v0_;
138 return first_term + second_term + T0_;
139 }
140
152 double cold_curve_bound(double rho) const final
153 {
154 const auto v = 1. / rho;
155 const auto f_c = repulsion_of_ions(v);
156 return p0_ * (v0_ - v) + f_c + e0_;
157 }
158
169 double specific_entropy(double rho, double e) const final
170 {
171 const auto v = 1. / rho;
172 const auto f_c = repulsion_of_ions(v);
173 const auto T = (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_ +
174 gm0_ * T0_ * (v0_ - v) / v0_ + T0_;
175 auto s = std::log(T / T0_) + gm0_ * (v - v0_) / v0_;
176 s *= cv_;
177 return s + s0_;
178 }
179
196 double speed_of_sound(double rho, double e) const final
197 {
198 const auto v = 1. / rho;
199 const auto ratio = v / v0_;
200 const auto f_c = repulsion_of_ions(v);
201 const auto T = (e - e0_ - p0_ * (v0_ - v) - f_c) / cv_ +
202 gm0_ * T0_ * (v0_ - v) / v0_ + T0_;
203 const auto radicand = v0_ * k0_ * std::pow(ratio, 1. - N_) +
204 cv_ * gm0_ * gm0_ * v * v * T / (v0_ * v0_);
205 return std::sqrt(radicand);
206 }
207
208 private:
209 double e0_;
210 double k0_;
211 double p0_;
212 double rho0_;
213 double s0_;
214 double T0_;
215 double gm0_;
216 double cv_;
217 double N_;
218 double v0_;
219
227 double repulsion_of_ions(const double v) const
228 {
229 const double ratio = v / v0_;
230 double f_c = std::pow(ratio, 1. - N_) - (N_ - 1.) * (1. - ratio) - 1.;
231 f_c *= k0_ * v0_ / (N_ * (N_ - 1.));
232 return f_c;
233 }
234 };
235 } // namespace EquationOfStateLibrary
236} // 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
double specific_internal_energy(double rho, double p) const final
double speed_of_sound(double rho, double e) const final
double cold_curve_bound(double rho) const final
double specific_entropy(double rho, double e) const final
double pressure(double rho, double e) const final
double temperature(double rho, double e) const final