ObserverSourcePairNewUpdate Subroutine

public subroutine ObserverSourcePairNewUpdate(self, N, NDiscard, M, tsource, sameDelay)

Type Bound

ObserverSourcePairClass

Arguments

Type IntentOptional Attributes Name
class(ObserverSourcePairClass) :: self
integer, intent(in) :: N
integer, intent(in) :: NDiscard
integer, intent(in) :: M
real(kind=RP), intent(in), dimension(:) :: tsource
logical, intent(in) :: sameDelay

Source Code

  Subroutine ObserverSourcePairNewUpdate(self, N, NDiscard, M, tsource, sameDelay)

       implicit none

       class(ObserverSourcePairClass)                      :: self
       integer, intent(in)                                 :: N, NDiscard, M
       ! real(kind=RP), dimension(N), intent(in)             :: tobserver
       real(kind=RP), dimension(:), intent(in)             :: tsource
       logical, intent(in)                                 :: sameDelay

       !local variables
       real(kind=RP), dimension(M)                         :: tPair         ! time array of the panel
       real(kind=RP), dimension(:,:), allocatable          :: PaccFuture    ! solution of the pair of future (have not been interpolainterpolated) values
       integer                                             :: Nfuture

       tPair = tsource + self % tDelay
       if (sameDelay) then
           !size = 1 for last value + 1(empty for next iter)
           Nfuture = 2
       else
           !size = M - interpolated values +1 + 1(empty for next iter)
           Nfuture = M - N -NDiscard + 1
       end if 

       ! save old results and kept last position empty
       allocate(PaccFuture(Nfuture-1,3))
       PaccFuture(:,:) = self % Pacc(M-Nfuture+2:M,:)

       safedeallocate(self % Pacc)
       allocate(self % Pacc(1:Nfuture,3))

       self % Pacc(1:Nfuture-1,:) = PaccFuture(:,:)

       if (.not. sameDelay) then
           allocate(self % tInterp(1:Nfuture))
           ! save old results and kept last position empty
           self % tInterp(1:Nfuture-1) = tPair(NDiscard+N+1:M)
       end if 

  End Subroutine ObserverSourcePairNewUpdate