SpECTRE  2021.08.02
Spectral

Namespaces

namespace  Spectral
 Functionality associated with a particular choice of basis functions and quadrature for spectral operations.
 
namespace  Spectral::Swsh
 Namespace for spin-weighted spherical harmonic utilities.
 
namespace  Spectral::filtering
 Matrices for filtering spectral coefficients.
 

Classes

class  SpherepackIterator
 Iterates over spectral coefficients stored in SPHEREPACK format. More...
 
class  YlmSpherepack
 Defines the C++ interface to SPHEREPACK. More...
 

Typedefs

template<typename DerivativeTagList , ComplexRepresentation Representation = ComplexRepresentation::Interleaved>
using Spectral::Swsh::AngularDerivatives = detail::AngularDerivativesImpl< DerivativeTagList, typename detail::unique_derived_from_list< DerivativeTagList >::type, Representation >
 A DataBox mutate-compatible computational struct for computing a set of spin-weighted spherical harmonic derivatives by grouping and batch-computing spin-weighted spherical harmonic transforms. More...
 

Enumerations

enum class  Spectral::Basis { Chebyshev , Legendre , FiniteDifference , SphericalHarmonic }
 The choice of basis functions for computing collocation points and weights. More...
 
enum class  Spectral::Quadrature { Gauss , GaussLobatto , CellCentered , FaceCentered }
 The choice of quadrature method to compute integration weights. More...
 

Functions

template<int Spin>
auto Spectral::Swsh::swsh_buffer (const size_t l_max, const size_t number_of_radial_points) noexcept
 Produces a SpinWeighted<ComplexModalVector, Spin> of the appropriate size to be used as a modal buffer for Spectral::Swsh::AngularDerivatives or Spectral::Swsh::angular_derivatives. More...
 
template<typename DerivativeKindList , ComplexRepresentation Representation = ComplexRepresentation::Interleaved, typename... ArgumentTypes>
void Spectral::Swsh::angular_derivatives (const size_t l_max, const size_t number_of_radial_points, const ArgumentTypes &... arguments) noexcept
 Evaluate all of the spin-weighted derivatives in DerivKindList on input SpinWeighted<ComplexDataVector, Spin> collocation data, returning by pointer. More...
 
template<typename DerivKind , ComplexRepresentation Representation = ComplexRepresentation::Interleaved, int Spin>
SpinWeighted< ComplexDataVector, Tags::derivative_spin_weight< DerivKind >+Spin > Spectral::Swsh::angular_derivative (size_t l_max, size_t number_of_radial_points, const SpinWeighted< ComplexDataVector, Spin > &to_differentiate) noexcept
 Evaluate the spin-weighted derivative DerivKind on the provided SpinWeighted<ComplexDataVector, Spin> collocation data, returning by value.
 
