MapBoundaryConditions_DGModel3D_t Subroutine

public subroutine MapBoundaryConditions_DGModel3D_t(this)

Scan the mesh sideInfo and populate the elements/sides arrays for each registered boundary condition.

Arguments

TypeIntentOptionalAttributesName
class(DGModel3D_t), intent(inout) :: this

Contents


Source Code

  subroutine MapBoundaryConditions_DGModel3D_t(this)
    !! Scan the mesh sideInfo and populate the elements/sides
    !! arrays for each registered boundary condition.
    implicit none
    class(DGModel3D_t),intent(inout) :: this
    ! Local
    type(BoundaryCondition),pointer :: bc
    integer :: iEl,k,e2,bcid
    integer :: count,n
    integer,allocatable :: elems(:),sds(:)

    ! Map hyperbolic BCs
    bc => this%hyperbolicBCs%head
    do while(associated(bc))
      count = 0
      do iEl = 1,this%mesh%nElem
        do k = 1,6
          e2 = this%mesh%sideInfo(3,k,iEl)
          bcid = this%mesh%sideInfo(5,k,iEl)
          if(e2 == 0 .and. bcid == bc%bcid) count = count+1
        enddo
      enddo

      if(count > 0) then
        allocate(elems(count),sds(count))
        n = 0
        do iEl = 1,this%mesh%nElem
          do k = 1,6
            e2 = this%mesh%sideInfo(3,k,iEl)
            bcid = this%mesh%sideInfo(5,k,iEl)
            if(e2 == 0 .and. bcid == bc%bcid) then
              n = n+1
              elems(n) = iEl
              sds(n) = k
            endif
          enddo
        enddo
        call this%hyperbolicBCs%PopulateBoundaries(bc%bcid,count,elems,sds)
        deallocate(elems,sds)
      endif
      bc => bc%next
    enddo

    ! Map parabolic BCs
    bc => this%parabolicBCs%head
    do while(associated(bc))
      count = 0
      do iEl = 1,this%mesh%nElem
        do k = 1,6
          e2 = this%mesh%sideInfo(3,k,iEl)
          bcid = this%mesh%sideInfo(5,k,iEl)
          if(e2 == 0 .and. bcid == bc%bcid) count = count+1
        enddo
      enddo

      if(count > 0) then
        allocate(elems(count),sds(count))
        n = 0
        do iEl = 1,this%mesh%nElem
          do k = 1,6
            e2 = this%mesh%sideInfo(3,k,iEl)
            bcid = this%mesh%sideInfo(5,k,iEl)
            if(e2 == 0 .and. bcid == bc%bcid) then
              n = n+1
              elems(n) = iEl
              sds(n) = k
            endif
          enddo
        enddo
        call this%parabolicBCs%PopulateBoundaries(bc%bcid,count,elems,sds)
        deallocate(elems,sds)
      endif
      bc => bc%next
    enddo

  endsubroutine MapBoundaryConditions_DGModel3D_t