Filtering.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7
8 /// \cond
9 class Matrix;
10 template <size_t>
11 class Mesh;
12 /// \endcond
13
14 namespace Spectral {
15 /*!
16  * \ingroup SpectralGroup
17  * \brief Matrices for filtering spectral coefficients.
18  */
19 namespace filtering {
20 /*!
21  * \brief Returns a Matrix by which to multiply the nodal coefficients to
22  * apply a stable exponential filter.
23  *
24  * The exponential filter rescales the modal coefficients according to:
25  *
26  * \f{align*}{
27  * c_i\to c_i \exp\left[-\alpha \left(\frac{i}{N}\right)^{2m}\right]
28  * \f}
29  *
30  * where \f$c_i\f$ are the zero-indexed modal coefficients, \f$N\f$ is the basis
31  * order, \f$\alpha\f$ determines how much the coefficients are rescaled, and
32  * \f$m\f$ determines how aggressive/broad the filter is (lower values means
33  * filtering more coefficients). Setting \f$\alpha=36\f$ results in setting the
34  * highest coefficient to machine precision, effectively zeroing it out.
35  *
36  * \note The filter matrix is not cached by the function because it depends on a
37  * double, an integer, and the mesh, which could make caching very memory
38  * intensive. The caller of this function is responsible for determining whether
39  * or not the matrix should be cached.
40  */
41 Matrix exponential_filter(const Mesh<1>& mesh, double alpha,
42  unsigned half_power) noexcept;
43 } // namespace filtering
44 } // namespace Spectral
Holds the number of grid points, basis, and quadrature in each direction of the computational grid...
Definition: Mesh.hpp:49
Matrix exponential_filter(const Mesh< 1 > &mesh, const double alpha, const unsigned half_power) noexcept
Returns a Matrix by which to multiply the nodal coefficients to apply a stable exponential filter...
Definition: Filtering.cpp:15
A dynamically sized matrix of doubles with column-major storage.
Definition: Matrix.hpp:19
Functionality associated with a particular choice of basis functions and quadrature for spectral oper...
Definition: Chebyshev.cpp:19