Subroutine to make the matrices for interpolation between noodes
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=pfdp), | intent(in) | :: | f_nodes(0:f_nnodes-1) | quadrature nodes on fine level |
||
integer, | intent(in) | :: | f_nnodes | number of nodes on fine level |
||
real(kind=pfdp), | intent(in) | :: | c_nodes(0:c_nnodes-1) | quadrature nodes on coarse level |
||
integer, | intent(in) | :: | c_nnodes | number of nodes on coarse level |
||
real(kind=pfdp), | intent(out) | :: | tmat(0:f_nnodes-1,0:c_nnodes-1) | Interpolation matrix to compute |
subroutine pf_time_interpolation_matrix(f_nodes, f_nnodes, c_nodes, c_nnodes, tmat)
integer, intent(in) :: f_nnodes !! number of nodes on fine level
integer, intent(in) :: c_nnodes !! number of nodes on coarse level
real(pfdp), intent(in) :: f_nodes(0:f_nnodes-1) !! quadrature nodes on fine level
real(pfdp), intent(in) :: c_nodes(0:c_nnodes-1) !! quadrature nodes on coarse level
real(pfdp), intent(out) :: tmat(0:f_nnodes-1,0:c_nnodes-1) !! Interpolation matrix to compute
integer :: i, j, k
real(pfdp) :: xi, num, den
do i = 0, f_nnodes-1
xi = f_nodes(i)
do j = 0, c_nnodes-1
den = 1.0_pfdp
num = 1.0_pfdp
do k = 0, c_nnodes-1
if (k == j) cycle
den = den * (c_nodes(j) - c_nodes(k))
num = num * (xi - c_nodes(k))
end do
tmat(i, j) = num/den
end do
end do
end subroutine pf_time_interpolation_matrix