generate_treelm_single Subroutine

private subroutine generate_treelm_single(me, origin, length, myPart, nParts, comm)

This serves as an simple grid generation for performance or scaling analysis without being obliged to use Seeder. You have to specify the generic grid parameters in the lua file instead of the mesh folder

 mesh = { predefined='single',
          origin = {0.,0.,0.},
          length = 10.}

You have to specify the shape 'single', a bounding box origin and its length. The generated element will have treeID 1 and is periodic in all directions. The given length will be the length of the element, and the bounding cube will be adapted accordingly, to map this to treeID 1.

Arguments

Type IntentOptional Attributes Name
type(treelmesh_type), intent(out) :: me

Mesh to generate

real(kind=rk), intent(in) :: origin(3)

Corner of the cube

real(kind=rk), intent(in) :: length

Length of cube

integer, intent(in) :: myPart

Partition of the caller (starts with 0)

integer, intent(in) :: nParts

Number of partitions

integer, intent(in) :: comm

communicator to be used


Called by

proc~~generate_treelm_single~~CalledByGraph proc~generate_treelm_single generate_treelm_single proc~tem_load_internal tem_load_internal proc~tem_load_internal->proc~generate_treelm_single proc~load_tem load_tem proc~load_tem->proc~tem_load_internal proc~tem_restart_readheader tem_restart_readHeader proc~tem_restart_readheader->proc~load_tem proc~tem_load_restart tem_load_restart proc~tem_load_restart->proc~tem_restart_readheader

Source Code

  subroutine generate_treelm_single( me, origin, length, myPart, &
    &                                nParts, comm )
    ! -------------------------------------------------------------------- !
    !> Mesh to generate
    type(treelmesh_type), intent(out) :: me
    !> Corner of the cube
    real(kind=rk), intent(in) :: origin(3)
    !> Length of cube
    real(kind=rk), intent(in) :: length
    !> Partition of the caller (starts with 0)
    integer, intent(in) :: myPart
    !> Number of partitions
    integer, intent(in) :: nParts
    !> communicator to be used
    integer, intent(in) :: comm
    ! -------------------------------------------------------------------- !
    integer(kind=long_k) :: firstID, lastID
    integer :: iPart
    ! -------------------------------------------------------------------- !

    me%global%nParts = nParts
    me%global%myPart = myPart
    me%global%comm = comm

    me%global%origin = origin
    me%global%BoundingCubeLength = length
    me%global%minLevel = 1
    me%global%maxLevel = 1
    me%global%label = 'Generic_Single'
    me%global%predefined = 'single'
    write(me%global%comment,'(a15,i7,a16,i2,a1)')         &
      &     'Generated with ', nParts, ' Parts on Level 1.'
    me%global%dirname = './'

    ! Boundary property to define periodic boundary
    me%global%nProperties = 1
    if (associated(me%global%property)) deallocate(me%global%property)
    if (associated(me%property)) deallocate(me%property)
    allocate(me%global%Property(me%global%nProperties))
    allocate(me%Property(me%global%nProperties))

    allocate(me%Part_First(nParts))
    allocate(me%Part_Last(nParts))

    ! Compute the treeIDs of the mesh:
    firstID = 1_long_k
    lastID = firstID

    ! Total number of elements in this mesh
    me%global%nElems = 1_long_k

    ! The first partition starts always with the firstID
    me%Part_First(1) = firstID
    me%Part_Last(1) = lastID

    ! There is only one element, all partitions but the first one are empty.
    do iPart=2,nParts
      me%Part_First(iPart) = lastID
      me%Part_Last(iPart) = lastID - 1
    end do

    ! Local data:
    if (myPart == 0) then
      me%nElems = 1
      me%elemOffset = 0_long_k
    else
      me%nElems = 0
      me%elemOffset = 1_long_k
    end if

    ! All elements have (periodic) boundaries
    me%Property(1)%nElems = me%nElems
    me%Property(1)%offset = me%elemOffset
    allocate(me%Property(1)%ElemID(me%Property(1)%nElems))
    ! Please note, that the tem_bc_prop_module will set boundary conditions
    ! based on this label accordingly!
    me%global%Property(1)%label = 'internal 0D BC'
    me%global%Property(1)%bitpos = prp_hasBnd
    me%global%Property(1)%nElems = me%Property(1)%nElems

    allocate(me%treeID(me%nElems))
    allocate(me%ElemPropertyBits(me%nElems))

    ! No Properties:
    me%ElemPropertyBits = ibset(0_long_k, prp_hasBnd)

    ! There is only one element:
    me%treeID = firstID

  end subroutine generate_treelm_single