MinmodTci.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <cstdlib>
8 #include <utility>
9 
10 #include "Evolution/DiscontinuousGalerkin/SlopeLimiters/MinmodType.hpp"
11 #include "Utilities/Gsl.hpp"
12 
13 /// \cond
14 class DataVector;
15 template <size_t Dim, typename T>
16 class DirectionMap;
17 template <size_t VolumeDim>
18 class Element;
19 template <size_t VolumeDim>
20 class Mesh;
21 /// \endcond
22 
23 namespace SlopeLimiters {
24 namespace Minmod_detail {
25 
26 // Implements the troubled-cell indicator corresponding to the Minmod limiter.
27 //
28 // The troubled-cell indicator (TCI) determines whether or not limiting is
29 // needed. See SlopeLimiters::Minmod for a full description of the Minmod
30 // limiter. Note that as an optimization, this TCI returns (by reference) some
31 // additional data that are used by the Minmod limiter in the case where the
32 // TCI returns true (i.e., the case where limiting is needed).
33 template <size_t VolumeDim>
34 bool troubled_cell_indicator(
37  gsl::not_null<DataVector*> u_lin_buffer,
39  const SlopeLimiters::MinmodType& minmod_type, double tvbm_constant,
40  const DataVector& u, const Element<VolumeDim>& element,
41  const Mesh<VolumeDim>& mesh,
42  const std::array<double, VolumeDim>& element_size,
43  const DirectionMap<VolumeDim, double>& effective_neighbor_means,
44  const DirectionMap<VolumeDim, double>& effective_neighbor_sizes,
47  VolumeDim>& volume_and_slice_indices) noexcept;
48 
49 } // namespace Minmod_detail
50 } // namespace SlopeLimiters
std::pair< std::unique_ptr< std::pair< size_t, size_t >[], decltype(&free)>, std::array< std::pair< gsl::span< std::pair< size_t, size_t > >, gsl::span< std::pair< size_t, size_t > > >, VolumeDim > > volume_and_slice_indices(const Index< VolumeDim > &extents) noexcept
Get the mapping between volume and boundary slice indices.
Definition: SliceIterator.cpp:49
An optimized map with Direction keys.
Definition: DirectionMap.hpp:15
Holds the number of grid points, basis, and quadrature in each direction of the computational grid...
Definition: Mesh.hpp:49
MinmodType
Possible types of the minmod slope limiter and/or troubled-cell indicator.
Definition: MinmodType.hpp:18
Create a span/view on a range, which is cheap to copy (one pointer).
Definition: Gsl.hpp:291
Things relating to slope limiting.
Definition: Krivodonova.hpp:52
A spectral element with knowledge of its neighbors.
Definition: Element.hpp:29
Stores a collection of function values.
Definition: DataVector.hpp:42
Defines functions and classes from the GSL.
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12