ObserverSourcePairInterpolateSolFirst Subroutine

public subroutine ObserverSourcePairInterpolateSolFirst(self, N, M, tobserver, tsource, nd)

Type Bound

ObserverSourcePairClass

Arguments

Type IntentOptional Attributes Name
class(ObserverSourcePairClass) :: self
integer, intent(in) :: N
integer, intent(in) :: M
real(kind=RP), intent(in), dimension(N) :: tobserver
real(kind=RP), intent(in), dimension(:) :: tsource
integer, intent(out) :: nd

Source Code

  Subroutine ObserverSourcePairInterpolateSolFirst(self, N, M, tobserver, tsource, nd)

       implicit none

       class(ObserverSourcePairClass)                      :: self
       integer, intent(in)                                 :: N, M
       real(kind=RP), dimension(N), intent(in)             :: tobserver
       real(kind=RP), dimension(:), intent(in)             :: tsource
       integer, intent(out)                                :: nd

       ! local variables
       real(kind=RP), dimension(N,3)                       :: PaccInterp    ! solution of the pair interpolated
       real(kind=RP), dimension(M)                         :: tPair         ! time array of the panel
       integer                                             :: i, j, ii

       ! get the times of the pair for interpolation
       tPair = tsource + self % tDelay

       j = 1
       nd = 0
       do i = 2, M
           if (j .gt. N) exit
           ii = i - 1
           if (tPair(i) .lt. tobserver(1)) then
               nd = nd +1
               cycle
           end if 
           PaccInterp(j,:) = linearInterpolation(tobserver(j), tPair(ii), self%Pacc(ii,:), tPair(i), self%Pacc(i,:), 3)
           j = j + 1
       end do 

           !update solution of the pair with the interpolated one
           self % Pacc(nd+1:nd+N,:) = PaccInterp

  End Subroutine ObserverSourcePairInterpolateSolFirst