I've successfully implemented a 1D DG code with non-normalized Legendre basis and I've now moved onto developing a 2D code using tensor products. For my 2D code I've chosen to have normalized Legendre polynomials,i.e.
$$ L_{0}(x) = \sqrt{\frac{1}{2}}\\ L_{1}(x) = \sqrt{\frac{3}{2}} x. $$
My question is: If we normalize the Legendre polynomials, do I also have to normalized my Gauss-Legendre weights as well? Or do we only normalized the polynomials in terms of the basis?
subroutine GaussQuad (xq,wq,n)
use parameters
implicit none
integer :: n
real(kind=8),dimension(n) :: xq,wq
integer :: i,iter
real(kind=8) :: xx
real(kind=8) :: legendre,dlegendre
do i=1,n
xx = cos(dpi*(i - 0.25d0)/(n + 0.5d0))
do iter=1,500
xx = xx - legendre(xx,n)/dlegendre(xx,n)
end do
xq(i) = xx
wq(i) = (2.0*dble(n) + 1.0)*2.0d0/((1.0d0-xx**2.0)*dlegendre(xx,n)**2.0)
end do
end subroutine GaussQuad
In order for my 2D code to work I need to use the normalized Legendre polynomials in the Gauss quadrature routine along with the $2n + 1$ normalization on the weights (see how its been added to wq(i)). However, I only got this to work due to an ad hoc guess. I would like to avoid this as I don't personally understand why this is required for my solver to work.