tem_init_elemLevels Subroutine

public subroutine tem_init_elemLevels(me, boundary, tree, stencils)

subroutine to find neighbours of cells

Typically every element requires information from its neighbors to perform an update of its state. All such required neighbors constitute a so called tem_stencil_module. tem_build_horizontalDependencies, or the connectivity of elements on the same refinement level in the tree, are therefore essential for the stencils in typical mesh-based numerical schemes. We now sketch the method to find the connectivity of elements in the mesh with the help of the described mesh layout. In a distributed mesh, the first distinction has to be made with respect to processor ownership.

For all identify_local_element, their actual position in the sparse mesh has to be identified for a given treeID.

A tem_path_type comparison of two nodes to decide their relative position in the ordered list of elements has to take into account the hierarchy of the mesh.

As in the actual simulation only leaves will be present, and no overlap of refinement levels is allowed, this is a sufficient determination. However, such overlapping regions might be created to enable the interpolation between different levels with virtual elements. These special elements are distinguished anyway, so this does not pose any problem in the search for neighborhood relations.

An element can be either identified by its treeID or by a tuple with four integer entries for the spatial coordinates and the refinement level: . This coordinate fully describes the spatial shape and position of an element and is important to determine spatial relations between elements. Conversion between treeIDs and coordinates can be achieved by the routines - tem_CoordOfId Coordinate from TreeID - tem_IdOfCoord TreeID from Coordinate

The spatial indices are limited by the refinement level: . To avoid undefined coordinates, movements through the mesh by additions to indices are done in a modulo() safeguard resulting in an periodic universe cube. This enables the movement in the mesh in horizontal direction by index alteration and translation into a treeID again. The described procedure is completely reversible, enabling the construction of the treeID for any given coordinate. Thus, the conversion between this coordinate and the serialized treeID encoding is fully described by the topology of the octree and the chosen space-filling curve ordering of elements, as explained above.

With this method we can describe the neighborhood of any given element independently of the actual solver by a simple list of relative offsets. In contrast to the generic horizontal relation, the vertical relation between child and parent nodes in the tree requires an interpolation operator between different refinement levels. This interpolation usually has to take into account solver specific requirements, but is otherwise quite isolated from the numerical operation on each refinement level. The TreElM library offers the solver a level-wise view, as suggested by the properties described above. To find all required neighbors in the distributed octree, the solver merely has to provide its horizontal dependencies. These are described with the help of an element specific tem_stencil_module. A stencil is basically a set of element-offsets , describing the relative positions of all required elements for a given element.

In this routine, level descriptor is allocated, all elements in tree are added into me%elem as fluid type, including their property, pntTID, stencil, neighID, sourceProc


type(tem_levelDesc_type), intent(out), allocatable:: me(:)

neighbor list containing all the neighbours for the cells given in treeidsubset. Result of this routine

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

boundaries for the elements with bnd property set

type(treelmesh_type), intent(in) :: tree

subset of tree ids for which the neighbours will be specified

type(tem_stencilHeader_type), intent(in) :: stencils(:)

the given stencil


