tem_isFromFinerFace Function

private function tem_isFromFinerFace(facePos, faces) result(isFromFiner)

faces on the current rank.

\todo JZ: Add more cases for the different types of faces. Especially combinations of finer/coarser elements and remote properties are still missing. For some combinations it might be necessary to determine if vertical dependencies exist or not.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: facePos
type(tem_face_descriptor_type), intent(in) :: faces

Return Value integer


Calls

proc~~tem_isfromfinerface~~CallsGraph proc~tem_isfromfinerface tem_isFromFinerFace proc~tem_abort tem_abort proc~tem_isfromfinerface->proc~tem_abort mpi_abort mpi_abort proc~tem_abort->mpi_abort

Called by

proc~~tem_isfromfinerface~~CalledByGraph proc~tem_isfromfinerface tem_isFromFinerFace proc~tem_build_fromfinerlist tem_build_fromFinerList proc~tem_build_fromfinerlist->proc~tem_isfromfinerface proc~tem_build_facelists tem_build_faceLists proc~tem_build_facelists->proc~tem_build_fromfinerlist proc~tem_build_face_info tem_build_face_info proc~tem_build_face_info->proc~tem_build_facelists

Source Code

  function tem_isFromFinerFace(facePos, faces) result( isFromFiner )
    ! --------------------------------------------------------------------------
    integer, intent(in) :: facePos
    type(tem_face_descriptor_type), intent(in) :: faces
    integer :: isFromFiner
    ! --------------------------------------------------------------------------
    integer :: leftPrp, rightPrp
    ! --------------------------------------------------------------------------

    leftPrp = faces%faceList%leftPrp%val(facePos)
    rightPrp = faces%faceList%rightPrp%val(facePos)

    ! Fluid-fluid face (purely local)
    if( leftPrp.eq.tem_fluidFace_prp .and. rightPrp.eq.tem_fluidFace_prp ) then
      isFromFiner = 0

    ! Fluid-ghostFromFiner face (purley local, no remote property set)
    elseif( leftPrp.eq.tem_fluidFace_prp .and.                                 &
      &     rightPrp.eq.tem_fromFinerFace_prp ) then
      isFromFiner = tem_right

    ! GhostFromFiner-fluid face (purley local, no remote property set)
    elseif( leftPrp.eq.tem_fromFinerFace_prp .and.                             &
      &     rightPrp.eq.tem_fluidFace_prp ) then
      isFromFiner = tem_left

    ! GhostFromFiner-GhostFromFiner face (purley local, no remote property set)
    ! --> two ghost elements from finer meet each other somehow. However, we
    !     do not have to interpolate for these face combination.
    elseif( leftPrp.eq.tem_fromFinerFace_prp .and.                             &
      &     rightPrp.eq.tem_fromFinerFace_prp ) then
      isFromFiner = 0

    ! Fluid-ghostFromCoarser face (purely local, no remote property)
    ! --> no from finer face.
    elseif( leftPrp.eq.tem_fluidFace_prp .and.                                 &
      &     rightPrp.eq.tem_fromCoarserFace_prp ) then
      isFromFiner = 0

    ! GhostFromCoarser-fluid face (purely local, no remote property)
    ! --> no from finer face.
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.tem_fluidFace_prp ) then
      isFromFiner = 0

    ! GhostFromCoarser-GhostFromCoarser face (purely local, no remote property)
    ! --> no from finer face. Somehow, two ghost from coarser meet each other,
    !     but it is not from finer face.
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.tem_fromCoarserFace_prp ) then
      isFromFiner = 0

    ! Fluid-remote face (no refinement property set)
    ! --> no refinement, so it is not from finer.
    elseif( leftPrp.eq.tem_fluidFace_prp .and.                                 &
      &     rightPrp.eq.tem_remoteFace_prp ) then
      isFromFiner = 0

    ! Remote-fluid face (no refinement property set)
    ! --> no refinement, so it is not from finer.
    elseif( leftPrp.eq.tem_remoteFace_prp .and.                                &
      &     rightPrp.eq.tem_fluidFace_prp ) then
      isFromFiner = 0

    ! GhostFromCoarser-remote face
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.tem_remoteFace_prp ) then
      isFromFiner = 0

    ! Remote-GhostFromCoarser face
    elseif( leftPrp.eq.tem_remoteFace_prp .and.                                &
      &     rightPrp.eq.tem_fromCoarserFace_prp ) then
      isFromFiner = 0

    ! Remote-remote face (somehow, two halo elements are meeting)
    elseif( leftPrp.eq.tem_remoteFace_prp .and.                                &
      &     rightPrp.eq.tem_remoteFace_prp ) then
      isFromFiner = 0

    ! notExist - remote face (nothing from a finer level)
    elseif( leftPrp.eq.tem_notExist_prp .and.                                  &
      &     rightPrp.eq.tem_remoteFace_prp ) then
      isFromFiner = 0

    ! remote - notExist face (nothing from a finer level)
    elseif( leftPrp.eq.tem_remoteFace_prp .and.                                &
      &     rightPrp.eq.tem_notExist_prp ) then
      isFromFiner = 0

    ! fluid-remote+fromCoaser face (nothing is from a finer level)
    elseif( leftPrp.eq.tem_fluidFace_prp .and.                                 &
      &     rightPrp.eq.ior(tem_remoteFace_prp, tem_fromCoarserFace_prp)) then
      isFromFiner = 0

    ! remote+fromCoarser-fluid face (nothing is from a finer level)
    elseif( leftPrp.eq.ior(tem_remoteFace_prp,tem_fromCoarserFace_prp) .and.   &
      &     rightPrp.eq.tem_fluidFace_prp) then
      isFromFiner = 0

    ! notExist-remote+fromCoaser face (neither my ranks hold an element for this
    ! face, nor elements are from finer. So, this face is not from finer).
    elseif( leftPrp.eq.tem_notExist_prp .and.                                  &
      &     rightPrp.eq.ior(tem_remoteFace_prp, tem_fromCoarserFace_prp)) then
      isFromFiner = 0

    ! remote+fromCoarser-remote face (neither my ranks hold an element for this
    ! face, nor elements are from finer. So, this face is not from finer).
    elseif( leftPrp.eq.ior(tem_remoteFace_prp, tem_fromCoarserFace_prp) .and.  &
      &     rightPrp.eq.tem_notExist_prp ) then
      isFromFiner = 0

    ! remote+fromCoarser-remote+fromCoaser face (neither my ranks hold an
    ! element for this face, nor elements are from finer. So, this face is not
    ! from finer).
    elseif( leftPrp.eq.ior(tem_remoteFace_prp, tem_fromCoarserFace_prp) .and.  &
      &     rightPrp.eq.ior(tem_remoteFace_prp, tem_fromCoarserFace_prp)) then
      isFromFiner = 0

    ! fromFiner - not exist face (this situation happens if a coarser element is
    ! located next to finer elements which are completely located on my rank. So
    ! my rank has to interpolate them upwards before we send them to the coarse
    ! element on the remote rank)
    elseif( leftPrp.eq.tem_fromFinerFace_prp .and.                             &
      &     rightPrp.eq.tem_notExist_prp ) then
      isFromFiner = 0

    ! notExist - fromFiner face (this situation happens if a coarser element is
    ! located next to finer elements which are completely located on my rank. So
    ! my rank has to interpolate them upwards before we send them to the coarse
    ! element on the remote rank)
    elseif( leftPrp.eq.tem_notExist_prp .and.                                  &
      &     rightPrp.eq.tem_fromFinerFace_prp ) then
      isFromFiner = 0

    ! fromCoarser - notExist face (nothing is from finer)
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.tem_notExist_prp ) then
      isFromFiner = 0

    ! notExist - fromCoarser face (nothing is from finer)
    elseif( leftPrp.eq.tem_notExist_prp .and.                                  &
      &     rightPrp.eq.tem_fromCoarserFace_prp ) then
      isFromFiner = 0

    ! fluid-remote+fromFiner face (data is send to the remote rank on this
    ! level. The remote rank will also do the interpolation for me, so my rank
    ! does not have to do anyhting here.)
    elseif( leftPrp.eq.tem_fluidFace_prp .and.                                 &
      &     rightPrp.eq.ior(tem_fromFinerFace_prp, tem_remoteFace_prp)) then
      isFromFiner = tem_right

    ! remote+fromFiner-fluid face (data is send to the remote rank on this
    ! level. The remote rank will also do the interpolation for me, so my rank
    ! does not have to do anyhting here.)
    elseif( leftPrp.eq.ior(tem_fromFinerFace_prp, tem_remoteFace_prp) .and.    &
      &     rightPrp.eq.tem_fluidFace_prp ) then
      isFromFiner = tem_left

    ! remote+fromFiner-remote face (everything is remote)
    elseif( leftPrp.eq.ior(tem_fromFinerFace_prp, tem_remoteFace_prp) .and.    &
      &     rightPrp.eq.tem_remoteFace_prp ) then
      isFromFiner = 0

    ! remote-remote+fromFiner face (everything is remote)
    elseif( leftPrp.eq. tem_remoteFace_prp .and.                               &
      &     rightPrp.eq.ior(tem_remoteFace_prp, tem_fromFinerFace_prp)) then
      isFromFiner = 0

    ! notExist-remote+fromFiner face (nothing is on my rank)
    elseif( leftPrp.eq. tem_notExist_prp .and.                                 &
      &     rightPrp.eq.ior(tem_remoteFace_prp, tem_fromFinerFace_prp)) then
      isFromFiner = 0

    ! remote+fromFiner-notExist face (nothing is on my rank)
    elseif( leftPrp.eq.ior(tem_remoteFace_prp, tem_fromFinerFace_prp) .and.    &
      &     rightPrp.eq.tem_notExist_prp) then
      isFromFiner = 0

    ! fromFiner-fromCoarser face (everything is local, this is an intermediate
    ! face level (i.e. leveljumps of difference larger than 1 occure here) )
    elseif( leftPrp.eq.tem_fromFinerFace_prp .and.                             &
      &     rightPrp.eq.tem_fromCoarserFace_prp ) then
      isFromFiner = tem_left

    ! fromCoarser-fromFiner face (everything is local, this is an intermediate
    ! face level (i.e. leveljumps of difference larger than 1 occure here) )
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.tem_fromFinerFace_prp ) then
      isFromFiner = tem_right

    ! fromFiner+remote - fromCoarser face (intermediate level for domain
    ! boundary and refinement boundary)
    elseif( leftPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp) .and.     &
      &     rightPrp.eq.tem_fromCoarserFace_prp) then
      isFromFiner = tem_left

    ! fromCoarser - remote+fromFiner face (intermediate level for domain
    ! boundary and refinement boundary)
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp)) then
      isFromFiner = tem_right

    ! remote+fromFiner - remote+fromFiner face (everything is remote, nothing
    ! to be done)
    elseif( leftPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp)  .and.    &
      &     rightPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp)) then
      isFromFiner = 0

    ! remote+fromFiner - fromFiner face (everything is from finer, nothing to
    ! be done)
    elseif( leftPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp) .and.     &
      &     rightPrp.eq.tem_fromFinerFace_prp) then
      isFromFiner = 0

    ! fromFiner - remote+fromFiner face (everything is from finer, nothing to
    ! be done)
    elseif( leftPrp.eq.tem_fromFinerFace_prp  .and.                            &
      &     rightPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp)) then
      isFromFiner = 0

    ! fromFiner - remote face (nothing to be done)
    elseif(leftPrp.eq.tem_fromFinerFace_prp .and. rightPrp.eq.tem_remoteFace_prp) then
      isFromFiner = 0

    ! remote - fromFiner face (nothing to be done)
    elseif( leftPrp.eq.tem_remoteFace_prp .and.                                &
      &     rightPrp.eq.tem_fromFinerFace_prp) then
      isFromFiner = 0

    ! remote+fromCoarser - fromCoarser face (elements are on coarser
    ! level, here and remote so nothing to be done)
    elseif( leftPrp.eq.ior(tem_fromCoarserFace_prp,tem_remoteFace_prp) .and.   &
      &     rightPrp.eq.tem_fromCoarserFace_prp) then
      isFromFiner = 0

    ! fromCoarser - remote+fromCoarser face (elements are on coarser
    ! level, here and remote so nothing to be done)
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.ior(tem_fromCoarserFace_prp,tem_remoteFace_prp)) then
      isFromFiner = 0

    ! fluid - boundary face (nothing to be done)
    elseif(leftPrp.eq.tem_fluidFace_prp .and. rightPrp.eq.tem_bndFace_prp) then
      isFromFiner = 0

    ! boundary - fluid face (nothing to be done)
    elseif(leftPrp.eq.tem_bndFace_prp .and. rightPrp.eq.tem_fluidFace_prp) then
      isFromFiner = 0

    ! remote - boundary face (nothing to be done)
    elseif(leftPrp.eq.tem_remoteFace_prp .and. rightPrp.eq.tem_bndFace_prp) then
      isFromFiner = 0

    ! boundary - remote face (nothing to be done)
    elseif(leftPrp.eq.tem_bndFace_prp .and. rightPrp.eq.tem_remoteFace_prp) then
      isFromFiner = 0

    ! fromFiner - boundary face (nothing to be done)
    elseif( leftPrp.eq.tem_fromFinerFace_prp .and.                             &
      &     rightPrp.eq.tem_bndFace_prp) then
      isFromFiner = 0

    ! boundary - fromFiner face (nothing to be done)
    elseif( leftPrp.eq.tem_bndFace_prp .and.                                   &
      &     rightPrp.eq.tem_fromFinerFace_prp) then
      isFromFiner = 0

    ! fromFiner+remote - boundary face (nothing to be done)
    elseif( leftPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp) .and.     &
      &     rightPrp.eq.tem_bndFace_prp) then
      isFromFiner = 0

    ! boundary - fromFiner+remote face (nothing to be done)
    elseif( leftPrp.eq.tem_bndFace_prp .and.                                   &
      &     rightPrp.eq.ior(tem_fromFinerFace_prp,tem_remoteFace_prp)) then
      isFromFiner = 0

    ! fromCoarser - boundary face (nothing to be done)
    elseif( leftPrp.eq.tem_fromCoarserFace_prp .and.                           &
      &     rightPrp.eq.tem_bndFace_prp) then
      isFromFiner = 0

    ! boundary - fromCoarser face (nothing to be done)
    elseif( leftPrp.eq.tem_bndFace_prp .and.                                   &
      &     rightPrp.eq.tem_fromCoarserFace_prp) then
      isFromFiner = 0

!> \todo JZ: Add more cases for the different types of faces. Especially
!! combinations of finer/coarser elements and remote properties are still
!! missing.
!! For some combinations it might be necessary to determine if vertical
!! dependencies exist or not.

    else
      write(logUnit(1),*) 'ERROR in tem_isFromFinerFace: not able to decide whether '// &
        &        'face is locally from finer or not, stopping'
      write(logUnit(1),*) 'left elem pos: ', faces%faceList%leftElemPos%val(facePos)
      write(logUnit(1),*) 'right elem pos: ', faces%faceList%rightElemPos%val(facePos)
      write(logUnit(1),*) 'left face prp: ', leftPrp
      write(logUnit(1),*) 'right face prp: ', rightPrp
      call tem_abort()
    end if

  end function tem_isFromFinerFace