ESMF_GridCreateNoPeriDimUfrmR Function

private function ESMF_GridCreateNoPeriDimUfrmR(minIndex, maxIndex, minCornerCoord, maxCornerCoord, keywordEnforcer, regDecomp, decompflag, coordSys, staggerLocList, petMap, name, rc)

Arguments

Type IntentOptional Attributes Name
integer, intent(in), optional :: minIndex(:)
integer, intent(in) :: maxIndex(:)
real(kind=ESMF_KIND_R8), intent(in) :: minCornerCoord(:)
real(kind=ESMF_KIND_R8), intent(in) :: maxCornerCoord(:)
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(in), optional :: regDecomp(:)
type(ESMF_Decomp_Flag), intent(in), optional :: decompflag(:)
type(ESMF_CoordSys_Flag), intent(in), optional :: coordSys
type(ESMF_StaggerLoc), intent(in), optional :: staggerLocList(:)
integer, intent(in), optional :: petMap(:,:,:)
character(len=*), intent(in), optional :: name
integer, intent(out), optional :: rc

Return Value type(ESMF_Grid)


Source Code

      function ESMF_GridCreateNoPeriDimUfrmR(minIndex, maxIndex, &
        minCornerCoord, maxCornerCoord, &
        keywordEnforcer, regDecomp, decompFlag, &
        coordSys, staggerLocList, petMap, name, rc)

 !
! !RETURN VALUE:
      type(ESMF_Grid) :: ESMF_GridCreateNoPeriDimUfrmR
!
! !ARGUMENTS:
       integer,                   intent(in),  optional :: minIndex(:)
       integer,                   intent(in)            :: maxIndex(:)
       real(ESMF_KIND_R8),        intent(in)            :: minCornerCoord(:)
       real(ESMF_KIND_R8),        intent(in)            :: maxCornerCoord(:)
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
       integer,                   intent(in),  optional :: regDecomp(:)
       type(ESMF_Decomp_Flag),    intent(in),  optional :: decompflag(:)
       type(ESMF_CoordSys_Flag),  intent(in),  optional :: coordSys
       type(ESMF_StaggerLoc),     intent(in),  optional :: staggerLocList(:)
       integer,                   intent(in),  optional :: petMap(:,:,:)
       character (len=*),         intent(in),  optional :: name
       integer,                   intent(out), optional :: rc
