Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
riemann_rusanov.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
20
22
23namespace shammath {
24
28 template<FluidStateSpec FSpec>
29 inline constexpr typename FSpec::Tcons rusanov_flux(
30 const FSpec &fspec,
31 const typename FSpec::Tprim &prim_l,
32 const typename FSpec::Tprim &prim_r,
33 const typename FSpec::Tvec &n) {
34 const auto cs_l = fspec.sound_speed(prim_l);
35 const auto cs_r = fspec.sound_speed(prim_r);
36
37 const auto vn_l = fspec.vn(prim_l, n);
38 const auto vn_r = fspec.vn(prim_r, n);
39
40 // NOLINTBEGIN(readability-identifier-naming)
41
42 // Equation (10.56) from Toro 3rd Edition , Springer 2009
43 const auto S = sham::max((sham::abs(vn_l) + cs_l), (sham::abs(vn_r) + cs_r));
44
45 // NOLINTEND(readability-identifier-naming)
46
47 const auto f_l = fspec.flux(prim_l, n, vn_l);
48 const auto f_r = fspec.flux(prim_r, n, vn_r);
49
50 const auto cons_l = fspec.prim_to_cons(prim_l);
51 const auto cons_r = fspec.prim_to_cons(prim_r);
52
53 // Equation (10.55) from Toro 3rd Edition , Springer 2009
54 return 0.5 * ((f_l + f_r) - (cons_r - cons_l) * S);
55 }
56
57} // namespace shammath
namespace for math utility
Definition AABB.hpp:26
constexpr FSpec::Tcons rusanov_flux(const FSpec &fspec, const typename FSpec::Tprim &prim_l, const typename FSpec::Tprim &prim_r, const typename FSpec::Tvec &n)
Rusanov flux across a face with unit normal n.
Gas and dust conservative/primitive states and axis-transform helpers shared by every gas and dust Ri...