tem_setEffBoundingBox_fromSubTree Subroutine

private subroutine tem_setEffBoundingBox_fromSubTree(subTree, globalTree)

Calculate the real bounding box around the fluid domain

Arguments

Type IntentOptional Attributes Name
type(tem_subTree_type) :: subTree

subTree to get effective bounding cube from

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

corresponding global tree


Source Code

  subroutine tem_setEffBoundingBox_fromSubTree( subTree, globalTree )
    ! -------------------------------------------------------------------- !
    !> subTree to get effective bounding cube from
    type(tem_subTree_type)   :: subTree
    !> corresponding global tree
    type(treelmesh_type), intent(in) :: globalTree
    ! -------------------------------------------------------------------- !
    real(kind=rk) :: boundingBox(3,2)
    real(kind=rk) :: tBounding(3)
    integer :: iErr
    ! -------------------------------------------------------------------- !

    ! if the subTree equals to the global tree take over the settings
    if( subTree%useGlobalMesh )then
      subTree%global%effOrigin = globalTree%global%effOrigin
      subTree%global%effLength = globalTree%global%effLength
    else ! subTree is not equal to the global tree
      ! Calculate process-local bounding cube
      boundingBox = tem_GetLocalBoundingCube( subTree, globalTree )
      ! Exchange with neighbors
      call mpi_allreduce( boundingBox(:,1), tBounding, 3, rk_mpi, mpi_min, &
        &                 subTree%global%comm, iErr  )
      boundingBox(:,1) = tBounding
      call mpi_allreduce( boundingBox(:,2), tBounding, 3, rk_mpi, mpi_max, &
        &                 subTree%global%comm, iErr  )
      boundingBox(:,2) = tBounding

      ! Set the effective origin and length in the global subTree part
      subTree%global%effOrigin(:) = boundingBox(:,1)
      subTree%global%effLength(:) = boundingBox(:,2) -  boundingBox(:,1)
    end if

  end subroutine tem_setEffBoundingBox_fromSubTree