8#include <compile_time_options.h>
21 template <
int dim,
typename Number>
22 DEAL_II_ALWAYS_INLINE
inline Number
24 const Number p_star)
const
26 const auto &[rho, u, p, a] = riemann_data;
27 const auto gamma = hyperbolic_system.gamma();
29 const Number Az =
ScalarNumber(2.) / (rho * (gamma + Number(1.)));
32 const Number radicand = Az / (p_star + Bz);
33 const Number true_value = (p_star - p) * std::sqrt(radicand);
37 const Number factor =
ryujin::pow(p_star / p, exponent) - Number(1.);
38 const auto false_value =
41 return dealii::compare_and_apply_mask<
42 dealii::SIMDComparison::greater_than_or_equal>(
43 p_star, p, true_value, false_value);
47 template <
int dim,
typename Number>
48 DEAL_II_ALWAYS_INLINE
inline Number
51 const Number p_in)
const
53 const Number &u_i = riemann_data_i[1];
54 const Number &u_j = riemann_data_j[1];
56 return f(riemann_data_i, p_in) + f(riemann_data_j, p_in) + u_j - u_i;
72 template <
int dim,
typename Number>
73 DEAL_II_ALWAYS_INLINE
inline Number
78 const auto &[rho_i, u_i, p_i, a_i] = riemann_data_i;
79 const auto &[rho_j, u_j, p_j, a_j] = riemann_data_j;
81 const Number p_max = std::max(p_i, p_j);
83 const auto gamma = hyperbolic_system.gamma();
85 const Number radicand_inverse_i =
ScalarNumber(0.5) * rho_i *
89 const Number value_i = (p_max - p_i) / std::sqrt(radicand_inverse_i);
91 const Number radicand_inverse_j =
ScalarNumber(0.5) * rho_j *
95 const Number value_j = (p_max - p_j) / std::sqrt(radicand_inverse_j);
97 return value_i + value_j + u_j - u_i;
113 template <
int dim,
typename Number>
114 DEAL_II_ALWAYS_INLINE
inline Number
118 const auto &[rho, u, p, a] = riemann_data;
121 const auto gamma = hyperbolic_system.gamma();
122 const auto gamma_inverse = hyperbolic_system.gamma_inverse();
127 return u - a * std::sqrt(
ScalarNumber(1.0) + factor * tmp);
136 template <
int dim,
typename Number>
137 DEAL_II_ALWAYS_INLINE
inline Number
141 const auto &[rho, u, p, a] = primitive_state;
144 const auto gamma = hyperbolic_system.gamma();
145 const auto gamma_inverse = hyperbolic_system.gamma_inverse();
146 const Number factor =
149 return u + a * std::sqrt(Number(1.0) + factor * tmp);
164 template <
int dim,
typename Number>
165 DEAL_II_ALWAYS_INLINE
inline Number
169 const Number p_star)
const
171 const Number nu_11 = lambda1_minus(riemann_data_i, p_star);
172 const Number nu_32 = lambda3_plus(riemann_data_j, p_star);
186 template <
int dim,
typename Number>
187 DEAL_II_ALWAYS_INLINE
inline Number
192 const auto &[rho_i, u_i, p_i, a_i] = riemann_data_i;
193 const auto &[rho_j, u_j, p_j, a_j] = riemann_data_j;
203 const auto &gamma = hyperbolic_system.gamma();
213 const auto &gamma_inverse = hyperbolic_system.gamma_inverse();
214 const auto &gm1_inverse = hyperbolic_system.gamma_minus_one_inverse();
216 const Number numerator =
positive_part(a_i + a_j - factor * (u_j - u_i));
217 const Number denominator =
218 a_i *
ryujin::pow(p_i * inv_p_j, -factor * gamma_inverse) + a_j;
220 const auto exponent =
ScalarNumber(2.0) * gamma * gm1_inverse;
222 const auto p_1_tilde =
223 p_j *
ryujin::pow(numerator / denominator, exponent);
225#ifdef DEBUG_RIEMANN_SOLVER
226 std::cout <<
"p_star_two_rarefaction = " << p_1_tilde << std::endl;
240 template <
int dim,
typename Number>
241 DEAL_II_ALWAYS_INLINE
inline Number
246 const auto &[rho_i, u_i, p_i, a_i] = riemann_data_i;
247 const auto &[rho_j, u_j, p_j, a_j] = riemann_data_j;
249 const auto &gamma = hyperbolic_system.gamma();
257 const Number p_max = std::max(p_i, p_j);
261 rho_i * ((gamma + Number(1.)) * p_max + (gamma - Number(1.)) * p_i);
263 const Number x_i = std::sqrt(radicand_i);
267 rho_j * ((gamma + Number(1.)) * p_max + (gamma - Number(1.)) * p_j);
269 const Number x_j = std::sqrt(radicand_j);
271 const Number a = x_i + x_j;
272 const Number b = u_j - u_i;
273 const Number c = -p_i * x_i - p_j * x_j;
275 const Number base = (-b + std::sqrt(b * b -
ScalarNumber(4.) * a * c)) /
277 const Number p_2_tilde = base * base;
279#ifdef DEBUG_RIEMANN_SOLVER
280 std::cout <<
"p_star_failsafe = " << p_2_tilde << std::endl;
286 template <
int dim,
typename Number>
338 const auto &[rho_i, u_i, p_i, a_i] = riemann_data_i;
339 const auto &[rho_j, u_j, p_j, a_j] = riemann_data_j;
341#ifdef DEBUG_RIEMANN_SOLVER
342 std::cout <<
"rho_left: " << rho_i << std::endl;
343 std::cout <<
"u_left: " << u_i << std::endl;
344 std::cout <<
"p_left: " << p_i << std::endl;
345 std::cout <<
"a_left: " << a_i << std::endl;
346 std::cout <<
"rho_right: " << rho_j << std::endl;
347 std::cout <<
"u_right: " << u_j << std::endl;
348 std::cout <<
"p_right: " << p_j << std::endl;
349 std::cout <<
"a_right: " << a_j << std::endl;
352 const Number p_max = std::max(p_i, p_j);
354 const Number rarefaction =
355 p_star_two_rarefaction(riemann_data_i, riemann_data_j);
356 const Number failsafe = p_star_failsafe(riemann_data_i, riemann_data_j);
357 const Number p_star_tilde = std::min(rarefaction, failsafe);
359 const Number phi_p_max = phi_of_p_max(riemann_data_i, riemann_data_j);
362 dealii::compare_and_apply_mask<dealii::SIMDComparison::less_than>(
366 std::min(p_max, p_star_tilde));
368#ifdef DEBUG_RIEMANN_SOLVER
369 std::cout <<
" p^*_tilde = " << p_2 <<
"\n";
370 std::cout <<
" phi(p_*_t) = "
371 << phi(riemann_data_i, riemann_data_j, p_2) <<
"\n";
372 std::cout <<
"-> lambda_max = "
373 << compute_lambda(riemann_data_i, riemann_data_j, p_2)
377 return compute_lambda(riemann_data_i, riemann_data_j, p_2);
Number phi_of_p_max(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
Number compute_lambda(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j, const Number p_star) const
Number lambda1_minus(const primitive_type &riemann_data, const Number p_star) const
Number p_star_two_rarefaction(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
Number compute(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
std::array< Number, riemann_data_size > primitive_type
Number p_star_failsafe(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
typename HyperbolicSystemView::ScalarNumber ScalarNumber
Number lambda3_plus(const primitive_type &primitive_state, const Number p_star) const
std::array< Number, riemann_data_size > primitive_type
typename get_value_type< Number >::type ScalarNumber
T pow(const T x, const T b)
DEAL_II_ALWAYS_INLINE Number negative_part(const Number number)
DEAL_II_ALWAYS_INLINE Number positive_part(const Number number)