subroutine test2e_ugb(rc)
integer, intent(out) :: rc
integer :: localrc
type(ESMF_Field) :: field
type(ESMF_Grid) :: grid
real, dimension(:,:,:), allocatable :: farray
type(ESMF_VM) :: vm
integer :: lpe
integer, dimension(2) :: ec, cc
integer, dimension(2) :: gelb, geub, gclb, gcub
type(ESMF_StaggerLoc) :: sloc
rc = ESMF_SUCCESS
localrc = ESMF_SUCCESS
grid = ESMF_GridCreateNoPeriDim(minIndex=(/1,1/), maxIndex=(/16,20/), &
regDecomp=(/4,1/), name="testgrid", rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_VMGetGlobal(vm, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_VMGet(vm, localPet=lpe, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
sloc = ESMF_STAGGERLOC_CENTER
call ESMF_GridGet(grid, localDe=0, staggerloc=sloc, &
exclusiveLBound=gelb, exclusiveUBound=geub, exclusiveCount=ec, &
computationalLBound=gclb, computationalUBound=gcub, computationalCount=cc, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
allocate(farray(ec(1), ec(2), 10))
field = ESMF_FieldCreate(grid, farray, &
indexflag=ESMF_INDEX_DELOCAL, datacopyflag=ESMF_DATACOPY_VALUE, &
ungriddedLBound=(/1/), ungriddedUBound=(/10/), &
staggerloc=ESMF_STAGGERLOC_CENTER, &
rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_FieldDestroy(field, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_GridDestroy(grid, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
deallocate(farray)
end subroutine test2e_ugb