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 :
8 : #include "DataStructures/ComplexDataVector.hpp"
9 : #include "DataStructures/ComplexModalVector.hpp"
10 : #include "DataStructures/SpinWeighted.hpp"
11 : #include "Utilities/Gsl.hpp"
12 :
13 : namespace Spectral {
14 : namespace Swsh {
15 : /// @{
16 : /*!
17 : * \ingroup SwshGroup
18 : * \brief Filter a volume collocation set in the form of consecutive
19 : * libsharp-compatible spherical shells.
20 : *
21 : * \details Two separate filters are applied. First, an exponential radial
22 : * filter is applied to each radial ray, with parameters `exponential_alpha` and
23 : * `exponential_half_power` (see `Spectral::filtering::exponential_filter` for
24 : * details on these parameters). Next, a modal Heaviside angular filter is
25 : * applied which simply sets to zero all `l > filter_max_l` modes.
26 : * \note It is assumed that Gauss-Lobatto points are used for the radial
27 : * direction (as that is the representation for CCE evolution). If that is too
28 : * restrictive, this function will need generalization.
29 : * \warning In principle, the radial filter in this function could cache the
30 : * matrix used, but currently does not. If such a cache becomes desirable for
31 : * performance, care must be taken regarding the exponential parameters. An
32 : * implementation similar to `dg::Actions::ExponentialFilter` may be necessary.
33 : * \note For comparisons with SpEC CCE, `exponential_half_power` of 8,
34 : * `exponential_alpha` of 108, and `filter_max_l` of `l_max - 3` should be used.
35 : * This gives a highly aggressive radial filter, though, and for runs not
36 : * attempting to compare with SpEC it is recommended to use smaller parameters
37 : * to preserve more of the radial modes.
38 : */
39 : template <int Spin>
40 1 : void filter_swsh_volume_quantity(
41 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
42 : size_t l_max, size_t filter_max_l, double exponential_alpha,
43 : size_t exponential_half_power, gsl::not_null<ComplexDataVector*> buffer,
44 : gsl::not_null<SpinWeighted<ComplexModalVector, Spin>*> transform_buffer);
45 :
46 : template <int Spin>
47 1 : void filter_swsh_volume_quantity(
48 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
49 : size_t l_max, size_t filter_max_l, double exponential_alpha,
50 : size_t exponential_half_power);
51 : /// @}
52 : /// @{
53 : /*!
54 : * \ingroup SwshGroup
55 : * \brief Filter a volume collocation set in the form of consecutive
56 : * libsharp-compatible spherical shells.
57 : *
58 : * \details Two separate filters are applied. First, an exponential radial
59 : * filter is applied to each radial ray, with parameters `exponential_alpha` and
60 : * `exponential_half_power` (see `Spectral::filtering::exponential_filter` for
61 : * details on these parameters). Next, a modal Heaviside angular filter is
62 : * applied which simply sets to zero all `l > max_l` or `l < min_l` modes.
63 : * \note It is assumed that Gauss-Lobatto points are used for the radial
64 : * direction (as that is the representation for CCE evolution). If that is too
65 : * restrictive, this function will need generalization.
66 : * \warning In principle, the radial filter in this function could cache the
67 : * matrix used, but currently does not. If such a cache becomes desirable for
68 : * performance, care must be taken regarding the exponential parameters. An
69 : * implementation similar to `dg::Actions::ExponentialFilter` may be necessary.
70 : */
71 : template <int Spin>
72 1 : void filter_swsh_volume_quantity(
73 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
74 : size_t l_max, size_t filter_min_l, size_t filter_max_l,
75 : double exponential_alpha, size_t exponential_half_power,
76 : gsl::not_null<ComplexDataVector*> buffer,
77 : gsl::not_null<SpinWeighted<ComplexModalVector, Spin>*> transform_buffer);
78 :
79 : template <int Spin>
80 1 : void filter_swsh_volume_quantity(
81 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
82 : size_t l_max, size_t filter_min_l, size_t filter_max_l,
83 : double exponential_alpha, size_t exponential_half_power);
84 : /// @}
85 : /// @{
86 : /*!
87 : * \ingroup SwshGroup
88 : * \brief Filter a libsharp-compatible set of collocation points on a spherical
89 : * surface.
90 : *
91 : * \details A modal Heaviside angular filter is applied which simply sets to
92 : * zero all `l > filter_max_l` modes.
93 : * \note For comparisons with SpEC CCE, `filter_max_l` of `l_max - 3` should be
94 : * used.
95 : */
96 : template <int Spin>
97 1 : void filter_swsh_boundary_quantity(
98 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
99 : size_t l_max, size_t filter_max_l,
100 : gsl::not_null<SpinWeighted<ComplexModalVector, Spin>*> transform_buffer);
101 :
102 : template <int Spin>
103 1 : void filter_swsh_boundary_quantity(
104 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
105 : size_t l_max, size_t filter_max_l);
106 : /// @}
107 : /// @{
108 : /*!
109 : * \ingroup SwshGroup
110 : * \brief Filter a libsharp-compatible set of collocation points on a spherical
111 : * surface.
112 : *
113 : * \details A modal Heaviside angular filter is applied which simply sets to
114 : * zero all `l > max_l` and `l < min_l` modes.
115 : */
116 : template <int Spin>
117 1 : void filter_swsh_boundary_quantity(
118 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
119 : size_t l_max, size_t filter_min_l, size_t filter_max_l,
120 : gsl::not_null<SpinWeighted<ComplexModalVector, Spin>*> transform_buffer);
121 :
122 : template <int Spin>
123 1 : void filter_swsh_boundary_quantity(
124 : gsl::not_null<SpinWeighted<ComplexDataVector, Spin>*> to_filter,
125 : size_t l_max, size_t filter_min_l, size_t filter_max_l);
126 : /// @}
127 : } // namespace Swsh
128 : } // namespace Spectral
|