PolynomialDerivativeMatrix Subroutine

public subroutine PolynomialDerivativeMatrix(N_in, xGP, D)

Computes polynomial differentiation matrix for interpolation polynomial given by set of nodes. (Algorithm 37, Kopriva book)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: N_in

polynomial degree

real(kind=wp), intent(in) :: xGP(0:N_in)

Gauss point positions for the reference interval [-1,1]

real(kind=wp), intent(out) :: D(0:N_in,0:N_in)

differentiation Matrix


Calls

proc~~polynomialderivativematrix~~CallsGraph proc~polynomialderivativematrix PolynomialDerivativeMatrix interface~barycentricweights BarycentricWeights proc~polynomialderivativematrix->interface~barycentricweights interface~barycentricweights->interface~barycentricweights

Source Code

SUBROUTINE PolynomialDerivativeMatrix(N_in,xGP,D)
IMPLICIT NONE
!----------------------------------------------------------------------------------------------------------------------------------
! INPUT/OUTPUT VARIABLES
INTEGER,INTENT(IN) :: N_in              !! polynomial degree
REAL(wp),INTENT(IN)    :: xGP(0:N_in)       !! Gauss point positions for the reference interval [-1,1]
REAL(wp),INTENT(OUT)   :: D(0:N_in,0:N_in)  !! differentiation Matrix
!----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
INTEGER            :: iGP,iLagrange
REAL(wp)               :: wBary(0:N_in)
!==================================================================================================================================
CALL BarycentricWeights(N_in,xGP,wBary)
D(:,:)=0.0_wp
DO iLagrange=0,N_in
  DO iGP=0,N_in
    IF(iLagrange.NE.iGP)THEN
      D(iGP,iLagrange)=wBary(iLagrange)/(wBary(iGP)*(xGP(iGP)-xGP(iLagrange)))
      D(iGP,iGP)=D(iGP,iGP)-D(iGP,iLagrange)
    END IF ! (iLagrange.NE.iGP)
  END DO ! iGP
END DO ! iLagrange
END SUBROUTINE PolynomialDerivativeMatrix