Initialize the differentiation matrix for a reference element of order .
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ip), | intent(in) | :: | n | The order of the Jacobi polynomials. |
||
real(kind=wp), | intent(in), | dimension(n+1) | :: | x | The nodal points where the differentiation matrix will provide approximations to the derivative. |
|
real(kind=wp), | intent(in), | dimension(n+1,n+1) | :: | v | The Vandermonde matrix, . |
The return value is the differentiation matrix, .
function Dmatrix1D ( n, x, v )
!! Initialize the differentiation matrix for a reference element of
!! order \(n\).
integer(ip), intent(in) :: n
!! The order of the Jacobi polynomials.
real(wp), dimension(n+1), intent(in) :: x
!! The nodal points \(x\in[-1:1]\) where the differentiation matrix
!! will provide approximations to the derivative.
real(wp), dimension(n+1,n+1), intent(in) :: v
!! The Vandermonde matrix, \(\mathcal{V}_{ij}\).
real(wp), dimension(n+1,n+1) :: Dmatrix1D
!! The return value is the differentiation matrix, \(\mathcal{D}_r=
!! \mathcal{V}_r \mathcal{V}^{-1}\).
real(wp), dimension(n+1,n+1) :: vr, vrt, vt, drt
integer(ip), dimension(n+1) :: ipiv
integer(ip) :: i, j, info
vt = transpose(v)
vr = GradVandermonde1D ( n, x )
vrt = transpose(vr)
if ( wp == dp ) then
call dgesv ( n+1, n+1, vt, n+1, ipiv, vrt, n+1, info )
else if ( wp == qp ) then
call qgesv ( n+1, n+1, vt, n+1, ipiv, vrt, n+1, info )
endif
if (info <0) then
print*,'Parameter ', i, ' in call to dgesv has illegal value'
stop
end if
if (info >0) then
print*, 'Matrix in call to dgesv is singular'
stop
end if
Dmatrix1D = transpose(vrt)
end function Dmatrix1D