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