ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
limiter.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2023 - 2024 by the ryujin authors
4//
5
6#pragma once
7
8#include "hyperbolic_system.h"
9
10#include <compile_time_options.h>
12#include <newton.h>
13#include <simd.h>
14
15namespace ryujin
16{
17 namespace Skeleton
18 {
19 template <typename ScalarNumber = double>
20 class LimiterParameters : public dealii::ParameterAcceptor
21 {
22 public:
23 LimiterParameters(const std::string &subsection = "/Limiter")
24 : ParameterAcceptor(subsection)
25 {
26 iterations_ = 2;
27 add_parameter(
28 "iterations", iterations_, "Number of limiter iterations");
29 }
30
31 ACCESSOR_READ_ONLY(iterations);
32
33 private:
34 unsigned int iterations_;
35 };
36
37
43 template <int dim, typename Number = double>
44 class Limiter
45 {
46 public:
51
53
55
56 using state_type = typename View::state_type;
57
59
61
63
65
72 static constexpr unsigned int n_bounds = 0;
73
77 using Bounds = std::array<Number, n_bounds>;
78
82 Limiter(const HyperbolicSystem &hyperbolic_system,
83 const Parameters &parameters,
84 const PrecomputedVector &precomputed_values)
85 : hyperbolic_system(hyperbolic_system)
86 , parameters(parameters)
87 , precomputed_values(precomputed_values)
88 {
89 }
90
95 Bounds projection_bounds_from_state(const unsigned int /*i*/,
96 const state_type & /*U_i*/) const
97 {
98 return Bounds{};
99 }
100
106 Bounds combine_bounds(const Bounds & /*bounds_left*/,
107 const Bounds & /*bounds_right*/) const
108 {
109 return Bounds{};
110 }
111
113
131
135 void reset(const unsigned int /*i*/,
136 const state_type & /*new_U_i*/,
137 const flux_contribution_type & /*new_flux_i*/)
138 {
139 // empty
140 }
141
146 void accumulate(const unsigned int * /*js*/,
147 const state_type & /*U_j*/,
148 const flux_contribution_type & /*flux_j*/,
149 const dealii::Tensor<1, dim, Number> & /*scaled_c_ij*/,
150 const state_type & /*affine_shift*/)
151 {
152 // empty
153 }
154
158 Bounds bounds(const Number /*hd_i*/) const
159 {
160 auto relaxed_bounds = bounds_;
161
162 return relaxed_bounds;
163 }
164
165 //*}
168
175 std::tuple<Number, bool> limit(const Bounds & /*bounds*/,
176 const state_type & /*U*/,
177 const state_type & /*P*/,
178 const Number /*t_min*/ = Number(0.),
179 const Number t_max = Number(1.))
180 {
181 return {t_max, true};
182 }
183
184 private:
186
188
189 const HyperbolicSystem &hyperbolic_system;
190 const Parameters &parameters;
191 const PrecomputedVector &precomputed_values;
192
193 Bounds bounds_;
195 };
196 } // namespace Skeleton
197} // namespace ryujin
dealii::Tensor< 1, problem_dimension, Number > state_type
typename get_value_type< Number >::type ScalarNumber
Vectors::MultiComponentVector< ScalarNumber, n_precomputed_values > PrecomputedVector
LimiterParameters(const std::string &subsection="/Limiter")
Definition: limiter.h:23
typename View::ScalarNumber ScalarNumber
Definition: limiter.h:54
void accumulate(const unsigned int *, const state_type &, const flux_contribution_type &, const dealii::Tensor< 1, dim, Number > &, const state_type &)
Definition: limiter.h:146
typename View::state_type state_type
Definition: limiter.h:56
static constexpr unsigned int n_bounds
Definition: limiter.h:72
typename View::flux_contribution_type flux_contribution_type
Definition: limiter.h:58
void reset(const unsigned int, const state_type &, const flux_contribution_type &)
Definition: limiter.h:135
std::tuple< Number, bool > limit(const Bounds &, const state_type &, const state_type &, const Number=Number(0.), const Number t_max=Number(1.))
Definition: limiter.h:175
std::array< Number, n_bounds > Bounds
Definition: limiter.h:77
Bounds bounds(const Number) const
Definition: limiter.h:158
Bounds combine_bounds(const Bounds &, const Bounds &) const
Definition: limiter.h:106
Limiter(const HyperbolicSystem &hyperbolic_system, const Parameters &parameters, const PrecomputedVector &precomputed_values)
Definition: limiter.h:82
Bounds projection_bounds_from_state(const unsigned int, const state_type &) const
Definition: limiter.h:95
LimiterParameters< ScalarNumber > Parameters
Definition: limiter.h:62
typename View::PrecomputedVector PrecomputedVector
Definition: limiter.h:60