Quadratures
ClimaCore.Quadratures.QuadratureStyle — Type
QuadratureStyle{Nq}Supertype for quadrature rules with Nq points on the reference interval [-1, 1].
Subtypes:
GLL: Gauss-Legendre-Lobatto quadrature, which includes the endpoints.GL: Gauss-Legendre quadrature.Uniform: uniformly spaced midpoint quadrature.ClosedUniform: uniformly spaced quadrature including the endpoints.
Subtypes implement quadrature_points and unique_degrees_of_freedom.
ClimaCore.Quadratures.GLL — Type
GLL{Nq}()Gauss-Legendre-Lobatto quadrature using Nq quadrature points.
ClimaCore.Quadratures.GL — Type
GL{Nq}()Gauss-Legendre quadrature using Nq quadrature points.
ClimaCore.Quadratures.Uniform — Type
Uniform{Nq}()Uniformly spaced midpoint quadrature with Nq points; the endpoints of [-1, 1] are not included.
ClimaCore.Quadratures.degrees_of_freedom — Function
degrees_of_freedom(quadstyle::QuadratureStyle)Return the number of quadrature points Nq of the quadrature rule quadstyle.
ClimaCore.Quadratures.unique_degrees_of_freedom — Function
unique_degrees_of_freedom(quadstyle::QuadratureStyle)Return the number of quadrature points of quadstyle per element that are not shared with a neighbouring element. This is Nq - 1 for rules that include the element endpoints (Quadratures.GLL and ClosedUniform), whose endpoint nodes are shared, and Nq for rules that do not (Quadratures.GL and Uniform).
ClimaCore.Quadratures.polynomial_degree — Function
polynomial_degree(quadstyle::QuadratureStyle)Return the polynomial degree Nq - 1 of the quadrature rule quadstyle.
ClimaCore.Quadratures.quadrature_points — Function
quadrature_points(::Type{FT}, quadstyle::QuadratureStyle)Return the points and weights of the quadrature rule quadstyle on [-1, 1] as a tuple of two SVectors with element type FT.
ClimaCore.Quadratures.barycentric_weights — Function
barycentric_weights(x::SVector{Nq})
barycentric_weights(::Type{FT}, quadstyle::QuadratureStyle)Return the barycentric weights associated with the point locations x, or with the quadrature points of quadstyle in float type FT:
\[w_j = \frac{1}{\prod_{k \ne j} (x_k - x_j)}\]
See [19], equation 3.2.
ClimaCore.Quadratures.interpolation_matrix — Function
interpolation_matrix(x::SVector, r::SVector{Nq})
interpolation_matrix(x::Vector, r)
interpolation_matrix(::Type{FT}, quadto::QuadratureStyle, quadfrom::QuadratureStyle)Return the matrix that interpolates the Lagrange polynomial of degree Nq - 1 through the points r to the points x. The third method uses the quadrature points of quadfrom and quadto in float type FT. The matrix coefficients are computed with the barycentric formula of [19], section 4:
\[I_{ij} = \begin{cases} 1 & \text{if } x_i = r_j, \\ 0 & \text{if } x_i = r_k \text{ for } k \ne j, \\ \frac{\displaystyle \frac{w_j}{x_i - r_j}}{\displaystyle \sum_k \frac{w_k}{x_i - r_k}} & \text{otherwise,} \end{cases}\]
where $w_j$ are the barycentric weights, see barycentric_weights.
ClimaCore.Quadratures.differentiation_matrix — Function
differentiation_matrix(r::SVector{Nq, T})Return the spectral differentiation matrix for the Lagrange polynomial of degree Nq - 1 interpolating at the points r.
The matrix coefficients are computed following [19], section 9.3:
\[D_{ij} = \begin{cases} \displaystyle \frac{w_j}{w_i (x_i - x_j)} &\text{ if } i \ne j, \\ \displaystyle \sum_{k \ne i} \frac{1}{x_i - x_k} &\text{ if } i = j, \end{cases}\]
where $w_j$ are the barycentric weights, see barycentric_weights. The rows of $D$ sum to zero.
differentiation_matrix(::Type{FT}, quadstyle::QuadratureStyle)Return the spectral differentiation matrix at the quadrature points of quadstyle, in float type FT.
ClimaCore.Quadratures.cutoff_filter_matrix — Function
cutoff_filter_matrix(::Type{FT}, quad::GLL{Nq}, Nc::Integer)Return the Nq × Nq SMatrix{Nq, Nq, FT} that applies a spectral cutoff filter to nodal values at the Quadratures.GLL points of quad: the values are projected onto the orthonormal Legendre basis, the first Nc modes (polynomial degrees 0 to Nc - 1) are kept and the remaining modes are set to zero, and the result is transformed back to nodal values.
ClimaCore.Quadratures.orthonormal_poly — Function
orthonormal_poly(points::SVector, quad::GLL)Return the matrix V whose entry V[i, j] is the orthonormal Legendre polynomial of degree j - 1 evaluated at points[i], i.e. the map from the modal to the nodal representation for the polynomial space of quad.