SwshFiltering.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 #include "DataStructures/ComplexDataVector.hpp" // IWYU pragma: keep
9 #include "DataStructures/ComplexModalVector.hpp" // IWYU pragma: keep
10 #include "DataStructures/SpinWeighted.hpp" // IWYU pragma: keep
11 #include "Utilities/Gsl.hpp"
12 
13 // IWYU pragma: no_forward_declare ComplexDataVector
14 // IWYU pragma: no_forward_declare ComplexModalVector
15 // IWYU pragma: no_forward_declare SpinWeighted
16 
17 namespace Spectral {
18 namespace Swsh {
19 // @{
20 /*!
21  * \ingroup SwshGroup
22  * \brief Filter a volume collocation set in the form of consecutive
23  * libsharp-compatible spherical shells.
24  *
25  * \details Two separate filters are applied. First, an exponential radial
26  * filter is applied to each radial ray, with parameters `exponential_alpha` and
27  * `exponential_half_power` (see `Spectral::filtering::exponential_filter` for
28  * details on these parameters). Next, a modal Heaviside angular filter is
29  * applied which simply sets to zero all `l > limit_l` modes.
30  * \note It is assumed that Gauss-Lobatto points are used for the radial
31  * direction (as that is the representation for CCE evolution). If that is too
32  * restrictive, this function will need generalization.
33  * \warning In principle, the radial filter in this function could cache the
34  * matrix used, but currently does not. If such a cache becomes desirable for
35  * performance, care must be taken regarding the exponential parameters. An
36  * implementation similar to `dg::Actions::ExponentialFilter` may be necessary.
37  * \note For comparisons with SpEC CCE, `exponential_half_power` of 8,
38  * `exponential_alpha` of 108, and `limit_l` of `l_max - 3` should be used. This
39  * gives a highly aggressive radial filter, though, and for runs not attempting
40  * to compare with SpEC it is recommended to use smaller parameters to preserve
41  * more of the radial modes.
42  */
43 template <int Spin>
44 void filter_swsh_volume_quantity(
46  size_t l_max, size_t limit_l, double exponential_alpha,
47  size_t exponential_half_power, gsl::not_null<ComplexDataVector*> buffer,
49  transform_buffer) noexcept;
50 
51 template <int Spin>
52 void filter_swsh_volume_quantity(
54  size_t l_max, size_t limit_l, double exponential_alpha,
55  size_t exponential_half_power) noexcept;
56 // @}
57 // @{
58 /*!
59  * \ingroup SwshGroup
60  * \brief Filter a libsharp-compatible set of collocation points on a spherical
61  * surface.
62  *
63  * \details A modal Heaviside angular filter is applied which simply sets to
64  * zero all `l > limit_l` modes.
65  * \note For comparisons with SpEC CCE, `limit_l` of `l_max - 3` should be used.
66  */
67 template <int Spin>
68 void filter_swsh_boundary_quantity(
70  size_t l_max, size_t limit_l,
72  transform_buffer) noexcept;
73 
74 template <int Spin>
75 void filter_swsh_boundary_quantity(
77  size_t l_max, size_t limit_l) noexcept;
78 // @}
79 } // namespace Swsh
80 } // namespace Spectral
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition...
Definition: SpinWeighted.hpp:25
Defines functions and classes from the GSL.
Functionality associated with a particular choice of basis functions and quadrature for spectral oper...
Definition: Chebyshev.cpp:19
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12