ryujin 2.1.1 revision dbf0e3ba7acdb60b6d558e4257815df4a8f8daf9
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 <compile_time_options.h>
9
10#include "hyperbolic_system.h"
11
12#include <compile_time_options.h>
14#include <newton.h>
15#include <simd.h>
16
17namespace ryujin
18{
19 namespace Skeleton
20 {
21 template <typename ScalarNumber = double>
22 class LimiterParameters : public dealii::ParameterAcceptor
23 {
24 public:
25 LimiterParameters(const std::string &subsection = "/Limiter")
26 : ParameterAcceptor(subsection)
27 {
28 iterations_ = 2;
29 add_parameter(
30 "iterations", iterations_, "Number of limiter iterations");
31 }
32
33 ACCESSOR_READ_ONLY(iterations);
34
35 private:
36 unsigned int iterations_;
37 };
38
39
45 template <int dim, typename Number = double>
46 class Limiter
47 {
48 public:
53
55
57
58 using state_type = typename View::state_type;
59
61
63
65
67
74 static constexpr unsigned int n_bounds = 0;
75
79 using Bounds = std::array<Number, n_bounds>;
80
84 Limiter(const HyperbolicSystem &hyperbolic_system,
85 const Parameters &parameters,
86 const PrecomputedVector &precomputed_values)
87 : hyperbolic_system(hyperbolic_system)
88 , parameters(parameters)
89 , precomputed_values(precomputed_values)
90 {
91 }
92
97 Bounds projection_bounds_from_state(const unsigned int /*i*/,
98 const state_type & /*U_i*/) const
99 {
100 return Bounds{};
101 }
102
108 Bounds combine_bounds(const Bounds & /*bounds_left*/,
109 const Bounds & /*bounds_right*/) const
110 {
111 return Bounds{};
112 }
113
119 Bounds fully_relax_bounds(const Bounds & /*bounds*/,
120 const Number & /*hd*/) const
121 {
122 return Bounds{};
123 }
124
126
144
148 void reset(const unsigned int /*i*/,
149 const state_type & /*new_U_i*/,
150 const flux_contribution_type & /*new_flux_i*/)
151 {
152 // empty
153 }
154
159 void accumulate(const unsigned int * /*js*/,
160 const state_type & /*U_j*/,
161 const flux_contribution_type & /*flux_j*/,
162 const dealii::Tensor<1, dim, Number> & /*scaled_c_ij*/,
163 const state_type & /*affine_shift*/)
164 {
165 // empty
166 }
167
171 Bounds bounds(const Number hd_i) const
172 {
173 auto relaxed_bounds = fully_relax_bounds(bounds_, hd_i);
174
175 return relaxed_bounds;
176 }
177
178 //*}
181
188 std::tuple<Number, bool> limit(const Bounds & /*bounds*/,
189 const state_type & /*U*/,
190 const state_type & /*P*/,
191 const Number /*t_min*/ = Number(0.),
192 const Number t_max = Number(1.)) const
193 {
194 return {t_max, true};
195 }
196
197 private:
199
201
202 const HyperbolicSystem &hyperbolic_system;
203 const Parameters &parameters;
204 const PrecomputedVector &precomputed_values;
205
206 Bounds bounds_;
208 };
209 } // namespace Skeleton
210} // 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:25
std::tuple< Number, bool > limit(const Bounds &, const state_type &, const state_type &, const Number=Number(0.), const Number t_max=Number(1.)) const
Definition: limiter.h:188
typename View::ScalarNumber ScalarNumber
Definition: limiter.h:56
void accumulate(const unsigned int *, const state_type &, const flux_contribution_type &, const dealii::Tensor< 1, dim, Number > &, const state_type &)
Definition: limiter.h:159
typename View::state_type state_type
Definition: limiter.h:58
static constexpr unsigned int n_bounds
Definition: limiter.h:74
typename View::flux_contribution_type flux_contribution_type
Definition: limiter.h:60
void reset(const unsigned int, const state_type &, const flux_contribution_type &)
Definition: limiter.h:148
std::array< Number, n_bounds > Bounds
Definition: limiter.h:79
Bounds combine_bounds(const Bounds &, const Bounds &) const
Definition: limiter.h:108
Bounds fully_relax_bounds(const Bounds &, const Number &) const
Definition: limiter.h:119
Bounds bounds(const Number hd_i) const
Definition: limiter.h:171
Limiter(const HyperbolicSystem &hyperbolic_system, const Parameters &parameters, const PrecomputedVector &precomputed_values)
Definition: limiter.h:84
Bounds projection_bounds_from_state(const unsigned int, const state_type &) const
Definition: limiter.h:97
LimiterParameters< ScalarNumber > Parameters
Definition: limiter.h:64
typename View::PrecomputedVector PrecomputedVector
Definition: limiter.h:62