SpECTRE  v2024.04.12
Filters::Exponential< FilterIndex > Class Template Reference

A cached exponential filter. More...

#include <ExponentialFilter.hpp>

Classes

struct  Alpha
 The value of exp(-alpha) is what the highest modal coefficient is rescaled by. More...
 
struct  BlocksToFilter
 
struct  Enable
 Turn the filter off. More...
 
struct  HalfPower
 Half of the exponent in the exponential. More...
 

Public Types

using options = tmpl::list< Alpha, HalfPower, Enable, BlocksToFilter >
 

Public Member Functions

 Exponential (double alpha, unsigned half_power, bool enable, const std::optional< std::vector< std::string > > &blocks_to_filter, const Options::Context &context={})
 
const Matrixfilter_matrix (const Mesh< 1 > &mesh) const
 A cached matrix used to apply the filter to the given mesh.
 
bool enable () const
 
const std::optional< std::unordered_set< std::string > > & blocks_to_filter () const
 
void pup (PUP::er &p)
 

Static Public Member Functions

static std::string name ()
 

Static Public Attributes

static constexpr Options::String help = {"An exponential filter."}
 

Friends

template<size_t LocalFilterIndex>
bool operator== (const Exponential< LocalFilterIndex > &lhs, const Exponential< LocalFilterIndex > &rhs)
 

Detailed Description

template<size_t FilterIndex>
class Filters::Exponential< FilterIndex >

A cached exponential filter.

Applies an exponential filter in each logical direction to each component of the tensors TagsToFilter. The exponential filter rescales the 1d modal coefficients \(c_i\) as:

\begin{align*} c_i\to c_i \exp\left[-\alpha_{\mathrm{ef}} \left(\frac{i}{N}\right)^{2\beta_{\mathrm{ef}}}\right] \end{align*}

where \(N\) is the basis degree (number of grid points per element per dimension minus one), \(\alpha_{\mathrm{ef}}\) determines how much the coefficients are rescaled, and \(\beta_{\mathrm{ef}}\) (given by the HalfPower option) determines how aggressive/broad the filter is (lower values means filtering more coefficients). Setting \(\alpha_{\mathrm{ef}}=36\) results in effectively zeroing the highest coefficient (in practice it gets rescaled by machine epsilon). The same \(\alpha_{\mathrm{ef}}\) and \(\beta_{\mathrm{ef}}\) are used in each logical direction. For a discussion of filtering see section 5.3 of [88].

Design decision:

  • The reason for the size_t template parameter is to allow for different Alpha and HalfPower parameters for different tensors while still being able to cache the matrices. If different Alpha or HalfPower parameters are desired for filtering different tensors, then multiple filters must be inserted into the GlobalCache with different FilterIndex values. In the input file these will be specified as ExpFilterFILTER_INDEX, e.g.
    "Filtering:\n"
    " ExpFilter0:\n"
    " Alpha: 36\n"
    " HalfPower: 32\n"
    " Enable: True\n"
    " BlocksToFilter: All\n"
    " ExpFilter1:\n"
    " Alpha: 36\n"
    " HalfPower: 12\n"
    " Enable: True\n"
    " BlocksToFilter:\n"
    " - Block0\n"
    " - BlockGroup1\n"

The documentation for this class was generated from the following file: