SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
Spectral::filtering Namespace Reference

Matrices for filtering spectral coefficients. More...

Functions

Matrix exponential_filter (const Mesh< 1 > &mesh, double alpha, unsigned half_power)
 Returns a Matrix by which to multiply the nodal coefficients to apply a stable exponential filter.
const Matrixzero_lowest_modes (const Mesh< 1 > &mesh, size_t number_of_modes_to_zero)
 Zeros the lowest number_of_modes_to_zero modal coefficients. Note that the matrix must be applied to a nodal representation.
template<typename TagsList>
void ZernikeB2_disk_exponential_filter (gsl::not_null< Variables< TagsList > * > u, const Mesh< 2 > &mesh, double alpha, unsigned half_power)
 Filters the tensors stored within a Variables being represented by ZernikeB2 basis functions.
template<typename TagsList>
void ZernikeB2_cylinder_exponential_filter (gsl::not_null< Variables< TagsList > * > u, const Mesh< 3 > &mesh, double alpha, unsigned half_power)
 Filters the tensors stored within a Variables being represented by ZernikeB2 \(\times\) Legendre basis functions.

Detailed Description

Matrices for filtering spectral coefficients.

Function Documentation

◆ exponential_filter()

Matrix Spectral::filtering::exponential_filter ( const Mesh< 1 > & mesh,
double alpha,
unsigned half_power )

Returns a Matrix by which to multiply the nodal coefficients to apply a stable exponential filter.

The exponential filter rescales the modal coefficients according to:

\begin{align*} c_i\to c_i \exp\left[-\alpha \left(\frac{i}{N}\right)^{2m}\right] \end{align*}

where \(c_i\) are the zero-indexed modal coefficients, \(N\) is the basis degree (number of grid points per element per dimension minus one), \(\alpha\) determines how much the coefficients are rescaled, and \(m\) determines how aggressive/broad the filter is (lower values means filtering more coefficients). Setting \(\alpha=36\) results in setting the highest coefficient to machine precision, effectively zeroing it out.

Note
The filter matrix is not cached by the function because it depends on a double, an integer, and the mesh, which could make caching very memory intensive. The caller of this function is responsible for determining whether or not the matrix should be cached.

◆ ZernikeB2_cylinder_exponential_filter()

template<typename TagsList>
void Spectral::filtering::ZernikeB2_cylinder_exponential_filter ( gsl::not_null< Variables< TagsList > * > u,
const Mesh< 3 > & mesh,
double alpha,
unsigned half_power )

Filters the tensors stored within a Variables being represented by ZernikeB2 \(\times\) Legendre basis functions.

Details

Representing functions on a filled cylinder requires special basis functions, namely a filled disk with ZernikeB2 cross Legendre. This requires inherently two-dimensional basis functions, meaning the radial and angular spectral spaces are intertwined. This function goes to that combined modal space, applies the exponential filter, transforms back, and then filters the third I1 dimension.

See also
exponential_filter()

◆ ZernikeB2_disk_exponential_filter()

template<typename TagsList>
void Spectral::filtering::ZernikeB2_disk_exponential_filter ( gsl::not_null< Variables< TagsList > * > u,
const Mesh< 2 > & mesh,
double alpha,
unsigned half_power )

Filters the tensors stored within a Variables being represented by ZernikeB2 basis functions.

Details

Representing functions on a filled disk requires special basis functions, namely ZernikeB2. These are inherently two-dimensional, meaning the radial and angular spectral spaces are intertwined. This function goes to that combined modal space, applies the exponential filter, and transforms back.

See also
exponential_filter()

◆ zero_lowest_modes()

const Matrix & Spectral::filtering::zero_lowest_modes ( const Mesh< 1 > & mesh,
size_t number_of_modes_to_zero )

Zeros the lowest number_of_modes_to_zero modal coefficients. Note that the matrix must be applied to a nodal representation.

Given a function \(u\)

\begin{align} u(x)=\sum_{i=0}^N c_i P_i(x), \end{align}

where \(c_i\) are the modal coefficients and \(P_i(x)\) is the basis (e.g. Legendre polynomials), the filter matrix will take the nodal representation of \(u\) and zero out the lowest number_of_modes_to_zero modal coefficients. That is, after the filter is applied \(u\to\bar{u}\) is

\begin{align} \bar{u}(x)=\sum_{i=k}^N c_i P_i(x), \end{align}

where \(k\) is the number of modes set to zero. The output \(\bar{u}\) is also in the nodal representation.