ryujin 2.5.0 revision c64172211cf21344cb9b9b0f3a1266aa6400d392
Loading...
Searching...
No Matches
equation_of_state_simple_macaw.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// [LANL Copyright Statement]
4// Copyright (C) 2025 - 2026 by the ryujin authors
5// Copyright (C) 2024 - 2025 by Triad National Security, LLC
6//
7
8#pragma once
9
11
12#include <cmath>
13
14namespace ryujin
15{
16 namespace EquationsOfState
17 {
28 {
29 public:
34
35 SimpleMacaw(const std::string &subsection)
36 : EquationOfState("simple macaw", subsection)
37 {
38 rho0_ = 8.952; // [g/cc]
39 this->add_parameter(
40 "reference rho0", rho0_, "The reference density at T=0 and P=0");
41
42 T0_ = 150.; // [K]
43 this->add_parameter("reference T0", T0_, "The reference temperature");
44
45 Gc_ = 0.5; // [unitless]
46 this->add_parameter("Gamma", Gc_, "The Gruneisen parameter");
47
48 capA_ = 7.3; // [Gpa]. This is the "bulk modulus divided by B"
49 this->add_parameter("A", capA_, "The A constant");
50
51 // Derivative of the bulk modulus w.r.t pressure at T=0, P=0.
52 capB_ = 3.9; // [unitless]
53 this->add_parameter("B", capB_, "The B constant");
54
55 // The Dulong-Petit limit of the specific heat at constant volume
56 cvInf_ = 3.89e-4; // [kJ / (g K )]
57 this->add_parameter("cvInf", cvInf_, "The Dulong-Petit limit of cv");
58
59 /*
60 * Update the EOS interpolation parameters on parameter read in and
61 * reference volume:
62 */
63 const auto update_values = [this]() {
64 this->interpolation_pinfty_ = capA_ * capB_;
65 v0_ = 1. / rho0_;
66 };
67
68 this->parse_parameters_call_back.connect(update_values);
69 update_values();
70 }
71
80 double pressure(double rho, double e) const final
81 {
82 const auto v = 1. / rho;
83 const auto ratio = v / v0_;
84 const auto p_cold = pressure_cold(v);
85 const auto e_cold =
86 capA_ * v0_ *
87 (std::pow(ratio, -capB_) + ratio * capB_ - (capB_ + 1.));
88
89 return p_cold + Gc_ * rho * (e - e_cold);
90 }
91
100 double specific_internal_energy(double rho, double p) const final
101 {
102 const auto v = 1. / rho;
103 const auto ratio = v / v0_;
104 const auto p_cold = pressure_cold(v);
105 const auto e_cold =
106 capA_ * v0_ *
107 (std::pow(ratio, -capB_) + ratio * capB_ - (capB_ + 1.));
108
109 return (p - p_cold) / (Gc_ * rho) + e_cold;
110 }
111
121 double temperature(double rho, double e) const final
122 {
123 const auto v = 1. / rho;
124 const auto ratio = v / v0_;
125 const auto e_cold =
126 capA_ * v0_ *
127 (std::pow(ratio, -capB_) + ratio * capB_ - (capB_ + 1.));
128 const auto delta_e = e - e_cold;
129 const auto radicand =
130 delta_e * (delta_e + 4. * cvInf_ * T0_ * std::pow(ratio, -Gc_));
131 const auto numerator = delta_e + std::sqrt(radicand);
132 const auto denominator = 2. * cvInf_;
133
134 return numerator / denominator;
135 }
136
143 double cold_curve_bound(double rho) const final
144 {
145 const auto v = 1. / rho;
146 const auto ratio = v / v0_;
147 auto e_cold = std::pow(ratio, -capB_) + ratio * capB_ - (capB_ + 1.);
148 e_cold *= capA_ * v0_;
149
150 return e_cold;
151 }
152
160 double specific_entropy(double rho, double e) const final
161 {
162 const auto v = 1. / rho;
163 const auto ratio = v / v0_;
164 const auto e_cold =
165 capA_ * v0_ *
166 (std::pow(ratio, -capB_) + ratio * capB_ - (capB_ + 1.));
167 const auto delta_e = e - e_cold;
168 const auto radicand =
169 delta_e * (delta_e + 4. * cvInf_ * T0_ * std::pow(ratio, -Gc_));
170 const auto numerator = delta_e + std::sqrt(radicand);
171 const auto denominator = 2. * cvInf_;
172 const auto T = numerator / denominator;
173 const auto tau = T * std::pow(ratio, Gc_) / T0_;
174
175 return cvInf_ * (tau / (1. + tau) + std::log(1. + tau));
176 }
177
186 double speed_of_sound(double rho, double e) const final
187 {
188 const auto v = 1. / rho;
189 const auto ratio = v / v0_;
190
191 const auto e_cold =
192 capA_ * v0_ *
193 (std::pow(ratio, -capB_) + ratio * capB_ - (capB_ + 1.));
194
195 // Cold contribution
196 const auto c_cold =
197 capA_ * capB_ * v0_ * (capB_ + 1.) * std::pow(ratio, -capB_);
198
199 return std::sqrt(c_cold + Gc_ * (Gc_ + 1.) * (e - e_cold));
200 }
201
202 private:
203 double rho0_;
204 double v0_;
205 double T0_;
206 double capA_;
207 double capB_;
208 double Gc_;
209 double cvInf_;
210
211 double pressure_cold(const double v) const
212 {
213 const auto ratio = v / v0_;
214
215 auto cold_curve = std::pow(ratio, -capB_ - 1.) - 1.;
216 cold_curve *= capA_ * capB_;
217 return cold_curve;
218 }
219 };
220 } // namespace EquationsOfState
221} // 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_internal_energy(double rho, double p) const final
double specific_entropy(double rho, double e) const final
double speed_of_sound(double rho, double e) const final
double temperature(double rho, double e) const final
double pressure(double rho, double e) const final