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