Class defining a 1D Gauss-Legendre-Lobatto quadrature set on [-1,1]. The quadrature set approximates the integral using a set of weights ( \(w_k\)) and abscissas ( \(\xi_k\)): More...
#include <gauss_lobatto_legendre.h>
Public Member Functions | |
| GaussLobattoLegendre (const size_t n_points) | |
| Construct a new GaussLobattoLegendre object. | |
| double | GetLagrangeDerivative (const size_t node_idx, const size_t polynomial_idx) const |
| Get the derivative of the specific Lagrange polynomial at the specified node. Note that both the node index and the polynomial index are zero-indexed. | |
| double | IntegrateGridFunction (const std::valarray< double > &grid_function_vals) |
| Integrate a function defined on the abscissae given in the order the abscissae are stored. | |
| Public Member Functions inherited from hummingbird::QuadratureBase< double > | |
| QuadratureBase ()=default | |
| double | GetWeight (const unsigned int abscissa_index) const |
| Get the weight value corresponding to a given abscissa value. | |
| double | GetAbscissa (const unsigned int index) const |
| Get the abscissa corresponding to the index. | |
| double | Integrate (const std::vector< QuadraturePair > &quad_pairs) const |
| Integrate the function using the function value and its location on the quadrature grid. | |
| const std::vector< double > & | abscissas () const |
| Getter for the abscissas in the quadrature set. | |
| size_t | n_points () const |
| Get total number of abscissas. | |
Private Member Functions | |
| void | ComputeLagrangeDerivatives () |
| Computes and sets the Lagrange polynomial derivatives at the GLL nodes. The vector lagrange_derivatives_ is constructed with the polynomial index being the "fast" counting index, and the node number being the "slow" counting index. That is, the derivative of the N=1 polynomial at the 3rd GLL node of 5 has a flattened index of 16. | |
| std::vector< double > | ComputeAbscissas (const size_t n_points) |
| Computes the abscissa values, given by: | |
| double | ComputeWeight (const size_t k, const size_t n) override |
| Computes the weights for a Gauss-Legendre-Lobatto quadrature scheme using: | |
Private Attributes | |
| std::vector< double > | lagrange_derivatives_ |
| Derivatives of the Lagrange polynomials at the GLL nodes. These are stored as a flattened array and are indexed using the node number and the polynomial number in GetLagrangeDerivative. See the extended description in ComputeLagrangeDerivatives(). | |
Additional Inherited Members | |
| Protected Member Functions inherited from hummingbird::QuadratureBase< double > | |
| void | CreateWeightMap () |
| Create the weight map. | |
| Protected Attributes inherited from hummingbird::QuadratureBase< double > | |
| std::vector< double > | abscissas_ |
| Abscissa values. | |
| std::map< unsigned int, double > | weight_map_ |
| Map to store the weights of the quadrature set where the keys are the indices corresponding to abscissa values. | |
Class defining a 1D Gauss-Legendre-Lobatto quadrature set on [-1,1]. The quadrature set approximates the integral using a set of weights ( \(w_k\)) and abscissas ( \(\xi_k\)):
\[\int_{-1}^{1}u(x)dx \approx \sum_{i=0}^{N-1}w_k u(\xi_k). \]
Formulae for this class were taken from the textbook "High-Order Methods for Incompressible Fluid Flow" by Deville, Fischer, and Mund. https://doi.org/10.1017/CBO9780511546792
Definition at line 27 of file gauss_lobatto_legendre.h.
| hummingbird::GaussLobattoLegendre::GaussLobattoLegendre | ( | const size_t | n_points | ) |
Construct a new GaussLobattoLegendre object.
| n_points | Number of quadrature points to be created |
Definition at line 9 of file gauss_lobatto_legendre.cc.
|
private |
Computes the abscissa values, given by:
\[\xi_k = \begin{cases} -1, & k=0\\ \text{zeros of } P'_{N-1}, & 1\leq k\leq N-2\\ 1,& k=N-1 \end{cases} \]
| n_points | Total number of abscissa points |
Definition at line 15 of file gauss_lobatto_legendre.cc.
|
private |
Computes and sets the Lagrange polynomial derivatives at the GLL nodes. The vector lagrange_derivatives_ is constructed with the polynomial index being the "fast" counting index, and the node number being the "slow" counting index. That is, the derivative of the N=1 polynomial at the 3rd GLL node of 5 has a flattened index of 16.
Definition at line 31 of file gauss_lobatto_legendre.cc.
|
overrideprivatevirtual |
Computes the weights for a Gauss-Legendre-Lobatto quadrature scheme using:
\[w_k=\frac{2}{(N-1)N}\frac{1}{[P_{N-1}(\xi_k)]^2} \]
| k | Abscissa index |
| n | Total number of points |
Reimplemented from hummingbird::QuadratureBase< double >.
Definition at line 54 of file gauss_lobatto_legendre.cc.
|
inline |
Get the derivative of the specific Lagrange polynomial at the specified node. Note that both the node index and the polynomial index are zero-indexed.
| node_idx | GLL node index |
| polynomial_idx | Lagrange polynomial index |
Definition at line 45 of file gauss_lobatto_legendre.h.
| double hummingbird::GaussLobattoLegendre::IntegrateGridFunction | ( | const std::valarray< double > & | grid_function_vals | ) |
Integrate a function defined on the abscissae given in the order the abscissae are stored.
| grid_function_vals | Grid function values on the abscissae |
Definition at line 62 of file gauss_lobatto_legendre.cc.
|
private |
Derivatives of the Lagrange polynomials at the GLL nodes. These are stored as a flattened array and are indexed using the node number and the polynomial number in GetLagrangeDerivative. See the extended description in ComputeLagrangeDerivatives().
Definition at line 65 of file gauss_lobatto_legendre.h.