10#include <compile_time_options.h>
19#include <deal.II/base/parameter_acceptor.h>
20#include <deal.II/base/tensor.h>
36 template <
typename Number>
37 DEAL_II_ALWAYS_INLINE
inline Number
safe_division(
const Number &numerator,
38 const Number &denominator)
41 constexpr ScalarNumber
min = std::numeric_limits<ScalarNumber>::min();
43 return std::max(numerator, Number(0.)) /
44 std::max(denominator, Number(
min));
48 template <
int dim,
typename Number>
70 "Compressible Euler equations (arbitrary EOS)";
83 template <
int dim,
typename Number>
95 std::string equation_of_state_;
96 double reference_density_;
97 double vacuum_state_relaxation_small_;
98 double vacuum_state_relaxation_large_;
99 bool compute_strict_bounds_;
102 equation_of_state_list_;
105 std::shared_ptr<EquationOfState> selected_equation_of_state_;
107 template <
int dim,
typename Number>
129 template <
int dim,
typename Number>
138 : hyperbolic_system_(hyperbolic_system)
145 template <
int dim2,
typename Number2>
163 return hyperbolic_system_.equation_of_state_;
168 return hyperbolic_system_.reference_density_;
174 return hyperbolic_system_.vacuum_state_relaxation_small_;
180 return hyperbolic_system_.vacuum_state_relaxation_large_;
185 return hyperbolic_system_.compute_strict_bounds_;
199 const Number &e)
const
201 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
203 if constexpr (std::is_same_v<ScalarNumber, Number>) {
207 for (
unsigned int k = 0; k < Number::size(); ++k) {
218 DEAL_II_ALWAYS_INLINE
inline Number
221 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
223 if constexpr (std::is_same_v<ScalarNumber, Number>) {
224 return ScalarNumber(eos->specific_internal_energy(rho, p));
227 for (
unsigned int k = 0; k < Number::size(); ++k) {
228 e[k] =
ScalarNumber(eos->specific_internal_energy(rho[k], p[k]));
239 const Number &e)
const
241 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
243 if constexpr (std::is_same_v<ScalarNumber, Number>) {
247 for (
unsigned int k = 0; k < Number::size(); ++k) {
258 DEAL_II_ALWAYS_INLINE
inline Number
261 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
263 if constexpr (std::is_same_v<ScalarNumber, Number>) {
267 for (
unsigned int k = 0; k < Number::size(); ++k) {
279 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
288 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
298 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
338 using state_type = dealii::Tensor<1, problem_dimension, Number>;
344 dealii::Tensor<1, problem_dimension, dealii::Tensor<1, dim, Number>>;
356 []() -> std::array<std::string, problem_dimension> {
357 if constexpr (dim == 1)
358 return {
"rho",
"m",
"E"};
359 else if constexpr (dim == 2)
360 return {
"rho",
"m_1",
"m_2",
"E"};
361 else if constexpr (dim == 3)
362 return {
"rho",
"m_1",
"m_2",
"m_3",
"E"};
371 []() -> std::array<std::string, problem_dimension> {
372 if constexpr (dim == 1)
373 return {
"rho",
"v",
"e"};
374 else if constexpr (dim == 2)
375 return {
"rho",
"v_1",
"v_2",
"e"};
376 else if constexpr (dim == 3)
377 return {
"rho",
"v_1",
"v_2",
"v_3",
"e"};
395 std::array<std::string, n_precomputed_values>{
397 "surrogate_gamma_min",
398 "surrogate_specific_entropy",
399 "surrogate_harten_entropy"}};
410 std::array<Number, n_initial_precomputed_values>;
416 std::array<std::string, n_initial_precomputed_values>{};
422 StateVector<ScalarNumber, problem_dimension, n_precomputed_values>;
459 template <
typename DISPATCH,
typename SPARSITY>
461 const DISPATCH &dispatch_check,
462 const SPARSITY &sparsity_simd,
465 unsigned int right)
const;
530 const Number &gamma_min)
const;
543 const Number &gamma_min)
const;
558 const Number &gamma_min)
const;
599 const Number &gamma)
const;
620 template <
int component>
626 const dealii::Tensor<1, dim, Number> &normal)
const;
646 template <
typename Lambda>
650 const dealii::Tensor<1, dim, Number> &normal,
651 const Lambda &get_dirichlet_data)
const;
693 const unsigned int i,
699 const unsigned int *js,
709 const dealii::Tensor<1, dim, Number> &c_ij)
const;
719 const dealii::Tensor<1, dim, Number> &c_ij)
const =
delete;
730 const unsigned int i,
735 const unsigned int *js,
755 template <
typename ST>
770 template <
typename ST>
790 template <
typename Lambda>
792 const Lambda &lambda)
const;
805 const std::string &subsection )
806 : ParameterAcceptor(subsection)
808 equation_of_state_ =
"polytropic gas";
812 "The equation of state. Valid names are given by any of the "
813 "subsections defined below");
815 compute_strict_bounds_ =
true;
817 "compute strict bounds",
818 compute_strict_bounds_,
819 "Compute strict, but significantly more expensive bounds at various "
820 "places: (a) an expensive, but better upper wavespeed estimate in "
821 "the approximate RiemannSolver; (b) entropy viscosity-commutator "
822 "with correct gamma_min over the stencil; (c) mathematically correct "
823 "surrogate specific entropy minimum with gamma_min over the "
826 reference_density_ = 1.;
827 add_parameter(
"reference density",
829 "Problem specific density reference");
831 vacuum_state_relaxation_small_ = 1.e2;
832 add_parameter(
"vacuum state relaxation small",
833 vacuum_state_relaxation_small_,
834 "Problem specific vacuum relaxation parameter");
836 vacuum_state_relaxation_large_ = 1.e4;
837 add_parameter(
"vacuum state relaxation large",
838 vacuum_state_relaxation_large_,
839 "Problem specific vacuum relaxation parameter");
846 equation_of_state_list_, subsection);
848 const auto populate_functions = [
this]() {
849 bool initialized =
false;
850 for (
auto &it : equation_of_state_list_)
853 if (it->name() == equation_of_state_) {
854 selected_equation_of_state_ = it;
856 "Compressible Euler equations (" + it->name() +
" EOS)";
864 "Could not find an equation of state description with name \"" +
865 equation_of_state_ +
"\""));
868 ParameterAcceptor::parse_parameters_call_back.connect(populate_functions);
869 populate_functions();
873 template <
int dim,
typename Number>
874 template <
typename DISPATCH,
typename SPARSITY>
875 DEAL_II_ALWAYS_INLINE
inline void
877 unsigned int cycle [[maybe_unused]],
878 const DISPATCH &dispatch_check,
879 const SPARSITY &sparsity_simd,
882 unsigned int right)
const
884 Assert(cycle == 0 || cycle == 1, dealii::ExcInternalError());
886 const auto &U = std::get<0>(state_vector);
887 auto &precomputed = std::get<1>(state_vector);
891 const auto &eos = hyperbolic_system_.selected_equation_of_state_;
892 unsigned int stride_size = get_stride_size<Number>;
895 if (eos->prefer_vector_interface()) {
900 const auto offset = left;
901 const auto size = right - left;
903 static std::vector<double> p;
904 static std::vector<double> rho;
905 static std::vector<double> e;
914 for (
unsigned int i = 0; i < size; i += stride_size) {
915 const auto U_i = U.template get_tensor<Number>(offset + i);
916 const auto rho_i = density(U_i);
917 const auto e_i = internal_energy(U_i) / rho_i;
923 write_entry<Number>(rho, rho_i, i);
924 write_entry<Number>(e, e_i, i);
930 eos->pressure(p, rho, e);
934 for (
unsigned int i = 0; i < size; i += stride_size) {
936 const unsigned int row_length = sparsity_simd.row_length(i);
943 const auto U_i = U.template get_tensor<Number>(offset + i);
944 const auto p_i = get_entry<Number>(p, i);
945 const auto gamma_i = surrogate_gamma(U_i, p_i);
946 const PT prec_i{p_i, gamma_i, Number(0.), Number(0.)};
947 precomputed.template write_tensor<Number>(prec_i, offset + i);
956 for (
unsigned int i = left; i < right; i += stride_size) {
958 const unsigned int row_length = sparsity_simd.row_length(i);
964 const auto U_i = U.template get_tensor<Number>(i);
965 const auto rho_i = density(U_i);
966 const auto e_i = internal_energy(U_i) / rho_i;
967 const auto p_i = eos_pressure(rho_i, e_i);
969 const auto gamma_i = surrogate_gamma(U_i, p_i);
971 const PT prec_i{p_i, gamma_i, Number(0.), Number(0.)};
972 precomputed.template write_tensor<Number>(prec_i, i);
979 for (
unsigned int i = left; i < right; i += stride_size) {
983 const unsigned int row_length = sparsity_simd.row_length(i);
989 const auto U_i = U.template get_tensor<Number>(i);
990 auto prec_i = precomputed.template get_tensor<Number, PT>(i);
991 auto &[p_i, gamma_min_i, s_i, eta_i] = prec_i;
993 const unsigned int *js = sparsity_simd.columns(i) + stride_size;
994 for (
unsigned int col_idx = 1; col_idx < row_length;
995 ++col_idx, js += stride_size) {
997 const auto U_j = U.template get_tensor<Number>(js);
998 const auto prec_j = precomputed.template get_tensor<Number, PT>(js);
999 auto &[p_j, gamma_min_j, s_j, eta_j] = prec_j;
1000 const auto gamma_j = surrogate_gamma(U_j, p_j);
1001 gamma_min_i = std::min(gamma_min_i, gamma_j);
1004 s_i = surrogate_specific_entropy(U_i, gamma_min_i);
1005 eta_i = surrogate_harten_entropy(U_i, gamma_min_i);
1006 precomputed.template write_tensor<Number>(prec_i, i);
1012 template <
int dim,
typename Number>
1013 DEAL_II_ALWAYS_INLINE
inline Number
1020 template <
int dim,
typename Number>
1021 DEAL_II_ALWAYS_INLINE
inline Number
1023 const Number &rho)
const
1025 constexpr ScalarNumber eps = std::numeric_limits<ScalarNumber>::epsilon();
1026 const Number rho_cutoff_large =
1027 reference_density() * vacuum_state_relaxation_large() * eps;
1029 return dealii::compare_and_apply_mask<dealii::SIMDComparison::less_than>(
1030 std::abs(rho), rho_cutoff_large, Number(0.), rho);
1034 template <
int dim,
typename Number>
1035 DEAL_II_ALWAYS_INLINE
inline dealii::Tensor<1, dim, Number>
1038 dealii::Tensor<1, dim, Number> result;
1039 for (
unsigned int i = 0; i < dim; ++i)
1040 result[i] = U[1 + i];
1045 template <
int dim,
typename Number>
1046 DEAL_II_ALWAYS_INLINE
inline Number
1053 template <
int dim,
typename Number>
1054 DEAL_II_ALWAYS_INLINE
inline Number
1060 const Number rho_inverse =
ScalarNumber(1.) / density(U);
1061 const auto m = momentum(U);
1062 const Number E = total_energy(U);
1063 return E -
ScalarNumber(0.5) * m.norm_square() * rho_inverse;
1067 template <
int dim,
typename Number>
1068 DEAL_II_ALWAYS_INLINE
inline auto
1079 const Number rho_inverse =
ScalarNumber(1.) / density(U);
1080 const auto u = momentum(U) * rho_inverse;
1085 for (
unsigned int i = 0; i < dim; ++i) {
1086 result[1 + i] = -u[i];
1094 template <
int dim,
typename Number>
1095 DEAL_II_ALWAYS_INLINE
inline Number
1097 const state_type &U,
const Number &gamma_min)
const
1099 const auto b = Number(eos_interpolation_b());
1100 const auto pinf = Number(eos_interpolation_pinfty());
1101 const auto q = Number(eos_interpolation_q());
1103 const auto rho = density(U);
1106 const auto covolume = Number(1.) - b * rho;
1108 const auto shift = internal_energy(U) - rho * q - pinf * covolume;
1110 return shift *
ryujin::pow(rho_inverse - b, gamma_min) / covolume;
1114 template <
int dim,
typename Number>
1115 DEAL_II_ALWAYS_INLINE
inline Number
1117 const state_type &U,
const Number &gamma_min)
const
1119 const auto b = Number(eos_interpolation_b());
1120 const auto pinf = Number(eos_interpolation_pinfty());
1121 const auto q = Number(eos_interpolation_q());
1123 const auto rho = density(U);
1124 const auto m = momentum(U);
1125 const auto E = total_energy(U);
1126 const auto rho_rho_e_q =
1127 rho * E -
ScalarNumber(0.5) * m.norm_square() - rho * rho * q;
1129 const auto exponent =
ScalarNumber(1.) / (gamma_min + Number(1.));
1131 const auto covolume = Number(1.) - b * rho;
1132 const auto covolume_term =
ryujin::pow(covolume, gamma_min - Number(1.));
1134 const auto rho_pinfcov = rho * pinf * covolume;
1137 positive_part(rho_rho_e_q - rho_pinfcov) * covolume_term, exponent);
1141 template <
int dim,
typename Number>
1142 DEAL_II_ALWAYS_INLINE
inline auto
1144 const state_type &U,
const Number &eta,
const Number &gamma_min)
const
1161 const auto b = Number(eos_interpolation_b());
1162 const auto pinf = Number(eos_interpolation_pinfty());
1163 const auto q = Number(eos_interpolation_q());
1165 const auto rho = density(U);
1166 const auto m = momentum(U);
1167 const auto E = total_energy(U);
1169 const auto covolume = Number(1.) - b * rho;
1170 const auto covolume_inverse =
ScalarNumber(1.) / covolume;
1172 const auto shift = rho * E -
ScalarNumber(0.5) * m.norm_square() -
1173 rho * rho * q - rho * pinf * covolume;
1175 constexpr auto eps = std::numeric_limits<ScalarNumber>::epsilon();
1176 const auto regularization = m.norm() * eps;
1179 std::max(regularization, eta * covolume_inverse), -gamma_min);
1180 factor *= fixed_power<2>(covolume_inverse) / (gamma_min + Number(1.));
1184 const auto first_term = E -
ScalarNumber(2.) * rho * q -
1186 const auto second_term = -(gamma_min - Number(1.)) * shift * b;
1188 result[0] = factor * (covolume * first_term + second_term);
1189 for (
unsigned int i = 0; i < dim; ++i)
1190 result[1 + i] = -factor * covolume * m[i];
1191 result[dim + 1] = factor * covolume * rho;
1197 template <
int dim,
typename Number>
1198 DEAL_II_ALWAYS_INLINE
inline Number
1200 const Number &p)
const
1202 const auto b = Number(eos_interpolation_b());
1203 const auto pinf = Number(eos_interpolation_pinfty());
1204 const auto q = Number(eos_interpolation_q());
1206 const auto rho = density(U);
1207 const auto rho_e = internal_energy(U);
1208 const auto covolume = Number(1.) - b * rho;
1210 const auto numerator = (p + pinf) * covolume;
1211 const auto denominator = rho_e - rho * q - covolume * pinf;
1216 template <
int dim,
typename Number>
1217 DEAL_II_ALWAYS_INLINE
inline Number
1219 const state_type &U,
const Number &gamma)
const
1221 const auto b = Number(eos_interpolation_b());
1222 const auto pinf = Number(eos_interpolation_pinfty());
1223 const auto q = Number(eos_interpolation_q());
1225 const auto rho = density(U);
1226 const auto rho_e = internal_energy(U);
1227 const auto covolume = Number(1.) - b * rho;
1235 template <
int dim,
typename Number>
1236 DEAL_II_ALWAYS_INLINE
inline Number
1238 const state_type &U,
const Number &gamma)
const
1240 const auto b = Number(eos_interpolation_b());
1241 const auto pinf = Number(eos_interpolation_pinfty());
1242 const auto q = Number(eos_interpolation_q());
1244 const auto rho = density(U);
1245 const auto rho_e = internal_energy(U);
1246 const auto covolume = Number(1.) - b * rho;
1249 (rho_e - rho * q - pinf * covolume) / (covolume * covolume * rho);
1250 radicand *= gamma * (gamma - 1.);
1255 template <
int dim,
typename Number>
1256 DEAL_II_ALWAYS_INLINE
inline bool
1259 const auto b = Number(eos_interpolation_b());
1260 const auto pinf = Number(eos_interpolation_pinfty());
1261 const auto q = Number(eos_interpolation_q());
1263 const auto rho = density(U);
1264 const auto rho_e = internal_energy(U);
1265 const auto covolume = Number(1.) - b * rho;
1267 const auto shift = rho_e - rho * q - pinf * covolume;
1269 constexpr auto gt = dealii::SIMDComparison::greater_than;
1272 dealii::compare_and_apply_mask<gt>(rho, T(0.), T(0.), T(-1.)) +
1273 dealii::compare_and_apply_mask<gt>(shift, T(0.), T(0.), T(-1.));
1276 if (!(test == Number(0.))) {
1277 std::cout << std::fixed << std::setprecision(16);
1278 std::cout <<
"Bounds violation: Negative state [rho, e] detected!\n";
1279 std::cout <<
"\t\trho: " << rho <<
"\n";
1280 std::cout <<
"\t\tint (shifted): " << shift <<
"\n";
1284 return (test == Number(0.));
1288 template <
int dim,
typename Number>
1289 template <
int component>
1290 DEAL_II_ALWAYS_INLINE
inline auto
1295 const Number &p_bar,
1296 const dealii::Tensor<1, dim, Number> &normal)
const ->
state_type
1298 static_assert(component == 1 || component == 2,
1299 "component has to be 1 or 2");
1301 const auto b = Number(eos_interpolation_b());
1302 const auto pinf = Number(eos_interpolation_pinfty());
1303 const auto q = Number(eos_interpolation_q());
1315 const auto m = momentum(U);
1316 const auto rho = density(U);
1317 const auto vn = m * normal / rho;
1319 const auto gamma = surrogate_gamma(U, p);
1320 const auto a = surrogate_speed_of_sound(U, gamma);
1321 const auto covolume = 1. - b * rho;
1323 const auto m_bar = momentum(U_bar);
1324 const auto rho_bar = density(U_bar);
1325 const auto vn_bar = m_bar * normal / rho_bar;
1327 const auto gamma_bar = surrogate_gamma(U_bar, p_bar);
1328 const auto a_bar = surrogate_speed_of_sound(U_bar, gamma_bar);
1329 const auto covolume_bar = 1. - b * rho_bar;
1342 component == 1 ? vn_bar - 2. * a_bar / (gamma_bar - 1.) * covolume_bar
1343 : vn - 2. * a / (gamma - 1.) * covolume;
1346 component == 2 ? vn_bar + 2. * a_bar / (gamma_bar - 1.) * covolume_bar
1347 : vn + 2. * a / (gamma - 1.) * covolume;
1356 dealii::ExcMessage(
"Encountered R_2 < R_1 in dynamic boundary value "
1357 "enforcement. This implies that the interpolation "
1358 "with Riemann characteristics failed."));
1360 const auto vperp = m / rho - vn * normal;
1362 const auto S = (p + pinf) *
ryujin::pow(Number(1.) / rho - b, gamma);
1379 const auto vn_new = Number(0.5) * (R_1 + R_2);
1409 const auto a_new_square =
1410 ryujin::fixed_power<2>((gamma - 1.) * (R_2 - R_1) / (4. * covolume));
1412 auto term =
ryujin::pow(a_new_square / (gamma * S), 1. / (gamma - 1.));
1414 term *=
std::pow(covolume, 2. / (gamma - 1.));
1417 const auto rho_new = term / (1. + b * term);
1419 const auto covolume_new = (1. - b * rho_new);
1420 const auto p_new = a_new_square / gamma * rho_new * covolume_new - pinf;
1426 const auto rho_e_new =
1427 rho_new * q + (p_new + gamma * pinf) * covolume_new / (gamma - 1.);
1431 for (
unsigned int d = 0; d < dim; ++d) {
1432 U_new[1 + d] = rho_new * (vn_new * normal + vperp)[d];
1435 rho_e_new + 0.5 * rho_new * (vn_new * vn_new + vperp.norm_square());
1441 template <
int dim,
typename Number>
1442 template <
typename Lambda>
1443 DEAL_II_ALWAYS_INLINE
inline auto
1445 dealii::types::boundary_id
id,
1447 const dealii::Tensor<1, dim, Number> &normal,
1448 const Lambda &get_dirichlet_data)
const ->
state_type
1453 result = get_dirichlet_data();
1457 auto m_dirichlet = momentum(get_dirichlet_data());
1458 for (
unsigned int k = 0; k < dim; ++k)
1459 result[k + 1] = m_dirichlet[k];
1462 auto m = momentum(U);
1463 m -= 1. * (m * normal) * normal;
1464 for (
unsigned int k = 0; k < dim; ++k)
1465 result[k + 1] = m[k];
1468 for (
unsigned int k = 0; k < dim; ++k)
1469 result[k + 1] = Number(0.);
1484 const auto m = momentum(U);
1485 const auto rho = density(U);
1486 const auto rho_e = internal_energy(U);
1493 const auto p = eos_pressure(rho, rho_e / rho);
1494 const auto gamma = surrogate_gamma(U, p);
1495 const auto a = surrogate_speed_of_sound(U, gamma);
1496 const auto vn = m * normal / rho;
1500 result = get_dirichlet_data();
1504 if (vn >= -a && vn <= 0.) {
1505 const auto U_dirichlet = get_dirichlet_data();
1506 const auto rho_dirichlet = density(U_dirichlet);
1507 const auto rho_e_dirichlet = internal_energy(U_dirichlet);
1508 const auto p_dirichlet =
1509 eos_pressure(rho_dirichlet, rho_e_dirichlet / rho_dirichlet);
1511 result = prescribe_riemann_characteristic<2>(
1512 U_dirichlet, p_dirichlet, U, p, normal);
1516 if (vn > 0. && vn <= a) {
1517 const auto U_dirichlet = get_dirichlet_data();
1518 const auto rho_dirichlet = density(U_dirichlet);
1519 const auto rho_e_dirichlet = internal_energy(U_dirichlet);
1520 const auto p_dirichlet =
1521 eos_pressure(rho_dirichlet, rho_e_dirichlet / rho_dirichlet);
1523 result = prescribe_riemann_characteristic<1>(
1524 U, p, U_dirichlet, p_dirichlet, normal);
1529 AssertThrow(
false, dealii::ExcNotImplemented());
1536 template <
int dim,
typename Number>
1537 DEAL_II_ALWAYS_INLINE
inline auto
1541 const auto rho_inverse =
ScalarNumber(1.) / density(U);
1542 const auto m = momentum(U);
1543 const auto E = total_energy(U);
1548 for (
unsigned int i = 0; i < dim; ++i) {
1549 result[1 + i] = m * (m[i] * rho_inverse);
1550 result[1 + i][i] += p;
1552 result[dim + 1] = m * (rho_inverse * (E + p));
1558 template <
int dim,
typename Number>
1559 DEAL_II_ALWAYS_INLINE
inline auto
1563 const unsigned int i,
1566 const auto &[p_i, gamma_min_i, s_i, eta_i] =
1567 pv.template get_tensor<Number, precomputed_type>(i);
1572 template <
int dim,
typename Number>
1573 DEAL_II_ALWAYS_INLINE
inline auto
1577 const unsigned int *js,
1580 const auto &[p_j, gamma_min_j, s_j, eta_j] =
1581 pv.template get_tensor<Number, precomputed_type>(js);
1586 template <
int dim,
typename Number>
1587 DEAL_II_ALWAYS_INLINE
inline auto
1591 const dealii::Tensor<1, dim, Number> &c_ij)
const ->
state_type
1597 template <
int dim,
typename Number>
1598 template <
typename ST>
1602 using T =
typename ST::value_type;
1603 static_assert(std::is_same_v<Number, T>,
"template mismatch");
1605 constexpr auto dim2 = ST::dimension - 2;
1606 static_assert(dim >= dim2,
1607 "the space dimension of the argument state must not be "
1608 "larger than the one of the target state");
1611 result[0] = state[0];
1612 result[dim + 1] = state[dim2 + 1];
1613 for (
unsigned int i = 1; i < dim2 + 1; ++i)
1614 result[i] = state[i];
1620 template <
int dim,
typename Number>
1621 template <
typename ST>
1622 DEAL_II_ALWAYS_INLINE
inline auto
1626 auto primitive_state = expand_state(initial_state);
1629 const auto rho = density(primitive_state);
1630 const auto p = total_energy(primitive_state);
1631 const auto e = eos_specific_internal_energy(rho, p);
1632 primitive_state[dim + 1] = e;
1634 return from_primitive_state(primitive_state);
1638 template <
int dim,
typename Number>
1639 DEAL_II_ALWAYS_INLINE
inline auto
1643 const auto rho = density(primitive_state);
1645 const auto u = momentum(primitive_state);
1647 const auto &e = total_energy(primitive_state);
1649 auto state = primitive_state;
1651 for (
unsigned int i = 1; i < dim + 1; ++i)
1655 state[dim + 1] = rho * e + Number(0.5) * rho * u * u;
1661 template <
int dim,
typename Number>
1662 DEAL_II_ALWAYS_INLINE
inline auto
1666 const auto rho = density(state);
1667 const auto rho_inverse = Number(1.) / rho;
1668 const auto rho_e = internal_energy(state);
1670 auto primitive_state = state;
1672 for (
unsigned int i = 1; i < dim + 1; ++i)
1673 primitive_state[i] *= rho_inverse;
1675 primitive_state[dim + 1] = rho_e * rho_inverse;
1677 return primitive_state;
1681 template <
int dim,
typename Number>
1682 template <
typename Lambda>
1686 auto result = state;
1687 const auto M = lambda(momentum(state));
1688 for (
unsigned int d = 0; d < dim; ++d)
1689 result[1 + d] = M[d];
dealii::Tensor< 1, problem_dimension, Number > state_type
Vectors::StateVector< ScalarNumber, problem_dimension, n_precomputed_values > StateVector
state_type from_initial_state(const ST &initial_state) const
std::array< Number, n_initial_precomputed_values > initial_precomputed_type
Number surrogate_harten_entropy(const state_type &U, const Number &gamma_min) const
flux_contribution_type flux_contribution(const PrecomputedVector &pv, const InitialPrecomputedVector &piv, const unsigned int i, const state_type &U_i) const
static Number internal_energy(const state_type &U)
state_type to_primitive_state(const state_type &state) const
state_type high_order_flux_divergence(const flux_contribution_type &flux_i, const flux_contribution_type &flux_j, const dealii::Tensor< 1, dim, Number > &c_ij) const =delete
static constexpr bool have_high_order_flux
typename get_value_type< Number >::type ScalarNumber
static dealii::Tensor< 1, dim, Number > momentum(const state_type &U)
Number surrogate_pressure(const state_type &U, const Number &gamma) const
Number surrogate_speed_of_sound(const state_type &U, const Number &gamma) const
DEAL_II_ALWAYS_INLINE const std::string & equation_of_state() const
DEAL_II_ALWAYS_INLINE ScalarNumber vacuum_state_relaxation_large() const
static constexpr unsigned int n_precomputed_values
DEAL_II_ALWAYS_INLINE ScalarNumber reference_density() const
static const auto component_names
state_type from_primitive_state(const state_type &primitive_state) const
void precomputation_loop(unsigned int cycle, const DISPATCH &dispatch_check, const SPARSITY &sparsity_simd, StateVector &state_vector, unsigned int left, unsigned int right) const
static constexpr bool have_eos_interpolation_b
static state_type internal_energy_derivative(const state_type &U)
DEAL_II_ALWAYS_INLINE Number eos_temperature(const Number &rho, const Number &e) const
DEAL_II_ALWAYS_INLINE ScalarNumber eos_interpolation_b() const
static constexpr bool have_source_terms
DEAL_II_ALWAYS_INLINE Number eos_pressure(const Number &rho, const Number &e) const
static constexpr unsigned int problem_dimension
flux_type flux_contribution_type
state_type nodal_source(const PrecomputedVector &pv, const unsigned int *js, const state_type &U_j, const ScalarNumber tau) const =delete
Number surrogate_specific_entropy(const state_type &U, const Number &gamma_min) const
static const auto precomputed_names
static const auto primitive_component_names
DEAL_II_ALWAYS_INLINE ScalarNumber eos_interpolation_pinfty() const
static Number total_energy(const state_type &U)
bool is_admissible(const state_type &U) const
DEAL_II_ALWAYS_INLINE bool compute_strict_bounds() const
state_type flux_divergence(const flux_contribution_type &flux_i, const flux_contribution_type &flux_j, const dealii::Tensor< 1, dim, Number > &c_ij) const
DEAL_II_ALWAYS_INLINE Number eos_specific_internal_energy(const Number &rho, const Number &p) const
static constexpr unsigned int n_precomputation_cycles
HyperbolicSystemView(const HyperbolicSystem &hyperbolic_system)
DEAL_II_ALWAYS_INLINE ScalarNumber eos_interpolation_q() const
Number filter_vacuum_density(const Number &rho) const
flux_type f(const state_type &U, const Number &p) const
state_type prescribe_riemann_characteristic(const state_type &U, const Number &p, const state_type &U_bar, const Number &p_bar, const dealii::Tensor< 1, dim, Number > &normal) const
state_type expand_state(const ST &state) const
std::array< Number, n_precomputed_values > precomputed_type
state_type surrogate_harten_entropy_derivative(const state_type &U, const Number &eta, const Number &gamma_min) const
static const auto initial_precomputed_names
DEAL_II_ALWAYS_INLINE ScalarNumber vacuum_state_relaxation_small() const
Number surrogate_gamma(const state_type &U, const Number &p) const
static constexpr unsigned int n_initial_precomputed_values
DEAL_II_ALWAYS_INLINE Number eos_speed_of_sound(const Number &rho, const Number &e) const
dealii::Tensor< 1, problem_dimension, dealii::Tensor< 1, dim, Number > > flux_type
static Number density(const state_type &U)
state_type apply_boundary_conditions(const dealii::types::boundary_id id, const state_type &U, const dealii::Tensor< 1, dim, Number > &normal, const Lambda &get_dirichlet_data) const
static constexpr bool have_gamma
state_type nodal_source(const PrecomputedVector &pv, const unsigned int i, const state_type &U_i, const ScalarNumber tau) const =delete
state_type apply_galilei_transform(const state_type &state, const Lambda &lambda) const
HyperbolicSystem(const std::string &subsection="/HyperbolicSystem")
static std::string problem_name
typename get_value_type< Number >::type ScalarNumber
dealii::Tensor< 1, problem_dimension, Number > state_type
std::array< Number, n_precomputed_values > precomputed_type
Vectors::StateVector< ScalarNumber, problem_dimension, n_precomputed_values > StateVector
void populate_equation_of_state_list(equation_of_state_list_type &equation_of_state_list, const std::string &subsection)
#define RYUJIN_OMP_SINGLE
T pow(const T x, const T b)
DEAL_II_ALWAYS_INLINE Number positive_part(const Number number)
std::set< std::shared_ptr< EquationOfState > > equation_of_state_list_type
DEAL_II_ALWAYS_INLINE Number safe_division(const Number &numerator, const Number &denominator)
DEAL_II_ALWAYS_INLINE FT add(const FT &flux_left_ij, const FT &flux_right_ij)
DEAL_II_ALWAYS_INLINE dealii::Tensor< 1, problem_dim, T > contract(const FT &flux_ij, const TT &c_ij)