ApplyFlip_MappedVector2D_t Subroutine

public subroutine ApplyFlip_MappedVector2D_t(this, mesh)

Arguments

TypeIntentOptionalAttributesName
class(MappedVector2D_t), intent(inout) :: this
type(Mesh2D), intent(in) :: mesh

Contents


Source Code

  subroutine ApplyFlip_MappedVector2D_t(this,mesh)
    ! Apply side flips to sides where MPI exchanges took place.
    implicit none
    class(MappedVector2D_t),intent(inout) :: this
    type(Mesh2D),intent(in) :: mesh
    ! Local
    integer :: e1,s1,e2,s2
    integer :: i,i2
    integer :: r2,flip,ivar,idir
    real(prec) :: extBuff(1:this%interp%N+1)

    do idir = 1,2
      do ivar = 1,this%nvar
        do e1 = 1,this%nElem
          do s1 = 1,4

            e2 = mesh%sideInfo(3,s1,e1) ! Neighbor Element (global id)

            if(e2 > 0) then ! Interior Element
              r2 = mesh%decomp%elemToRank(e2) ! Neighbor Rank

              if(r2 /= mesh%decomp%rankId) then

                s2 = mesh%sideInfo(4,s1,e1)/10
                flip = mesh%sideInfo(4,s1,e1)-s2*10

                ! Need to update extBoundary with flip applied
                if(flip == 1) then

                  do i = 1,this%interp%N+1
                    i2 = this%interp%N+2-i
                    extBuff(i) = this%extBoundary(i2,s1,e1,ivar,idir)
                  enddo
                  do i = 1,this%interp%N+1
                    this%extBoundary(i,s1,e1,ivar,idir) = extBuff(i)
                  enddo

                endif
              endif

            endif

          enddo
        enddo
      enddo
    enddo

  endsubroutine ApplyFlip_MappedVector2D_t