ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
riemann_solver.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2020 - 2024 by the ryujin authors
4//
5
6#pragma once
7
8#include "hyperbolic_system.h"
9
10#include <simd.h>
11
12#include <deal.II/base/point.h>
13#include <deal.II/base/tensor.h>
14
15namespace ryujin
16{
17 namespace Euler
18 {
19 template <typename ScalarNumber = double>
20 class RiemannSolverParameters : public dealii::ParameterAcceptor
21 {
22 public:
23 RiemannSolverParameters(const std::string &subsection = "/RiemannSolver")
24 : ParameterAcceptor(subsection)
25 {
26 if constexpr (std::is_same<ScalarNumber, double>::value)
27 newton_tolerance_ = 1.e-10;
28 else
29 newton_tolerance_ = 1.e-4;
30 add_parameter("newton tolerance",
31 newton_tolerance_,
32 "Tolerance for the quadratic newton stopping criterion");
33
34 newton_max_iterations_ = 0;
35 add_parameter("newton max iterations",
36 newton_max_iterations_,
37 "Maximal number of quadratic newton iterations performed "
38 "during limiting");
39 }
40
41 ACCESSOR_READ_ONLY(newton_tolerance);
42 ACCESSOR_READ_ONLY(newton_max_iterations);
43
44 private:
45 ScalarNumber newton_tolerance_;
46 unsigned int newton_max_iterations_;
47 };
48
49
59 template <int dim, typename Number = double>
61 {
62 public:
67
69
71
73
74 using state_type = typename View::state_type;
75
80 static constexpr unsigned int riemann_data_size = 4;
81
86 using primitive_type = std::array<Number, riemann_data_size>;
87
89
91
93
95
99
103 RiemannSolver(const HyperbolicSystem &hyperbolic_system,
104 const Parameters &parameters,
105 const PrecomputedVector &precomputed_values)
106 : hyperbolic_system(hyperbolic_system)
107 , parameters(parameters)
108 , precomputed_values(precomputed_values)
109 {
110 }
111
117 Number compute(const primitive_type &riemann_data_i,
118 const primitive_type &riemann_data_j) const;
119
127 Number compute(const state_type &U_i,
128 const state_type &U_j,
129 const unsigned int i,
130 const unsigned int *js,
131 const dealii::Tensor<1, dim, Number> &n_ij) const;
132
134
135 protected:
138
144 Number f(const primitive_type &riemann_data, const Number p_star) const;
145
146
152 Number df(const primitive_type &riemann_data, const Number &p_star) const;
153
154
160 Number phi(const primitive_type &riemann_data_i,
161 const primitive_type &riemann_data_j,
162 const Number p_in) const;
163
164
170 Number dphi(const primitive_type &riemann_data_i,
171 const primitive_type &riemann_data_j,
172 const Number &p) const;
173
174
189 Number phi_of_p_max(const primitive_type &riemann_data_i,
190 const primitive_type &riemann_data_j) const;
191
192
198 Number lambda1_minus(const primitive_type &riemann_data,
199 const Number p_star) const;
200
201
207 Number lambda3_plus(const primitive_type &primitive_state,
208 const Number p_star) const;
209
210
221 std::array<Number, 2> compute_gap(const primitive_type &riemann_data_i,
222 const primitive_type &riemann_data_j,
223 const Number p_1,
224 const Number p_2) const;
225
226
236 Number compute_lambda(const primitive_type &riemann_data_i,
237 const primitive_type &riemann_data_j,
238 const Number p_star) const;
239
240
249 Number p_star_two_rarefaction(const primitive_type &riemann_data_i,
250 const primitive_type &riemann_data_j) const;
251
260 Number p_star_failsafe(const primitive_type &riemann_data_i,
261 const primitive_type &riemann_data_j) const;
262
263
273 const dealii::Tensor<1, dim, Number> &n_ij) const;
274
275 private:
276 const HyperbolicSystem &hyperbolic_system;
277 const Parameters &parameters;
278 const PrecomputedVector &precomputed_values;
280 };
281 } // namespace Euler
282} // namespace ryujin
typename get_value_type< Number >::type ScalarNumber
Vectors::MultiComponentVector< ScalarNumber, n_precomputed_values > PrecomputedVector
static constexpr unsigned int problem_dimension
dealii::Tensor< 1, problem_dimension, Number > state_type
std::array< Number, n_precomputed_values > precomputed_type
RiemannSolverParameters(const std::string &subsection="/RiemannSolver")
ACCESSOR_READ_ONLY(newton_max_iterations)
Number phi_of_p_max(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
typename View::PrecomputedVector PrecomputedVector
Number compute_lambda(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j, const Number p_star) const
typename View::ScalarNumber ScalarNumber
Number df(const primitive_type &riemann_data, const Number &p_star) const
Number lambda1_minus(const primitive_type &riemann_data, const Number p_star) const
Number phi(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j, const Number p_in) const
Number p_star_two_rarefaction(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
primitive_type riemann_data_from_state(const state_type &U, const dealii::Tensor< 1, dim, Number > &n_ij) const
std::array< Number, 2 > compute_gap(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j, const Number p_1, const Number p_2) const
typename View::state_type state_type
Number compute(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j) const
static constexpr auto problem_dimension
static constexpr unsigned int riemann_data_size
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 View::precomputed_type precomputed_type
Number dphi(const primitive_type &riemann_data_i, const primitive_type &riemann_data_j, const Number &p) const
RiemannSolverParameters< ScalarNumber > Parameters
Number f(const primitive_type &riemann_data, const Number p_star) const
RiemannSolver(const HyperbolicSystem &hyperbolic_system, const Parameters &parameters, const PrecomputedVector &precomputed_values)
Number lambda3_plus(const primitive_type &primitive_state, const Number p_star) const