ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
equation_of_state.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2023 by the ryujin authors
4//
5
6#pragma once
7
8#include <compile_time_options.h>
9
10#include "convenience_macros.h"
11
12#include <deal.II/base/array_view.h>
13#include <deal.II/base/exceptions.h>
14#include <deal.II/base/parameter_acceptor.h>
15#include <deal.II/base/tensor.h>
16
17#include <string>
18
19namespace ryujin
20{
21 namespace EquationOfStateLibrary
22 {
29 class EquationOfState : public dealii::ParameterAcceptor
30 {
31 public:
37 EquationOfState(const std::string &name, const std::string &subsection)
38 : ParameterAcceptor(subsection + "/" + name)
39 , name_(name)
40 {
41 /*
42 * If necessary derived EOS can override the covolume b that is
43 * used in the interpolatory NASG eos.
44 */
46
47 /*
48 * If necessary derived EOS can override the reference pressure
49 * that is used in the interpolatory NASG eos.
50 */
52
53 /*
54 * If necessary derived EOS can override the reference specific
55 * internal energy q that is used in the interpolatory NASG eos.
56 */
58
59 /*
60 * If necessary derived EOS can override this boolean to indicate
61 * that the dealii::ArrayView<double> variants of the pressure()
62 * function (etc.) should be preferred.
63 */
65 }
66
71 virtual double pressure(double rho, double e) const = 0;
72
83 virtual void pressure(const dealii::ArrayView<double> &p,
84 const dealii::ArrayView<double> &rho,
85 const dealii::ArrayView<double> &e) const
86 {
87 Assert(p.size() == rho.size() && rho.size() == e.size(),
88 dealii::ExcMessage("vectors have different size"));
89
90 std::transform(std::begin(rho),
91 std::end(rho),
92 std::begin(e),
93 std::begin(p),
94 [&](double rho, double e) { return pressure(rho, e); });
95 }
96
101 virtual double specific_internal_energy(double rho, double p) const = 0;
102
113 virtual void
114 specific_internal_energy(const dealii::ArrayView<double> &e,
115 const dealii::ArrayView<double> &rho,
116 const dealii::ArrayView<double> &p) const
117 {
118 Assert(p.size() == rho.size() && rho.size() == e.size(),
119 dealii::ExcMessage("vectors have different size"));
120
121 std::transform(std::begin(rho),
122 std::end(rho),
123 std::begin(p),
124 std::begin(e),
125 [&](double rho, double p) {
126 return specific_internal_energy(rho, p);
127 });
128 }
129
134 virtual double temperature(double rho, double e) const = 0;
135
146 virtual void temperature(const dealii::ArrayView<double> &T,
147 const dealii::ArrayView<double> &rho,
148 const dealii::ArrayView<double> &e) const
149 {
150 Assert(T.size() == rho.size() && rho.size() == e.size(),
151 dealii::ExcMessage("vectors have different size"));
152
153 std::transform(
154 std::begin(rho),
155 std::end(rho),
156 std::begin(e),
157 std::begin(T),
158 [&](double rho, double e) { return temperature(rho, e); });
159 }
160
165 virtual double speed_of_sound(double rho, double e) const = 0;
166
177 virtual void speed_of_sound(const dealii::ArrayView<double> &c,
178 const dealii::ArrayView<double> &rho,
179 const dealii::ArrayView<double> &e) const
180 {
181 Assert(c.size() == rho.size() && rho.size() == e.size(),
182 dealii::ExcMessage("vectors have different size"));
183
184 std::transform(
185 std::begin(rho),
186 std::end(rho),
187 std::begin(e),
188 std::begin(c),
189 [&](double rho, double e) { return speed_of_sound(rho, e); });
190 }
191
195 ACCESSOR_READ_ONLY(interpolation_b)
196
197
200 ACCESSOR_READ_ONLY(interpolation_pinfty)
201
202
205 ACCESSOR_READ_ONLY(interpolation_q)
206
207
218 ACCESSOR_READ_ONLY(prefer_vector_interface)
219
220
224
225 protected:
230
231 private:
232 const std::string name_;
233 };
234
235 } // namespace EquationOfStateLibrary
236} /* namespace ryujin */
virtual double specific_internal_energy(double rho, double p) const =0
virtual void pressure(const dealii::ArrayView< double > &p, const dealii::ArrayView< double > &rho, const dealii::ArrayView< double > &e) const
virtual double pressure(double rho, double e) const =0
virtual void specific_internal_energy(const dealii::ArrayView< double > &e, const dealii::ArrayView< double > &rho, const dealii::ArrayView< double > &p) const
virtual void speed_of_sound(const dealii::ArrayView< double > &c, const dealii::ArrayView< double > &rho, const dealii::ArrayView< double > &e) const
virtual double speed_of_sound(double rho, double e) const =0
virtual double temperature(double rho, double e) const =0
EquationOfState(const std::string &name, const std::string &subsection)
virtual void temperature(const dealii::ArrayView< double > &T, const dealii::ArrayView< double > &rho, const dealii::ArrayView< double > &e) const
#define ACCESSOR_READ_ONLY(member)