tem_build_face_info Subroutine

public subroutine tem_build_face_info(tree, boundary, commPattern, proc, faces, nEligibleChildren)

This routine builds a description of the faces on each level. The resulting array of tem_face_type ranges from the minimal level of the mesh to the maximal level of the mesh.

\todo Remove all the unnecessary faces from the face descriptor

\todo JZ: this is very memory consuming since we store them in different arrays several times.

Arguments

Type IntentOptional Attributes Name
type(treelmesh_type), intent(inout) :: tree

Tree representation of the mesh to buid the faces for.

type(tem_BC_prop_type), intent(in) :: boundary

The boundaries of your simulation domain.

type(tem_commPattern_type), intent(in) :: commPattern

The communication pattern you use for the buffer.

type(tem_comm_env_type), intent(in) :: proc

Process description to use.

type(tem_face_type), intent(out), allocatable :: faces(:)

The created face descriptors (one for each level).

integer, intent(in) :: nEligibleChildren

The number of eligible children for the vertical face dependency


Calls

proc~~tem_build_face_info~~CallsGraph proc~tem_build_face_info tem_build_face_info proc~tem_collect_faces tem_collect_faces proc~tem_build_face_info->proc~tem_collect_faces proc~tem_build_facelists tem_build_faceLists proc~tem_build_face_info->proc~tem_build_facelists proc~tem_build_facebuffers tem_build_faceBuffers proc~tem_build_face_info->proc~tem_build_facebuffers proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_build_face_info->proc~tem_dimbydim_construction proc~tem_extend_remoteprp tem_extend_remotePrp proc~tem_build_face_info->proc~tem_extend_remoteprp proc~tem_facedep_vertical tem_faceDep_vertical proc~tem_build_face_info->proc~tem_facedep_vertical proc~tem_get_faces tem_get_faces proc~tem_collect_faces->proc~tem_get_faces proc~tem_build_fromfinerlist tem_build_fromFinerList proc~tem_build_facelists->proc~tem_build_fromfinerlist proc~tem_build_computelist tem_build_computeList proc~tem_build_facelists->proc~tem_build_computelist proc~tem_build_facerecvbuffers tem_build_faceRecvBuffers proc~tem_build_facebuffers->proc~tem_build_facerecvbuffers proc~tem_build_facesendbuffers tem_build_faceSendBuffers proc~tem_build_facebuffers->proc~tem_build_facesendbuffers proc~tem_create_leveldesc tem_create_levelDesc proc~tem_dimbydim_construction->proc~tem_create_leveldesc interface~tem_stencil_dump tem_stencil_dump proc~tem_dimbydim_construction->interface~tem_stencil_dump proc~tem_define_dimstencil tem_define_dimStencil proc~tem_dimbydim_construction->proc~tem_define_dimstencil proc~tem_extend_commfromcoarserprp tem_extend_commFromCoarserPrp proc~tem_extend_remoteprp->proc~tem_extend_commfromcoarserprp proc~tem_extend_commfromfinerprp tem_extend_commFromFinerPrp proc~tem_extend_remoteprp->proc~tem_extend_commfromfinerprp proc~tem_facedep_verticaldown tem_faceDep_verticalDown proc~tem_facedep_vertical->proc~tem_facedep_verticaldown proc~tem_init_facedep tem_init_faceDep proc~tem_facedep_vertical->proc~tem_init_facedep proc~tem_facedep_verticalup tem_faceDep_verticalUp proc~tem_facedep_vertical->proc~tem_facedep_verticalup

Contents

Source Code


Source Code

  subroutine tem_build_face_info( tree, boundary, commPattern, proc, faces, &
                                & nEligibleChildren )
    ! --------------------------------------------------------------------------
    !> Tree representation of the mesh to buid the faces for.
    type(treelmesh_type), intent(inout) :: tree

    !> The boundaries of your simulation domain.
    type(tem_bc_prop_type), intent(in) :: boundary

    !> The communication pattern you use for the buffer.
    type(tem_commpattern_type), intent(in) :: commPattern

    !> Process description to use.
    type(tem_comm_env_type), intent(in) :: proc

    !> The number of eligible children for the vertical face dependency
    integer, intent(in) :: nEligibleChildren

    !> The created face descriptors (one for each level).
    type(tem_face_type), allocatable, intent(out) :: faces(:)
    ! --------------------------------------------------------------------------
    ! Level descriptor for each spatial direction and each level of your mesh.
    ! The level descriptor have to be constructed with the dimension by
    ! dimension stencils (+1, 0, -1) for each spatial direction.
    type(tem_levelDesc_type) :: levelDesc( 1:3, tree%global%minLevel  &
      &                                         :tree%global%maxLevel )
    type(tem_levelDesc_type), allocatable :: levelDescX(:)
    type(tem_levelDesc_type), allocatable :: levelDescY(:)
    type(tem_levelDesc_type), allocatable :: levelDescZ(:)
    integer :: iLevel
    ! --------------------------------------------------------------------------


    allocate(faces(tree%global%minLevel:tree%global%maxLevel))

    ! create the level desriptor in a dim-by-dim manner.
    write(logUnit(3),*)'Building dim-by-dim level descriptors for faces ...'
    call tem_dimByDim_construction( tree, boundary, commPattern, proc, &
      &                             levelDescX, levelDescY, levelDescZ )
    do iLevel = tree%global%minLevel,tree%global%maxLevel
      levelDesc(1,iLevel) = levelDescX(iLevel)
      levelDesc(2,iLevel) = levelDescY(iLevel)
      levelDesc(3,iLevel) = levelDescZ(iLevel)
    end do
    deallocate(levelDescX, levelDescY, levelDescZ)

    ! First we collect all the faces. A face is always identified by its left
    ! element tree id.
    ! We collect all the faces, even if only one element next to the face
    ! exists.
    ! Therefore, we run over fluids, ghostFromCoarser, ghostFromFiner and halo
    ! elements.
    ! We attach two-sided properties to the faces, too (depending on the element
    ! left and right to the face).
    call tem_collect_faces( levelDesc, tree%global%minLevel, &
      &                     tree%global%maxLevel, faces      )

    ! Now, we have to check all the faces which have the communication property
    ! again.
    ! We have to check if the halo element next to it is refined/from coarser on
    ! the remote rank. So, we extend the faces' properties.
    call tem_extend_remotePrp( levelDesc, tree%global%minLevel, &
      &                        tree%global%maxLevel, faces      )

    ! Now, we build the vertical dependency of the faces.
    call tem_faceDep_vertical( tree%global%minLevel, tree%global%maxLevel, &
      &                        faces, nEligibleChildren                    )

    !> \todo Remove all the unnecessary faces from the face descriptor

    ! Build the buffers for sent/received faces.
    call tem_build_faceBuffers( tree%global%minLevel, tree%global%maxLevel, &
      &                         faces, levelDesc                            )

    ! Build the iterators for the faces. These ones will be used by the solvers.
    call tem_build_faceLists(tree%global%minLevel, tree%global%maxLevel, &
      &                       nEligibleChildren, faces                   )

    !> \todo JZ: this is very memory consuming since we store them in different
    !! arrays several times.
    ! Buffer the dimension by dimension descriptor
    do iLevel = tree%global%minLevel,tree%global%maxLevel
      faces(iLevel)%dimByDimDesc(1) = levelDesc(1,iLevel)
      faces(iLevel)%dimByDimDesc(2) = levelDesc(2,iLevel)
      faces(iLevel)%dimByDimDesc(3) = levelDesc(3,iLevel)
    end do

  end subroutine tem_build_face_info