tem_intp_trilinearReduced_vect Function

private function tem_intp_trilinearReduced_vect(srcVal, targetCoord, nSize) result(phi)

This function returns the tri-linearly interpolated values from the seven source points to the target position located at targetCoord. The source points are arranged in a square from (0,0,0)x(1,1,1) The order of the source points are according to the morton curve

Arguments

Type IntentOptional AttributesName
real(kind=rk), intent(in) :: srcVal(nSize,7)

source values of the square corners

real(kind=rk), intent(in) :: targetCoord(3)

interpolation location within the square

integer, intent(in) :: nSize

vector size

Return Value real(kind=rk) (nSize)

interpolated value


Called by

proc~~tem_intp_trilinearreduced_vect~~CalledByGraph proc~tem_intp_trilinearreduced_vect tem_intp_trilinearReduced_vect interface~tem_intp_trilinearreduced tem_intp_trilinearReduced interface~tem_intp_trilinearreduced->proc~tem_intp_trilinearreduced_vect

Contents


Source Code

  function tem_intp_trilinearReduced_vect( srcVal, targetCoord, nSize )        &
    &                                                             result( phi )
    ! ---------------------------------------------------------------------------
    !> vector size
    integer, intent(in) :: nSize
    !> source values of the square corners
    real(kind=rk), intent(in) :: srcVal(nSize, 7)
    !> interpolation location within the square
    real(kind=rk), intent(in) :: targetCoord(3)
    !> interpolated value
    real(kind=rk) :: phi( nSize )
    ! ---------------------------------------------------------------------------
    real(kind=rk) :: phi_northFront, phi_southFront
    real(kind=rk) :: phi_northBack, phi_southBack
    real(kind=rk) :: phi_front, phi_back
    integer :: iSize
    ! ---------------------------------------------------------------------------
    do iSize = 1, nSize
      ! Linear interpolation on the cube front side (z = 0 )
      phi_northFront = (1._rk - targetCoord(1))* srcVal(iSize,3)               &
        &                     + targetCoord(1) * srcVal(iSize,4)
      phi_southFront = (1._rk - targetCoord(1))* srcVal(iSize,1)               &
        &                     + targetCoord(1) * srcVal(iSize,2)
      ! Linear interpolation on the cube back side (z = 1 )
      phi_northBack  = srcVal(iSize,7) !(1._rk - targetCoord(1))* srcVal(7) ! + targetCoord(1)*srcVal(8)
      phi_southBack  = (1._rk - targetCoord(1))* srcVal(iSize,5)               &
        &                     + targetCoord(1) * srcVal(iSize,6)
      ! Linear interpolation on the cube front side (z = 0 )
      phi_front = (1._rk - targetCoord(2))* phi_southFront                     &
        &                + targetCoord(2) * phi_northFront
      ! Linear interpolation on the cube back side (z = 1 )
      phi_back  = (1._rk - targetCoord(2))* phi_southBack                      &
        &                + targetCoord(2) * phi_northBack
      phi( iSize ) = (1._rk - targetCoord(3))* phi_front                       &
        &                   + targetCoord(3) * phi_back
    enddo

  end function tem_intp_trilinearReduced_vect