tem_stencil_getLabelForcxDir Function

public function tem_stencil_getLabelForcxDir(me, prevailDir) result(uLabel)

This function returns a unique label for given stencil cxDir

Arguments

Type IntentOptional Attributes Name
type(tem_stencilHeader_type), intent(in) :: me

stencil

real(kind=rk), intent(in) :: prevailDir(:,:)

prevail directions

Return Value character(len=labelLen)

return unique label


Calls

proc~~tem_stencil_getlabelforcxdir~~CallsGraph proc~tem_stencil_getlabelforcxdir tem_stencil_getLabelForcxDir proc~tem_determine_discretevector tem_determine_discreteVector proc~tem_stencil_getlabelforcxdir->proc~tem_determine_discretevector

Source Code

  function tem_stencil_getLabelForcxDir( me, prevailDir ) result (uLabel)
    ! -------------------------------------------------------------------- !
    !> stencil
    type(tem_stencilHeader_type), intent(in) :: me
    !> prevail directions
    real(kind=rk), intent(in) :: prevailDir(:,:)
    !> return unique label
    character(len=labelLen) :: uLabel
    ! -------------------------------------------------------------------- !
    integer :: vector(3)
    integer :: iDir, iDir_tem, length
    character(len=4) :: buffer
    ! -------------------------------------------------------------------- !

    ! if stencil label is one of below then set label to stencil label
    select case(trim(me%label))
    case ( 'd3q19', 'd3q27', 'd3q13', 'd3q7', 'd3q6', 'flekkoy', &
      &    'd2q9', 'd2q5',                                       &
      &    'd1q3',                                               &
      &    'new_stencil'                                         )
      uLabel = trim(me%label)

    case default
      uLabel = ''
      ! loop over each direction of stencil
      do iDir = 1, me%QQN

        vector = me%cxDir(:, iDir)

        ! if length of vector is > 1 append length to label
        length = ceiling( sqrt( dot_product( real(vector, kind=rk), &
          &                                  real(vector, kind=rk)  &
          &                                )                        &
          &                    )                                    )

        ! determine discrete vector from prevailDir
        call tem_determine_discreteVector(vector, prevailDir)
        ! find direction label
        do iDir_tem=1,qQQQ
          if ( all(vector == qOffset(iDir_tem,:)) ) then
            uLabel = trim(uLabel)//trim(adjustl(qDirName(iDir_tem)))
          end if
        end do

        ! append length
        if (length > 1) then
          write(buffer,'(i4)') length
          uLabel = trim(uLabel)//trim(adjustl(buffer))
        end if

        ! if cxDir is 0 then set label to restPosition
        if ( all(me%cxDir(:, iDir) == 0 ) ) then
          uLabel = 'restPosition'
        end if
      end do

      write(buffer,'(i4)') me%QQN
      uLabel = trim(uLabel)//'_QQN'//trim(adjustl(buffer))

    end select

  end function tem_stencil_getLabelForcxDir