SpECTRE  v2025.03.17
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
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. More...
 
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. More...
 

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:

ciciexp[α(iN)2m]

where ci are the zero-indexed modal coefficients, N is the basis degree (number of grid points per element per dimension minus one), α determines how much the coefficients are rescaled, and m determines how aggressive/broad the filter is (lower values means filtering more coefficients). Setting α=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.

◆ 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

(1)u(x)=i=0NciPi(x),

where ci are the modal coefficients and Pi(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 uu¯ is

(2)u¯(x)=i=kNciPi(x),

where k is the number of modes set to zero. The output u¯ is also in the nodal representation.