# ply_split_legendre_module Module

This module provides the functionality to split Legendre polynomials into a left and right subinterval with transformed coordinates.

The original polynomial is defined on the interval [-1,1] and the two new polynomial representations are computed in the intervals [-1,0] and [0,1] but in the changed coordinate system, with the interval [-1,1] for each. Thus, if we refer to the coordinates in the original (coarse) element as x and to the respective coordinates in the two halfed elements as xi_left and xi_right, we compute the modal representation of the original Legendre polynomial series under these transformations:

This is needed when refining elements.

## Functions

### public pure function ply_split_legendre_matrix(nModes) result(split_matrix)

Compute the transformation matrix for a projection to the left and right half-interval of Legendre polynomials for the given maximal number of modes.

#### Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: nModes

The maximal number of modes to compute the transformation for.

The resulting matrix v will be max_modes x max_modes large and can be used for the transformation of all polynomials with up to this many modes.

### private elemental function alpha(mode)

Coefficient alpha from the recursive formulation of Legendre polynomials, for the Legendre mode 'mode'.

#### Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: mode

The Legendre mode to compute $\alpha$ for.

### private elemental function beta(mode)

Coefficient beta from the recursive formulation of Legendre polynomials, for the Legendre mode 'mode'.

#### Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: mode

The Legendre mode to compute $\beta$ for.

### private elemental function alpha_frac(denominator, numerator)

Quotient of two alpha values.

#### Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: denominator

Legendre mode of the $\alpha$ to use in the denominator.

integer, intent(in) :: numerator

Legendre mode of the $\alpha$ to use in the numeratorr.

### private elemental function alpha_beta(denominator, numerator)

Prodcut of alpha(numerator) * beta(denominator) / alpha(denominator) as needed by the Clenshaw algorithm in ply_split_legendre_matrix.

#### Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: denominator

Legendre mode for the $\alpha$ in the denominator and the $\beta$.

integer, intent(in) :: numerator

Legendre mode for the $\alpha$ in the numerator.

## Subroutines

### public subroutine ply_split_legendre_test(success)

A small testing routine to check the functions of this module.

#### Arguments

TypeIntentOptionalAttributesName
logical, intent(out) :: success

Indication whether the tests were completed successfully.