!
! !DESCRIPTION:
!
! This method creates a single tile, regularly distributed grid
! (see Figure \ref{fig:GridDecomps}) with no periodic dimension.
!
! The resulting grid will have its coordinates uniformly spread between the
! ranges specified by the user. The coordinates are ESMF\_TYPEKIND\_R8.
! Currently, this method only fills the center stagger with coordinates, and
! the {\tt minCornerCoord} and {\tt maxCornerCoord} arguments give the boundaries of
! the center stagger.
!
! To specify the distribution, the user passes in an array
! ({\tt regDecomp}) specifying the number of DEs to divide each
! dimension into. The array {\tt decompFlag} indicates how the division into DEs is to
! occur.  The default is to divide the range as evenly as possible. Currently this call
! only supports creating a 2D or 3D Grid, and thus, for example, {\tt maxIndex} must be of size 2 or 3.
!
!  The following arguments have been set to non-typical values and so
!  there is a reasonable possibility that they may change in the future
!  to be inconsistent with other Grid create interfaces:
!
!  The arguements coordDep1, coordDep2, and coordDep3 have internally
!  been set to 1, 2, and 3 respectively.
!  This was done because this call creates a uniform grid and so only 1D arrays
!  are needed to hold the coordinates. This means the coordinate arrays
!  will be 1D.
!
!  The argument indexFlag has internally been set to ESMF\_INDEX\_GLOBAL. This
!  means that the grid created from this function will have a global index space.
!
! The arguments are:
! \begin{description}
! \item[{[minIndex]}]
!      The bottom extent of the grid array. If not given then the value defaults
!      to /1,1,1,.../.
! \item[maxIndex]
!      The upper extent of the grid array.
! \item[minCornerCoord]
!      The coordinates of the corner of the grid that corresponds to {\tt minIndex}.
!      size(minCornerCoord) must be equal to size(maxIndex).
! \item[maxCornerCoord]
!      The coordinates of the corner of the grid that corresponds to {\tt maxIndex}.
!      size(maxCornerCoord) must be equal to size(maxIndex).
! \item[{[regDecomp]}]
!      A ndims-element array specifying how the grid is decomposed.
!      Each entry is the number of decounts for that dimension.
! \item[{[decompflag]}]
!      List of decomposition flags indicating how each dimension of the
!      tile is to be divided between the DEs. The default setting
!      is {\tt ESMF\_DECOMP\_BALANCED} in all dimensions. Please see
!      Section~\ref{const:decompflag} for a full description of the
!      possible options. Note that currently the option
!      {\tt ESMF\_DECOMP\_CYCLIC} isn't supported in Grid creation.
! \item[{[coordSys]}]
!     The coordinate system of the grid coordinate data.
!     For a full list of options, please see Section~\ref{const:coordsys}.
!     If not specified then defaults to ESMF\_COORDSYS\_SPH\_DEG.
! \item[{[staggerLocList]}]
!     The list of stagger locations to fill with coordinates. Please see Section~\ref{const:staggerloc}
!     for a description of the available stagger locations. If not present, then
!     no staggers are added or filled.
! \item[{[petMap]}]
!       Sets the mapping of pets to the created DEs. This 3D
!       should be of size regDecomp(1) x regDecomp(2) x regDecomp(3)
!       If the Grid is 2D, then the last dimension is of size 1.
! \item[{[name]}]
!      {\tt ESMF\_Grid} name.
! \item[{[rc]}]
!      Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
    type(ESMF_Grid)  :: grid
    integer :: localrc
    integer :: dimCount
    integer :: s

    ! Initialize return code; assume failure until success is certain
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! Create grid structure
    if (size(maxIndex) < 3) then
       grid=ESMF_GridCreateNoPeriDim(regDecomp=regDecomp, &
             decompFlag=decompFlag, &
             minIndex=minIndex, &
            maxIndex=maxIndex, &
            coordSys=coordSys, &
            coordTypeKind=ESMF_TYPEKIND_R8,   &
            coordDep1=(/1/), &
            coordDep2=(/2/), &
             indexFlag=ESMF_INDEX_GLOBAL, &
            petMap=petMap, &
            name=name, &
            rc=localrc)
    else
       grid=ESMF_GridCreateNoPeriDim(regDecomp=regDecomp, &
            decompFlag=decompFlag, &
            minIndex=minIndex, &
            maxIndex=maxIndex, &
            coordSys=coordSys, &
            coordTypeKind=ESMF_TYPEKIND_R8,   &
            coordDep1=(/1/), &
            coordDep2=(/2/), &
            coordDep3=(/3/), &
             indexFlag=ESMF_INDEX_GLOBAL, &
            petMap=petMap, &
            name=name, &
            rc=localrc)
    endif
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return


    ! Get  dimCount
    call ESMF_GridGet(grid, dimCount=dimCount, rc=localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
       ESMF_CONTEXT, rcToReturn=rc)) return

    ! Check size of coordinate arrays
    if (size(minCornerCoord) .ne. dimCount) then
       call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
            msg="- minCornerCoord array must be the same dimension as the grid (i.e. maxIndex)", &
            ESMF_CONTEXT, rcToReturn=rc)
       return
    endif

    if (size(maxCornerCoord) .ne. dimCount) then
       call ESMF_LogSetError(rcToCheck=ESMF_RC_ARG_SIZE, &
             msg="- maxCornerCoord array must be the same dimension as the grid (i.e. maxIndex)", &
            ESMF_CONTEXT, rcToReturn=rc)
       return
    endif

    ! Fill staggers
    if (present(staggerLocList)) then
       do s=1, size(staggerLocList)
          call ESMF_GridFillStaggerCoordsUfrm(grid, &
               minCornerCoord, maxCornerCoord, &
               staggerloc=staggerLocList(s), &
               rc=localrc)
          if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
               ESMF_CONTEXT, rcToReturn=rc)) return
       enddo
    endif

    ! Set Grid
    ESMF_GridCreateNoPeriDimUfrmR=grid

    ! Return successfully
    if (present(rc)) rc = ESMF_SUCCESS
  end function ESMF_GridCreateNoPeriDimUfrmR