ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
wave_speed_estimator.template.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2025 - 2026 by the ryujin authors
4//
5
6#pragma once
7
9
10#include <newton.h>
11#include <simd.h>
12
13// #define DEBUG_WAVE_SPEED_ESTIMATOR
14
15namespace ryujin
16{
17 namespace EulerBarotropic
18 {
19 template <int dim, typename Number>
21 const primitive_type &riemann_data_i,
22 const primitive_type &riemann_data_j) const
23 {
24 const auto &[u_i, a_i] = riemann_data_i;
25 const auto &[u_j, a_j] = riemann_data_j;
26
27#ifdef DEBUG_WAVE_SPEED_ESTIMATOR
28 std::cout << "u_left: " << u_i << std::endl;
29 std::cout << "a_left: " << a_i << std::endl;
30 std::cout << "u_right: " << u_j << std::endl;
31 std::cout << "a_right: " << a_j << std::endl;
32#endif
33
34 const Number lambda_max =
35 std::max(std::abs(u_i) + a_i, std::abs(u_j) + a_j);
36 return lambda_max;
37 }
38
39
40 template <int dim, typename Number>
41 DEAL_II_ALWAYS_INLINE inline Number
43 const PrecomputedVectorView &pv,
44 const state_type &U_i,
45 const state_type &U_j,
46 const unsigned int i,
47 const unsigned int *js,
48 const dealii::Tensor<1, dim, Number> &n_ij) const
49 {
50 const auto &[e_i, p_i, a_i] =
51 pv.template read_tensor<Number, precomputed_type>(i);
52
53 const auto &[e_j, p_j, a_j] =
54 pv.template read_tensor<Number, precomputed_type>(js);
55
56 const auto rho_i = view_.density(U_i);
57 const auto rho_i_inverse = Number(1.0) / rho_i;
58 const auto m_i = view_.momentum(U_i);
59 const auto u_i = rho_i_inverse * n_ij * m_i;
60
61 const auto rho_j = view_.density(U_j);
62 const auto rho_j_inverse = Number(1.0) / rho_j;
63 const auto m_j = view_.momentum(U_j);
64 const auto u_j = rho_j_inverse * n_ij * m_j;
65
66 return compute(primitive_type{u_i, a_i}, primitive_type{u_j, a_j});
67 }
68 } // namespace EulerBarotropic
69} // namespace ryujin
typename std::array< Number, riemann_data_size > primitive_type
typename View::PrecomputedVectorView PrecomputedVectorView
Number compute(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const