template<size_t Dim>
void to_modal_coefficients (gsl::not_null< ComplexModalVector * > modal_coefficients, const ComplexDataVector &nodal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the modal coefficients from the nodal coefficients. More...
 
template<size_t Dim>
void to_modal_coefficients (gsl::not_null< ModalVector * > modal_coefficients, const DataVector &nodal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the modal coefficients from the nodal coefficients. More...
 
template<size_t Dim>
ModalVector to_modal_coefficients (const DataVector &nodal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the modal coefficients from the nodal coefficients. More...
 
template<size_t Dim>
ComplexModalVector to_modal_coefficients (const ComplexDataVector &nodal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the modal coefficients from the nodal coefficients. More...
 
template<size_t Dim>
void to_nodal_coefficients (gsl::not_null< ComplexDataVector * > nodal_coefficients, const ComplexModalVector &modal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the nodal coefficients from the modal coefficients. More...
 
template<size_t Dim>
void to_nodal_coefficients (gsl::not_null< DataVector * > nodal_coefficients, const ModalVector &modal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the nodal coefficients from the modal coefficients. More...
 
template<size_t Dim>
DataVector to_nodal_coefficients (const ModalVector &modal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the nodal coefficients from the modal coefficients. More...
 
template<size_t Dim>
ComplexDataVector to_nodal_coefficients (const ComplexModalVector &modal_coefficients, const Mesh< Dim > &mesh) noexcept
 Compute the nodal coefficients from the modal coefficients. More...
 

Detailed Description

Things related to spectral transformations.

Typedef Documentation

◆ AngularDerivatives

template<typename DerivativeTagList , ComplexRepresentation Representation = ComplexRepresentation::Interleaved>
using Spectral::Swsh::AngularDerivatives = typedef detail::AngularDerivativesImpl< DerivativeTagList, typename detail::unique_derived_from_list<DerivativeTagList>::type, Representation>

A DataBox mutate-compatible computational struct for computing a set of spin-weighted spherical harmonic derivatives by grouping and batch-computing spin-weighted spherical harmonic transforms.

Details

A derivative is evaluated for each tag in DerivativeTagList. All entries in DerivativeTagList must be the tag Spectral::Swsh::Tags::Derivative<Tag, DerivativeKind> prefixing the Tag to be differentiated, and indicating the spin-weighted derivative DerivativeKind to be taken. A DataBox on which this struct is invoked must contain:

  • each of the tags in DerivativeTagList (the results of the computation)
  • each of the tags Tag prefixed by Spectral::Swsh::Tags::Derivative in DerivativeTagList (the inputs of the computation).
  • each of the tags Spectral::Swsh::Tags::SwshTransform<DerivativeTag> for DerivativeTagin DerivativeTagList (the buffers for the derivative applied to the modes)
  • each of the tags Spectral::Swsh::Tags::SwshTransform<Tag> for Tag prefixed by any DerivativeTag in DerivativeTagList (the buffers for the transforms of the input data).

This function optimizes the derivative taking process by clustering like spins of tags, forward-transforming each spin cluster together, applying the factor for the derivative to each modal vector, re-clustering according to the new spin weights (the derivatives alter the spin weights), and finally inverse-transforming in clusters.

Enumeration Type Documentation

◆ Basis

enum class Spectral::Basis
strong

The choice of basis functions for computing collocation points and weights.

Details

Choose Legendre for a general-purpose DG mesh, unless you have a particular reason for choosing another basis.

Warning
The FiniteDifference "basis" is used to denote that only the collocation points are defined, but that differentiation, integration, and interpolation schemes are to be chosen locally wherever a FiniteDifference mesh is being used. The reason is that there isn't a requirement that the basis and collocation point locations are at all related to the differentiation, integration, or interpolation methods - it is merely a convenient choice in a lot of cases. For FiniteDifference we need to choose the order of the scheme (and hence the weights, differentiation matrix, integration weights, and interpolant) locally in space and time to handle discontinuous solutions, hence none of those are defined for the FiniteDifference basis.

◆ Quadrature

enum class Spectral::Quadrature
strong

The choice of quadrature method to compute integration weights.

Details

Integrals using \(N\) collocation points with Gauss quadrature are exact to polynomial order \(p=2N-1\). Gauss-Lobatto quadrature is exact only to polynomial order \(p=2N-3\), but includes collocation points at the domain boundary.

Warning
CellCentered and FaceCentered are intended to be used with the FiniteDifference basis (though in principle they could be used with any basis), and thus do not implement differentiation matrices, integration weights, and interpolation matrices.

Function Documentation

◆ angular_derivatives()

template<typename DerivativeKindList , ComplexRepresentation Representation = ComplexRepresentation::Interleaved, typename... ArgumentTypes>
void Spectral::Swsh::angular_derivatives ( const size_t  l_max,
const size_t  number_of_radial_points,
const ArgumentTypes &...  arguments 
)
noexcept

Evaluate all of the spin-weighted derivatives in DerivKindList on input SpinWeighted<ComplexDataVector, Spin> collocation data, returning by pointer.

Details

This function provides two interfaces, one in which the caller provides the intermediate coefficient buffers needed during the computation of the derivatives, and one in which those buffers are temporarily allocated during the derivative function calls.

For the interface in which the caller does not provide buffers, the arguments must take the following structure (enforced by internal function calls):

  • size_t l_max : angular resolution for the spherical representation
  • size_t number_of_radial_points : radial resolution (number of consecutive blocks to evaluate derivatives, for each input vector )
  • for each DerivKind in DerivKindList, a gsl::not_null<SpinWeighted<ComplexDataVector, Spin + Tags::derivative_spin_weight<DerivKind>>> : the output of the derivative evaluation
  • for each DerivKind in DerivKindList, a const SpinWeighted<ComplexDataVector, Spin>& (where the Spin for these arguments matches the corresponding vector from the previous set) : the input to the derivative evaluation.

For the interface in which the caller does provide buffers, the arguments must take the following structure (enforced by internal function calls):

  • size_t l_max : angular resolution for the spherical representation
  • size_t number_of_radial_points : radial resolution (number of consecutive blocks to evaluate derivatives, for each input vector )
  • for each DerivKind in DerivKindList, a gsl::not_null<SpinWeighted<ComplexModalVector, Spin + Tags::derivative_spin_weight<DerivKind>>> : the buffer for the spin-weighted spherical harmonic modes of the derivative quantities.
  • for each DerivKind in DerivKindList, a const SpinWeighted<ComplexModalVector, Spin> (where the Spin for these arguments matches the corresponding vector from the previous set) : the buffer for the spin-weighted spherical harmonic modes of the input quantities.
  • for each DerivKind in DerivKindList, a gsl::not_null<SpinWeighted<ComplexDataVector, Spin + Tags::derivative_spin_weight<DerivKind>>> : the output of the derivative evaluation
  • for each DerivKind in DerivKindList, a const SpinWeighted<ComplexDataVector, Spin> (where the Spin for these arguments matches the corresponding vector from the previous set) : the input to the derivative evaluation.

The function swsh_buffer assists in generating the modal buffers of appropriate size.

◆ swsh_buffer()

template<int Spin>
auto Spectral::Swsh::swsh_buffer ( const size_t  l_max,
const size_t  number_of_radial_points 
)
noexcept

Produces a SpinWeighted<ComplexModalVector, Spin> of the appropriate size to be used as a modal buffer for Spectral::Swsh::AngularDerivatives or Spectral::Swsh::angular_derivatives.

Details

The Spectral::Swsh::angular_derivatives and Spectral::Swsh::AngularDerivatives interfaces require that calling code provides a buffer for the intermediate transform results, to ensure that callers are aware of the allocations and can suitably reuse buffers if possible. This utility eases the creation of those buffers.

◆ to_modal_coefficients() [1/4]

template<size_t Dim>
ComplexModalVector to_modal_coefficients ( const ComplexDataVector nodal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the modal coefficients from the nodal coefficients.

See also
Spectral::nodal_to_modal_matrix

◆ to_modal_coefficients() [2/4]

template<size_t Dim>
ModalVector to_modal_coefficients ( const DataVector nodal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the modal coefficients from the nodal coefficients.

See also
Spectral::nodal_to_modal_matrix

◆ to_modal_coefficients() [3/4]

template<size_t Dim>
void to_modal_coefficients ( gsl::not_null< ComplexModalVector * >  modal_coefficients,
const ComplexDataVector nodal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the modal coefficients from the nodal coefficients.

See also
Spectral::nodal_to_modal_matrix

◆ to_modal_coefficients() [4/4]

template<size_t Dim>
void to_modal_coefficients ( gsl::not_null< ModalVector * >  modal_coefficients,
const DataVector nodal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the modal coefficients from the nodal coefficients.

See also
Spectral::nodal_to_modal_matrix

◆ to_nodal_coefficients() [1/4]

template<size_t Dim>
ComplexDataVector to_nodal_coefficients ( const ComplexModalVector modal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the nodal coefficients from the modal coefficients.

See also
Spectral::modal_to_nodal_matrix

◆ to_nodal_coefficients() [2/4]

template<size_t Dim>
DataVector to_nodal_coefficients ( const ModalVector modal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the nodal coefficients from the modal coefficients.

See also
Spectral::modal_to_nodal_matrix

◆ to_nodal_coefficients() [3/4]

template<size_t Dim>
void to_nodal_coefficients ( gsl::not_null< ComplexDataVector * >  nodal_coefficients,
const ComplexModalVector modal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the nodal coefficients from the modal coefficients.

See also
Spectral::modal_to_nodal_matrix

◆ to_nodal_coefficients() [4/4]

template<size_t Dim>
void to_nodal_coefficients ( gsl::not_null< DataVector * >  nodal_coefficients,
const ModalVector modal_coefficients,
const Mesh< Dim > &  mesh 
)
noexcept

Compute the nodal coefficients from the modal coefficients.

See also
Spectral::modal_to_nodal_matrix