Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 : #include <ostream>
8 :
9 : /// \cond
10 : class DataVector;
11 : template <size_t>
12 : class Mesh;
13 : /// \endcond
14 :
15 : namespace Limiters::Weno_detail {
16 :
17 : // Denote different schemes for computing related oscillation indicators by
18 : // changing the relative weight given to each derivative of the input data.
19 : // - Unity: l'th derivative has weight 1
20 : // - PowTwoEll: l'th derivative has weight 2^(2 l - 1)
21 : // This penalizes higher derivatives more strongly: w(l=4) = 128
22 : // - PowTwoEllOverEllFactorial: l'th derivative has weight 2^(2 l - 1) / (l!)^2
23 : // This penalizes the 1st and 2nd derivatives most strongly, but then higher
24 : // derivatives have decreasing weights so are weakly penalized: w(l=4) = 0.222
25 : enum class DerivativeWeight { Unity, PowTwoEll, PowTwoEllOverEllFactorial };
26 :
27 : std::ostream& operator<<(std::ostream& os, DerivativeWeight derivative_weight);
28 :
29 : // Compute the WENO oscillation indicator (also called the smoothness indicator)
30 : //
31 : // The oscillation indicator measures the amount of variation in the input data,
32 : // with larger indicator values corresponding to a larger amount of variation
33 : // (either from large monotonic slopes or from oscillations).
34 : //
35 : // Implements an indicator similar to that of Eq. 23 of Dumbser2007, but with
36 : // the necessary adaptations for use on square/cube grids. We favor this
37 : // indicator because it is formulated in the reference coordinates, which we
38 : // use for the WENO reconstruction, and because it lends itself to an efficient
39 : // implementation.
40 : template <size_t VolumeDim>
41 : double oscillation_indicator(DerivativeWeight derivative_weight,
42 : const DataVector& data,
43 : const Mesh<VolumeDim>& mesh);
44 :
45 : } // namespace Limiters::Weno_detail
|