proc~~tem_init_elemlevels~~CallsGraph proc~tem_init_elemlevels tem_init_elemLevels proc~tem_stencil_map_totreelmdef tem_stencil_map_toTreelmDef proc~tem_init_elemlevels->proc~tem_stencil_map_totreelmdef interface~tem_logging_isactive tem_logging_isActive proc~tem_init_elemlevels->interface~tem_logging_isactive interface~append~4 append proc~tem_init_elemlevels->interface~append~4 proc~tem_horizontalspacer tem_horizontalSpacer proc~tem_init_elemlevels->proc~tem_horizontalspacer proc~tem_calc_neighbors tem_calc_neighbors proc~tem_init_elemlevels->proc~tem_calc_neighbors proc~tem_coordofid tem_CoordOfId proc~tem_init_elemlevels->proc~tem_coordofid proc~tem_require_dump tem_require_dump proc~tem_init_elemlevels->proc~tem_require_dump proc~tem_alloc_leveldesc tem_alloc_levelDesc proc~tem_init_elemlevels->proc~tem_alloc_leveldesc interface~init~15 init proc~tem_init_elemlevels->interface~init~15 proc~tem_abort tem_abort proc~tem_init_elemlevels->proc~tem_abort proc~tem_elemlist_dump tem_elemList_dump proc~tem_init_elemlevels->proc~tem_elemlist_dump proc~tem_logging_isactive_primary tem_logging_isActive_primary interface~tem_logging_isactive->proc~tem_logging_isactive_primary proc~tem_logging_isactive_for tem_logging_isActive_for interface~tem_logging_isactive->proc~tem_logging_isactive_for proc~append_ga_dynlong append_ga_dynlong interface~append~4->proc~append_ga_dynlong proc~append_ga_dynlong_vec append_ga_dynlong_vec interface~append~4->proc~append_ga_dynlong_vec proc~tem_firstidatlevel tem_FirstIdAtLevel proc~tem_calc_neighbors->proc~tem_firstidatlevel proc~tem_idofcoord tem_IdOfCoord proc~tem_calc_neighbors->proc~tem_idofcoord proc~tem_levelof tem_LevelOf proc~tem_coordofid->proc~tem_levelof proc~tem_alloc_leveldesc->interface~init~15 proc~init_ga2d_real init_ga2d_real interface~init~15->proc~init_ga2d_real mpi_abort mpi_abort proc~tem_abort->mpi_abort proc~tem_element_dump tem_element_dump proc~tem_elemlist_dump->proc~tem_element_dump interface~tem_stencil_dump tem_stencil_dump proc~tem_element_dump->interface~tem_stencil_dump interface~expand~2 expand proc~append_ga_dynlong->interface~expand~2 proc~append_ga_dynlong_vec->interface~expand~2 proc~expand_ga_dynlong expand_ga_dynlong interface~expand~2->proc~expand_ga_dynlong proc~tem_stencilheader_dump tem_stencilHeader_dump interface~tem_stencil_dump->proc~tem_stencilheader_dump proc~tem_stencilelement_dump tem_stencilElement_dump interface~tem_stencil_dump->proc~tem_stencilelement_dump

Called by

proc~~tem_init_elemlevels~~CalledByGraph proc~tem_init_elemlevels tem_init_elemLevels proc~tem_create_leveldesc tem_create_levelDesc proc~tem_create_leveldesc->proc~tem_init_elemlevels proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_dimbydim_construction->proc~tem_create_leveldesc proc~tem_build_face_info tem_build_face_info proc~tem_build_face_info->proc~tem_dimbydim_construction proc~check_serial_multilevel_facedesc check_serial_multilevel_faceDesc proc~check_serial_multilevel_facedesc->proc~tem_build_face_info proc~check_parallel_singlelevel_facedesc check_parallel_singlelevel_faceDesc proc~check_parallel_singlelevel_facedesc->proc~tem_build_face_info proc~check_serial_singlelevel_facedesc check_serial_singlelevel_faceDesc proc~check_serial_singlelevel_facedesc->proc~tem_build_face_info



type(tem_stencilElement_type), private :: tStencil
integer, private :: posInTree
integer, private :: nElemsBnd
integer, private :: iQQN
integer, private :: iLevel
integer, private :: nProcs
integer, private :: hashpos
integer, private :: x(4)
integer, private :: nStencils
integer, private :: iStencil
integer, private :: elemPos
integer, private :: nStencilElems
integer, private :: indElem
integer, private :: minLevel
integer, private :: maxLevel
integer, private :: QQN
integer, private :: initlen
integer(kind=long_k), private :: treeID
integer(kind=long_k), private, allocatable:: neighIDs(:)
integer, private :: addedPos
logical, private :: wasAdded
integer, private :: posInBCID